summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2014-01-02 21:33:30 +0100
committerPeter Hutterer <peter.hutterer@who-t.net>2014-01-09 13:39:05 +1000
commitb2d5ee2e3684951b611fd2068d57cc65fd8305a3 (patch)
tree52dff086e1765b9c756e8255a8d7b0ce7d7b7be7 /Xi
parent863d2ad5c02cccde9a4d1a392a7cae78d001c8a9 (diff)
Xi: Ensure DeviceChanged is emitted after grabs are deactivated
When a grab on a slave device is deactivated, the master device must be checked, just in case there were events from other devices while the slave device was stolen away by the passive grab. This may introduce misbehaviors on mismatching valuators and device features later on UpdateDeviceState(). Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi')
-rw-r--r--Xi/exevents.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index dff0a92b0..528e105a3 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1783,8 +1783,25 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent *) event,
NullGrab, NullWindow, device);
- if (deactivateDeviceGrab == TRUE)
+ if (deactivateDeviceGrab == TRUE) {
(*device->deviceGrab.DeactivateGrab) (device);
+
+ if (!IsMaster (device) && !IsFloating (device)) {
+ int flags, num_events = 0;
+ InternalEvent dce;
+
+ flags = (IsPointerDevice (device)) ?
+ DEVCHANGE_POINTER_EVENT : DEVCHANGE_KEYBOARD_EVENT;
+ UpdateFromMaster (&dce, device, flags, &num_events);
+ BUG_WARN(num_events > 1);
+
+ if (num_events == 1)
+ ChangeMasterDeviceClasses(GetMaster (device, MASTER_ATTACHED),
+ &dce.changed_event);
+ }
+
+ }
+
event->detail.key = key;
}