summaryrefslogtreecommitdiff
path: root/hw/xnest
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-01-03 17:04:54 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-01-03 17:04:54 +1030
commit8da83836b60f7cdb75d08482f4311fa0e2ab4e1d (patch)
tree092efcfc39e3e293baaf04c4c84027ee453d3e13 /hw/xnest
parenteace88989c3b65d5c20e9f37ea9b23c7c8e19335 (diff)
parentae869fc7669764729e13fdd70149ed636753f2a3 (diff)
Merge branch 'master' into mpx
Conflicts: XTrap/xtrapddmi.c Xext/security.c Xext/xprint.c Xext/xtest.c Xext/xvdisp.c Xi/exevents.c Xi/grabdevb.c Xi/grabdevk.c Xi/opendev.c Xi/ungrdev.c Xi/ungrdevb.c Xi/ungrdevk.c dix/cursor.c dix/devices.c dix/dixutils.c dix/events.c dix/getevents.c dix/main.c dix/window.c hw/xfree86/ramdac/xf86Cursor.c include/dix.h include/input.h include/inputstr.h mi/midispcur.c mi/miinitext.c mi/misprite.c render/animcur.c xfixes/cursor.c xkb/xkbAccessX.c
Diffstat (limited to 'hw/xnest')
-rw-r--r--hw/xnest/Cursor.c6
-rw-r--r--hw/xnest/GC.c2
-rw-r--r--hw/xnest/Init.c4
-rw-r--r--hw/xnest/Makefile.am3
-rw-r--r--hw/xnest/Pixmap.c9
-rw-r--r--hw/xnest/Screen.c20
-rw-r--r--hw/xnest/Window.c2
-rw-r--r--hw/xnest/XNCursor.h9
-rw-r--r--hw/xnest/XNGC.h6
-rw-r--r--hw/xnest/XNPixmap.h6
-rw-r--r--hw/xnest/XNWindow.h6
11 files changed, 33 insertions, 40 deletions
diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c
index 134276e7b..138698068 100644
--- a/hw/xnest/Cursor.c
+++ b/hw/xnest/Cursor.c
@@ -104,8 +104,8 @@ xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
bg_color.green = pCursor->backGreen;
bg_color.blue = pCursor->backBlue;
- pCursor->devPriv[pScreen->myNum] = (pointer)xalloc(sizeof(xnestPrivCursor));
- xnestCursorPriv(pCursor, pScreen)->cursor =
+ xnestSetCursorPriv(pCursor, pScreen, xalloc(sizeof(xnestPrivCursor)));
+ xnestCursor(pCursor, pScreen) =
XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color,
pCursor->bits->xhot, pCursor->bits->yhot);
@@ -119,7 +119,7 @@ Bool
xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
{
XFreeCursor(xnestDisplay, xnestCursor(pCursor, pScreen));
- xfree(xnestCursorPriv(pCursor, pScreen));
+ xfree(xnestGetCursorPriv(pCursor, pScreen));
return True;
}
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index a52ce1f35..06e6e0205 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -35,7 +35,7 @@ is" without express or implied warranty.
#include "XNFont.h"
#include "Color.h"
-int xnestGCPrivateIndex;
+DevPrivateKey xnestGCPrivateKey = &xnestGCPrivateKey;
static GCFuncs xnestFuncs = {
xnestValidateGC,
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index 4699111b9..7b344e25f 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -74,8 +74,6 @@ InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
break;
}
- xnestWindowPrivateIndex = AllocateWindowPrivateIndex();
- xnestGCPrivateIndex = AllocateGCPrivateIndex();
xnestFontPrivateIndex = AllocateFontPrivateIndex();
if (!xnestNumScreens) xnestNumScreens = 1;
@@ -124,7 +122,7 @@ void ddxGiveUp()
AbortDDX();
}
-#ifdef __DARWIN__
+#ifdef __APPLE__
void
DarwinHandleGUI(int argc, char *argv[])
{
diff --git a/hw/xnest/Makefile.am b/hw/xnest/Makefile.am
index 92f840c97..8601b2988 100644
--- a/hw/xnest/Makefile.am
+++ b/hw/xnest/Makefile.am
@@ -50,8 +50,7 @@ libfbcmap_a_CFLAGS = $(AM_CFLAGS)
XNEST_LIBS = \
@XNEST_LIBS@ \
- libfbcmap.a \
- $(XSERVER_LIBS)
+ libfbcmap.a
Xnest_SOURCES = $(SRCS)
diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c
index 1f420015a..04311966d 100644
--- a/hw/xnest/Pixmap.c
+++ b/hw/xnest/Pixmap.c
@@ -24,6 +24,7 @@ is" without express or implied warranty.
#include "regionstr.h"
#include "gc.h"
#include "servermd.h"
+#include "privates.h"
#include "mi.h"
#include "Xnest.h"
@@ -32,7 +33,7 @@ is" without express or implied warranty.
#include "Screen.h"
#include "XNPixmap.h"
-int xnestPixmapPrivateIndex;
+DevPrivateKey xnestPixmapPrivateKey = &xnestPixmapPrivateKey;
PixmapPtr
xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
@@ -56,8 +57,9 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pPixmap->refcnt = 1;
pPixmap->devKind = PixmapBytePad(width, depth);
- pPixmap->devPrivates[xnestPixmapPrivateIndex].ptr =
- (pointer)((char *)pPixmap + pScreen->totalPixmapSize);
+ pPixmap->usage_hint = usage_hint;
+ dixSetPrivate(&pPixmap->devPrivates, xnestPixmapPrivateKey,
+ (char *)pPixmap + pScreen->totalPixmapSize);
if (width && height)
xnestPixmapPriv(pPixmap)->pixmap =
XCreatePixmap(xnestDisplay,
@@ -75,6 +77,7 @@ xnestDestroyPixmap(PixmapPtr pPixmap)
if(--pPixmap->refcnt)
return TRUE;
XFreePixmap(xnestDisplay, xnestPixmap(pPixmap));
+ dixFreePrivates(pPixmap->devPrivates);
xfree(pPixmap);
return TRUE;
}
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 02e82d193..61a325f3c 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -45,8 +45,6 @@ is" without express or implied warranty.
Window xnestDefaultWindows[MAXSCREENS];
Window xnestScreenSaverWindows[MAXSCREENS];
-static int xnestScreenGeneration = -1;
-
ScreenPtr
xnestScreen(Window window)
{
@@ -142,21 +140,13 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
VisualID defaultVisual;
int rootDepth;
- if (!(AllocateWindowPrivate(pScreen, xnestWindowPrivateIndex,
- sizeof(xnestPrivWin)) &&
- AllocateGCPrivate(pScreen, xnestGCPrivateIndex,
- sizeof(xnestPrivGC))))
+ if (!dixRequestPrivate(xnestWindowPrivateKey, sizeof(xnestPrivWin)))
+ return False;
+ if (!dixRequestPrivate(xnestGCPrivateKey, sizeof(xnestPrivGC)))
return False;
-
- if (xnestScreenGeneration != serverGeneration) {
- if ((xnestPixmapPrivateIndex = AllocatePixmapPrivateIndex()) < 0)
- return False;
- xnestScreenGeneration = serverGeneration;
- }
-
- if (!AllocatePixmapPrivate(pScreen,xnestPixmapPrivateIndex,
- sizeof (xnestPrivPixmap)))
+ if (!dixRequestPrivate(xnestPixmapPrivateKey, sizeof (xnestPrivPixmap)))
return False;
+
visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec));
numVisuals = 0;
diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c
index e83fb90d5..bc9d8bed2 100644
--- a/hw/xnest/Window.c
+++ b/hw/xnest/Window.c
@@ -39,7 +39,7 @@ is" without express or implied warranty.
#include "Events.h"
#include "Args.h"
-int xnestWindowPrivateIndex;
+DevPrivateKey xnestWindowPrivateKey = &xnestWindowPrivateKey;
static int
xnestFindWindowMatch(WindowPtr pWin, pointer ptr)
diff --git a/hw/xnest/XNCursor.h b/hw/xnest/XNCursor.h
index ffec9eb0a..9705f6bea 100644
--- a/hw/xnest/XNCursor.h
+++ b/hw/xnest/XNCursor.h
@@ -19,11 +19,14 @@ typedef struct {
Cursor cursor;
} xnestPrivCursor;
-#define xnestCursorPriv(pCursor, pScreen) \
- ((xnestPrivCursor *)((pCursor)->devPriv[pScreen->myNum]))
+#define xnestGetCursorPriv(pCursor, pScreen) \
+ ((xnestPrivCursor *)dixLookupPrivate(&(pCursor)->devPrivates, pScreen))
+
+#define xnestSetCursorPriv(pCursor, pScreen, v) \
+ dixSetPrivate(&(pCursor)->devPrivates, pScreen, v)
#define xnestCursor(pCursor, pScreen) \
- (xnestCursorPriv(pCursor, pScreen)->cursor)
+ (xnestGetCursorPriv(pCursor, pScreen)->cursor)
Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
Bool xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
diff --git a/hw/xnest/XNGC.h b/hw/xnest/XNGC.h
index d3ac3df0b..19535fe3a 100644
--- a/hw/xnest/XNGC.h
+++ b/hw/xnest/XNGC.h
@@ -22,10 +22,10 @@ typedef struct {
int nClipRects;
} xnestPrivGC;
-extern int xnestGCPrivateIndex;
+extern DevPrivateKey xnestGCPrivateKey;
-#define xnestGCPriv(pGC) \
- ((xnestPrivGC *)((pGC)->devPrivates[xnestGCPrivateIndex].ptr))
+#define xnestGCPriv(pGC) ((xnestPrivGC *) \
+ dixLookupPrivate(&(pGC)->devPrivates, xnestGCPrivateKey))
#define xnestGC(pGC) (xnestGCPriv(pGC)->gc)
diff --git a/hw/xnest/XNPixmap.h b/hw/xnest/XNPixmap.h
index 9eb2a3c70..614827587 100644
--- a/hw/xnest/XNPixmap.h
+++ b/hw/xnest/XNPixmap.h
@@ -15,14 +15,14 @@ is" without express or implied warranty.
#ifndef XNESTPIXMAP_H
#define XNESTPIXMAP_H
-extern int xnestPixmapPrivateIndex;
+extern DevPrivateKey xnestPixmapPrivateKey;
typedef struct {
Pixmap pixmap;
} xnestPrivPixmap;
-#define xnestPixmapPriv(pPixmap) \
- ((xnestPrivPixmap *)((pPixmap)->devPrivates[xnestPixmapPrivateIndex].ptr))
+#define xnestPixmapPriv(pPixmap) ((xnestPrivPixmap *) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, xnestPixmapPrivateKey))
#define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap)
diff --git a/hw/xnest/XNWindow.h b/hw/xnest/XNWindow.h
index 6c63f1f76..4cb66c8ce 100644
--- a/hw/xnest/XNWindow.h
+++ b/hw/xnest/XNWindow.h
@@ -35,10 +35,10 @@ typedef struct {
Window window;
} xnestWindowMatch;
-extern int xnestWindowPrivateIndex;
+extern DevPrivateKey xnestWindowPrivateKey;
-#define xnestWindowPriv(pWin) \
- ((xnestPrivWin *)((pWin)->devPrivates[xnestWindowPrivateIndex].ptr))
+#define xnestWindowPriv(pWin) ((xnestPrivWin *) \
+ dixLookupPrivate(&(pWin)->devPrivates, xnestWindowPrivateKey))
#define xnestWindow(pWin) (xnestWindowPriv(pWin)->window)