[PATCH xwayland 1/2] events: Stop tracking current cursor ourself

Jonas Ådahl jadahl at gmail.com
Mon Sep 28 19:25:21 PDT 2015


Instead of tracking what cursor is the current ourself, rely on the
next layer (most likely mipointer.c) do it for us. It leaves us with
a bit less logic in dix/ without any significant performance loss.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 dix/events.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index efaf91d..42bf774 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -915,21 +915,25 @@ ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor)
     SpritePtr pSprite = pDev->spriteInfo->sprite;
     ScreenPtr pScreen;
 
-    if (cursor != pSprite->current) {
-        if ((pSprite->current->bits->xhot != cursor->bits->xhot) ||
-            (pSprite->current->bits->yhot != cursor->bits->yhot))
-            CheckPhysLimits(pDev, cursor, FALSE, pSprite->confined,
-                            (ScreenPtr) NULL);
+    if (pSprite->current != cursor ||
+        (pSprite->current->bits->xhot != cursor->bits->xhot) ||
+        (pSprite->current->bits->yhot != cursor->bits->yhot))
+        CheckPhysLimits(pDev, cursor, FALSE, pSprite->confined,
+                        (ScreenPtr) NULL);
+
 #ifdef PANORAMIX
-        /* XXX: is this really necessary?? (whot) */
-        if (!noPanoramiXExtension)
-            pScreen = pSprite->screen;
-        else
+    /* XXX: is this really necessary?? (whot) */
+    if (!noPanoramiXExtension)
+        pScreen = pSprite->screen;
+    else
 #endif
-            pScreen = pSprite->hotPhys.pScreen;
+        pScreen = pSprite->hotPhys.pScreen;
 
-        (*pScreen->DisplayCursor) (pDev, pScreen, cursor);
-        FreeCursor(pSprite->current, (Cursor) 0);
+    (*pScreen->DisplayCursor) (pDev, pScreen, cursor);
+
+    if (cursor != pSprite->current) {
+        if (pSprite->current)
+            FreeCursor(pSprite->current, (Cursor) 0);
         pSprite->current = RefCursor(cursor);
     }
 }
-- 
2.4.3



More information about the xorg-devel mailing list