aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/grabs.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-25 19:39:46 +0000
committermarha <marha@users.sourceforge.net>2009-07-25 19:39:46 +0000
commit4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 (patch)
treec1e02b9d3509aa97703aa4b540d4cd22ec4600ed /xorg-server/dix/grabs.c
parentdc3c299dd0995549e2a6973ca0f25b254afd38a5 (diff)
downloadvcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.gz
vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.bz2
vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.zip
Added xorg-server-1.6.2.tar.gz
Diffstat (limited to 'xorg-server/dix/grabs.c')
-rw-r--r--xorg-server/dix/grabs.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/xorg-server/dix/grabs.c b/xorg-server/dix/grabs.c
index 85e101c6a..b372d8f1b 100644
--- a/xorg-server/dix/grabs.c
+++ b/xorg-server/dix/grabs.c
@@ -88,10 +88,10 @@ CreateGrab(
return (GrabPtr)NULL;
grab->resource = FakeClientID(client);
grab->device = device;
- grab->coreGrab = ((device == inputInfo.keyboard) ||
- (device == inputInfo.pointer));
+ grab->coreGrab = (type < LASTEvent);
grab->window = window;
grab->eventMask = eventMask;
+ grab->deviceMask = 0;
grab->ownerEvents = ownerEvents;
grab->keyboardMode = keyboardMode;
grab->pointerMode = pointerMode;
@@ -105,6 +105,8 @@ CreateGrab(
grab->detail.pMask = NULL;
grab->confineTo = confineTo;
grab->cursor = cursor;
+ grab->genericMasks = NULL;
+ grab->next = NULL;
if (cursor)
cursor->refcnt++;
return grab;
@@ -239,12 +241,28 @@ GrabSupersedesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab)
return FALSE;
}
+/**
+ * Compares two grabs and returns TRUE if the first grab matches the second
+ * grab.
+ *
+ * A match is when
+ * - the devices set for the grab are equal (this is optional).
+ * - the event types for both grabs are equal.
+ * - XXX
+ *
+ * @param ignoreDevice TRUE if the device settings on the grabs are to be
+ * ignored.
+ * @return TRUE if the grabs match or FALSE otherwise.
+ */
Bool
-GrabMatchesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab)
+GrabMatchesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab, Bool ignoreDevice)
{
- if ((pFirstGrab->device != pSecondGrab->device) ||
- (pFirstGrab->modifierDevice != pSecondGrab->modifierDevice) ||
- (pFirstGrab->type != pSecondGrab->type))
+ if (!ignoreDevice &&
+ ((pFirstGrab->device != pSecondGrab->device) ||
+ (pFirstGrab->modifierDevice != pSecondGrab->modifierDevice)))
+ return FALSE;
+
+ if (pFirstGrab->type != pSecondGrab->type)
return FALSE;
if (GrabSupersedesSecond(pFirstGrab, pSecondGrab) ||
@@ -315,7 +333,7 @@ AddPassiveGrabToList(ClientPtr client, GrabPtr pGrab)
for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next)
{
- if (GrabMatchesSecond(pGrab, grab))
+ if (GrabMatchesSecond(pGrab, grab, FALSE))
{
if (CLIENT_BITS(pGrab->resource) != CLIENT_BITS(grab->resource))
{
@@ -397,7 +415,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
grab = grab->next)
{
if ((CLIENT_BITS(grab->resource) != CLIENT_BITS(pMinuendGrab->resource)) ||
- !GrabMatchesSecond(grab, pMinuendGrab))
+ !GrabMatchesSecond(grab, pMinuendGrab, (grab->coreGrab)))
continue;
if (GrabSupersedesSecond(pMinuendGrab, grab))
{