diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-01-03 17:04:54 +1030 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-01-03 17:04:54 +1030 |
commit | 8da83836b60f7cdb75d08482f4311fa0e2ab4e1d (patch) | |
tree | 092efcfc39e3e293baaf04c4c84027ee453d3e13 /mi/mipointer.c | |
parent | eace88989c3b65d5c20e9f37ea9b23c7c8e19335 (diff) | |
parent | ae869fc7669764729e13fdd70149ed636753f2a3 (diff) |
Merge branch 'master' into mpx
Conflicts:
XTrap/xtrapddmi.c
Xext/security.c
Xext/xprint.c
Xext/xtest.c
Xext/xvdisp.c
Xi/exevents.c
Xi/grabdevb.c
Xi/grabdevk.c
Xi/opendev.c
Xi/ungrdev.c
Xi/ungrdevb.c
Xi/ungrdevk.c
dix/cursor.c
dix/devices.c
dix/dixutils.c
dix/events.c
dix/getevents.c
dix/main.c
dix/window.c
hw/xfree86/ramdac/xf86Cursor.c
include/dix.h
include/input.h
include/inputstr.h
mi/midispcur.c
mi/miinitext.c
mi/misprite.c
render/animcur.c
xfixes/cursor.c
xkb/xkbAccessX.c
Diffstat (limited to 'mi/mipointer.c')
-rw-r--r-- | mi/mipointer.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/mi/mipointer.c b/mi/mipointer.c index ff5882380..5706ef406 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -48,18 +48,18 @@ in this Software without prior written authorization from The Open Group. # include "dixstruct.h" # include "inputstr.h" -_X_EXPORT int miPointerScreenIndex; -static unsigned long miPointerGeneration = 0; +_X_EXPORT DevPrivateKey miPointerScreenKey = &miPointerScreenKey; -#define GetScreenPrivate(s) ((miPointerScreenPtr) ((s)->devPrivates[miPointerScreenIndex].ptr)) +#define GetScreenPrivate(s) ((miPointerScreenPtr) \ + dixLookupPrivate(&(s)->devPrivates, miPointerScreenKey)) #define SetupScreen(s) miPointerScreenPtr pScreenPriv = GetScreenPrivate(s) -static int miPointerPrivatesIndex = 0; +static DevPrivateKey miPointerPrivKey = &miPointerPrivKey; #define MIPOINTER(dev) \ ((DevHasCursor((dev))) ? \ - (miPointerPtr) dev->devPrivates[miPointerPrivatesIndex].ptr : \ - (miPointerPtr) dev->u.master->devPrivates[miPointerPrivatesIndex].ptr) + (miPointerPtr)dixLookupPrivate(&(dev)->devPrivates, miPointerPrivKey): \ + (miPointerPtr)dixLookupPrivate(&(dev)->u.master->devPrivates, miPointerPrivKey)) static Bool miPointerRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor); @@ -97,13 +97,6 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate) { miPointerScreenPtr pScreenPriv; - if (miPointerGeneration != serverGeneration) - { - miPointerScreenIndex = AllocateScreenPrivateIndex(); - if (miPointerScreenIndex < 0) - return FALSE; - miPointerGeneration = serverGeneration; - } pScreenPriv = (miPointerScreenPtr) xalloc (sizeof (miPointerScreenRec)); if (!pScreenPriv) return FALSE; @@ -120,7 +113,7 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate) pScreenPriv->showTransparent = FALSE; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = miPointerCloseScreen; - pScreen->devPrivates[miPointerScreenIndex].ptr = (pointer) pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, miPointerScreenKey, pScreenPriv); /* * set up screen cursor method table */ @@ -137,8 +130,6 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate) pScreen->DeviceCursorInitialize = miPointerDeviceInitialize; pScreen->DeviceCursorCleanup = miPointerDeviceCleanup; - miPointerPrivatesIndex = AllocateDevicePrivateIndex(); - events = NULL; return TRUE; } @@ -303,9 +294,6 @@ miPointerDeviceInitialize(pDev, pScreen) miPointerPtr pPointer; SetupScreen (pScreen); - if (!AllocateDevicePrivate(pDev, miPointerPrivatesIndex)) - return FALSE; - pPointer = xalloc(sizeof(miPointerRec)); if (!pPointer) return FALSE; @@ -328,7 +316,7 @@ miPointerDeviceInitialize(pDev, pScreen) return FALSE; } - pDev->devPrivates[miPointerPrivatesIndex].ptr = pPointer; + dixSetPrivate(&pDev->devPrivates, miPointerPrivKey, pPointer); return TRUE; } @@ -344,8 +332,8 @@ miPointerDeviceCleanup(pDev, pScreen) { SetupScreen(pScreen); (*pScreenPriv->spriteFuncs->DeviceCursorCleanup)(pDev, pScreen); - xfree(pDev->devPrivates[miPointerPrivatesIndex].ptr); - pDev->devPrivates[miPointerPrivatesIndex].ptr = NULL; + xfree(dixLookupPrivate(&pDev->devPrivates, miPointerPrivKey)); + dixSetPrivate(&pDev->devPrivates, miPointerPrivKey, NULL); } } |