diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2006-11-23 17:15:14 +1030 |
---|---|---|
committer | Peter Hutterer <whot@hyena.localdomain> | 2006-11-23 17:15:14 +1030 |
commit | 1c7568b8a1417257fa67c7fca69aa253099b9461 (patch) | |
tree | 9e2079d6e643d1b332e62f5806cdc5f5e2030fb9 | |
parent | f52d53e060d0468b658a565688d1f92c156405c7 (diff) |
mi: closing memory leak, miPointer is freed in miPointerCloseScreen
bugfix: uninitialized pPointer in miPointerGetPosition ifndef MPX
adding DeviceIntPtr parameter to ScreenRec's cursor functions.
cleanup of miPointer code to use same scheme in each function
dix: MPHasCursor() function determines checking whether to invoke
cursor rendering.
animcur: adding DeviceIntPtr parameter to cursor functions but animcur relies
on the core pointer right now.
xfixes: adding DeviceIntPtr parameter to cursor functions but xfixes relies on
the core pointer right now.
rac: adding DeviceIntPtr parameter to cursor functions but RAC relies on
the core pointer right now.
ramdac: adding DeviceIntPtr parameter to cursor functions but ramdac relies on
the core pointer right now.
-rw-r--r-- | Changelog | 47 | ||||
-rw-r--r-- | XTrap/xtrapddmi.c | 5 | ||||
-rw-r--r-- | Xext/xtest.c | 4 | ||||
-rw-r--r-- | dix/cursor.c | 143 | ||||
-rw-r--r-- | dix/events.c | 120 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Cursor.c | 8 | ||||
-rw-r--r-- | hw/xfree86/common/xf86RandR.c | 3 | ||||
-rw-r--r-- | hw/xfree86/dri/dri.c | 3 | ||||
-rw-r--r-- | hw/xfree86/rac/xf86RAC.c | 44 | ||||
-rw-r--r-- | hw/xfree86/ramdac/xf86Cursor.c | 5 | ||||
-rw-r--r-- | include/cursor.h | 1 | ||||
-rw-r--r-- | include/dix.h | 4 | ||||
-rw-r--r-- | include/inputstr.h | 2 | ||||
-rw-r--r-- | include/scrnintstr.h | 7 | ||||
-rw-r--r-- | mi/mi.h | 1 | ||||
-rw-r--r-- | mi/micursor.c | 16 | ||||
-rw-r--r-- | mi/mieq.c | 2 | ||||
-rw-r--r-- | mi/mipointer.c | 253 | ||||
-rw-r--r-- | mi/mipointer.h | 2 | ||||
-rw-r--r-- | render/animcur.c | 50 | ||||
-rwxr-xr-x | xfixes/cursor.c | 11 | ||||
-rw-r--r-- | xkb/ddxFakeMtn.c | 4 |
22 files changed, 466 insertions, 269 deletions
@@ -1,4 +1,49 @@ MPX Changelog file +== 23.11.06 == +mi: closing memory leak, miPointer is freed in miPointerCloseScreen + bugfix: uninitialized pPointer in miPointerGetPosition ifndef MPX + adding DeviceIntPtr parameter to ScreenRec's cursor functions. + cleanup of miPointer code to use same scheme in each function + +dix: MPHasCursor() function determines checking whether to invoke + cursor rendering. + +animcur: adding DeviceIntPtr parameter to cursor functions but animcur relies + on the core pointer right now. + +xfixes: adding DeviceIntPtr parameter to cursor functions but xfixes relies on + the core pointer right now. + +rac: adding DeviceIntPtr parameter to cursor functions but RAC relies on + the core pointer right now. + +ramdac: adding DeviceIntPtr parameter to cursor functions but ramdac relies on + the core pointer right now. + +Files: + mi/mipointer.c + mi/mipointer.h + mi/micursor.c + mi/mi.h + mi/mieq.c + include/cursor.h + include/inputstr.h + include/scrnintstr.h + include/dix.h + dix/events.c + dix/cursor.c + Xext/xtest.c + render/animcur.c + xfixes/cursor.c + XTrap/xtrapddmi.c + xkb/ddxFakeMtn.c + hw/xfree86/common/xf86Cursor.c + hw/xfree86/common/xf86RandR.c + hw/xfree86/rac/xf86RAC.c + hw/xfree86/ramdac/xf86Cursor.c + hw/xfree86/dri/dri.c + + == 22.11.06 == mi: added DevToSprite() conversion function @@ -26,7 +71,7 @@ dix GetSpriteWindow() adjusted for MPX Files: Xext/security.c Xi/exevents.c - ddx/ddxFakeMtn.c + xkb/ddxFakeMtn.c dix/events.c include/dix.h diff --git a/XTrap/xtrapddmi.c b/XTrap/xtrapddmi.c index 73a20c1f6..c633b8d36 100644 --- a/XTrap/xtrapddmi.c +++ b/XTrap/xtrapddmi.c @@ -60,6 +60,7 @@ SOFTWARE. # include "extnsionst.h" /* Server ExtensionEntry definitions */ # include "scrnintstr.h" /* Screen struct */ #endif +#include "inputstr.h" #include <X11/extensions/xtrapdi.h> #include <X11/extensions/xtrapddmi.h> @@ -130,8 +131,8 @@ int XETrapSimulateXEvent(register xXTrapInputReq *request, { /* Set new cursor position on screen */ XETrap_avail.data.cur_x = x; XETrap_avail.data.cur_y = y; - NewCurrentScreen (pScr, x, y); /* fix from amnonc@mercury.co.il */ - if (!(*pScr->SetCursorPosition)(pScr, x, y, xFalse)) + NewCurrentScreen (inputInfo.pointer, pScr, x, y); /* fix from amnonc@mercury.co.il */ + if (!(*pScr->SetCursorPosition)(inputInfo.pointer, pScr, x, y, xFalse)) { status = BadImplementation; } diff --git a/Xext/xtest.c b/Xext/xtest.c index 18111c0df..66c84d752 100644 --- a/Xext/xtest.c +++ b/Xext/xtest.c @@ -433,13 +433,13 @@ ProcXTestFakeInput(client) if (root != GetCurrentRootWindow()) #endif { - NewCurrentScreen(root->drawable.pScreen, + NewCurrentScreen(dev, root->drawable.pScreen, ev->u.keyButtonPointer.rootX, ev->u.keyButtonPointer.rootY); return client->noClientException; } (*root->drawable.pScreen->SetCursorPosition) - (root->drawable.pScreen, + (dev, root->drawable.pScreen, ev->u.keyButtonPointer.rootX, ev->u.keyButtonPointer.rootY, FALSE); break; diff --git a/dix/cursor.c b/dix/cursor.c index b9ede1f76..92297b923 100644 --- a/dix/cursor.c +++ b/dix/cursor.c @@ -59,6 +59,7 @@ SOFTWARE. #include "cursorstr.h" #include "dixfontstr.h" #include "opaque.h" +#include "inputstr.h" typedef struct _GlyphShare { FontPtr font; @@ -114,14 +115,26 @@ FreeCursor(pointer value, XID cid) CursorPtr pCurs = (CursorPtr)value; ScreenPtr pscr; + DeviceIntPtr pDev; if ( --pCurs->refcnt > 0) return(Success); + pDev = inputInfo.pointer; + for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { pscr = screenInfo.screens[nscr]; - (void)( *pscr->UnrealizeCursor)( pscr, pCurs); +#ifdef MPX + pDev = inputInfo.devices; + while(pDev) + { +#endif + (void)( *pscr->UnrealizeCursor)(pDev, pscr, pCurs); +#ifdef MPX + pDev = pDev->next; + } +#endif } FreeCursorBits(pCurs->bits); xfree( pCurs); @@ -171,6 +184,7 @@ AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb, CursorPtr pCurs; int nscr; ScreenPtr pscr; + DeviceIntPtr pDev; pCurs = (CursorPtr)xalloc(sizeof(CursorRec) + sizeof(CursorBits)); if (!pCurs) @@ -207,23 +221,62 @@ AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb, pCurs->backGreen = backGreen; pCurs->backBlue = backBlue; + pDev = inputInfo.pointer; /* * realize the cursor for every screen */ for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { - pscr = screenInfo.screens[nscr]; - if (!( *pscr->RealizeCursor)( pscr, pCurs)) - { - while (--nscr >= 0) - { - pscr = screenInfo.screens[nscr]; - ( *pscr->UnrealizeCursor)( pscr, pCurs); - } - FreeCursorBits(bits); - xfree(pCurs); - return (CursorPtr)NULL; - } + pscr = screenInfo.screens[nscr]; +#ifdef MPX + pDev = inputInfo.devices; + while(pDev) + { + if (MPHasCursor(pDev)) + { +#endif + if (!( *pscr->RealizeCursor)(pDev, pscr, pCurs)) + { +#ifdef MPX + /* Realize failed for device pDev on screen pscr. + * We have to assume that for all devices before, realize + * worked. We need to rollback all devices so far on the + * current screen and then all devices on previous + * screens. + */ + DeviceIntPtr pDevIt = inputInfo.devices; /*dev iterator*/ + while(pDevIt && pDevIt != pDev) + { + if (MPHasCursor(pDevIt)) + ( *pscr->UnrealizeCursor)(pDevIt, pscr, pCurs); + pDevIt = pDevIt->next; + } +#endif + while (--nscr >= 0) + { + pscr = screenInfo.screens[nscr]; +#ifdef MPX + /* now unrealize all devices on previous screens */ + pDevIt = inputInfo.devices; + while (pDevIt) + { + if (MPHasCursor(pDevIt)) + ( *pscr->UnrealizeCursor)(pDevIt, pscr, pCurs); + pDevIt = pDevIt->next; + } +#else + ( *pscr->UnrealizeCursor)(pDev, pscr, pCurs); +#endif + } + FreeCursorBits(bits); + xfree(pCurs); + return (CursorPtr)NULL; + } +#ifdef MPX + } + pDev = pDev->next; + } +#endif } return pCurs; } @@ -260,6 +313,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, int nscr; ScreenPtr pscr; GlyphSharePtr pShare; + DeviceIntPtr pDev; sourcefont = (FontPtr) SecurityLookupIDByType(client, source, RT_FONT, SecurityReadAccess); @@ -398,23 +452,62 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, pCurs->backGreen = backGreen; pCurs->backBlue = backBlue; + pDev = inputInfo.pointer; /* * realize the cursor for every screen */ for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { - pscr = screenInfo.screens[nscr]; - if (!( *pscr->RealizeCursor)( pscr, pCurs)) - { - while (--nscr >= 0) - { - pscr = screenInfo.screens[nscr]; - ( *pscr->UnrealizeCursor)( pscr, pCurs); - } - FreeCursorBits(pCurs->bits); - xfree(pCurs); - return BadAlloc; - } + pscr = screenInfo.screens[nscr]; +#ifdef MPX + pDev = inputInfo.devices; + while(pDev) + { + if (MPHasCursor(pDev)) + { +#endif + if (!( *pscr->RealizeCursor)(pDev, pscr, pCurs)) + { +#ifdef MPX + /* Realize failed for device pDev on screen pscr. + * We have to assume that for all devices before, realize + * worked. We need to rollback all devices so far on the + * current screen and then all devices on previous + * screens. + */ + DeviceIntPtr pDevIt = inputInfo.devices; /*dev iterator*/ + while(pDevIt && pDevIt != pDev) + { + if (MPHasCursor(pDevIt)) + ( *pscr->UnrealizeCursor)(pDevIt, pscr, pCurs); + pDevIt = pDevIt->next; + } +#endif + while (--nscr >= 0) + { + pscr = screenInfo.screens[nscr]; +#ifdef MPX + /* now unrealize all devices on previous screens */ + pDevIt = inputInfo.devices; + while (pDevIt) + { + if (MPHasCursor(pDevIt)) + ( *pscr->UnrealizeCursor)(pDevIt, pscr, pCurs); + pDevIt = pDevIt->next; + } +#else + ( *pscr->UnrealizeCursor)(pDev, pscr, pCurs); +#endif + } + FreeCursorBits(bits); + xfree(pCurs); + return BadAlloc; + } +#ifdef MPX + } + pDev = pDev->next; + } +#endif } *ppCurs = pCurs; return Success; diff --git a/dix/events.c b/dix/events.c index 82d5d058f..d3b0e58bc 100644 --- a/dix/events.c +++ b/dix/events.c @@ -262,6 +262,19 @@ static SpritePtr sprite; /* info about the cursor sprite */ static SpritePtr mpsprites; /* info about the MPX sprites */ extern BOOL IsMPDev(DeviceIntPtr dev); + +/** + * True for the core pointer and any MPX device. + * False for any other device (including keyboards). + * Does ID checking for sane range as well. + */ +_X_EXPORT Bool +MPHasCursor(DeviceIntPtr pDev) +{ + return (pDev == inputInfo.pointer || + (pDev->isMPDev && pDev->id < MAX_DEVICES)); +} + #endif #ifdef XEVIE @@ -347,6 +360,7 @@ static void PostNewCursor(DeviceIntPtr pDev); static Bool XineramaSetCursorPosition( + DeviceIntPtr pDev, int x, int y, Bool generateEvent @@ -354,12 +368,18 @@ XineramaSetCursorPosition( ScreenPtr pScreen; BoxRec box; int i; + SpritePtr pSprite = sprite; + +#ifdef MPX + if (IsMPDev(pDev)) + pSprite = &mpsprites[pDev->id]; +#endif /* x,y are in Screen 0 coordinates. We need to decide what Screen to send the message too and what the coordinates relative to that screen are. */ - pScreen = sprite->screen; + pScreen = pSprite->screen; x += panoramiXdataPtr[0].x; y += panoramiXdataPtr[0].y; @@ -378,13 +398,13 @@ XineramaSetCursorPosition( } } - sprite->screen = pScreen; - sprite->hotPhys.x = x - panoramiXdataPtr[0].x; - sprite->hotPhys.y = y - panoramiXdataPtr[0].y; + pSprite->screen = pScreen; + pSprite->hotPhys.x = x - panoramiXdataPtr[0].x; + pSprite->hotPhys.y = y - panoramiXdataPtr[0].y; x -= panoramiXdataPtr[pScreen->myNum].x; y -= panoramiXdataPtr[pScreen->myNum].y; - return (*pScreen->SetCursorPosition)(pScreen, x, y, generateEvent); + return (*pScreen->SetCursorPosition)(pDev, pScreen, x, y, generateEvent); } @@ -451,7 +471,7 @@ XineramaCheckPhysLimits( if((new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y)) { - XineramaSetCursorPosition (new.x, new.y, generateEvents); + XineramaSetCursorPosition (pDev, new.x, new.y, generateEvents); if (!generateEvents) SyntheticMotion(new.x, new.y); } @@ -597,7 +617,7 @@ XineramaCheckMotion(xEvent *xE, DeviceIntPtr pDev) (pSprite->hotPhys.y != XE_KBPTR.rootY)) { XineramaSetCursorPosition( - pSprite->hotPhys.x, pSprite->hotPhys.y, FALSE); + pDev, pSprite->hotPhys.x, pSprite->hotPhys.y, FALSE); } XE_KBPTR.rootX = pSprite->hot.x; XE_KBPTR.rootY = pSprite->hot.y; @@ -693,7 +713,7 @@ XineramaChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor) if ((pSprite->current->bits->xhot != cursor->bits->xhot) || (pSprite->current->bits->yhot != cursor->bits->yhot)) XineramaCheckPhysLimits(pDev, cursor, FALSE); - (*pSprite->screen->DisplayCursor)(pSprite->screen, cursor); + (*pSprite->screen->DisplayCursor)(pDev, pSprite->screen, cursor); FreeCursor(pSprite->current, (Cursor)0); pSprite->current = cursor; pSprite->current->refcnt++; @@ -785,7 +805,7 @@ CheckPhysLimits( new.pScreen = pScreen; else pScreen = new.pScreen; - (*pScreen->CursorLimits) (pScreen, cursor, &pSprite->hotLimits, + (*pScreen->CursorLimits) (pDev, pScreen, cursor, &pSprite->hotLimits, &pSprite->physLimits); pSprite->confined = confineToScreen; (* pScreen->ConstrainCursor)(pDev, pScreen, &pSprite->physLimits); @@ -808,8 +828,9 @@ CheckPhysLimits( { if (pScreen != pSprite->hotPhys.pScreen) pSprite->hotPhys = new; - (*pScreen->SetCursorPosition) (pScreen, new.x, new.y, generateEvents); - if (!generateEvents) + (*pScreen->SetCursorPosition) + (pDev, pScreen, new.x, new.y, generateEvents); + if (!generateEvents) SyntheticMotion(new.x, new.y); } } @@ -932,8 +953,9 @@ ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor) (pSprite->current->bits->yhot != cursor->bits->yhot)) CheckPhysLimits(pDev, cursor, FALSE, pSprite->confined, (ScreenPtr)NULL); - (*sprite->hotPhys.pScreen->DisplayCursor) (pSprite->hotPhys.pScreen, - cursor); + (*sprite->hotPhys.pScreen->DisplayCursor) (pDev, + pSprite->hotPhys.pScreen, + cursor); FreeCursor(pSprite->current, (Cursor)0); pSprite->current = cursor; pSprite->current->refcnt++; @@ -2208,10 +2230,9 @@ DefineInitialRootWindow(register WindowPtr win) { register ScreenPtr pScreen = win->drawable.pScreen; SpritePtr pSprite = sprite; + DeviceIntPtr pDev = inputInfo.pointer; #ifdef MPX int mpSpriteIdx = 0; - DeviceIntPtr pDev; - while (mpSpriteIdx < MAX_DEVICES) { @@ -2232,7 +2253,7 @@ DefineInitialRootWindow(register WindowPtr win) pSprite->current->refcnt++; spriteTraceGood = 1; ROOT = win; - (*pScreen->CursorLimits) ( pScreen, pSprite->current, + (*pScreen->CursorLimits) ( pDev, pScreen, pSprite->current, &pSprite->hotLimits, &pSprite->physLimits); pSprite->confined = FALSE; @@ -2241,18 +2262,20 @@ DefineInitialRootWindow(register WindowPtr win) pDev = inputInfo.devices; while(pDev) { - if (pDev->id == mpSpriteIdx) - (*pScreen->ConstrainCursor) (pDev, pScreen, &pSprite->physLimits); - + if (pDev->id == mpSpriteIdx && MPHasCursor(pDev)) + { +#endif + (*pScreen->ConstrainCursor) (pDev, pScreen, + &pSprite->physLimits); + (*pScreen->SetCursorPosition) (pDev, pScreen, pSprite->hot.x, + pSprite->hot.y, + FALSE); + (*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current); +#ifdef MPX + } pDev = pDev->next; } -#else - (*pScreen->ConstrainCursor) (inputInfo.pointer, pScreen, - &pSprite->physLimits); #endif - (*pScreen->SetCursorPosition) (pScreen, pSprite->hot.x, pSprite->hot.y, - FALSE); - (*pScreen->DisplayCursor) (pScreen, pSprite->current); #ifdef PANORAMIX if(!noPanoramiXExtension) { @@ -2291,35 +2314,43 @@ WindowHasNewCursor(WindowPtr pWin) } _X_EXPORT void -NewCurrentScreen(ScreenPtr newScreen, int x, int y) +NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y) { - sprite->hotPhys.x = x; - sprite->hotPhys.y = y; + SpritePtr pSprite = sprite; +#ifdef MPX + if (IsMPDev(pDev)) + pSprite = &mpsprites[pDev->id]; +#endif + + pSprite->hotPhys.x = x; + pSprite->hotPhys.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension) { - sprite->hotPhys.x += panoramiXdataPtr[newScreen->myNum].x - + pSprite->hotPhys.x += panoramiXdataPtr[newScreen->myNum].x - panoramiXdataPtr[0].x; - sprite->hotPhys.y += panoramiXdataPtr[newScreen->myNum].y - + pSprite->hotPhys.y += panoramiXdataPtr[newScreen->myNum].y - panoramiXdataPtr[0].y; - if (newScreen != sprite->screen) { - sprite->screen = newScreen; + if (newScreen != pSprite->screen) { + pSprite->screen = newScreen; /* Make sure we tell the DDX to update its copy of the screen */ - if(sprite->confineWin) - XineramaConfineCursorToWindow(sprite->confineWin, TRUE); + if(pSprite->confineWin) + XineramaConfineCursorToWindow(pSprite->confineWin, TRUE); else XineramaConfineCursorToWindow(WindowTable[0], TRUE); /* if the pointer wasn't confined, the DDX won't get told of the pointer warp so we reposition it here */ if(!syncEvents.playingEvents) - (*sprite->screen->SetCursorPosition)(sprite->screen, - sprite->hotPhys.x + panoramiXdataPtr[0].x - - panoramiXdataPtr[sprite->screen->myNum].x, - sprite->hotPhys.y + panoramiXdataPtr[0].y - - panoramiXdataPtr[sprite->screen->myNum].y, FALSE); + (*pSprite->screen->SetCursorPosition)( + pDev, + pSprite->screen, + pSprite->hotPhys.x + panoramiXdataPtr[0].x - + panoramiXdataPtr[pSprite->screen->myNum].x, + pSprite->hotPhys.y + panoramiXdataPtr[0].y - + panoramiXdataPtr[pSprite->screen->myNum].y, FALSE); } } else #endif - if (newScreen != sprite->hotPhys.pScreen) + if (newScreen != pSprite->hotPhys.pScreen) ConfineCursorToWindow(WindowTable[newScreen->myNum], TRUE, FALSE); } @@ -2430,7 +2461,7 @@ XineramaWarpPointer(ClientPtr client) if (sprite->hotShape) ConfineToShape(inputInfo.pointer, sprite->hotShape, &x, &y); - XineramaSetCursorPosition(x, y, TRUE); + XineramaSetCursorPosition(inputInfo.pointer, x, y, TRUE); return Success; } @@ -2518,11 +2549,12 @@ ProcWarpPointer(ClientPtr client) if (sprite->hotShape) ConfineToShape(inputInfo.pointer, sprite->hotShape, &x, &y); #endif - (*newScreen->SetCursorPosition)(newScreen, x, y, TRUE); + (*newScreen->SetCursorPosition)(inputInfo.pointer, newScreen, x, y, + TRUE); } else if (!PointerConfinedToScreen(inputInfo.pointer)) { - NewCurrentScreen(newScreen, x, y); + NewCurrentScreen(inputInfo.pointer, newScreen, x, y); } return Success; } @@ -4693,7 +4725,7 @@ ProcRecolorCursor(ClientPtr client) else #endif displayed = (pscr == sprite->hotPhys.pScreen); - ( *pscr->RecolorCursor)(pscr, pCursor, + ( *pscr->RecolorCursor)(inputInfo.pointer, pscr, pCursor, (pCursor == sprite->current) && displayed); } return (Success); diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c index 46d812804..27264a252 100644 --- a/hw/xfree86/common/xf86Cursor.c +++ b/hw/xfree86/common/xf86Cursor.c @@ -69,7 +69,7 @@ typedef struct { static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y); static void xf86CrossScreen(ScreenPtr pScreen, Bool entering); -static void xf86WarpCursor(ScreenPtr pScreen, int x, int y); +static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); static void xf86PointerMoved(int scrnIndex, int x, int y); @@ -269,7 +269,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) (*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); if (pScreen == pCursorScreen) - xf86WarpCursor(pScreen, px, py); + xf86WarpCursor(inputInfo.pointer, pScreen, px, py); return Switched; } @@ -430,11 +430,11 @@ xf86CrossScreen (ScreenPtr pScreen, Bool entering) /* ARGSUSED */ static void -xf86WarpCursor (ScreenPtr pScreen, int x, int y) +xf86WarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { int sigstate; sigstate = xf86BlockSIGIO (); - miPointerWarpCursor(pScreen,x,y); + miPointerWarpCursor(pDev, pScreen,x,y); xf86Info.currentScreen = pScreen; xf86UnblockSIGIO (sigstate); diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c index 288d72193..87d5a364b 100644 --- a/hw/xfree86/common/xf86RandR.c +++ b/hw/xfree86/common/xf86RandR.c @@ -34,6 +34,7 @@ #include "xf86DDC.h" #include "mipointer.h" #include <randrstr.h> +#include "inputstr.h" typedef struct _xf86RandRInfo { CreateScreenResourcesProcPtr CreateScreenResources; @@ -291,7 +292,7 @@ xf86RandRSetConfig (ScreenPtr pScreen, xf86SetViewport(pScreen, px, py); - (*pScreen->SetCursorPosition) (pScreen, px, py, FALSE); + (*pScreen->SetCursorPosition) (inputInfo.pointer, pScreen, px, py, FALSE); } return TRUE; diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index a49c63212..76f0b702a 100644 --- a/hw/xfree86/dri/dri.c +++ b/hw/xfree86/dri/dri.c @@ -70,6 +70,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "mi.h" #include "mipointer.h" #include "xf86_OSproc.h" +#include "inputstr.h" #if !defined(PANORAMIX) extern Bool noPanoramiXExtension; @@ -2013,7 +2014,7 @@ DRIAdjustFrame(int scrnIndex, int x, int y, int flags) if (px > pScrn->frameX1) px = pScrn->frameX1; if (py < pScrn->frameY0) py = pScrn->frameY0; if (py > pScrn->frameY1) py = pScrn->frameY1; - pScreen->SetCursorPosition(pScreen, px, py, TRUE); + pScreen->SetCursorPosition(inputInfo.pointer, pScreen, px, py, TRUE); return; } diff --git a/hw/xfree86/rac/xf86RAC.c b/hw/xfree86/rac/xf86RAC.c index 23dab862f..022f4748e 100644 --- a/hw/xfree86/rac/xf86RAC.c +++ b/hw/xfree86/rac/xf86RAC.c @@ -154,13 +154,16 @@ static PixmapPtr RACCreatePixmap(ScreenPtr pScreen, int w, int h, int depth); static Bool RACCreateGC(GCPtr pGC); static Bool RACSaveScreen(ScreenPtr pScreen, Bool unblank); static void RACStoreColors (ColormapPtr pmap, int ndef, xColorItem *pdefs); -static void RACRecolorCursor (ScreenPtr pScreen, CursorPtr pCurs, - Bool displayed); -static Bool RACRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor); -static Bool RACUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor); -static Bool RACDisplayCursor (ScreenPtr pScreen, CursorPtr pCursor); -static Bool RACSetCursorPosition (ScreenPtr pScreen, int x, int y, - Bool generateEvent); +static void RACRecolorCursor (DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCurs, Bool displayed); +static Bool RACRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor); +static Bool RACUnrealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor); +static Bool RACDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor); +static Bool RACSetCursorPosition (DeviceIntPtr pDev, ScreenPtr pScreen, + int x, int y, Bool generateEvent); static void RACAdjustFrame(int index, int x, int y, int flags); static Bool RACSwitchMode(int index, DisplayModePtr mode, int flags); static Bool RACEnterVT(int index, int flags); @@ -586,6 +589,7 @@ RACStoreColors ( static void RACRecolorCursor ( + DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs, Bool displayed @@ -594,15 +598,16 @@ RACRecolorCursor ( DPRINT_S("RACRecolorCursor",pScreen->myNum); SCREEN_PROLOG (RecolorCursor); ENABLE; - (*pScreen->RecolorCursor) (pScreen,pCurs,displayed); + (*pScreen->RecolorCursor) (pDev, pScreen,pCurs,displayed); SCREEN_EPILOG ( RecolorCursor, RACRecolorCursor); } static Bool RACRealizeCursor ( - ScreenPtr pScreen, - CursorPtr pCursor + DeviceIntPtr pDev, + ScreenPtr pScreen, + CursorPtr pCursor ) { Bool val; @@ -610,7 +615,7 @@ RACRealizeCursor ( DPRINT_S("RACRealizeCursor",pScreen->myNum); SCREEN_PROLOG (RealizeCursor); ENABLE; - val = (*pScreen->RealizeCursor) (pScreen,pCursor); + val = (*pScreen->RealizeCursor) (pDev, pScreen,pCursor); SCREEN_EPILOG ( RealizeCursor, RACRealizeCursor); return val; @@ -618,8 +623,9 @@ RACRealizeCursor ( static Bool RACUnrealizeCursor ( - ScreenPtr pScreen, - CursorPtr pCursor + DeviceIntPtr pDev, + ScreenPtr pScreen, + CursorPtr pCursor ) { Bool val; @@ -627,7 +633,7 @@ RACUnrealizeCursor ( DPRINT_S("RACUnrealizeCursor",pScreen->myNum); SCREEN_PROLOG (UnrealizeCursor); ENABLE; - val = (*pScreen->UnrealizeCursor) (pScreen,pCursor); + val = (*pScreen->UnrealizeCursor) (pDev, pScreen,pCursor); SCREEN_EPILOG ( UnrealizeCursor, RACUnrealizeCursor); return val; @@ -635,8 +641,9 @@ RACUnrealizeCursor ( static Bool RACDisplayCursor ( - ScreenPtr pScreen, - CursorPtr pCursor + DeviceIntPtr pDev, + ScreenPtr pScreen, + CursorPtr pCursor ) { Bool val; @@ -644,7 +651,7 @@ RACDisplayCursor ( DPRINT_S("RACDisplayCursor",pScreen->myNum); SCREEN_PROLOG (DisplayCursor); ENABLE; - val = (*pScreen->DisplayCursor) (pScreen,pCursor); + val = (*pScreen->DisplayCursor) (pDev, pScreen,pCursor); SCREEN_EPILOG ( DisplayCursor, RACDisplayCursor); return val; @@ -652,6 +659,7 @@ RACDisplayCursor ( static Bool RACSetCursorPosition ( + DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, Bool generateEvent) @@ -661,7 +669,7 @@ RACSetCursorPosition ( DPRINT_S("RACSetCursorPosition",pScreen->myNum); SCREEN_PROLOG (SetCursorPosition); ENABLE; - val = (*pScreen->SetCursorPosition) (pScreen,x,y,generateEvent); + val = (*pScreen->SetCursorPosition) (pDev, pScreen,x,y,generateEvent); SCREEN_EPILOG ( SetCursorPosition, RACSetCursorPosition); return val; diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c index ec813e068..5a8509bdb 100644 --- a/hw/xfree86/ramdac/xf86Cursor.c +++ b/hw/xfree86/ramdac/xf86Cursor.c @@ -38,7 +38,7 @@ static miPointerSpriteFuncRec xf86CursorSpriteFuncs = { /* Screen functions */ static void xf86CursorInstallColormap(ColormapPtr); -static void xf86CursorRecolorCursor(ScreenPtr, CursorPtr, Bool); +static void xf86CursorRecolorCursor(DeviceIntPtr pDev, ScreenPtr, CursorPtr, Bool); static Bool xf86CursorCloseScreen(int, ScreenPtr); static void xf86CursorQueryBestSize(int, unsigned short*, unsigned short*, ScreenPtr); @@ -181,6 +181,7 @@ xf86CursorInstallColormap(ColormapPtr pMap) static void xf86CursorRecolorCursor( + DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs, Bool displayed) @@ -192,7 +193,7 @@ xf86CursorRecolorCursor( return; if (ScreenPriv->SWCursor) - (*ScreenPriv->RecolorCursor)(pScreen, pCurs, displayed); + (*ScreenPriv->RecolorCursor)(pDev, pScreen, pCurs, displayed); else xf86RecolorCursor(pScreen, pCurs, displayed); } diff --git a/include/cursor.h b/include/cursor.h index b28f8db5b..7aacf23f5 100644 --- a/include/cursor.h +++ b/include/cursor.h @@ -131,6 +131,7 @@ extern void CheckCursorConfinement( WindowPtr /*pWin*/); extern void NewCurrentScreen( + struct _DeviceIntRec* /*pDev*/, ScreenPtr /*newScreen*/, int /*x*/, int /*y*/); diff --git a/include/dix.h b/include/dix.h index d59cccc44..6f2e43ae5 100644 --- a/include/dix.h +++ b/include/dix.h @@ -821,4 +821,8 @@ extern int xstrcasecmp(char *s1, char *s2); /* ffs.c */ extern int ffs(int i); +#ifdef MPX +extern Bool MPHasCursor(DeviceIntPtr pDev); +#endif + #endif /* DIX_H */ diff --git a/include/inputstr.h b/include/inputstr.h index 6f6b6760c..512829373 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -330,7 +330,7 @@ typedef struct _DeviceIntRec { int nPrivates; DeviceUnwrapProc unwrapProc; #ifdef MPX - Bool isMPDev; /* TRUE if multipointer device */ + Bool isMPDev; /* TRUE if multipointer device */ #endif } DeviceIntRec; diff --git a/include/scrnintstr.h b/include/scrnintstr.h index 4fa2919df..629d45ed8 100644 --- a/include/scrnintstr.h +++ b/include/scrnintstr.h @@ -121,6 +121,7 @@ typedef void (* GetSpansProcPtr)( char * /*pdstStart*/); typedef void (* PointerNonInterestBoxProcPtr)( + DeviceIntPtr /*pDev*/, ScreenPtr /*pScreen*/, BoxPtr /*pBox*/); @@ -262,29 +263,35 @@ typedef void (* ConstrainCursorProcPtr)( BoxPtr /*pBox*/); typedef void (* CursorLimitsProcPtr)( + DeviceIntPtr /* pDev */, ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, BoxPtr /*pHotBox*/, BoxPtr /*pTopLeftBox*/); typedef Bool (* DisplayCursorProcPtr)( + DeviceIntPtr /* pDev */, ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/); typedef Bool (* RealizeCursorProcPtr)( + DeviceIntPtr /* pDev */, ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/); typedef Bool (* UnrealizeCursorProcPtr)( + DeviceIntPtr /* pDev */, ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/); typedef void (* RecolorCursorProcPtr)( + DeviceIntPtr /* pDev */, ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, Bool /*displayed*/); typedef Bool (* SetCursorPositionProcPtr)( + DeviceIntPtr /* pDev */, ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, @@ -137,6 +137,7 @@ extern void miPutImage( /* micursor.c */ extern void miRecolorCursor( + DeviceIntPtr /* pDev */, ScreenPtr /*pScr*/, CursorPtr /*pCurs*/, Bool /*displayed*/ diff --git a/mi/micursor.c b/mi/micursor.c index 6e06fbc07..af2cd0870 100644 --- a/mi/micursor.c +++ b/mi/micursor.c @@ -52,24 +52,26 @@ SOFTWARE. #include "cursor.h" #include "misc.h" #include "mi.h" +#include "inputstr.h" extern Bool Must_have_memory; _X_EXPORT void -miRecolorCursor( pScr, pCurs, displayed) - ScreenPtr pScr; - CursorPtr pCurs; - Bool displayed; +miRecolorCursor( pDev, pScr, pCurs, displayed) + DeviceIntPtr pDev; + ScreenPtr pScr; + CursorPtr pCurs; + Bool displayed; { /* * This is guaranteed to correct any color-dependent state which may have * been bound up in private state created by RealizeCursor */ - (* pScr->UnrealizeCursor)( pScr, pCurs); + (* pScr->UnrealizeCursor)( pDev, pScr, pCurs); Must_have_memory = TRUE; /* XXX */ - (* pScr->RealizeCursor)( pScr, pCurs); + (* pScr->RealizeCursor)( pDev, pScr, pCurs); Must_have_memory = FALSE; /* XXX */ if ( displayed) - (* pScr->DisplayCursor)( pScr, pCurs); + (* pScr->DisplayCursor)( pDev, pScr, pCurs); } @@ -209,7 +209,7 @@ mieqProcessInputEvents() miEventQueue.head = 0; else ++miEventQueue.head; - NewCurrentScreen (miEventQueue.pDequeueScreen, x, y); + NewCurrentScreen (e->pDev, miEventQueue.pDequeueScreen, x, y); } else { if (miEventQueue.head == QUEUE_SIZE - 1) diff --git a/mi/mipointer.c b/mi/mipointer.c index f954ba656..acce4ccab 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -68,7 +68,9 @@ static unsigned long miPointerGeneration = 0; static miPointerPtr miPointer; #ifdef MPX -/* Multipointers */ +/* Multipointers + * ID of a device == index in this array. + */ static miPointerRec miMPPointers[MAX_DEVICES]; @@ -80,19 +82,26 @@ IsMPDev(DeviceIntPtr pDev) } #endif -static Bool miPointerRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); -static Bool miPointerUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); -static Bool miPointerDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor); +static Bool miPointerRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor); +static Bool miPointerUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor); +static Bool miPointerDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor); static void miPointerConstrainCursor(DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox); -static void miPointerPointerNonInterestBox(ScreenPtr - pScreen, BoxPtr pBox); -static void miPointerCursorLimits(ScreenPtr pScreen, CursorPtr pCursor, - BoxPtr pHotBox, BoxPtr pTopLeftBox); -static Bool miPointerSetCursorPosition(ScreenPtr pScreen, int x, int y, +static void miPointerPointerNonInterestBox(DeviceIntPtr pDev, + ScreenPtr pScreen, BoxPtr pBox); +static void miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor, BoxPtr pHotBox, + BoxPtr pTopLeftBox); +static Bool miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, + int x, int y, Bool generateEvent); static Bool miPointerCloseScreen(int index, ScreenPtr pScreen); -static void miPointerMove(ScreenPtr pScreen, int x, int y, unsigned long time); +static void miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, + int x, int y, + unsigned long time); _X_EXPORT Bool miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate) @@ -101,9 +110,6 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate) miPointerScreenFuncPtr screenFuncs; Bool waitForUpdate; { -#ifdef MPX - int mpPtrIdx = 0; /* loop counter */ -#endif miPointerScreenPtr pScreenPriv; if (miPointerGeneration != serverGeneration) @@ -147,7 +153,7 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate) miPointer = (miPointerPtr)xalloc(sizeof(miPointerRec)); if (!miPointer) { - xfree(pScreenPriv); + xfree((pointer)pScreenPriv); return FALSE; } miPointer->pScreen = NULL; @@ -165,23 +171,26 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate) #ifdef MPX xfree(miPointer); miPointer = &miMPPointers[1]; - /* - * Set up pointer objects for multipointer devices. - */ - while(mpPtrIdx < MAX_DEVICES) { - miMPPointers[mpPtrIdx].pScreen = NULL; - miMPPointers[mpPtrIdx].pSpriteScreen = NULL; - miMPPointers[mpPtrIdx].pCursor = NULL; - miMPPointers[mpPtrIdx].pSpriteCursor = NULL; - miMPPointers[mpPtrIdx].limits.x1 = 0; - miMPPointers[mpPtrIdx].limits.x2 = 32767; - miMPPointers[mpPtrIdx].limits.y1 = 0; - miMPPointers[mpPtrIdx].limits.y2 = 32767; - miMPPointers[mpPtrIdx].confined = FALSE; - miMPPointers[mpPtrIdx].x = 0; - miMPPointers[mpPtrIdx].y = 0; - mpPtrIdx++; + int mpPtrIdx = 0; /* loop counter */ + /* + * Set up pointer objects for multipointer devices. + */ + while(mpPtrIdx < MAX_DEVICES) + { + miMPPointers[mpPtrIdx].pScreen = NULL; + miMPPointers[mpPtrIdx].pSpriteScreen = NULL; + miMPPointers[mpPtrIdx].pCursor = NULL; + miMPPointers[mpPtrIdx].pSpriteCursor = NULL; + miMPPointers[mpPtrIdx].limits.x1 = 0; + miMPPointers[mpPtrIdx].limits.x2 = 32767; + miMPPointers[mpPtrIdx].limits.y1 = 0; + miMPPointers[mpPtrIdx].limits.y2 = 32767; + miMPPointers[mpPtrIdx].confined = FALSE; + miMPPointers[mpPtrIdx].x = 0; + miMPPointers[mpPtrIdx].y = 0; + mpPtrIdx++; + } } #endif @@ -196,10 +205,6 @@ miPointerCloseScreen (index, pScreen) int mpPointerIdx = 0; SetupScreen(pScreen); - if (pScreen == miPointer->pScreen) - miPointer->pScreen = 0; - if (pScreen == miPointer->pSpriteScreen) - miPointer->pSpriteScreen = 0; #ifdef MPX while(mpPointerIdx < MAX_DEVICES) { @@ -209,6 +214,12 @@ miPointerCloseScreen (index, pScreen) miMPPointers[mpPointerIdx].pSpriteScreen = 0; mpPointerIdx++; } +#else + if (pScreen == miPointer->pScreen) + miPointer->pScreen = 0; + if (pScreen == miPointer->pSpriteScreen) + miPointer->pSpriteScreen = 0; + xfree((pointer)miPointer); #endif pScreen->CloseScreen = pScreenPriv->CloseScreen; xfree ((pointer) pScreenPriv); @@ -220,67 +231,44 @@ miPointerCloseScreen (index, pScreen) */ static Bool -miPointerRealizeCursor (pScreen, pCursor) - ScreenPtr pScreen; - CursorPtr pCursor; +miPointerRealizeCursor (pDev, pScreen, pCursor) + DeviceIntPtr pDev; + ScreenPtr pScreen; + CursorPtr pCursor; { - DeviceIntPtr pDev = inputInfo.pointer; - SetupScreen(pScreen); -#ifdef MPX - pDev = inputInfo.devices; - while(pDev) - { - if (pDev != inputInfo.keyboard) - (*pScreenPriv->spriteFuncs->RealizeCursor) (pDev, pScreen, pCursor); - pDev = pDev->next; - } - return TRUE; -#else return (*pScreenPriv->spriteFuncs->RealizeCursor) (pDev, pScreen, pCursor); -#endif } static Bool -miPointerUnrealizeCursor (pScreen, pCursor) - ScreenPtr pScreen; - CursorPtr pCursor; +miPointerUnrealizeCursor (pDev, pScreen, pCursor) + DeviceIntPtr pDev; + ScreenPtr pScreen; + CursorPtr pCursor; { - DeviceIntPtr pDev = inputInfo.pointer; SetupScreen(pScreen); - -#ifdef MPX - pDev = inputInfo.devices; - while(pDev) - { - if (pDev != inputInfo.keyboard) - (*pScreenPriv->spriteFuncs->UnrealizeCursor) (pDev, pScreen, pCursor); - pDev = pDev->next; - } - return TRUE; -#else return (*pScreenPriv->spriteFuncs->UnrealizeCursor) (pDev, pScreen, pCursor); -#endif } static Bool -miPointerDisplayCursor (pScreen, pCursor) - ScreenPtr pScreen; - CursorPtr pCursor; +miPointerDisplayCursor (pDev, pScreen, pCursor) + DeviceIntPtr pDev; + ScreenPtr pScreen; + CursorPtr pCursor; { #ifdef MPX - int mpPtrIdx = 0; - while (mpPtrIdx < MAX_DEVICES) - { - miMPPointers[mpPtrIdx].pCursor = pCursor; - miMPPointers[mpPtrIdx].pScreen = pScreen; - mpPtrIdx++; - } + /* use core pointer for non MPX devices */ + if (!IsMPDev(pDev)) + pDev = inputInfo.pointer; -#endif + miMPPointers[pDev->id].pCursor = pCursor; + miMPPointers[pDev->id].pScreen = pScreen; + miPointerUpdateSprite(pDev); +#else miPointer->pCursor = pCursor; miPointer->pScreen = pScreen; miPointerUpdateSprite(inputInfo.pointer); +#endif return TRUE; } @@ -301,20 +289,22 @@ miPointerConstrainCursor (pDev, pScreen, pBox) /*ARGSUSED*/ static void -miPointerPointerNonInterestBox (pScreen, pBox) - ScreenPtr pScreen; - BoxPtr pBox; +miPointerPointerNonInterestBox (pDev, pScreen, pBox) + DeviceIntPtr pDev; + ScreenPtr pScreen; + BoxPtr pBox; { /* until DIX uses this, this will remain a stub */ } /*ARGSUSED*/ static void -miPointerCursorLimits(pScreen, pCursor, pHotBox, pTopLeftBox) - ScreenPtr pScreen; - CursorPtr pCursor; - BoxPtr pHotBox; - BoxPtr pTopLeftBox; +miPointerCursorLimits(pDev, pScreen, pCursor, pHotBox, pTopLeftBox) + DeviceIntPtr pDev; + ScreenPtr pScreen; + CursorPtr pCursor; + BoxPtr pHotBox; + BoxPtr pTopLeftBox; { *pTopLeftBox = *pHotBox; } @@ -322,33 +312,40 @@ miPointerCursorLimits(pScreen, pCursor, pHotBox, pTopLeftBox) static Bool GenerateEvent; static Bool -miPointerSetCursorPosition(pScreen, x, y, generateEvent) - ScreenPtr pScreen; - int x, y; - Bool generateEvent; +miPointerSetCursorPosition(pDev, pScreen, x, y, generateEvent) + DeviceIntPtr pDev; + ScreenPtr pScreen; + int x, y; + Bool generateEvent; { SetupScreen (pScreen); GenerateEvent = generateEvent; /* device dependent - must pend signal and call miPointerWarpCursor */ - (*pScreenPriv->screenFuncs->WarpCursor) (pScreen, x, y); + (*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y); if (!generateEvent) - miPointerUpdateSprite(inputInfo.pointer); + miPointerUpdateSprite(pDev); return TRUE; } /* Once signals are ignored, the WarpCursor function can call this */ _X_EXPORT void -miPointerWarpCursor (pScreen, x, y) - ScreenPtr pScreen; - int x, y; +miPointerWarpCursor (pDev, pScreen, x, y) + DeviceIntPtr pDev; + ScreenPtr pScreen; + int x, y; { - DeviceIntPtr pDev = inputInfo.pointer; - + miPointerPtr pPointer = miPointer; SetupScreen (pScreen); - if (miPointer->pScreen != pScreen) +#ifdef MPX + if (IsMPDev(pDev)) + pPointer = &miMPPointers[pDev->id]; +#endif + + + if (pPointer->pScreen != pScreen) (*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, TRUE); if (GenerateEvent) @@ -359,16 +356,16 @@ miPointerWarpCursor (pScreen, x, y) { /* everything from miPointerMove except the event and history */ - if (!pScreenPriv->waitForUpdate && pScreen == miPointer->pSpriteScreen) + if (!pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen) { - miPointer->devx = x; - miPointer->devy = y; - if(!miPointer->pCursor->bits->emptyMask) + pPointer->devx = x; + pPointer->devy = y; + if(!pPointer->pCursor->bits->emptyMask) (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y); } - miPointer->x = x; - miPointer->y = y; - miPointer->pScreen = pScreen; + pPointer->x = x; + pPointer->y = y; + pPointer->pScreen = pScreen; } } @@ -395,7 +392,7 @@ miPointerUpdateSprite (DeviceIntPtr pDev) miPointerScreenPtr pScreenPriv; CursorPtr pCursor; int x, y, devx, devy; - miPointerPtr pPointer; + miPointerPtr pPointer = miPointer; #ifdef MPX if (!pDev || @@ -408,8 +405,6 @@ miPointerUpdateSprite (DeviceIntPtr pDev) #ifdef MPX if (IsMPDev(pDev)) pPointer = &miMPPointers[pDev->id]; - else - pPointer = miPointer; #endif pScreen = pPointer->pScreen; @@ -495,22 +490,18 @@ miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y) { miPointerScreenPtr pScreenPriv; ScreenPtr pScreen; + miPointerPtr pPointer = miPointer; pScreen = screenInfo.screens[screen_no]; pScreenPriv = GetScreenPrivate (pScreen); (*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, FALSE); - NewCurrentScreen (pScreen, x, y); + NewCurrentScreen (pDev, pScreen, x, y); #ifdef MPX if (IsMPDev(pDev)) - { - miMPPointers[pDev->id].limits.x2 = pScreen->width; - miMPPointers[pDev->id].limits.y2 = pScreen->height; - } + pPointer = &miMPPointers[pDev->id]; #endif - { - miPointer->limits.x2 = pScreen->width; - miPointer->limits.y2 = pScreen->height; - } + pPointer->limits.x2 = pScreen->width; + pPointer->limits.y2 = pScreen->height; } _X_EXPORT ScreenPtr @@ -522,11 +513,12 @@ miPointerCurrentScreen () _X_EXPORT ScreenPtr miPointerGetScreen(DeviceIntPtr pDev) { + miPointerPtr pPointer; #ifdef MPX if (IsMPDev(pDev)) - return miMPPointers[pDev->id].pScreen; + pPointer = &miMPPointers[pDev->id]; #endif - return miPointer->pScreen; + return pPointer->pScreen; } /* Move the pointer to x, y on the current screen, update the sprite, and @@ -545,13 +537,11 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y, unsigned long time) ScreenPtr pScreen; ScreenPtr newScreen; - miPointerPtr pPointer; + miPointerPtr pPointer = miPointer; #ifdef MPX if (IsMPDev(pDev)) pPointer = &(miMPPointers[pDev->id]); - else #endif - pPointer = miPointer; pScreen = pPointer->pScreen; if (!pScreen) @@ -609,24 +599,19 @@ miPointerPosition (int *x, int *y) _X_EXPORT void miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y) { + miPointerPtr pPointer = miPointer; #ifdef MPX if (IsMPDev(pDev)) - { - *x = miMPPointers[pDev->id].x; - *y = miMPPointers[pDev->id].y; - } - else + pPointer = &miMPPointers[pDev->id]; #endif - { - *x = miPointer->x; - *y = miPointer->y; - } + *x = pPointer->x; + *y = pPointer->y; } void -miPointerMove (ScreenPtr pScreen, int x, int y, unsigned long time) +miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, unsigned long time) { - miPointerMoved(inputInfo.pointer, pScreen, x, y, time); + miPointerMoved(pDev, pScreen, x, y, time); } /* Move the pointer on the current screen, and update the sprite. */ @@ -634,15 +619,13 @@ void miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, unsigned long time) { - miPointerPtr pPointer; + miPointerPtr pPointer = miPointer; SetupScreen(pScreen); #ifdef MPX if (IsMPDev(pDev)) pPointer = &miMPPointers[pDev->id]; - else #endif - pPointer = miPointer; if (pDev && (pDev->coreEvents || pDev == inputInfo.pointer #ifdef MPX diff --git a/mi/mipointer.h b/mi/mipointer.h index 1b01ba19b..85c5c8b2e 100644 --- a/mi/mipointer.h +++ b/mi/mipointer.h @@ -72,6 +72,7 @@ typedef struct _miPointerScreenFuncRec { int /* entering */ ); void (*WarpCursor)( + DeviceIntPtr /*pDev*/, ScreenPtr /* pScr */, int /* x */, int /* y */ @@ -99,6 +100,7 @@ extern Bool miPointerInitialize( ); extern void miPointerWarpCursor( + DeviceIntPtr /*pDev*/, ScreenPtr /*pScreen*/, int /*x*/, int /*y*/ diff --git a/render/animcur.c b/render/animcur.c index 8e4f59d1b..2b552a3a2 100644 --- a/render/animcur.c +++ b/render/animcur.c @@ -44,6 +44,7 @@ #include "dixfontstr.h" #include "opaque.h" #include "picturestr.h" +#include "inputstr.h" typedef struct _AnimCurElt { CursorPtr pCursor; /* cursor to show */ @@ -100,11 +101,13 @@ int AnimCurGeneration; #define Unwrap(as,s,elt) ((s)->elt = (as)->elt) static Bool -AnimCurDisplayCursor (ScreenPtr pScreen, +AnimCurDisplayCursor (DeviceIntPtr pDev, + ScreenPtr pScreen, CursorPtr pCursor); static Bool -AnimCurSetCursorPosition (ScreenPtr pScreen, +AnimCurSetCursorPosition (DeviceIntPtr pDev, + ScreenPtr pScreen, int x, int y, Bool generateEvent); @@ -134,7 +137,8 @@ AnimCurCloseScreen (int index, ScreenPtr pScreen) } static void -AnimCurCursorLimits (ScreenPtr pScreen, +AnimCurCursorLimits (DeviceIntPtr pDev, + ScreenPtr pScreen, CursorPtr pCursor, BoxPtr pHotBox, BoxPtr pTopLeftBox) @@ -146,11 +150,13 @@ AnimCurCursorLimits (ScreenPtr pScreen, { AnimCurPtr ac = GetAnimCur(pCursor); - (*pScreen->CursorLimits) (pScreen, ac->elts[0].pCursor, pHotBox, pTopLeftBox); + (*pScreen->CursorLimits) (pDev, pScreen, ac->elts[0].pCursor, + pHotBox, pTopLeftBox); } else { - (*pScreen->CursorLimits) (pScreen, pCursor, pHotBox, pTopLeftBox); + (*pScreen->CursorLimits) (inputInfo.pointer, pScreen, pCursor, + pHotBox, pTopLeftBox); } Wrap (as, pScreen, CursorLimits, AnimCurCursorLimits); } @@ -187,7 +193,9 @@ AnimCurScreenBlockHandler (int screenNum, */ DisplayCursor = pScreen->DisplayCursor; pScreen->DisplayCursor = as->DisplayCursor; - (void) (*pScreen->DisplayCursor) (pScreen, ac->elts[elt].pCursor); + (void) (*pScreen->DisplayCursor) (inputInfo.pointer, + pScreen, + ac->elts[elt].pCursor); as->DisplayCursor = pScreen->DisplayCursor; pScreen->DisplayCursor = DisplayCursor; @@ -202,7 +210,8 @@ AnimCurScreenBlockHandler (int screenNum, } static Bool -AnimCurDisplayCursor (ScreenPtr pScreen, +AnimCurDisplayCursor (DeviceIntPtr pDev, + ScreenPtr pScreen, CursorPtr pCursor) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); @@ -215,7 +224,8 @@ AnimCurDisplayCursor (ScreenPtr pScreen, { AnimCurPtr ac = GetAnimCur(pCursor); - ret = (*pScreen->DisplayCursor) (pScreen, ac->elts[0].pCursor); + ret = (*pScreen->DisplayCursor) + (pDev, pScreen, ac->elts[0].pCursor); if (ret) { animCurState.elt = 0; @@ -231,14 +241,15 @@ AnimCurDisplayCursor (ScreenPtr pScreen, { animCurState.pCursor = 0; animCurState.pScreen = 0; - ret = (*pScreen->DisplayCursor) (pScreen, pCursor); + ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor); } Wrap (as, pScreen, DisplayCursor, AnimCurDisplayCursor); return ret; } static Bool -AnimCurSetCursorPosition (ScreenPtr pScreen, +AnimCurSetCursorPosition (DeviceIntPtr pDev, + ScreenPtr pScreen, int x, int y, Bool generateEvent) @@ -249,13 +260,14 @@ AnimCurSetCursorPosition (ScreenPtr pScreen, Unwrap (as, pScreen, SetCursorPosition); if (animCurState.pCursor) animCurState.pScreen = pScreen; - ret = (*pScreen->SetCursorPosition) (pScreen, x, y, generateEvent); + ret = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent); Wrap (as, pScreen, SetCursorPosition, AnimCurSetCursorPosition); return ret; } static Bool -AnimCurRealizeCursor (ScreenPtr pScreen, +AnimCurRealizeCursor (DeviceIntPtr pDev, + ScreenPtr pScreen, CursorPtr pCursor) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); @@ -265,13 +277,14 @@ AnimCurRealizeCursor (ScreenPtr pScreen, if (IsAnimCur(pCursor)) ret = TRUE; else - ret = (*pScreen->RealizeCursor) (pScreen, pCursor); + ret = (*pScreen->RealizeCursor) (pDev, pScreen, pCursor); Wrap (as, pScreen, RealizeCursor, AnimCurRealizeCursor); return ret; } static Bool -AnimCurUnrealizeCursor (ScreenPtr pScreen, +AnimCurUnrealizeCursor (DeviceIntPtr pDev, + ScreenPtr pScreen, CursorPtr pCursor) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); @@ -289,13 +302,14 @@ AnimCurUnrealizeCursor (ScreenPtr pScreen, ret = TRUE; } else - ret = (*pScreen->UnrealizeCursor) (pScreen, pCursor); + ret = (*pScreen->UnrealizeCursor) (pDev, pScreen, pCursor); Wrap (as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor); return ret; } static void -AnimCurRecolorCursor (ScreenPtr pScreen, +AnimCurRecolorCursor (DeviceIntPtr pDev, + ScreenPtr pScreen, CursorPtr pCursor, Bool displayed) { @@ -308,12 +322,12 @@ AnimCurRecolorCursor (ScreenPtr pScreen, int i; for (i = 0; i < ac->nelt; i++) - (*pScreen->RecolorCursor) (pScreen, ac->elts[i].pCursor, + (*pScreen->RecolorCursor) (pDev, pScreen, ac->elts[i].pCursor, displayed && animCurState.elt == i); } else - (*pScreen->RecolorCursor) (pScreen, pCursor, displayed); + (*pScreen->RecolorCursor) (pDev, pScreen, pCursor, displayed); Wrap (as, pScreen, RecolorCursor, AnimCurRecolorCursor); } diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 22f9b0942..3bcd4361e 100755 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -122,7 +122,8 @@ typedef struct _CursorScreen { #define Unwrap(as,s,elt) ((s)->elt = (as)->elt) static Bool -CursorDisplayCursor (ScreenPtr pScreen, +CursorDisplayCursor (DeviceIntPtr pDev, + ScreenPtr pScreen, CursorPtr pCursor) { CursorScreenPtr cs = GetCursorScreen(pScreen); @@ -131,9 +132,9 @@ CursorDisplayCursor (ScreenPtr pScreen, Unwrap (cs, pScreen, DisplayCursor); if (cs->pCursorHideCounts != NULL) { - ret = (*pScreen->DisplayCursor) (pScreen, pInvisibleCursor); + ret = (*pScreen->DisplayCursor) (pDev, pScreen, pInvisibleCursor); } else { - ret = (*pScreen->DisplayCursor) (pScreen, pCursor); + ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor); } if (pCursor != CursorCurrent) @@ -866,7 +867,7 @@ ProcXFixesHideCursor (ClientPtr client) ret = createCursorHideCount(client, pWin->drawable.pScreen); if (ret == Success) { - (void) CursorDisplayCursor(pWin->drawable.pScreen, CursorCurrent); + (void) CursorDisplayCursor(inputInfo.pointer, pWin->drawable.pScreen, CursorCurrent); } return ret; @@ -953,7 +954,7 @@ CursorFreeHideCount (pointer data, XID id) ScreenPtr pScreen = pChc->pScreen; deleteCursorHideCount(pChc, pChc->pScreen); - (void) CursorDisplayCursor(pScreen, CursorCurrent); + (void) CursorDisplayCursor(inputInfo.pointer, pScreen, CursorCurrent); return 1; } diff --git a/xkb/ddxFakeMtn.c b/xkb/ddxFakeMtn.c index 7e75c1586..d15c5c193 100644 --- a/xkb/ddxFakeMtn.c +++ b/xkb/ddxFakeMtn.c @@ -113,7 +113,7 @@ ScreenPtr pScreen, oldScreen; } if (pScreen != oldScreen) - NewCurrentScreen(pScreen, oldX, oldY); + NewCurrentScreen(inputInfo.pointer, pScreen, oldX, oldY); if (pScreen->SetCursorPosition) - (*pScreen->SetCursorPosition)(pScreen, oldX, oldY, TRUE); + (*pScreen->SetCursorPosition)(inputInfo.pointer, pScreen, oldX, oldY, TRUE); } |