summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-06-09 11:23:53 +0930
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-06-11 17:24:19 +0930
commite083b5a07507d53de0d1d365ef1565346284c997 (patch)
treef205ca6aa8e5bf5db59ad74f4f197c54338260f7
parentea6a02c048e8589e99ee3b459f3612eb3d041558 (diff)
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.
-rw-r--r--hw/xnest/Cursor.c26
-rw-r--r--hw/xnest/Screen.c13
-rw-r--r--hw/xnest/XNCursor.h12
3 files changed, 47 insertions, 4 deletions
diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c
index 3e676d11b..12f47e725 100644
--- a/hw/xnest/Cursor.c
+++ b/hw/xnest/Cursor.c
@@ -25,6 +25,7 @@ is" without express or implied warranty.
#include "cursorstr.h"
#include "scrnintstr.h"
#include "servermd.h"
+#include "mipointrst.h"
#include "Xnest.h"
@@ -35,6 +36,8 @@ is" without express or implied warranty.
#include "Keyboard.h"
#include "Args.h"
+xnestCursorFuncRec xnestCursorFuncs = {NULL};
+
Bool
xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
@@ -155,3 +158,26 @@ void
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);
+}
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 9d157a3c6..1c129e703 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -41,9 +41,11 @@ is" without express or implied warranty.
#include "Init.h"
#include "mipointer.h"
#include "Args.h"
+#include "mipointrst.h"
Window xnestDefaultWindows[MAXSCREENS];
Window xnestScreenSaverWindows[MAXSCREENS];
+DevPrivateKey xnestCursorScreenKey = &xnestCursorScreenKey;
ScreenPtr
xnestScreen(Window window)
@@ -124,8 +126,8 @@ static miPointerSpriteFuncRec xnestPointerSpriteFuncs =
xnestUnrealizeCursor,
xnestSetCursor,
xnestMoveCursor,
- NULL,
- NULL
+ xnestDeviceCursorInitialize,
+ xnestDeviceCursorCleanup
};
Bool
@@ -141,6 +143,7 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
XSizeHints sizeHints;
VisualID defaultVisual;
int rootDepth;
+ miPointerScreenPtr PointPriv;
if (!dixRequestPrivate(xnestWindowPrivateKey, sizeof(xnestPrivWin)))
return False;
@@ -307,7 +310,11 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
pScreen->blockData = 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,
DefaultScreen(xnestDisplay)) /
diff --git a/hw/xnest/XNCursor.h b/hw/xnest/XNCursor.h
index 627be03fd..d99355565 100644
--- a/hw/xnest/XNCursor.h
+++ b/hw/xnest/XNCursor.h
@@ -15,6 +15,15 @@ is" without express or implied warranty.
#ifndef XNESTCURSOR_H
#define XNESTCURSOR_H
+#include "mipointrst.h"
+
+typedef struct {
+ miPointerSpriteFuncPtr spriteFuncs;
+} xnestCursorFuncRec, *xnestCursorFuncPtr;
+
+extern DevPrivateKey xnestCursorScreenKey;
+extern xnestCursorFuncRec xnestCursorFuncs;
+
typedef struct {
Cursor cursor;
} xnestPrivCursor;
@@ -44,5 +53,6 @@ void xnestSetCursor (DeviceIntPtr pDev,
void xnestMoveCursor (DeviceIntPtr pDev,
ScreenPtr pScreen,
int x, int y);
-
+Bool xnestDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
+void xnestDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
#endif /* XNESTCURSOR_H */