xnest: wrap the xnest cursor sprite funcs around the mi funcs.

Modelled after the xfree86 code. Call miDCInitialize to init the SW rendering
engine, then take the pointers, store it in a xnest-local variable, and put
the xnest-specific sprite funcs in place. In the xnest sprite funcs, call
through to the mi sprite funcs after doing xnest-specific stuff.
This commit is contained in:
Peter Hutterer 2008-06-09 11:23:53 +09:30
parent ea6a02c048
commit e083b5a075
3 changed files with 47 additions and 4 deletions

View File

@ -25,6 +25,7 @@ is" without express or implied warranty.
#include "cursorstr.h" #include "cursorstr.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include "servermd.h" #include "servermd.h"
#include "mipointrst.h"
#include "Xnest.h" #include "Xnest.h"
@ -35,6 +36,8 @@ is" without express or implied warranty.
#include "Keyboard.h" #include "Keyboard.h"
#include "Args.h" #include "Args.h"
xnestCursorFuncRec xnestCursorFuncs = {NULL};
Bool Bool
xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{ {
@ -155,3 +158,26 @@ void
xnestMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) xnestMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{ {
} }
Bool
xnestDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
xnestCursorFuncPtr pScreenPriv;
pScreenPriv = (xnestCursorFuncPtr)
dixLookupPrivate(&pScreen->devPrivates, xnestCursorScreenKey);
pScreenPriv->spriteFuncs->DeviceCursorInitialize(pDev, pScreen);
return TRUE;
}
void
xnestDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{
xnestCursorFuncPtr pScreenPriv;
pScreenPriv = (xnestCursorFuncPtr)
dixLookupPrivate(&pScreen->devPrivates, xnestCursorScreenKey);
pScreenPriv->spriteFuncs->DeviceCursorCleanup(pDev, pScreen);
}

View File

@ -41,9 +41,11 @@ is" without express or implied warranty.
#include "Init.h" #include "Init.h"
#include "mipointer.h" #include "mipointer.h"
#include "Args.h" #include "Args.h"
#include "mipointrst.h"
Window xnestDefaultWindows[MAXSCREENS]; Window xnestDefaultWindows[MAXSCREENS];
Window xnestScreenSaverWindows[MAXSCREENS]; Window xnestScreenSaverWindows[MAXSCREENS];
DevPrivateKey xnestCursorScreenKey = &xnestCursorScreenKey;
ScreenPtr ScreenPtr
xnestScreen(Window window) xnestScreen(Window window)
@ -124,8 +126,8 @@ static miPointerSpriteFuncRec xnestPointerSpriteFuncs =
xnestUnrealizeCursor, xnestUnrealizeCursor,
xnestSetCursor, xnestSetCursor,
xnestMoveCursor, xnestMoveCursor,
NULL, xnestDeviceCursorInitialize,
NULL xnestDeviceCursorCleanup
}; };
Bool Bool
@ -141,6 +143,7 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
XSizeHints sizeHints; XSizeHints sizeHints;
VisualID defaultVisual; VisualID defaultVisual;
int rootDepth; int rootDepth;
miPointerScreenPtr PointPriv;
if (!dixRequestPrivate(xnestWindowPrivateKey, sizeof(xnestPrivWin))) if (!dixRequestPrivate(xnestWindowPrivateKey, sizeof(xnestPrivWin)))
return False; return False;
@ -307,7 +310,11 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
pScreen->blockData = NULL; pScreen->blockData = NULL;
pScreen->wakeupData = NULL; pScreen->wakeupData = NULL;
miDCInitialize (pScreen, &xnestPointerCursorFuncs); miDCInitialize(pScreen, &xnestPointerCursorFuncs); /* init SW rendering */
PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
xnestCursorFuncs.spriteFuncs = PointPriv->spriteFuncs;
dixSetPrivate(&pScreen->devPrivates, xnestCursorScreenKey, &xnestCursorFuncs);
PointPriv->spriteFuncs = &xnestPointerSpriteFuncs;
pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay, pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay,
DefaultScreen(xnestDisplay)) / DefaultScreen(xnestDisplay)) /

View File

@ -15,6 +15,15 @@ is" without express or implied warranty.
#ifndef XNESTCURSOR_H #ifndef XNESTCURSOR_H
#define XNESTCURSOR_H #define XNESTCURSOR_H
#include "mipointrst.h"
typedef struct {
miPointerSpriteFuncPtr spriteFuncs;
} xnestCursorFuncRec, *xnestCursorFuncPtr;
extern DevPrivateKey xnestCursorScreenKey;
extern xnestCursorFuncRec xnestCursorFuncs;
typedef struct { typedef struct {
Cursor cursor; Cursor cursor;
} xnestPrivCursor; } xnestPrivCursor;
@ -44,5 +53,6 @@ void xnestSetCursor (DeviceIntPtr pDev,
void xnestMoveCursor (DeviceIntPtr pDev, void xnestMoveCursor (DeviceIntPtr pDev,
ScreenPtr pScreen, ScreenPtr pScreen,
int x, int y); int x, int y);
Bool xnestDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
void xnestDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
#endif /* XNESTCURSOR_H */ #endif /* XNESTCURSOR_H */