From d314a13be330e52c29fc670c1deb374f2f555aab Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 10 Mar 2010 14:16:32 +1000 Subject: [PATCH] mi: ignore fromDIX argument in mieqSwitchScreen. This parameter dates back to several server releases and is exclusively used to control the setting of the DequeueScreen for the device. [Each device has two screen settings, the enqueue screen (the screen for which events are being enqueued for) and the dequeue screen (the screen on which events are being dequeued (==processed) for.] Events resulting from miPointerWarpCursor are appended onto the event queue and force the screen switch. Events occuring after the warping thus have the new screen already set and are enqueued with the correct screen. For normal events, when dequeuing, events are being checked for a new potential screen and if that screen is different, the DequeueScreen is changed and the pointer is moved to the new screen. For events following a miPointerWarpCursor call, the screen is already changed and no extra screen switch is needed. However, if events are left in the EQ when a call to miPointerWarpCursor is issued, switching the DequeueScreen results in an infinite loop. 1. miPointerWarpCursor changes to new screen 2 2. As the still-queued event is replayed, it changes the screen back to the original screen 1, causing another call to miPointerWarpCursor 3. miPointerWarpCursor changes to screen 1, enqueues events 4. first miPointerWarpCursor events are replayed, causing a screen switch to screen 2, enqueuing events. 5. repeat ad absurdum This patch removes switching the DequeueScreen for a device. As a result, events remaining in the event queue are processed on the correct screen and the DequeueScreen isn't changed until the events on the new screen are being processed. --- mi/mieq.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/mi/mieq.c b/mi/mieq.c index 9b6d0c9..cdf7a40 100644 --- a/mi/mieq.c +++ b/mi/mieq.c @@ -229,8 +229,6 @@ mieqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, Bool fromDIX) pthread_mutex_lock(&miEventQueueMutex); #endif EnqueueScreen(pDev) = pScreen; - if (fromDIX) - DequeueScreen(pDev) = pScreen; #ifdef XQUARTZ pthread_mutex_unlock(&miEventQueueMutex); #endif -- 1.6.6.1