mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-05 14:38:09 +02:00
Add new cursor code and track changes to glyphs.
Cursors are now completely handled by backend servers.
This commit is contained in:
parent
f6328963c6
commit
700d5bf74e
7 changed files with 236 additions and 332 deletions
|
|
@ -111,13 +111,13 @@
|
|||
#define DMXDBG7(f,a,b,c,d,e,g,h)
|
||||
#endif
|
||||
|
||||
static int dmxCursorDoMultiCursors = 1;
|
||||
|
||||
/** Turn off support for displaying multiple cursors on overlapped
|
||||
back-end displays. See #dmxCursorDoMultiCursors. */
|
||||
void dmxCursorNoMulti(void)
|
||||
/** Initialize the private area for the cursor functions. */
|
||||
Bool dmxInitCursor(ScreenPtr pScreen)
|
||||
{
|
||||
dmxCursorDoMultiCursors = 0;
|
||||
if (!dixRequestPrivate(pScreen, sizeof(dmxCursorPrivRec)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool dmxCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
|
||||
|
|
@ -180,25 +180,28 @@ static void dmxCrossScreen(ScreenPtr pScreen, Bool entering)
|
|||
|
||||
static void dmxWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
|
||||
{
|
||||
DMXDBG3("dmxWarpCursor(%d,%d,%d)\n", pScreen->myNum, x, y);
|
||||
#if 11 /*BP*/
|
||||
/* This call is depracated. Replace with???? */
|
||||
miPointerWarpCursor(pDev, pScreen, x, y);
|
||||
#else
|
||||
pScreen->SetCursorPosition(pDev, pScreen, x, y, FALSE);
|
||||
#endif
|
||||
int i;
|
||||
|
||||
for (i = 0; i < dmxNumScreens; i++)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[i];
|
||||
|
||||
if (!dmxScreen->beDisplay)
|
||||
continue;
|
||||
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XWarpPointer (dmxScreen->beDisplay, None, dmxScreen->scrnWin,
|
||||
0, 0, 0, 0, x, y);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
}
|
||||
}
|
||||
|
||||
miPointerScreenFuncRec dmxPointerCursorFuncs =
|
||||
{
|
||||
miPointerScreenFuncRec dmxPointerCursorFuncs = {
|
||||
dmxCursorOffScreen,
|
||||
dmxCrossScreen,
|
||||
dmxWarpCursor,
|
||||
dmxeqEnqueue, /*XXX incompatible type/function! */
|
||||
dmxeqSwitchScreen
|
||||
dmxWarpCursor
|
||||
};
|
||||
|
||||
|
||||
/** Create a list of screens that we'll manipulate. */
|
||||
static int *dmxSLCreate(void)
|
||||
{
|
||||
|
|
@ -406,7 +409,7 @@ void dmxInitOrigins(void)
|
|||
|
||||
/** Returns non-zero if the global \a x, \a y coordinate is on the
|
||||
* screen window of the \a dmxScreen. */
|
||||
int dmxOnScreen(int x, int y, DMXScreenInfo *dmxScreen)
|
||||
static int dmxOnScreen(int x, int y, DMXScreenInfo *dmxScreen)
|
||||
{
|
||||
#if DMX_CURSOR_DEBUG > 1
|
||||
dmxLog(dmxDebug,
|
||||
|
|
@ -595,10 +598,39 @@ void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor)
|
|||
unsigned long m;
|
||||
int i;
|
||||
|
||||
if (!pCursorPriv)
|
||||
if (pCursorPriv->cursor)
|
||||
return;
|
||||
|
||||
pCursorPriv->cursor = None;
|
||||
if (IsAnimCur (pCursor))
|
||||
{
|
||||
AnimCurPtr ac = GetAnimCur (pCursor);
|
||||
XAnimCursor *cursors;
|
||||
int i;
|
||||
|
||||
cursors = xalloc (sizeof (*cursors) * ac->nelt);
|
||||
if (!cursors)
|
||||
return;
|
||||
|
||||
for (i = 0; i < ac->nelt; i++)
|
||||
{
|
||||
dmxCursorPrivPtr pEltPriv = DMX_GET_CURSOR_PRIV (ac->elts[i].pCursor,
|
||||
pScreen);
|
||||
|
||||
dmxBECreateCursor (pScreen, ac->elts[i].pCursor);
|
||||
|
||||
cursors[i].cursor = pEltPriv->cursor;
|
||||
cursors[i].delay = ac->elts[i].delay;
|
||||
}
|
||||
|
||||
pCursorPriv->cursor = XRenderCreateAnimCursor (dmxScreen->beDisplay,
|
||||
ac->nelt,
|
||||
cursors);
|
||||
|
||||
xfree (cursors);
|
||||
|
||||
if (pCursorPriv->cursor)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ARGB_CURSOR
|
||||
if (pCursor->bits->argb)
|
||||
|
|
@ -676,8 +708,6 @@ void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor)
|
|||
XFreeGC(dmxScreen->beDisplay, gc);
|
||||
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
|
||||
dmxSync(dmxScreen, FALSE);
|
||||
}
|
||||
|
||||
static Bool _dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
|
||||
|
|
@ -687,17 +717,12 @@ static Bool _dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
|
|||
|
||||
DMXDBG2("_dmxRealizeCursor(%d,%p)\n", pScreen->myNum, pCursor);
|
||||
|
||||
DMX_SET_CURSOR_PRIV(pCursor, pScreen, xalloc(sizeof(*pCursorPriv)));
|
||||
if (!DMX_GET_CURSOR_PRIV(pCursor, pScreen))
|
||||
return FALSE;
|
||||
|
||||
pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
|
||||
pCursorPriv->cursor = (Cursor)0;
|
||||
|
||||
if (!dmxScreen->beDisplay)
|
||||
return TRUE;
|
||||
if (dmxScreen->beDisplay)
|
||||
dmxBECreateCursor(pScreen, pCursor);
|
||||
|
||||
dmxBECreateCursor(pScreen, pCursor);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -707,298 +732,74 @@ Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor)
|
|||
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
||||
dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
|
||||
|
||||
if (pCursorPriv) {
|
||||
if (pCursorPriv->cursor)
|
||||
{
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XFreeCursor(dmxScreen->beDisplay, pCursorPriv->cursor);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
pCursorPriv->cursor = (Cursor) 0;
|
||||
|
||||
if (IsAnimCur (pCursor))
|
||||
{
|
||||
AnimCurPtr ac = GetAnimCur (pCursor);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ac->nelt; i++)
|
||||
dmxBEFreeCursor (pScreen, ac->elts[i].pCursor);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static Bool _dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
|
||||
static Bool
|
||||
_dmxUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
||||
|
||||
DMXDBG2("_dmxUnrealizeCursor(%d,%p)\n",
|
||||
pScreen->myNum, pCursor);
|
||||
|
||||
if (dmxScreen->beDisplay) {
|
||||
if (dmxBEFreeCursor(pScreen, pCursor))
|
||||
xfree(DMX_GET_CURSOR_PRIV(pCursor, pScreen));
|
||||
}
|
||||
DMX_SET_CURSOR_PRIV(pCursor, pScreen, NULL);
|
||||
dmxBEFreeCursor(pScreen, pCursor);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void _dmxMoveCursor(ScreenPtr pScreen, int x, int y)
|
||||
static Bool
|
||||
dmxRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
||||
int newX = x + dmxScreen->rootX;
|
||||
int newY = y + dmxScreen->rootY;
|
||||
if (pDev == inputInfo.pointer)
|
||||
return _dmxRealizeCursor (pScreen, pCursor);
|
||||
|
||||
if (newX < 0) newX = 0;
|
||||
if (newY < 0) newY = 0;
|
||||
|
||||
DMXDBG5("_dmxMoveCursor(%d,%d,%d) -> %d,%d\n",
|
||||
pScreen->myNum, x, y, newX, newY);
|
||||
if (dmxScreen->beDisplay) {
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XWarpPointer(dmxScreen->beDisplay, None, dmxScreen->scrnWin,
|
||||
0, 0, 0, 0, newX, newY);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
dmxSync(dmxScreen, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void _dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
||||
|
||||
DMXDBG4("_dmxSetCursor(%d,%p,%d,%d)\n", pScreen->myNum, pCursor, x, y);
|
||||
|
||||
if (pCursor) {
|
||||
dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
|
||||
if (pCursorPriv && dmxScreen->curCursor != pCursorPriv->cursor) {
|
||||
if (dmxScreen->beDisplay)
|
||||
{
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
|
||||
pCursorPriv->cursor);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
}
|
||||
dmxScreen->cursor = pCursor;
|
||||
dmxScreen->curCursor = pCursorPriv->cursor;
|
||||
dmxScreen->cursorVisible = 1;
|
||||
}
|
||||
_dmxMoveCursor(pScreen, x, y);
|
||||
} else {
|
||||
if (dmxScreen->beDisplay)
|
||||
{
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
|
||||
dmxScreen->noCursor);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
}
|
||||
dmxScreen->cursor = NULL;
|
||||
dmxScreen->curCursor = (Cursor)0;
|
||||
dmxScreen->cursorVisible = 0;
|
||||
}
|
||||
if (dmxScreen->beDisplay) dmxSync(dmxScreen, TRUE);
|
||||
}
|
||||
|
||||
static Bool dmxRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
||||
{
|
||||
DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
|
||||
DMXScreenInfo *pt;
|
||||
|
||||
if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared)
|
||||
return _dmxRealizeCursor(pScreen, pCursor);
|
||||
|
||||
for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
|
||||
if (pt->cursorNotShared)
|
||||
continue;
|
||||
_dmxRealizeCursor(screenInfo.screens[pt->index], pCursor);
|
||||
if (pt == start)
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool dmxUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
||||
static Bool
|
||||
dmxUnrealizeCursor (DeviceIntPtr pDev,
|
||||
ScreenPtr pScreen,
|
||||
CursorPtr pCursor)
|
||||
{
|
||||
DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
|
||||
DMXScreenInfo *pt;
|
||||
if (pDev == inputInfo.pointer)
|
||||
return _dmxUnrealizeCursor (pScreen, pCursor);
|
||||
|
||||
if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared)
|
||||
return _dmxUnrealizeCursor(pScreen, pCursor);
|
||||
|
||||
for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
|
||||
if (pt->cursorNotShared)
|
||||
continue;
|
||||
_dmxUnrealizeCursor(screenInfo.screens[pt->index], pCursor);
|
||||
if (pt == start)
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static CursorPtr dmxFindCursor(DMXScreenInfo *start)
|
||||
static void
|
||||
dmxMoveCursor (DeviceIntPtr pDev,
|
||||
ScreenPtr pScreen,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
DMXScreenInfo *pt;
|
||||
|
||||
if (!start || !start->over)
|
||||
return GetSpriteCursor(inputInfo.pointer);
|
||||
for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
|
||||
if (pt->cursor)
|
||||
return pt->cursor;
|
||||
if (pt == start)
|
||||
break;
|
||||
}
|
||||
return GetSpriteCursor(inputInfo.pointer);
|
||||
}
|
||||
|
||||
/** Move the cursor to coordinates (\a x, \a y)on \a pScreen. This
|
||||
* function is usually called via #dmxPointerSpriteFuncs, except during
|
||||
* reconfiguration when the cursor is repositioned to force an update on
|
||||
* newley overlapping screens and on screens that no longer overlap.
|
||||
*
|
||||
* The coords (x,y) are in global coord space. We'll loop over the
|
||||
* back-end screens and see if they contain the global coord. If so, call
|
||||
* _dmxMoveCursor() (XWarpPointer) to position the pointer on that screen.
|
||||
*/
|
||||
void dmxMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
|
||||
static void
|
||||
dmxSetCursor (DeviceIntPtr pDev,
|
||||
ScreenPtr pScreen,
|
||||
CursorPtr pCursor,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
|
||||
DMXScreenInfo *pt;
|
||||
|
||||
DMXDBG3("dmxMoveCursor(%d,%d,%d)\n", pScreen->myNum, x, y);
|
||||
|
||||
if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
|
||||
_dmxMoveCursor(pScreen, x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
|
||||
if (pt->cursorNotShared)
|
||||
continue;
|
||||
if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
|
||||
if (/* pt != start && */ !pt->cursorVisible) {
|
||||
if (!pt->cursor) {
|
||||
/* This only happens during
|
||||
* reconfiguration when a new overlap
|
||||
* occurs. */
|
||||
CursorPtr pCursor;
|
||||
|
||||
if ((pCursor = dmxFindCursor(start)))
|
||||
_dmxRealizeCursor(screenInfo.screens[pt->index],
|
||||
pt->cursor = pCursor);
|
||||
|
||||
}
|
||||
_dmxSetCursor(screenInfo.screens[pt->index],
|
||||
pt->cursor,
|
||||
x + start->rootXOrigin - pt->rootXOrigin,
|
||||
y + start->rootYOrigin - pt->rootYOrigin);
|
||||
}
|
||||
_dmxMoveCursor(screenInfo.screens[pt->index],
|
||||
x + start->rootXOrigin - pt->rootXOrigin,
|
||||
y + start->rootYOrigin - pt->rootYOrigin);
|
||||
} else if (/* pt != start && */ pt->cursorVisible) {
|
||||
_dmxSetCursor(screenInfo.screens[pt->index],
|
||||
NULL,
|
||||
x + start->rootXOrigin - pt->rootXOrigin,
|
||||
y + start->rootYOrigin - pt->rootYOrigin);
|
||||
}
|
||||
if (pt == start)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void dmxSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
|
||||
{
|
||||
DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
|
||||
DMXScreenInfo *pt;
|
||||
int GX, GY, gx, gy;
|
||||
|
||||
DMXDBG5("dmxSetCursor(%d %p, %p,%d,%d)\n",
|
||||
pScreen->myNum, start, pCursor, x, y);
|
||||
|
||||
/* We do this check here because of two cases:
|
||||
*
|
||||
* 1) if a client calls XWarpPointer()
|
||||
* and Xinerama is not running, we can
|
||||
* have mi's notion of the pointer
|
||||
* position out of phase with DMX's
|
||||
* notion.
|
||||
*
|
||||
* 2) if a down button is held while the
|
||||
* cursor moves outside the root window,
|
||||
* mi's notion of the pointer position
|
||||
* is out of phase with DMX's notion and
|
||||
* the cursor can remain visible when it
|
||||
* shouldn't be. */
|
||||
|
||||
dmxGetGlobalPosition(&GX, &GY);
|
||||
gx = start->rootXOrigin + x;
|
||||
gy = start->rootYOrigin + y;
|
||||
if (x && y && (GX != gx || GY != gy))
|
||||
dmxCoreMotion(NULL, gx, gy, 0, DMX_NO_BLOCK);
|
||||
|
||||
if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
|
||||
_dmxSetCursor(pScreen, pCursor, x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
|
||||
if (pt->cursorNotShared)
|
||||
continue;
|
||||
if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
|
||||
_dmxSetCursor(screenInfo.screens[pt->index], pCursor,
|
||||
x + start->rootXOrigin - pt->rootXOrigin,
|
||||
y + start->rootYOrigin - pt->rootYOrigin);
|
||||
} else {
|
||||
_dmxSetCursor(screenInfo.screens[pt->index], NULL,
|
||||
x + start->rootXOrigin - pt->rootXOrigin,
|
||||
y + start->rootYOrigin - pt->rootYOrigin);
|
||||
}
|
||||
if (pt == start)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** This routine is used by the backend input routines to hide the
|
||||
* cursor on a screen that is being used for relative input. \see
|
||||
* dmxbackend.c */
|
||||
void dmxHideCursor(DMXScreenInfo *dmxScreen)
|
||||
{
|
||||
int x, y;
|
||||
ScreenPtr pScreen = screenInfo.screens[dmxScreen->index];
|
||||
|
||||
dmxGetGlobalPosition(&x, &y);
|
||||
_dmxSetCursor(pScreen, NULL, x, y);
|
||||
}
|
||||
|
||||
/** This routine is called during reconfiguration to make sure the
|
||||
* cursor is visible. */
|
||||
void dmxCheckCursor(void)
|
||||
{
|
||||
int i;
|
||||
int x, y;
|
||||
ScreenPtr pScreen;
|
||||
DMXScreenInfo *firstScreen;
|
||||
|
||||
dmxGetGlobalPosition(&x, &y);
|
||||
firstScreen = dmxFindFirstScreen(x, y);
|
||||
|
||||
DMXDBG2("dmxCheckCursor %d %d\n", x, y);
|
||||
for (i = 0; i < dmxNumScreens; i++) {
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[i];
|
||||
pScreen = screenInfo.screens[dmxScreen->index];
|
||||
|
||||
if (!dmxOnScreen(x, y, dmxScreen)) {
|
||||
if (firstScreen && i == miPointerGetScreen(inputInfo.pointer)->myNum)
|
||||
miPointerSetScreen(inputInfo.pointer, firstScreen->index, x, y);
|
||||
_dmxSetCursor(pScreen, NULL,
|
||||
x - dmxScreen->rootXOrigin,
|
||||
y - dmxScreen->rootYOrigin);
|
||||
} else {
|
||||
if (!dmxScreen->cursor) {
|
||||
CursorPtr pCursor;
|
||||
|
||||
if ((pCursor = dmxFindCursor(dmxScreen))) {
|
||||
_dmxRealizeCursor(pScreen, dmxScreen->cursor = pCursor);
|
||||
}
|
||||
}
|
||||
_dmxSetCursor(pScreen, dmxScreen->cursor,
|
||||
x - dmxScreen->rootXOrigin,
|
||||
y - dmxScreen->rootYOrigin);
|
||||
}
|
||||
}
|
||||
DMXDBG2(" leave dmxCheckCursor %d %d\n", x, y);
|
||||
}
|
||||
|
||||
static Bool dmxDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
|
||||
|
|
|
|||
|
|
@ -52,14 +52,10 @@ extern miPointerScreenFuncRec dmxPointerCursorFuncs;
|
|||
/** Sprite functions for mi layer. \see dmxcursor.c \see dmxscrinit.c */
|
||||
extern miPointerSpriteFuncRec dmxPointerSpriteFuncs;
|
||||
|
||||
extern Bool dmxInitCursor(ScreenPtr pScreen);
|
||||
extern void dmxReInitOrigins(void);
|
||||
extern void dmxInitOrigins(void);
|
||||
extern void dmxInitOverlap(void);
|
||||
extern void dmxCursorNoMulti(void);
|
||||
extern void dmxMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
|
||||
extern void dmxCheckCursor(void);
|
||||
extern int dmxOnScreen(int x, int y, DMXScreenInfo *dmxScreen);
|
||||
extern void dmxHideCursor(DMXScreenInfo *dmxScreen);
|
||||
|
||||
extern void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor);
|
||||
extern Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor);
|
||||
|
|
@ -67,7 +63,4 @@ extern Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor);
|
|||
#define DMX_GET_CURSOR_PRIV(_pCursor, _pScreen) ((dmxCursorPrivPtr) \
|
||||
dixLookupPrivate(&(_pCursor)->devPrivates, CursorScreenKey(_pScreen)))
|
||||
|
||||
#define DMX_SET_CURSOR_PRIV(_pCursor, _pScreen, v) \
|
||||
dixSetPrivate(&(_pCursor)->devPrivates, CursorScreenKey(_pScreen), v)
|
||||
|
||||
#endif /* DMXCURSOR_H */
|
||||
|
|
|
|||
|
|
@ -306,8 +306,6 @@ static void dmxAdjustCursorBoundaries(void)
|
|||
if (!dmxInput->detached) dmxInputReInit(dmxInput);
|
||||
}
|
||||
|
||||
dmxCheckCursor();
|
||||
|
||||
for (i = 0; i < dmxNumInputs; i++) {
|
||||
DMXInputInfo *dmxInput = &dmxInputs[i];
|
||||
if (!dmxInput->detached) dmxInputLateReInit(dmxInput);
|
||||
|
|
@ -1100,7 +1098,11 @@ static void dmxBECreateResources(pointer value, XID id, RESTYPE type,
|
|||
} else if ((type & TypeMask) == (RT_FONT & TypeMask)) {
|
||||
(void)dmxBELoadFont(pScreen, (FontPtr)value);
|
||||
} else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) {
|
||||
AnimForEachCursorElt (pScreen, (CursorPtr) value, dmxBECreateCursor);
|
||||
dmxBECreateCursor (pScreen, (CursorPtr) value);
|
||||
} else if ((type & TypeMask) == (RT_PASSIVEGRAB & TypeMask)) {
|
||||
GrabPtr grab = value;
|
||||
if (grab->cursor)
|
||||
dmxBECreateCursor (pScreen, grab->cursor);
|
||||
} else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) {
|
||||
ColormapPtr pCmap = value;
|
||||
if (pCmap->pScreen->myNum == scrnNum)
|
||||
|
|
@ -1142,9 +1144,15 @@ static void dmxBECreateWindowTree(int idx)
|
|||
dmxBERestorePixmap(pRoot->background.pixmap);
|
||||
}
|
||||
|
||||
dmxBECreateCursor (screenInfo.screens[idx], pRoot->optional->cursor);
|
||||
|
||||
/* Create root window first */
|
||||
dmxScreen->rootWin = pWinPriv->window = dmxCreateRootWindow(pRoot);
|
||||
|
||||
#ifdef RENDER
|
||||
if (pWinPriv->hasPict) dmxCreatePictureList (pRoot);
|
||||
#endif
|
||||
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
dmxSetIgnore (dmxScreen, NextRequest (dmxScreen->beDisplay));
|
||||
XMapWindow(dmxScreen->beDisplay, dmxScreen->rootWin);
|
||||
|
|
@ -1166,6 +1174,10 @@ static void dmxBECreateWindowTree(int idx)
|
|||
dmxBERestorePixmap(pWin->background.pixmap);
|
||||
}
|
||||
|
||||
if (wUseDefault(pWin, cursor, 0))
|
||||
dmxBECreateCursor (screenInfo.screens[idx],
|
||||
pWin->optional->cursor);
|
||||
|
||||
/* Reset the window attributes */
|
||||
dmxGetDefaultWindowAttributes(pWin,
|
||||
&pWinPriv->cmap,
|
||||
|
|
@ -1409,7 +1421,7 @@ static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
|
|||
char *pos;
|
||||
int beret;
|
||||
int len_images = 0;
|
||||
int i;
|
||||
int i, j, size;
|
||||
int ctr;
|
||||
|
||||
if (glyphPriv->glyphSets[scrnNum]) {
|
||||
|
|
@ -1433,9 +1445,18 @@ static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
|
|||
GlyphPtr gl = gr->glyph;
|
||||
|
||||
if (!gl || gl == DeletedGlyph) continue;
|
||||
len_images += gl->size - sizeof(gl->info);
|
||||
|
||||
size = gl->info.height * PixmapBytePad (gl->info.width,
|
||||
glyphSet->format->depth);
|
||||
if (size & 3)
|
||||
size += 4 - (size & 3);
|
||||
|
||||
len_images += size;
|
||||
}
|
||||
|
||||
if (!len_images)
|
||||
return;
|
||||
|
||||
/* Now allocate the memory we need */
|
||||
images = xcalloc(len_images, sizeof(char));
|
||||
gids = xalloc(glyphSet->hash.tableEntries*sizeof(Glyph));
|
||||
|
|
@ -1448,6 +1469,7 @@ static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
|
|||
for (i = 0; i < glyphSet->hash.hashSet->size; i++) {
|
||||
GlyphRefPtr gr = &table[i];
|
||||
GlyphPtr gl = gr->glyph;
|
||||
XImage *img = NULL;
|
||||
|
||||
if (!gl || gl == DeletedGlyph) continue;
|
||||
|
||||
|
|
@ -1462,21 +1484,62 @@ static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
|
|||
glyphs[ctr].xOff = gl->info.xOff;
|
||||
glyphs[ctr].yOff = gl->info.yOff;
|
||||
|
||||
/* Copy the images from the DIX's data into the buffer */
|
||||
memcpy(pos, gl+1, gl->size - sizeof(gl->info));
|
||||
pos += gl->size - sizeof(gl->info);
|
||||
for (j = 0; j < dmxNumScreens; j++)
|
||||
{
|
||||
if (j != scrnNum && dmxScreens[j].alive)
|
||||
{
|
||||
PicturePtr pPict = GlyphPicture (gl)[j];
|
||||
PixmapPtr pPixmap = (PixmapPtr) pPict->pDrawable;
|
||||
dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV (pPixmap);
|
||||
|
||||
XLIB_PROLOGUE (&dmxScreens[j]);
|
||||
img = XGetImage (dmxScreens[j].beDisplay,
|
||||
pPixPriv->pixmap,
|
||||
0, 0,
|
||||
pPixmap->drawable.width,
|
||||
pPixmap->drawable.height,
|
||||
-1,
|
||||
ZPixmap);
|
||||
XLIB_EPILOGUE (&dmxScreens[j]);
|
||||
|
||||
if (img)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
size = gl->info.height * PixmapBytePad (gl->info.width,
|
||||
glyphSet->format->depth);
|
||||
if (size & 3)
|
||||
size += 4 - (size & 3);
|
||||
|
||||
if (img)
|
||||
{
|
||||
memcpy (pos, img->data, size);
|
||||
XDestroyImage (img);
|
||||
}
|
||||
else
|
||||
{
|
||||
dmxLog (dmxWarning,
|
||||
"Cannot restore glyph image: %dx%d %d\n",
|
||||
gl->info.width,
|
||||
gl->info.height,
|
||||
glyphSet->format->depth);
|
||||
|
||||
memset (pos, 0xff, size);
|
||||
}
|
||||
|
||||
pos += size;
|
||||
ctr++;
|
||||
}
|
||||
|
||||
|
||||
/* Now restore the glyph data */
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XRenderAddGlyphs(dmxScreen->beDisplay, glyphPriv->glyphSets[scrnNum],
|
||||
gids,glyphs, glyphSet->hash.tableEntries, images,
|
||||
len_images);
|
||||
gids, glyphs, ctr, images, len_images);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
|
||||
/* Clean up */
|
||||
xfree(len_images);
|
||||
xfree(images);
|
||||
xfree(gids);
|
||||
xfree(glyphs);
|
||||
}
|
||||
|
|
@ -1669,6 +1732,10 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
|
|||
/* Create the scratch GCs */
|
||||
dmxBECreateScratchGCs(idx);
|
||||
|
||||
/* Create the scratch pixmap */
|
||||
if (pScreen->pScratchPixmap)
|
||||
dmxBECreatePixmap(pScreen->pScratchPixmap);
|
||||
|
||||
/* Create all resources that don't depend on windows */
|
||||
for (i = currentMaxClients; --i >= 0; )
|
||||
if (clients[i])
|
||||
|
|
@ -1712,7 +1779,7 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
|
|||
#endif
|
||||
|
||||
#ifdef RANDR
|
||||
RRTellChanged (screenInfo.screens[0]);
|
||||
RRGetInfo (screenInfo.screens[0]);
|
||||
#endif
|
||||
|
||||
return 0; /* Success */
|
||||
|
|
@ -1967,8 +2034,7 @@ static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type,
|
|||
} else if ((type & TypeMask) == (RT_FONT & TypeMask)) {
|
||||
dmxBEFreeFont(pScreen, (FontPtr)value);
|
||||
} else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) {
|
||||
AnimForEachCursorElt (pScreen, (CursorPtr) value,
|
||||
(void *) dmxBEFreeCursor);
|
||||
dmxBEFreeCursor (pScreen, (CursorPtr) value);
|
||||
} else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) {
|
||||
ColormapPtr pCmap = value;
|
||||
if (pCmap->pScreen->myNum == scrnNum)
|
||||
|
|
@ -2023,6 +2089,10 @@ static void dmxBEDestroyWindowTree(int idx)
|
|||
/* Destroy the window */
|
||||
dmxBEDestroyWindow(pChild);
|
||||
|
||||
if (wUseDefault(pChild, cursor, 0))
|
||||
dmxBEFreeCursor (screenInfo.screens[idx],
|
||||
pChild->optional->cursor);
|
||||
|
||||
/* Make sure we destroy the window's border and background
|
||||
* pixmaps if they exist */
|
||||
if (!pChild->borderIsPixel) {
|
||||
|
|
@ -2037,6 +2107,9 @@ static void dmxBEDestroyWindowTree(int idx)
|
|||
while (!pChild->nextSib && (pChild != pWin)) {
|
||||
pChild = pChild->parent;
|
||||
dmxBEDestroyWindow(pChild);
|
||||
if (wUseDefault(pChild, cursor, 0))
|
||||
dmxBEFreeCursor (screenInfo.screens[idx],
|
||||
pChild->optional->cursor);
|
||||
if (!pChild->borderIsPixel) {
|
||||
dmxBESavePixmap(pChild->border.pixmap);
|
||||
dmxBEFreePixmap(pChild->border.pixmap);
|
||||
|
|
@ -2131,6 +2204,9 @@ int dmxDetachScreen(int idx)
|
|||
dmxBESavePixmap(screenInfo.screens[idx]->PixmapPerDepth[0]);
|
||||
dmxBEFreePixmap(screenInfo.screens[idx]->PixmapPerDepth[0]);
|
||||
|
||||
if (screenInfo.screens[idx]->pScratchPixmap)
|
||||
dmxBEFreePixmap(screenInfo.screens[idx]->pScratchPixmap);
|
||||
|
||||
/* Free the remaining screen resources and close the screen */
|
||||
dmxBECloseScreen(screenInfo.screens[idx]);
|
||||
|
||||
|
|
@ -2140,7 +2216,7 @@ int dmxDetachScreen(int idx)
|
|||
dmxScreen->name = "";
|
||||
|
||||
#ifdef RANDR
|
||||
RRTellChanged (screenInfo.screens[0]);
|
||||
RRGetInfo (screenInfo.screens[0]);
|
||||
#endif
|
||||
|
||||
dmxDiscardIgnore (dmxScreen, ~0);
|
||||
|
|
|
|||
|
|
@ -1034,9 +1034,6 @@ int ddxProcessArgument(int argc, char *argv[], int i)
|
|||
"since it is now the default\n");
|
||||
dmxShadowFB = FALSE;
|
||||
retval = 1;
|
||||
} else if (!strcmp(argv[i], "-nomulticursor")) {
|
||||
dmxCursorNoMulti();
|
||||
retval = 1;
|
||||
} else if (!strcmp(argv[i], "-shadowfb")) {
|
||||
dmxShadowFB = TRUE;
|
||||
retval = 1;
|
||||
|
|
@ -1150,7 +1147,6 @@ void ddxUseMsg(void)
|
|||
ErrorF("-shadowfb Enable shadow frame buffer\n");
|
||||
ErrorF("-configfile file Read from a configuration file\n");
|
||||
ErrorF("-config config Select a specific configuration\n");
|
||||
ErrorF("-nomulticursor Turn of multiple cursor support\n");
|
||||
ErrorF("-fontpath Sets the default font path\n");
|
||||
ErrorF("-stat inter scrns Print out performance statistics\n");
|
||||
ErrorF("-syncbatch inter Set interval for XSync batching\n");
|
||||
|
|
|
|||
|
|
@ -127,9 +127,6 @@ struct _DMXInputInfo {
|
|||
char *keycodes; /**< XKB keycodes from command line */
|
||||
char *symbols; /**< XKB symbols from command line */
|
||||
char *geometry; /**< XKB geometry from command line */
|
||||
|
||||
CARD8 history[DOWN_LENGTH];
|
||||
int validHistory;
|
||||
};
|
||||
|
||||
extern int dmxNumInputs; /**< Number of #dmxInputs */
|
||||
|
|
|
|||
|
|
@ -1722,6 +1722,7 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
|
|||
if (!dmxInitGC(pScreen)) return FALSE;
|
||||
if (!dmxInitWindow(pScreen)) return FALSE;
|
||||
if (!dmxInitPixmap(pScreen)) return FALSE;
|
||||
if (!dmxInitCursor(pScreen)) return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
#include "dmxinput.h"
|
||||
#include "dmxextension.h"
|
||||
#include "dmxscrinit.h"
|
||||
#include "dmxcursor.h"
|
||||
#ifdef RENDER
|
||||
#include "dmxpict.h"
|
||||
#endif
|
||||
|
|
@ -430,14 +431,11 @@ Bool dmxBEDestroyWindow(WindowPtr pWindow)
|
|||
pWinPriv->beRedirected = FALSE;
|
||||
|
||||
if (pWinPriv->window) {
|
||||
if (dmxScreen->alive)
|
||||
{
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XDestroyWindow(dmxScreen->beDisplay, pWinPriv->window);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
}
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XDestroyWindow(dmxScreen->beDisplay, pWinPriv->window);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
pWinPriv->window = (Window)0;
|
||||
return (dmxScreen->alive);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
@ -615,7 +613,21 @@ static void dmxDoChangeWindowAttributes(WindowPtr pWindow,
|
|||
}
|
||||
|
||||
if (*mask & CWCursor)
|
||||
*mask &= ~CWCursor; /* Handled by the cursor code */
|
||||
{
|
||||
ScreenPtr pScreen = pWindow->drawable.pScreen;
|
||||
|
||||
if (wUseDefault (pWindow, cursor, 0))
|
||||
{
|
||||
dmxCursorPrivPtr pCursorPriv =
|
||||
DMX_GET_CURSOR_PRIV (pWindow->optional->cursor, pScreen);
|
||||
|
||||
attribs->cursor = pCursorPriv->cursor;
|
||||
}
|
||||
else
|
||||
{
|
||||
*mask &= ~CWCursor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Change the window attributes of \a pWindow. */
|
||||
|
|
@ -1068,6 +1080,34 @@ static void dmxDoSetShape(WindowPtr pWindow)
|
|||
XLIB_EPILOGUE (dmxScreen);
|
||||
}
|
||||
|
||||
if (wInputShape (pWindow)) {
|
||||
pBox = REGION_RECTS(wInputShape(pWindow));
|
||||
nRect = nBox = REGION_NUM_RECTS(wInputShape(pWindow));
|
||||
pRectFirst = pRect = xalloc(nRect * sizeof(*pRect));
|
||||
while (nBox--) {
|
||||
pRect->x = pBox->x1;
|
||||
pRect->y = pBox->y1;
|
||||
pRect->width = pBox->x2 - pBox->x1;
|
||||
pRect->height = pBox->y2 - pBox->y1;
|
||||
pBox++;
|
||||
pRect++;
|
||||
}
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window,
|
||||
ShapeInput, 0, 0,
|
||||
pRectFirst, nRect,
|
||||
ShapeSet, YXBanded);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
xfree(pRectFirst);
|
||||
}
|
||||
else
|
||||
{
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XShapeCombineMask (dmxScreen->beDisplay, pWinPriv->window,
|
||||
ShapeInput, 0, 0, None, ShapeSet);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
}
|
||||
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
if (XShapeInputSelected(dmxScreen->beDisplay, pWinPriv->window)) {
|
||||
ErrorF("Input selected for window %x on Screen %d\n",
|
||||
|
|
@ -1093,10 +1133,10 @@ void dmxSetShape(WindowPtr pWindow)
|
|||
/* Handle setting the current shape on the back-end server */
|
||||
dmxDoSetShape(pWindow);
|
||||
dmxSync(dmxScreen, False);
|
||||
} else {
|
||||
pWinPriv->isShaped = TRUE;
|
||||
}
|
||||
|
||||
pWinPriv->isShaped = TRUE;
|
||||
|
||||
DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue