From 70383105de279df553874efa56b37a7b3e426ea1 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 22 Nov 2006 15:27:16 +1030 Subject: [PATCH] mi: added DevToSprite() conversion function fixed miSpriteRealize to use passed pDev argument instead of looping. dix: changed sprite dependency and added MPX functionality to parts of events.c (XineramaChangeToCursor, XineramaCheckPhysLimits, XineramaConstrainCursor) Xi: fix: accessing other->buttons for keyboard segfaulted the server --- Changelog | 18 ++++++++++++ Xi/exevents.c | 6 +--- dix/events.c | 77 ++++++++++++++++++++++++++++++++------------------ mi/mipointer.c | 23 ++++++++++++++- mi/misprite.c | 34 +++++++++++++++------- 5 files changed, 115 insertions(+), 43 deletions(-) diff --git a/Changelog b/Changelog index 40ccea37c..93f1455d4 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,22 @@ MPX Changelog file +== 22.11.06 == + +mi: added DevToSprite() conversion function + fixed miSpriteRealize to use passed pDev argument instead of looping. + +dix: changed sprite dependency and added MPX functionality to parts of + events.c (XineramaChangeToCursor, XineramaCheckPhysLimits, + XineramaConstrainCursor) + +Xi: fix: accessing other->buttons for keyboard segfaulted the server + +Files: + mi/misprite.c + mi/mipointer.c + dix/events.c + Xi/exevents.c + + == 21.11.06 == mi: added MPX to miSpriteReportDamage added id field to miCursorInfoPtr, required to pass through to miDC diff --git a/Xi/exevents.c b/Xi/exevents.c index 7f7e12886..13687e3a5 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -125,11 +125,7 @@ ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) key = xE->u.u.detail; NoticeEventTime(xE); xE->u.keyButtonPointer.state = inputInfo.keyboard->key->state | -#ifdef MPX - other->button->state; -#else - inputInfo.pointer->button->state; -#endif + inputInfo.pointer->button->state; /* FIXME: change for MPX */ bit = 1 << (key & 7); } if (DeviceEventCallback) { diff --git a/dix/events.c b/dix/events.c index a06a05196..bb6bcfc41 100644 --- a/dix/events.c +++ b/dix/events.c @@ -388,10 +388,19 @@ XineramaSetCursorPosition( static void -XineramaConstrainCursor(void) +XineramaConstrainCursor(DeviceIntPtr pDev) { - ScreenPtr pScreen = sprite->screen; - BoxRec newBox = sprite->physLimits; + SpritePtr pSprite = sprite; + ScreenPtr pScreen; + BoxRec newBox; + +#ifdef MPX + if (IsMPDev(pDev)) + pSprite = &mpsprites[pDev->id]; +#endif + + pScreen = pSprite->screen; + newBox = pSprite->physLimits; /* Translate the constraining box to the screen the sprite is actually on */ @@ -400,40 +409,46 @@ XineramaConstrainCursor(void) newBox.y1 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y; newBox.y2 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y; - (* pScreen->ConstrainCursor)(inputInfo.pointer, pScreen, &newBox); + (* pScreen->ConstrainCursor)(pDev, pScreen, &newBox); } static void XineramaCheckPhysLimits( + DeviceIntPtr pDev, CursorPtr cursor, Bool generateEvents ){ HotSpot new; + SpritePtr pSprite = sprite; if (!cursor) return; +#ifdef MPX + if (IsMPDev(pDev)) + pSprite = &mpsprites[pDev->id]; +#endif - new = sprite->hotPhys; + new = pSprite->hotPhys; /* I don't care what the DDX has to say about it */ - sprite->physLimits = sprite->hotLimits; + pSprite->physLimits = pSprite->hotLimits; /* constrain the pointer to those limits */ - if (new.x < sprite->physLimits.x1) - new.x = sprite->physLimits.x1; + if (new.x < pSprite->physLimits.x1) + new.x = pSprite->physLimits.x1; else - if (new.x >= sprite->physLimits.x2) - new.x = sprite->physLimits.x2 - 1; - if (new.y < sprite->physLimits.y1) - new.y = sprite->physLimits.y1; + if (new.x >= pSprite->physLimits.x2) + new.x = pSprite->physLimits.x2 - 1; + if (new.y < pSprite->physLimits.y1) + new.y = pSprite->physLimits.y1; else - if (new.y >= sprite->physLimits.y2) - new.y = sprite->physLimits.y2 - 1; + if (new.y >= pSprite->physLimits.y2) + new.y = pSprite->physLimits.y2 - 1; - if (sprite->hotShape) /* more work if the shape is a mess */ - ConfineToShape(inputInfo.pointer, sprite->hotShape, &new.x, &new.y); + if (pSprite->hotShape) /* more work if the shape is a mess */ + ConfineToShape(pDev, pSprite->hotShape, &new.x, &new.y); - if((new.x != sprite->hotPhys.x) || (new.y != sprite->hotPhys.y)) + if((new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y)) { XineramaSetCursorPosition (new.x, new.y, generateEvents); if (!generateEvents) @@ -441,7 +456,7 @@ XineramaCheckPhysLimits( } /* Tell DDX what the limits are */ - XineramaConstrainCursor(); + XineramaConstrainCursor(pDev); } @@ -655,7 +670,8 @@ XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents) sprite->confined = FALSE; sprite->confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin; - XineramaCheckPhysLimits(sprite->current, generateEvents); + XineramaCheckPhysLimits(inputInfo.pointer, sprite->current, + generateEvents); } } @@ -663,15 +679,22 @@ XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents) static void XineramaChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor) { - if (cursor != sprite->current) + SpritePtr pSprite = sprite; + +#ifdef MPX + if (IsMPDev(pDev)) + pSprite = &mpsprites[pDev->id]; +#endif + + if (cursor != pSprite->current) { - if ((sprite->current->bits->xhot != cursor->bits->xhot) || - (sprite->current->bits->yhot != cursor->bits->yhot)) - XineramaCheckPhysLimits(cursor, FALSE); - (*sprite->screen->DisplayCursor)(sprite->screen, cursor); - FreeCursor(sprite->current, (Cursor)0); - sprite->current = cursor; - sprite->current->refcnt++; + 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); + FreeCursor(pSprite->current, (Cursor)0); + pSprite->current = cursor; + pSprite->current->refcnt++; } } diff --git a/mi/mipointer.c b/mi/mipointer.c index 27692234c..f954ba656 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -227,8 +227,18 @@ miPointerRealizeCursor (pScreen, 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 @@ -239,7 +249,18 @@ miPointerUnrealizeCursor (pScreen, 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 diff --git a/mi/misprite.c b/mi/misprite.c index dcb9e608f..8907a3da9 100644 --- a/mi/misprite.c +++ b/mi/misprite.c @@ -67,8 +67,11 @@ in this Software without prior written authorization from The Open Group. #ifdef MPX # include "inputstr.h" /* for MAX_DEVICES */ + +static miCursorInfoPtr DevToSprite(DeviceIntPtr pDev, ScreenPtr pScreen); #endif + #define SPRITE_DEBUG_ENABLE 1 #if SPRITE_DEBUG_ENABLE #define SPRITE_DEBUG(x) ErrorF x @@ -907,16 +910,9 @@ miSpriteRealizeCursor (pDev, pScreen, pCursor) pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; #ifdef MPX { - int mpCursorIdx = 0; - while (mpCursorIdx < MAX_DEVICES) - { - miCursorInfoPtr pMPCursor = &pScreenPriv->mpCursors[mpCursorIdx]; - - if (pCursor == pMPCursor->pCursor) - pMPCursor->checkPixels = TRUE; - - mpCursorIdx++; - } + miCursorInfoPtr pMPCursor = DevToSprite(pDev, pScreen); + if (pCursor == pMPCursor->pCursor) + pMPCursor->checkPixels = TRUE; } #else if (pCursor == pScreenPriv->cp->pCursor) @@ -1174,3 +1170,21 @@ miSpriteComputeSaved (pDevCursor, pScreen) pDevCursor->saved.x2 = pDevCursor->saved.x1 + w + wpad * 2; pDevCursor->saved.y2 = pDevCursor->saved.y1 + h + hpad * 2; } + +#ifdef MPX +static miCursorInfoPtr DevToSprite(DeviceIntPtr pDev, ScreenPtr pScreen) +{ + miSpriteScreenPtr pScreenPriv; + pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; + int mpCursorIdx = 0; + while(mpCursorIdx < MAX_DEVICES) + { + miCursorInfoPtr pMPCursor = &pScreenPriv->mpCursors[mpCursorIdx]; + if (pMPCursor->id == pDev->id) + return pMPCursor; + mpCursorIdx++; + } + return pScreenPriv->cp; +} + +#endif