summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-04-12 17:38:28 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-04-19 22:28:11 +1000
commitc94ea5bc055e4efc323e84b7a8266e8b8a4af48e (patch)
tree250806d53d035ae79260bd4e2a0a2a018654f74b
parent6bb4b5b93701535402f65ea828348ed7747c7dbf (diff)
input: use a GrabMask union in GrabDevice to allow for XI2 masks.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--Xi/grabdev.c5
-rw-r--r--dix/events.c19
-rw-r--r--include/dix.h2
-rw-r--r--include/input.h1
-rw-r--r--include/inputstr.h6
5 files changed, 27 insertions, 6 deletions
diff --git a/Xi/grabdev.c b/Xi/grabdev.c
index 65997acaf..6827fd1b1 100644
--- a/Xi/grabdev.c
+++ b/Xi/grabdev.c
@@ -104,6 +104,7 @@ ProcXGrabDevice(ClientPtr client)
int rc;
xGrabDeviceReply rep;
DeviceIntPtr dev;
+ GrabMask mask;
struct tmask tmp[EMASKSIZE];
REQUEST(xGrabDeviceReq);
@@ -126,10 +127,12 @@ ProcXGrabDevice(ClientPtr client)
X_GrabDevice)) != Success)
return rc;
+ mask.xi = tmp[stuff->deviceid].mask;
+
rc = GrabDevice(client, dev, stuff->other_devices_mode,
stuff->this_device_mode, stuff->grabWindow,
stuff->ownerEvents, stuff->time,
- tmp[stuff->deviceid].mask, FALSE, None, None,
+ &mask, FALSE, None, None,
&rep.status);
if (rc != Success)
diff --git a/dix/events.c b/dix/events.c
index dfbc49643..96f357911 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4395,6 +4395,7 @@ ProcGrabPointer(ClientPtr client)
xGrabPointerReply rep;
DeviceIntPtr device = PickPointer(client);
GrabPtr grab;
+ GrabMask mask;
WindowPtr confineTo;
CursorPtr oldCursor;
REQUEST(xGrabPointerReq);
@@ -4431,9 +4432,11 @@ ProcGrabPointer(ClientPtr client)
oldCursor = grab->cursor;
}
+ mask.core = stuff->eventMask;
+
rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode,
stuff->grabWindow, stuff->ownerEvents, stuff->time,
- stuff->eventMask, GRABTYPE_CORE, stuff->cursor,
+ &mask, GRABTYPE_CORE, stuff->cursor,
stuff->confineTo, &rep.status);
if (rc != Success)
return rc;
@@ -4551,7 +4554,7 @@ ProcUngrabPointer(ClientPtr client)
int
GrabDevice(ClientPtr client, DeviceIntPtr dev,
unsigned pointer_mode, unsigned keyboard_mode, Window grabWindow,
- unsigned ownerEvents, Time ctime, Mask mask,
+ unsigned ownerEvents, Time ctime, GrabMask *mask,
int grabtype, Cursor curs, Window confineToWin, CARD8 *status)
{
WindowPtr pWin, confineTo;
@@ -4643,7 +4646,12 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
tempGrab.ownerEvents = ownerEvents;
tempGrab.keyboardMode = keyboard_mode;
tempGrab.pointerMode = pointer_mode;
- tempGrab.eventMask = mask;
+ if (grabtype == GRABTYPE_CORE)
+ tempGrab.eventMask = mask->core;
+ else if (grabtype == GRABTYPE_XI)
+ tempGrab.eventMask = mask->xi;
+ else
+ memcpy(tempGrab.xi2mask, mask->xi2mask, sizeof(tempGrab.xi2mask));
tempGrab.device = dev;
tempGrab.cursor = cursor;
tempGrab.confineTo = confineTo;
@@ -4666,13 +4674,16 @@ ProcGrabKeyboard(ClientPtr client)
REQUEST(xGrabKeyboardReq);
int result;
DeviceIntPtr keyboard = PickKeyboard(client);
+ GrabMask mask;
REQUEST_SIZE_MATCH(xGrabKeyboardReq);
memset(&rep, 0, sizeof(xGrabKeyboardReply));
+ mask.core = KeyPressMask | KeyReleaseMask;
+
result = GrabDevice(client, keyboard, stuff->pointerMode,
stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents,
- stuff->time, KeyPressMask | KeyReleaseMask, GRABTYPE_CORE, None, None,
+ stuff->time, &mask, GRABTYPE_CORE, None, None,
&rep.status);
if (result != Success)
diff --git a/include/dix.h b/include/dix.h
index 8da218936..d4e503925 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -433,7 +433,7 @@ extern int GrabDevice(
Window /* grabWindow */,
unsigned /* ownerEvents */,
Time /* ctime */,
- Mask /* mask */,
+ GrabMask* /* mask */,
int /* grabtype */,
Cursor /* curs */,
Window /* confineToWin */,
diff --git a/include/input.h b/include/input.h
index baac05448..bc9c5beaf 100644
--- a/include/input.h
+++ b/include/input.h
@@ -103,6 +103,7 @@ typedef struct _OtherClients *OtherClientsPtr;
typedef struct _InputClients *InputClientsPtr;
typedef struct _DeviceIntRec *DeviceIntPtr;
typedef struct _ClassesRec *ClassesPtr;
+typedef union _GrabMask GrabMask;
typedef struct _EventList {
xEvent* event;
diff --git a/include/inputstr.h b/include/inputstr.h
index 7d666c15d..e562c0a13 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -156,6 +156,12 @@ typedef enum {
GRABTYPE_XI2
} GrabType;
+union _GrabMask {
+ Mask core;
+ Mask xi;
+ char xi2mask[EMASKSIZE][XI2MASKSIZE];
+};
+
/**
* Central struct for device grabs.
* The same struct is used for both core grabs and device grabs, with