[Kdrive] make XCalibrate 'orientation aware'
This commit is contained in:
parent
30375cd6d1
commit
c31aead0fe
|
@ -164,7 +164,6 @@ ProcXCalibrateSetRawMode (ClientPtr client)
|
||||||
return (client->noClientException);
|
return (client->noClientException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcXCalibrateSetRawMode (ClientPtr client)
|
SProcXCalibrateSetRawMode (ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -178,6 +177,47 @@ SProcXCalibrateSetRawMode (ClientPtr client)
|
||||||
return ProcXCalibrateSetRawMode(client);
|
return ProcXCalibrateSetRawMode(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
ProcXCalibrateScreenToCoord (ClientPtr client)
|
||||||
|
{
|
||||||
|
REQUEST(xXCalibrateScreenToCoordReq);
|
||||||
|
xXCalibrateScreenToCoordReply rep;
|
||||||
|
|
||||||
|
REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq);
|
||||||
|
|
||||||
|
memset (&rep, 0, sizeof (rep));
|
||||||
|
rep.type = X_Reply;
|
||||||
|
rep.sequenceNumber = client->sequence;
|
||||||
|
rep.x = stuff->x;
|
||||||
|
rep.y = stuff->y;
|
||||||
|
|
||||||
|
KdScreenToPointerCoords(&rep.x, &rep.y);
|
||||||
|
|
||||||
|
if (client->swapped)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
|
||||||
|
swaps (&rep.x, n);
|
||||||
|
swaps (&rep.y, n);
|
||||||
|
}
|
||||||
|
WriteToClient(client, sizeof (rep), (char *) &rep);
|
||||||
|
return (client->noClientException);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
SProcXCalibrateScreenToCoord (ClientPtr client)
|
||||||
|
{
|
||||||
|
REQUEST(xXCalibrateScreenToCoordReq);
|
||||||
|
int n;
|
||||||
|
|
||||||
|
REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq);
|
||||||
|
|
||||||
|
swaps(&stuff->x, n);
|
||||||
|
swaps(&stuff->y, n);
|
||||||
|
|
||||||
|
return ProcXCalibrateScreenToCoord(client);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
XCalibrateResetProc (ExtensionEntry *extEntry)
|
XCalibrateResetProc (ExtensionEntry *extEntry)
|
||||||
{
|
{
|
||||||
|
@ -192,6 +232,9 @@ ProcXCalibrateDispatch (ClientPtr client)
|
||||||
return ProcXCalibrateQueryVersion(client);
|
return ProcXCalibrateQueryVersion(client);
|
||||||
case X_XCalibrateRawMode:
|
case X_XCalibrateRawMode:
|
||||||
return ProcXCalibrateSetRawMode(client);
|
return ProcXCalibrateSetRawMode(client);
|
||||||
|
case X_XCalibrateScreenToCoord:
|
||||||
|
return ProcXCalibrateScreenToCoord(client);
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,6 +254,8 @@ SProcXCalibrateDispatch (ClientPtr client)
|
||||||
return SProcXCalibrateQueryVersion(client);
|
return SProcXCalibrateQueryVersion(client);
|
||||||
case X_XCalibrateRawMode:
|
case X_XCalibrateRawMode:
|
||||||
return SProcXCalibrateSetRawMode(client);
|
return SProcXCalibrateSetRawMode(client);
|
||||||
|
case X_XCalibrateScreenToCoord:
|
||||||
|
return SProcXCalibrateScreenToCoord(client);
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -833,6 +833,9 @@ KdSetPointerMatrix (KdPointerMatrix *pointer);
|
||||||
void
|
void
|
||||||
KdComputePointerMatrix (KdPointerMatrix *pointer, Rotation randr, int width, int height);
|
KdComputePointerMatrix (KdPointerMatrix *pointer, Rotation randr, int width, int height);
|
||||||
|
|
||||||
|
void
|
||||||
|
KdScreenToPointerCoords (int *x, int *y);
|
||||||
|
|
||||||
void
|
void
|
||||||
KdBlockHandler (int screen,
|
KdBlockHandler (int screen,
|
||||||
pointer blockData,
|
pointer blockData,
|
||||||
|
|
|
@ -631,6 +631,18 @@ KdComputePointerMatrix (KdPointerMatrix *m, Rotation randr, int width,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
KdScreenToPointerCoords (int *x, int *y)
|
||||||
|
{
|
||||||
|
int (*m)[3] = kdPointerMatrix.matrix;
|
||||||
|
int div = m[0][1] * m[1][0] - m[1][1] * m[0][0];
|
||||||
|
int sx = *x;
|
||||||
|
int sy = *y;
|
||||||
|
|
||||||
|
*x = (m[0][1] * sy - m[0][1] * m[1][2] + m[1][1] * m[0][2] - m[1][1] * sx) / div;
|
||||||
|
*y = (m[1][0] * sx + m[0][0] * m[1][2] - m[1][0] * m[0][2] - m[0][0] * sy) / div;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
|
KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user