diff options
author | Egbert Eich <eich@freedesktop.org> | 2013-08-16 19:52:16 +0200 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2013-10-22 15:43:18 +1000 |
commit | 551dbf744b38a3da3d39b9154cb30d1197297eb1 (patch) | |
tree | c064820312a652b6a26d935eba240dc48c7450f5 | |
parent | cc7084af0d61e88ec0a62e14d6eef10c0b2b8b38 (diff) |
DIX/Xi: Pass correct client to CheckDeviceGrabAndHintWindow()
If we have a client which has registered for a DeviceButton grab
be sure to pass this to CheckDeviceGrabAndHintWindow(). Since the
order of clients is arbitrary there is no guarantee that the last
client in the list is the one that belongs to this class.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 05ea6307fa4f0bee3d3bf536396059f3906791a0)
-rw-r--r-- | dix/events.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/dix/events.c b/dix/events.c index c53a64878..5027a729f 100644 --- a/dix/events.c +++ b/dix/events.c @@ -2102,6 +2102,7 @@ DeliverEventToInputClients(DeviceIntPtr dev, InputClients * inputclients, { int attempt; enum EventDeliveryState rc = EVENT_NOT_DELIVERED; + Bool have_device_button_grab_class_client = FALSE; for (; inputclients; inputclients = inputclients->next) { Mask mask; @@ -2121,13 +2122,21 @@ DeliverEventToInputClients(DeviceIntPtr dev, InputClients * inputclients, events, count, mask, filter, grab))) { if (attempt > 0) { - rc = EVENT_DELIVERED; - *client_return = client; - *mask_return = mask; - /* Success overrides non-success, so if we've been - * successful on one client, return that */ - } - else if (rc == EVENT_NOT_DELIVERED) + /* + * The order of clients is arbitrary therefore if one + * client belongs to DeviceButtonGrabClass make sure to + * catch it. + */ + if (!have_device_button_grab_class_client) { + rc = EVENT_DELIVERED; + *client_return = client; + *mask_return = mask; + /* Success overrides non-success, so if we've been + * successful on one client, return that */ + if (mask & DeviceButtonGrabMask) + have_device_button_grab_class_client = TRUE; + } + } else if (rc == EVENT_NOT_DELIVERED) rc = EVENT_REJECTED; } } |