mi:
added miCursorInfoRec to contain info of the MPX cursors. calling miUpdatePointerSprite() from event queue for MPX devices. adding device-specific processing to miPointer*() functions. dix: Call to SetCursorPosition in CheckMotion() temporarily disabled. xfree86/common: call to miPointerUpdateSprite() disabled, is done from the EQ NOTE: This build will not display cursor images. BUG: The second mouse does to take correct x coordinates.
This commit is contained in:
parent
94e106a898
commit
90bea69dfd
23
Changelog
23
Changelog
|
@ -25,6 +25,29 @@ Files:
|
|||
hw/xfree86/ramdac/xf86Cursor.c
|
||||
hw/xfree86/rac/xf86RAC.c
|
||||
|
||||
|
||||
mi:
|
||||
added miCursorInfoRec to contain info of the MPX cursors.
|
||||
calling miUpdatePointerSprite() from event queue for MPX devices.
|
||||
adding device-specific processing to miPointer*() functions.
|
||||
|
||||
dix: Call to SetCursorPosition in CheckMotion() temporarily disabled.
|
||||
|
||||
xfree86/common: call to miPointerUpdateSprite() disabled, is done from the EQ
|
||||
|
||||
NOTE: This build will not display cursor images.
|
||||
BUG: The second mouse does to take correct x coordinates.
|
||||
|
||||
Files:
|
||||
mi/mispritestr.h
|
||||
mi/misprite.c
|
||||
mi/mipointer.c
|
||||
mi/mipointer.h
|
||||
mi/mieq.c
|
||||
dix/events.c
|
||||
hw/xfree86/common/xf86Events.c
|
||||
|
||||
|
||||
== 16.11.06 ==
|
||||
dix:
|
||||
merge with code cleanup from master
|
||||
|
|
|
@ -2012,6 +2012,7 @@ CheckMotion(xEvent *xE)
|
|||
xeviehot.y = sprite.hot.y;
|
||||
#endif
|
||||
sprite.hotPhys = sprite.hot;
|
||||
#ifndef MPX
|
||||
if ((sprite.hotPhys.x != XE_KBPTR.rootX) ||
|
||||
(sprite.hotPhys.y != XE_KBPTR.rootY))
|
||||
{
|
||||
|
@ -2019,6 +2020,7 @@ CheckMotion(xEvent *xE)
|
|||
sprite.hotPhys.pScreen,
|
||||
sprite.hotPhys.x, sprite.hotPhys.y, FALSE);
|
||||
}
|
||||
#endif
|
||||
XE_KBPTR.rootX = sprite.hot.x;
|
||||
XE_KBPTR.rootY = sprite.hot.y;
|
||||
}
|
||||
|
|
|
@ -246,7 +246,10 @@ ProcessInputEvents ()
|
|||
xf86Info.inputPending = FALSE;
|
||||
|
||||
mieqProcessInputEvents();
|
||||
#ifndef MPX
|
||||
/* For MPX, this is done inside the mieqProcessInputEvents() */
|
||||
miPointerUpdateSprite(inputInfo.pointer);
|
||||
#endif
|
||||
|
||||
miPointerGetPosition(inputInfo.pointer, &x, &y);
|
||||
xf86SetViewport(xf86Info.currentScreen, x, y);
|
||||
|
|
12
mi/mieq.c
12
mi/mieq.c
|
@ -251,5 +251,17 @@ mieqProcessInputEvents()
|
|||
#endif
|
||||
dev->public.processInputProc(e->event, dev, e->nevents);
|
||||
}
|
||||
#ifdef MPX
|
||||
/*
|
||||
* This is inefficient as we update the sprite for each event rather
|
||||
* than at the end of the event queue. But we don't know if the
|
||||
* next event is from the same device, so it's better to do it here.
|
||||
*/
|
||||
if (e->event[0].u.u.type == MotionNotify &&
|
||||
(e->pDev->isMPDev || e->pDev->coreEvents))
|
||||
{
|
||||
miPointerUpdateSprite(e->pDev);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
181
mi/mipointer.c
181
mi/mipointer.c
|
@ -70,6 +70,14 @@ static miPointerRec miPointer;
|
|||
#ifdef MPX
|
||||
/* Multipointers */
|
||||
static miPointerRec miMPPointers[MAX_DEVICES];
|
||||
|
||||
|
||||
/* Check if the given device is a MP device. */
|
||||
_X_EXPORT Bool
|
||||
IsMPDev(DeviceIntPtr pDev)
|
||||
{
|
||||
return (pDev && pDev->isMPDev && pDev->id < MAX_DEVICES);
|
||||
}
|
||||
#endif
|
||||
|
||||
static Bool miPointerRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
|
||||
|
@ -175,12 +183,23 @@ miPointerCloseScreen (index, pScreen)
|
|||
int index;
|
||||
ScreenPtr 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)
|
||||
{
|
||||
if (pScreen == miMPPointers[mpPointerIdx].pScreen)
|
||||
miMPPointers[mpPointerIdx].pScreen = 0;
|
||||
if (pScreen == miMPPointers[mpPointerIdx].pSpriteScreen)
|
||||
miMPPointers[mpPointerIdx].pSpriteScreen = 0;
|
||||
mpPointerIdx++;
|
||||
}
|
||||
#endif
|
||||
pScreen->CloseScreen = pScreenPriv->CloseScreen;
|
||||
xfree ((pointer) pScreenPriv);
|
||||
return (*pScreen->CloseScreen) (index, pScreen);
|
||||
|
@ -218,6 +237,16 @@ miPointerDisplayCursor (pScreen, pCursor)
|
|||
ScreenPtr pScreen;
|
||||
CursorPtr pCursor;
|
||||
{
|
||||
#ifdef MPX
|
||||
int mpPtrIdx = 0;
|
||||
while (mpPtrIdx < MAX_DEVICES)
|
||||
{
|
||||
miMPPointers[mpPtrIdx].pCursor = pCursor;
|
||||
miMPPointers[mpPtrIdx].pScreen = pScreen;
|
||||
mpPtrIdx++;
|
||||
}
|
||||
|
||||
#endif
|
||||
miPointer.pCursor = pCursor;
|
||||
miPointer.pScreen = pScreen;
|
||||
miPointerUpdateSprite(inputInfo.pointer);
|
||||
|
@ -329,65 +358,78 @@ miPointerUpdateSprite (DeviceIntPtr pDev)
|
|||
miPointerScreenPtr pScreenPriv;
|
||||
CursorPtr pCursor;
|
||||
int x, y, devx, devy;
|
||||
miPointerPtr pointer;
|
||||
|
||||
#ifdef MPX
|
||||
if (!pDev ||
|
||||
!(pDev->coreEvents || pDev == inputInfo.pointer || pDev->isMPDev))
|
||||
#else
|
||||
if (!pDev || !(pDev->coreEvents || pDev == inputInfo.pointer))
|
||||
#endif
|
||||
return;
|
||||
|
||||
pScreen = miPointer.pScreen;
|
||||
#ifdef MPX
|
||||
if (IsMPDev(pDev))
|
||||
pointer = &miMPPointers[pDev->id];
|
||||
else
|
||||
pointer = &miPointer;
|
||||
#endif
|
||||
|
||||
pScreen = pointer->pScreen;
|
||||
if (!pScreen)
|
||||
return;
|
||||
|
||||
x = miPointer.x;
|
||||
y = miPointer.y;
|
||||
devx = miPointer.devx;
|
||||
devy = miPointer.devy;
|
||||
x = pointer->x;
|
||||
y = pointer->y;
|
||||
devx = pointer->devx;
|
||||
devy = pointer->devy;
|
||||
|
||||
pScreenPriv = GetScreenPrivate (pScreen);
|
||||
/*
|
||||
* if the cursor has switched screens, disable the sprite
|
||||
* on the old screen
|
||||
*/
|
||||
if (pScreen != miPointer.pSpriteScreen)
|
||||
if (pScreen != pointer->pSpriteScreen)
|
||||
{
|
||||
if (miPointer.pSpriteScreen)
|
||||
if (pointer->pSpriteScreen)
|
||||
{
|
||||
miPointerScreenPtr pOldPriv;
|
||||
|
||||
pOldPriv = GetScreenPrivate (miPointer.pSpriteScreen);
|
||||
if (miPointer.pCursor)
|
||||
pOldPriv = GetScreenPrivate (pointer->pSpriteScreen);
|
||||
if (pointer->pCursor)
|
||||
{
|
||||
(*pOldPriv->spriteFuncs->SetCursor)
|
||||
(pDev, miPointer.pSpriteScreen, NullCursor, 0, 0);
|
||||
(pDev, pointer->pSpriteScreen, NullCursor, 0, 0);
|
||||
}
|
||||
(*pOldPriv->screenFuncs->CrossScreen) (miPointer.pSpriteScreen, FALSE);
|
||||
(*pOldPriv->screenFuncs->CrossScreen) (pointer->pSpriteScreen, FALSE);
|
||||
}
|
||||
(*pScreenPriv->screenFuncs->CrossScreen) (pScreen, TRUE);
|
||||
(*pScreenPriv->spriteFuncs->SetCursor)
|
||||
(pDev, pScreen, miPointer.pCursor, x, y);
|
||||
miPointer.devx = x;
|
||||
miPointer.devy = y;
|
||||
miPointer.pSpriteCursor = miPointer.pCursor;
|
||||
miPointer.pSpriteScreen = pScreen;
|
||||
(pDev, pScreen, pointer->pCursor, x, y);
|
||||
pointer->devx = x;
|
||||
pointer->devy = y;
|
||||
pointer->pSpriteCursor = pointer->pCursor;
|
||||
pointer->pSpriteScreen = pScreen;
|
||||
}
|
||||
/*
|
||||
* if the cursor has changed, display the new one
|
||||
*/
|
||||
else if (miPointer.pCursor != miPointer.pSpriteCursor)
|
||||
else if (pointer->pCursor != pointer->pSpriteCursor)
|
||||
{
|
||||
pCursor = miPointer.pCursor;
|
||||
pCursor = pointer->pCursor;
|
||||
if (pCursor->bits->emptyMask && !pScreenPriv->showTransparent)
|
||||
pCursor = NullCursor;
|
||||
(*pScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, pCursor, x, y);
|
||||
|
||||
miPointer.devx = x;
|
||||
miPointer.devy = y;
|
||||
miPointer.pSpriteCursor = miPointer.pCursor;
|
||||
pointer->devx = x;
|
||||
pointer->devy = y;
|
||||
pointer->pSpriteCursor = pointer->pCursor;
|
||||
}
|
||||
else if (x != devx || y != devy)
|
||||
{
|
||||
miPointer.devx = x;
|
||||
miPointer.devy = y;
|
||||
if(!miPointer.pCursor->bits->emptyMask)
|
||||
pointer->devx = x;
|
||||
pointer->devy = y;
|
||||
if(!pointer->pCursor->bits->emptyMask)
|
||||
(*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
|
||||
}
|
||||
}
|
||||
|
@ -421,8 +463,17 @@ miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y)
|
|||
pScreenPriv = GetScreenPrivate (pScreen);
|
||||
(*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, FALSE);
|
||||
NewCurrentScreen (pScreen, x, y);
|
||||
miPointer.limits.x2 = pScreen->width;
|
||||
miPointer.limits.y2 = pScreen->height;
|
||||
#ifdef MPX
|
||||
if (IsMPDev(pDev))
|
||||
{
|
||||
miMPPointers[pDev->id].limits.x2 = pScreen->width;
|
||||
miMPPointers[pDev->id].limits.y2 = pScreen->height;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
miPointer.limits.x2 = pScreen->width;
|
||||
miPointer.limits.y2 = pScreen->height;
|
||||
}
|
||||
}
|
||||
|
||||
_X_EXPORT ScreenPtr
|
||||
|
@ -434,6 +485,10 @@ miPointerCurrentScreen ()
|
|||
_X_EXPORT ScreenPtr
|
||||
miPointerGetScreen(DeviceIntPtr pDev)
|
||||
{
|
||||
#ifdef MPX
|
||||
if (IsMPDev(pDev))
|
||||
return miMPPointers[pDev->id].pScreen;
|
||||
#endif
|
||||
return miPointer.pScreen;
|
||||
}
|
||||
|
||||
|
@ -453,7 +508,15 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y, unsigned long time)
|
|||
ScreenPtr pScreen;
|
||||
ScreenPtr newScreen;
|
||||
|
||||
pScreen = miPointer.pScreen;
|
||||
miPointerPtr pointer;
|
||||
#ifdef MPX
|
||||
if (IsMPDev(pDev))
|
||||
pointer = &(miMPPointers[pDev->id]);
|
||||
else
|
||||
#endif
|
||||
pointer = &miPointer;
|
||||
|
||||
pScreen = pointer->pScreen;
|
||||
if (!pScreen)
|
||||
return; /* called before ready */
|
||||
|
||||
|
@ -468,7 +531,7 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y, unsigned long time)
|
|||
if (*x < 0 || *x >= pScreen->width || *y < 0 || *y >= pScreen->height)
|
||||
{
|
||||
pScreenPriv = GetScreenPrivate (pScreen);
|
||||
if (!miPointer.confined)
|
||||
if (!pointer->confined)
|
||||
{
|
||||
newScreen = pScreen;
|
||||
(*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, x, y);
|
||||
|
@ -478,22 +541,22 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y, unsigned long time)
|
|||
(*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, FALSE);
|
||||
pScreenPriv = GetScreenPrivate (pScreen);
|
||||
/* Smash the confine to the new screen */
|
||||
miPointer.limits.x2 = pScreen->width;
|
||||
miPointer.limits.y2 = pScreen->height;
|
||||
pointer->limits.x2 = pScreen->width;
|
||||
pointer->limits.y2 = pScreen->height;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Constrain the sprite to the current limits. */
|
||||
if (*x < miPointer.limits.x1)
|
||||
*x = miPointer.limits.x1;
|
||||
if (*x >= miPointer.limits.x2)
|
||||
*x = miPointer.limits.x2 - 1;
|
||||
if (*y < miPointer.limits.y1)
|
||||
*y = miPointer.limits.y1;
|
||||
if (*y >= miPointer.limits.y2)
|
||||
*y = miPointer.limits.y2 - 1;
|
||||
if (*x < pointer->limits.x1)
|
||||
*x = pointer->limits.x1;
|
||||
if (*x >= pointer->limits.x2)
|
||||
*x = pointer->limits.x2 - 1;
|
||||
if (*y < pointer->limits.y1)
|
||||
*y = pointer->limits.y1;
|
||||
if (*y >= pointer->limits.y2)
|
||||
*y = pointer->limits.y2 - 1;
|
||||
|
||||
if (miPointer.x == *x && miPointer.y == *y && miPointer.pScreen == pScreen)
|
||||
if (pointer->x == *x && pointer->y == *y && pointer->pScreen == pScreen)
|
||||
return;
|
||||
|
||||
miPointerMoved(pDev, pScreen, *x, *y, time);
|
||||
|
@ -508,8 +571,18 @@ miPointerPosition (int *x, int *y)
|
|||
_X_EXPORT void
|
||||
miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
|
||||
{
|
||||
*x = miPointer.x;
|
||||
*y = miPointer.y;
|
||||
#ifdef MPX
|
||||
if (IsMPDev(pDev))
|
||||
{
|
||||
*x = miMPPointers[pDev->id].x;
|
||||
*y = miMPPointers[pDev->id].y;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
*x = miPointer.x;
|
||||
*y = miPointer.y;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -523,18 +596,30 @@ void
|
|||
miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
|
||||
unsigned long time)
|
||||
{
|
||||
miPointerPtr pointer;
|
||||
SetupScreen(pScreen);
|
||||
|
||||
if (pDev && (pDev->coreEvents || pDev == inputInfo.pointer) &&
|
||||
#ifdef MPX
|
||||
if (IsMPDev(pDev))
|
||||
pointer = &miMPPointers[pDev->id];
|
||||
else
|
||||
#endif
|
||||
pointer = &miPointer;
|
||||
|
||||
if (pDev && (pDev->coreEvents || pDev == inputInfo.pointer
|
||||
#ifdef MPX
|
||||
|| pDev->isMPDev
|
||||
#endif
|
||||
) &&
|
||||
!pScreenPriv->waitForUpdate && pScreen == miPointer.pSpriteScreen)
|
||||
{
|
||||
miPointer.devx = x;
|
||||
miPointer.devy = y;
|
||||
if(!miPointer.pCursor->bits->emptyMask)
|
||||
pointer->devx = x;
|
||||
pointer->devy = y;
|
||||
if(!pointer->pCursor->bits->emptyMask)
|
||||
(*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
|
||||
}
|
||||
|
||||
miPointer.x = x;
|
||||
miPointer.y = y;
|
||||
miPointer.pScreen = pScreen;
|
||||
pointer->x = x;
|
||||
pointer->y = y;
|
||||
pointer->pScreen = pScreen;
|
||||
}
|
||||
|
|
|
@ -187,4 +187,9 @@ extern void miPointerMoved(
|
|||
|
||||
extern int miPointerScreenIndex;
|
||||
|
||||
#ifdef MPX
|
||||
_X_EXPORT Bool IsMPDev(DeviceIntPtr pDev);
|
||||
#endif;
|
||||
|
||||
|
||||
#endif /* MIPOINTER_H */
|
||||
|
|
|
@ -65,6 +65,10 @@ in this Software without prior written authorization from The Open Group.
|
|||
#endif
|
||||
# include "damage.h"
|
||||
|
||||
#ifdef MPX
|
||||
# include "inputstr.h" /* for MAX_DEVICES */
|
||||
#endif
|
||||
|
||||
#define SPRITE_DEBUG_ENABLE 0
|
||||
#if SPRITE_DEBUG_ENABLE
|
||||
#define SPRITE_DEBUG(x) ErrorF x
|
||||
|
@ -165,6 +169,9 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
|
|||
miSpriteCursorFuncPtr cursorFuncs;
|
||||
miPointerScreenFuncPtr screenFuncs;
|
||||
{
|
||||
#ifdef MPX
|
||||
int mpCursorIdx = 0;
|
||||
#endif
|
||||
miSpriteScreenPtr pScreenPriv;
|
||||
VisualPtr pVisual;
|
||||
|
||||
|
@ -247,6 +254,24 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
|
|||
|
||||
pScreen->BlockHandler = miSpriteBlockHandler;
|
||||
|
||||
#ifdef MPX
|
||||
/* alloc and zero memory for all MPX cursors */
|
||||
pScreenPriv->mpCursors = (miCursorInfoPtr)xalloc(MAX_DEVICES * sizeof(miCursorInfoRec));
|
||||
while (mpCursorIdx < MAX_DEVICES)
|
||||
{
|
||||
miCursorInfoPtr cursor = &(pScreenPriv->mpCursors[mpCursorIdx]);
|
||||
|
||||
cursor->pCursor = NULL;
|
||||
cursor->x = 0;
|
||||
cursor->y = 0;
|
||||
cursor->isUp = FALSE;
|
||||
cursor->shouldBeUp = FALSE;
|
||||
cursor->pCacheWin = NullWindow;
|
||||
|
||||
mpCursorIdx++;
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -750,9 +775,15 @@ miSpriteMoveCursor (pDev, pScreen, x, y)
|
|||
int x, y;
|
||||
{
|
||||
miSpriteScreenPtr pScreenPriv;
|
||||
CursorPtr pCursor;
|
||||
|
||||
pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
|
||||
miSpriteSetCursor (pDev, pScreen, pScreenPriv->pCursor, x, y);
|
||||
pCursor = pScreenPriv->pCursor;
|
||||
#ifdef MPX
|
||||
if (IsMPDev(pDev))
|
||||
pCursor = pScreenPriv->mpCursors[pDev->id].pCursor;
|
||||
#endif
|
||||
miSpriteSetCursor (pDev, pScreen, pCursor, x, y);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -43,6 +43,18 @@ in this Software without prior written authorization from The Open Group.
|
|||
#endif
|
||||
# include "damage.h"
|
||||
|
||||
#ifdef MPX
|
||||
typedef struct {
|
||||
CursorPtr pCursor;
|
||||
int x; /* cursor hotspot */
|
||||
int y;
|
||||
BoxRec saved; /* saved area from the screen */
|
||||
Bool isUp; /* cursor in frame buffer */
|
||||
Bool shouldBeUp; /* cursor should be displayed */
|
||||
WindowPtr pCacheWin; /* window the cursor last seen in */
|
||||
} miCursorInfoRec, *miCursorInfoPtr;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* per screen information
|
||||
*/
|
||||
|
@ -82,6 +94,9 @@ typedef struct {
|
|||
VisualPtr pVisual;
|
||||
miSpriteCursorFuncPtr funcs;
|
||||
DamagePtr pDamage; /* damage tracking structure */
|
||||
#ifdef MPX
|
||||
miCursorInfoPtr mpCursors; /* all cursor's info */
|
||||
#endif
|
||||
} miSpriteScreenRec, *miSpriteScreenPtr;
|
||||
|
||||
#define SOURCE_COLOR 0
|
||||
|
|
Loading…
Reference in New Issue
Block a user