[PATCH] Update rootX/rootY when replaying events (Was: XI 1.5 questions)

Peter Hutterer peter.hutterer at who-t.net
Sun Jan 11 22:26:08 PST 2009


On Sat, Jan 03, 2009 at 10:31:47PM -0500, Thomas Jaeger wrote:
> Sorry, forgot the attachment.
> 
> Thomas Jaeger wrote:
> > The attached patch implements the suggested behavior.  I don't think
> > that this violates the spec.

> From c41b2dcfe145022b1a3dba4243ad992e903238f2 Mon Sep 17 00:00:00 2001
> From: Thomas Jaeger <ThJaeger at gmail.com>
> Date: Sat, 3 Jan 2009 17:19:55 -0500
> Subject: [PATCH] Update rootX/rootY when replaying events
> 
> This ensures that the actual motion history is replayed and that clients
> know the current pointer position.
> ---
>  dix/events.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/dix/events.c b/dix/events.c
> index bd56f3b..ac5adcc 100644
> --- a/dix/events.c
> +++ b/dix/events.c
> @@ -2558,7 +2558,7 @@ CheckMotion(xEvent *xE, DeviceIntPtr pDev)
>  	return XineramaCheckMotion(xE, pDev);
>  #endif
>  
> -    if (xE && !syncEvents.playingEvents)
> +    if (xE)
>      {
>          /* GetPointerEvents() guarantees that pointer events have the correct
>             rootX/Y set already. */
> @@ -2602,8 +2602,8 @@ CheckMotion(xEvent *xE, DeviceIntPtr pDev)
>  	    ConfineToShape(pDev, pSprite->hotShape, &pSprite->hot.x, &pSprite->hot.y);
>  	pSprite->hotPhys = pSprite->hot;
>  
> -	if ((pSprite->hotPhys.x != *rootX) ||
> -	    (pSprite->hotPhys.y != *rootY))
> +	if (!syncEvents.playingEvents &&
> +	    ((pSprite->hotPhys.x != *rootX) || (pSprite->hotPhys.y != *rootY)))
>  	{
>  	    (*pSprite->hotPhys.pScreen->SetCursorPosition)(
>                  pDev, pSprite->hotPhys.pScreen,
> -- 
> 1.6.0.4

My gut feeling was that your patch was missing something (the
!sync.playingEvents has been there for ages AFAIK). The real problem is that
during a device freeze, the coordinates don't get update, and hence the
pointer doesn't move. The patch below fixes that issue, it makes EnqueueEvent
understand XI events.

Sorry that took so long.

Cheers,
  Peter

>From 0e180a69acd80f926fd0a1d530a7cd1b0ae2a2cf Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer at who-t.net>
Date: Mon, 12 Jan 2009 16:16:24 +1000
Subject: [PATCH] dix: EnqueueEvent and PlayReleasedEvent need to handle DeviceMotionNotifies

No MotionNotify events in the processing anymore, so let's have them treat DMN
instead.

Reported by Thomas Jaeger.
---
 dix/events.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 48ee000..59332e2 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1157,14 +1157,14 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
 	 *  the data that GetCurrentRootWindow relies on hasn't been
 	 *  updated yet.
 	 */
-	if (xE->u.u.type == MotionNotify)
+	if (xE->u.u.type == DeviceMotionNotify)
 	    XE_KBPTR.root =
 		WindowTable[pSprite->hotPhys.pScreen->myNum]->drawable.id;
 	eventinfo.events = xE;
 	eventinfo.count = count;
 	CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
     }
-    if (xE->u.u.type == MotionNotify)
+    if (xE->u.u.type == DeviceMotionNotify)
     {
 #ifdef PANORAMIX
 	if(!noPanoramiXExtension) {
@@ -1178,7 +1178,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
 	pSprite->hotPhys.y = XE_KBPTR.rootY;
 	/* do motion compression, but not if from different devices */
 	if (tail &&
-	    (tail->event->u.u.type == MotionNotify) &&
+	    (tail->event->u.u.type == DeviceMotionNotify) &&
             (tail->device == device) &&
 	    (tail->pScreen == pSprite->hotPhys.pScreen))
 	{
@@ -1245,7 +1245,7 @@ PlayReleasedEvents(void)
             pDev = qe->device;
 	    if (*syncEvents.pendtail == *prev)
 		syncEvents.pendtail = prev;
-	    if (qe->event->u.u.type == MotionNotify)
+	    if (qe->event->u.u.type == DeviceMotionNotify)
 		CheckVirtualMotion(pDev, qe, NullWindow);
 	    syncEvents.time.months = qe->months;
             /* XXX: Hack! We can't reliably get the time from GenericEvents,
-- 
1.6.0.6




More information about the xorg mailing list