diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-26 14:42:25 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-27 14:40:58 +1000 |
commit | a7e23a79c1fc429aedbf9b6c0e78b1c8d7e02238 (patch) | |
tree | 5fc32f0134ef45239df861c6dd8def5e509297c6 /Xi/xipassivegrab.c | |
parent | ec2fe9660dbc0c16cdaca33b3b878011857e0fe2 (diff) |
Xi: Add support for Enter and FocusIn grabs.
Enter grabs are checked for in CheckMotion(), each time the sprite window
changes the current grab is deactivated (if applicable) and the new grab is
activated (if applicable). Exception - if the grab is on a parent window of
the current window since we keep the grab across descendants.
Since CheckMotion() may change the grab status of a device, we mustn't get
"dev->deviceGrab.grab" in ProcessOtherEvents until after CheckMotion().
FocusIn grabs are checked in much the same manner.
The event delivery for grabs replaces the NotifyNormal on window change with
a NotifyGrab on window change. Note that this happens before the grab
activates, so the EnterNotify(NotifyGrab) is still delivered to the window,
not to the grabbing client. This is in line with the core protocol semantics
for NotifyGrab events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi/xipassivegrab.c')
-rw-r--r-- | Xi/xipassivegrab.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c index f53b0504c..a8807bd32 100644 --- a/Xi/xipassivegrab.c +++ b/Xi/xipassivegrab.c @@ -95,12 +95,21 @@ ProcXIPassiveGrabDevice(ClientPtr client) return ret; if (stuff->grab_type != XIGrabtypeButton && - stuff->grab_type != XIGrabtypeKeysym) + stuff->grab_type != XIGrabtypeKeysym && + stuff->grab_type != XIGrabtypeEnter && + stuff->grab_type != XIGrabtypeFocusIn) { client->errorValue = stuff->grab_type; return BadValue; } + if ((stuff->grab_type == XIGrabtypeEnter || + stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0) + { + client->errorValue = stuff->detail; + return BadValue; + } + /* Can't grab for modifiers on an attached slave device */ if (!IsMaster(dev)) { @@ -175,6 +184,11 @@ ProcXIPassiveGrabDevice(ClientPtr client) status = GrabKey(client, dev, mod_dev, stuff->detail, ¶m, GRABTYPE_XI2, &mask); break; + case XIGrabtypeEnter: + case XIGrabtypeFocusIn: + status = GrabWindow(client, dev, stuff->grab_type, + ¶m, &mask); + break; } if (status != GrabSuccess) @@ -251,12 +265,21 @@ ProcXIPassiveUngrabDevice(ClientPtr client) return rc; if (stuff->grab_type != XIGrabtypeButton && - stuff->grab_type != XIGrabtypeKeysym) + stuff->grab_type != XIGrabtypeKeysym && + stuff->grab_type != XIGrabtypeEnter && + stuff->grab_type != XIGrabtypeFocusIn) { client->errorValue = stuff->grab_type; return BadValue; } + if ((stuff->grab_type == XIGrabtypeEnter || + stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0) + { + client->errorValue = stuff->detail; + return BadValue; + } + rc = dixLookupWindow(&win, stuff->grab_window, client, DixSetAttrAccess); if (rc != Success) return rc; @@ -269,8 +292,13 @@ ProcXIPassiveUngrabDevice(ClientPtr client) tempGrab.resource = client->clientAsMask; tempGrab.device = dev; tempGrab.window = win; - tempGrab.type = - (stuff->grab_type == XIGrabtypeButton) ? XI_ButtonPress : XI_KeyPress; + switch(stuff->grab_type) + { + case XIGrabtypeButton: tempGrab.type = XI_ButtonPress; break; + case XIGrabtypeKeysym: tempGrab.type = XI_KeyPress; break; + case XIGrabtypeEnter: tempGrab.type = XI_Enter; break; + case XIGrabtypeFocusIn: tempGrab.type = XI_FocusIn; break; + } tempGrab.grabtype = GRABTYPE_XI2; tempGrab.modifierDevice = mod_dev; tempGrab.modifiersDetail.pMask = NULL; |