diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-01-03 17:04:54 +1030 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-01-03 17:04:54 +1030 |
commit | 8da83836b60f7cdb75d08482f4311fa0e2ab4e1d (patch) | |
tree | 092efcfc39e3e293baaf04c4c84027ee453d3e13 /hw/xfree86/dixmods/extmod/xf86vmode.c | |
parent | eace88989c3b65d5c20e9f37ea9b23c7c8e19335 (diff) | |
parent | ae869fc7669764729e13fdd70149ed636753f2a3 (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/xfree86/dixmods/extmod/xf86vmode.c')
-rw-r--r-- | hw/xfree86/dixmods/extmod/xf86vmode.c | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c index 3b054a829..718d40fbd 100644 --- a/hw/xfree86/dixmods/extmod/xf86vmode.c +++ b/hw/xfree86/dixmods/extmod/xf86vmode.c @@ -52,8 +52,7 @@ from Kaleb S. KEITHLEY #define DEFAULT_XF86VIDMODE_VERBOSITY 3 static int VidModeErrorBase; -static int VidModeGeneration = 0; -static int VidModeClientPrivateIndex; +static DevPrivateKey VidModeClientPrivateKey = &VidModeClientPrivateKey; /* This holds the client's version information */ typedef struct { @@ -61,7 +60,10 @@ typedef struct { int minor; } VidModePrivRec, *VidModePrivPtr; -#define VMPRIV(c) ((c)->devPrivates[VidModeClientPrivateIndex].ptr) +#define VM_GETPRIV(c) ((VidModePrivPtr) \ + dixLookupPrivate(&(c)->devPrivates, VidModeClientPrivateKey)) +#define VM_SETPRIV(c,p) \ + dixSetPrivate(&(c)->devPrivates, VidModeClientPrivateKey, p) static void XF86VidModeResetProc( ExtensionEntry* /* extEntry */ @@ -145,10 +147,12 @@ typedef struct _XF86VidModeScreenPrivate { Bool hasWindow; } XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr; -static int ScreenPrivateIndex; +static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKey; -#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr) -#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v); +#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \ + dixLookupPrivate(&(s)->devPrivates, ScreenPrivateKey)) +#define SetScreenPrivate(s,v) \ + dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v) #define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s) #define New(t) (xalloc (sizeof (t))) @@ -172,7 +176,6 @@ XFree86VidModeExtensionInit(void) #ifdef XF86VIDMODE_EVENTS EventType = CreateNewResourceType(XF86VidModeFreeEvents); - ScreenPrivateIndex = AllocateScreenPrivateIndex (); #endif for(i = 0; i < screenInfo.numScreens; i++) { @@ -187,27 +190,9 @@ XFree86VidModeExtensionInit(void) if (!enabled) return; - /* - * Allocate a client private index to hold the client's version - * information. - */ - if (VidModeGeneration != serverGeneration) { - VidModeClientPrivateIndex = AllocateClientPrivateIndex(); - /* - * Allocate 0 length, and use the private to hold a pointer to our - * VidModePrivRec. - */ - if (!AllocateClientPrivate(VidModeClientPrivateIndex, 0)) { - ErrorF("XFree86VidModeExtensionInit: " - "AllocateClientPrivate failed\n"); - return; - } - VidModeGeneration = serverGeneration; - } - if ( #ifdef XF86VIDMODE_EVENTS - EventType && ScreenPrivateIndex != -1 && + EventType && #endif (extEntry = AddExtension(XF86VIDMODENAME, XF86VidModeNumberEvents, @@ -239,7 +224,7 @@ ClientMajorVersion(ClientPtr client) { VidModePrivPtr pPriv; - pPriv = VMPRIV(client); + pPriv = VM_GETPRIV(client); if (!pPriv) return 0; else @@ -1682,11 +1667,11 @@ ProcXF86VidModeSetClientVersion(ClientPtr client) REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq); - if ((pPriv = VMPRIV(client)) == NULL) { + if ((pPriv = VM_GETPRIV(client)) == NULL) { pPriv = xalloc(sizeof(VidModePrivRec)); if (!pPriv) return BadAlloc; - VMPRIV(client) = pPriv; + VM_SETPRIV(client, pPriv); } pPriv->major = stuff->major; pPriv->minor = stuff->minor; |