diff options
Diffstat (limited to 'xorg-server/hw/xquartz/xpr/xprCursor.c')
-rw-r--r-- | xorg-server/hw/xquartz/xpr/xprCursor.c | 61 |
1 files changed, 25 insertions, 36 deletions
diff --git a/xorg-server/hw/xquartz/xpr/xprCursor.c b/xorg-server/hw/xquartz/xpr/xprCursor.c index e084ef90e..4345beea4 100644 --- a/xorg-server/hw/xquartz/xpr/xprCursor.c +++ b/xorg-server/hw/xquartz/xpr/xprCursor.c @@ -29,6 +29,8 @@ * use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -37,7 +39,7 @@ #include "xpr.h" #include "darwin.h" #include "darwinEvents.h" -#include "Xplugin.h" +#include <Xplugin.h> #include "mi.h" #include "scrnintstr.h" @@ -47,6 +49,7 @@ #include "globals.h" #include "servermd.h" #include "dixevents.h" +#include "x-hash.h" typedef struct { int cursorVisible; @@ -54,7 +57,8 @@ typedef struct { miPointerSpriteFuncPtr spriteFuncs; } QuartzCursorScreenRec, *QuartzCursorScreenPtr; -static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey; +static int darwinCursorScreenKeyIndex; +static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKeyIndex; #define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \ dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey)) @@ -181,7 +185,7 @@ load_cursor(CursorPtr src, int screen) * Convert the X cursor representation to native format if possible. */ static Bool -QuartzRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +QuartzRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { if(pCursor == NULL || pCursor->bits == NULL) return FALSE; @@ -197,7 +201,7 @@ QuartzRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) * Free the storage space associated with a realized cursor. */ static Bool -QuartzUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +QuartzUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { return TRUE; } @@ -208,7 +212,7 @@ QuartzUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) * Set the cursor sprite and position. */ static void -QuartzSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +QuartzSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y) { QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); @@ -235,25 +239,15 @@ QuartzSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) } } - /* * QuartzMoveCursor * Move the cursor. This is a noop for us. */ static void -QuartzMoveCursor(ScreenPtr pScreen, int x, int y) +QuartzMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { } - -static miPointerSpriteFuncRec quartzSpriteFuncsRec = { - QuartzRealizeCursor, - QuartzUnrealizeCursor, - QuartzSetCursor, - QuartzMoveCursor -}; - - /* =========================================================================== @@ -289,18 +283,8 @@ QuartzCrossScreen(ScreenPtr pScreen, Bool entering) * */ static void -QuartzWarpCursor(ScreenPtr pScreen, int x, int y) +QuartzWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { - static Bool neverMoved = TRUE; - - if (neverMoved) - { - /* Don't move the cursor the first time. This is the - jump-to-center initialization, and it's annoying. */ - neverMoved = FALSE; - return; - } - if (quartzServerVisible) { int sx, sy; @@ -311,8 +295,8 @@ QuartzWarpCursor(ScreenPtr pScreen, int x, int y) CGWarpMouseCursorPosition(CGPointMake(sx + x, sy + y)); } - miPointerWarpCursor(pScreen, x, y); - miPointerUpdate(); + miPointerWarpCursor(pDev, pScreen, x, y); + miPointerUpdateSprite(pDev); } @@ -320,8 +304,8 @@ static miPointerScreenFuncRec quartzScreenFuncsRec = { QuartzCursorOffScreen, QuartzCrossScreen, QuartzWarpCursor, - DarwinEQPointerPost, - DarwinEQSwitchScreen + NULL, + NULL }; @@ -383,13 +367,16 @@ QuartzInitCursor(ScreenPtr pScreen) PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); ScreenPriv->spriteFuncs = PointPriv->spriteFuncs; - PointPriv->spriteFuncs = &quartzSpriteFuncsRec; + PointPriv->spriteFuncs->RealizeCursor = QuartzRealizeCursor; + PointPriv->spriteFuncs->UnrealizeCursor = QuartzUnrealizeCursor; + PointPriv->spriteFuncs->SetCursor = QuartzSetCursor; + PointPriv->spriteFuncs->MoveCursor = QuartzMoveCursor; + ScreenPriv->cursorVisible = TRUE; return TRUE; } - /* * QuartzSuspendXCursor * X server is hiding. Restore the Aqua cursor. @@ -410,13 +397,15 @@ QuartzResumeXCursor(ScreenPtr pScreen, int x, int y) WindowPtr pWin; CursorPtr pCursor; - pWin = GetSpriteWindow(); + /* TODO: Tablet? */ + + pWin = GetSpriteWindow(darwinPointer); if (pWin->drawable.pScreen != pScreen) return; - pCursor = GetSpriteCursor(); + pCursor = GetSpriteCursor(darwinPointer); if (pCursor == NULL) return; - QuartzSetCursor(pScreen, pCursor, x, y); + QuartzSetCursor(darwinPointer, pScreen, pCursor, x, y); } |