summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorRui Matos <tiagomatos@gmail.com>2016-11-24 19:56:18 +0100
committerAdam Jackson <ajax@redhat.com>2017-01-11 14:58:44 -0500
commit738c17b7ef4c70ad00c7bc01cf64edb770dda840 (patch)
treea83fa7ba1266691903bd828cafe1cf0f842c05ec /Xi
parentcd8f43e1b06aee8500548a94e3743cf153591683 (diff)
xwayland: Don't send KeyRelease events on wl_keyboard::leave
Commits 816015648ffe660ddaa0f7d4d192e555b723c372 and fee0827a9a695600765f3d04376fc9babe497401 made it so that wl_keyboard::enter doesn't result in X clients getting KeyPress events while still updating our internal xkb state to be in sync with the host compositor. wl_keyboard::leave needs to be handled in the same way as its semantics from an X client POV should be the same as an X grab getting triggered, i.e. X clients shouldn't get KeyRelease events for keys that are still down at that point. This patch uses LeaveNotify for these events on wl_keyboard::leave and changes the current use of KeymapNotify to EnterNotify instead just to keep some symmetry between both cases. On ProcessDeviceEvent() we still need to deactivate X grabs if needed for KeyReleases. Signed-off-by: Rui Matos <tiagomatos@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 5611585b87ce48428a66f98ece319a083f55d205)
Diffstat (limited to 'Xi')
-rw-r--r--Xi/exevents.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index fc5298e37..17d751e31 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1798,15 +1798,19 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
break;
}
- if (grab)
- DeliverGrabbedEvent((InternalEvent *) event, device,
- deactivateDeviceGrab);
- else if (device->focus && !IsPointerEvent(ev))
- DeliverFocusedEvent(device, (InternalEvent *) event,
- GetSpriteWindow(device));
- else
- DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent *) event,
- NullGrab, NullWindow, device);
+ /* Don't deliver focus events (e.g. from KeymapNotify when running
+ * nested) to clients. */
+ if (event->source_type != EVENT_SOURCE_FOCUS) {
+ if (grab)
+ DeliverGrabbedEvent((InternalEvent *) event, device,
+ deactivateDeviceGrab);
+ else if (device->focus && !IsPointerEvent(ev))
+ DeliverFocusedEvent(device, (InternalEvent *) event,
+ GetSpriteWindow(device));
+ else
+ DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent *) event,
+ NullGrab, NullWindow, device);
+ }
if (deactivateDeviceGrab == TRUE) {
(*device->deviceGrab.DeactivateGrab) (device);