From cdfd4983ebff6370adddd91c2384b861b04d94b5 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 1 Aug 2011 11:21:15 +1000 Subject: [PATCH] mi: only dequeue the current screen if we have valuators (#38313) The server remembers the screen an event was generated for and the screen an event is being processed on. In the case of screen crossings, the EnqueueScreen may change but the DequeueScreen is still the old one. This DequeueScreen is updated whenever we have an event that includes valuators. If the screen did change, generate a move event so the logical position of the cursor as seen by the protocol is updated to the current actual position. If a keyboard event is still in the queue and a pointer event causes the screen to change, a logical screen change is triggered on the keyboard event. The generated move event crashes the server when the keyboard's non-existent dev->valuator is dereferenced. Events without valuators cannot change the screen. Check if the event does actually include valuators. X.Org Bug 38313 Signed-off-by: Peter Hutterer --- mi/mieq.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/mi/mieq.c b/mi/mieq.c index a31e594..80bab86 100644 --- a/mi/mieq.c +++ b/mi/mieq.c @@ -391,7 +391,8 @@ mieqProcessDeviceEvent(DeviceIntPtr dev, case ET_KeyRelease: case ET_ButtonPress: case ET_ButtonRelease: - if (dev && screen && screen != DequeueScreen(dev) && !handler) { + if (dev && event->device_event.valuators.highest_valuator > -1 && + screen && screen != DequeueScreen(dev) && !handler) { DequeueScreen(dev) = screen; x = event->device_event.root_x; y = event->device_event.root_y; -- 1.7.6