diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-12-05 15:36:12 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-12-05 15:36:12 +0000 |
commit | a90ee792d96752ad1b71b9ada922fa6afe478c99 (patch) | |
tree | 6143b00f7646951d23dfe2a4fe2992ca40b77069 /xserver/dbe | |
parent | bc97d4ecc0aa9e1b823565b07282f848700bd11a (diff) |
Upgrade to xorg-server 1.9.2.
Tested by ajacoutot@, krw@, shadchin@ and jasper@ on various configurations
including multihead with both zaphod and xrandr.
Diffstat (limited to 'xserver/dbe')
-rw-r--r-- | xserver/dbe/Makefile.in | 30 | ||||
-rw-r--r-- | xserver/dbe/dbe.c | 186 | ||||
-rw-r--r-- | xserver/dbe/dbestruct.h | 12 | ||||
-rw-r--r-- | xserver/dbe/midbe.c | 56 | ||||
-rw-r--r-- | xserver/dbe/midbe.h | 14 | ||||
-rw-r--r-- | xserver/dbe/midbestr.h | 16 |
6 files changed, 126 insertions, 188 deletions
diff --git a/xserver/dbe/Makefile.in b/xserver/dbe/Makefile.in index c98128013..3fc9b9be7 100644 --- a/xserver/dbe/Makefile.in +++ b/xserver/dbe/Makefile.in @@ -119,10 +119,6 @@ BUILDDOCS_TRUE = @BUILDDOCS_TRUE@ BUILD_DATE = @BUILD_DATE@ BUILD_KDRIVEFBDEVLIB_FALSE = @BUILD_KDRIVEFBDEVLIB_FALSE@ BUILD_KDRIVEFBDEVLIB_TRUE = @BUILD_KDRIVEFBDEVLIB_TRUE@ -BUILD_LINUXDOC_FALSE = @BUILD_LINUXDOC_FALSE@ -BUILD_LINUXDOC_TRUE = @BUILD_LINUXDOC_TRUE@ -BUILD_PDFDOC_FALSE = @BUILD_PDFDOC_FALSE@ -BUILD_PDFDOC_TRUE = @BUILD_PDFDOC_TRUE@ BUILD_TIME = @BUILD_TIME@ CC = @CC@ CCAS = @CCAS@ @@ -210,6 +206,8 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_DEVEL_DOCS_FALSE = @ENABLE_DEVEL_DOCS_FALSE@ +ENABLE_DEVEL_DOCS_TRUE = @ENABLE_DEVEL_DOCS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FBDEVHW_FALSE = @FBDEVHW_FALSE@ @@ -224,6 +222,7 @@ FONTOTFDIR = @FONTOTFDIR@ FONTROOTDIR = @FONTROOTDIR@ FONTTTFDIR = @FONTTTFDIR@ FONTTYPE1DIR = @FONTTYPE1DIR@ +FOP = @FOP@ FREEBSD_KLDLOAD_FALSE = @FREEBSD_KLDLOAD_FALSE@ FREEBSD_KLDLOAD_TRUE = @FREEBSD_KLDLOAD_TRUE@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -241,10 +240,14 @@ HAVE_DBUS_FALSE = @HAVE_DBUS_FALSE@ HAVE_DBUS_TRUE = @HAVE_DBUS_TRUE@ HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_PS2PDF_FALSE = @HAVE_PS2PDF_FALSE@ -HAVE_PS2PDF_TRUE = @HAVE_PS2PDF_TRUE@ +HAVE_FOP_FALSE = @HAVE_FOP_FALSE@ +HAVE_FOP_TRUE = @HAVE_FOP_TRUE@ HAVE_STYLESHEETS_FALSE = @HAVE_STYLESHEETS_FALSE@ HAVE_STYLESHEETS_TRUE = @HAVE_STYLESHEETS_TRUE@ +HAVE_XMLTO_FALSE = @HAVE_XMLTO_FALSE@ +HAVE_XMLTO_TEXT_FALSE = @HAVE_XMLTO_TEXT_FALSE@ +HAVE_XMLTO_TEXT_TRUE = @HAVE_XMLTO_TEXT_TRUE@ +HAVE_XMLTO_TRUE = @HAVE_XMLTO_TRUE@ HP300_VIDEO_FALSE = @HP300_VIDEO_FALSE@ HP300_VIDEO_TRUE = @HP300_VIDEO_TRUE@ HPPA_VIDEO_FALSE = @HPPA_VIDEO_FALSE@ @@ -300,10 +303,11 @@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ +LIBSHA1_LIBS = @LIBSHA1_LIBS@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ -LINUXDOC = @LINUXDOC@ LINUX_ALPHA_FALSE = @LINUX_ALPHA_FALSE@ LINUX_ALPHA_TRUE = @LINUX_ALPHA_TRUE@ LINUX_IA64_FALSE = @LINUX_IA64_FALSE@ @@ -321,17 +325,11 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ -MAKE_HTML = @MAKE_HTML@ -MAKE_PDF = @MAKE_PDF@ -MAKE_PS = @MAKE_PS@ -MAKE_TEXT = @MAKE_TEXT@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MITSHM_FALSE = @MITSHM_FALSE@ MITSHM_TRUE = @MITSHM_TRUE@ -MULTIBUFFER_FALSE = @MULTIBUFFER_FALSE@ -MULTIBUFFER_TRUE = @MULTIBUFFER_TRUE@ NEED_STRLCAT_FALSE = @NEED_STRLCAT_FALSE@ NEED_STRLCAT_TRUE = @NEED_STRLCAT_TRUE@ NEED_VSNPRINTF_FALSE = @NEED_VSNPRINTF_FALSE@ @@ -358,20 +356,23 @@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PERL = @PERL@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PPC_VIDEO_FALSE = @PPC_VIDEO_FALSE@ PPC_VIDEO_TRUE = @PPC_VIDEO_TRUE@ PROJECTROOT = @PROJECTROOT@ -PS2PDF = @PS2PDF@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RECORD_FALSE = @RECORD_FALSE@ RECORD_TRUE = @RECORD_TRUE@ +RELEASE_DATE = @RELEASE_DATE@ RES_FALSE = @RES_FALSE@ RES_TRUE = @RES_TRUE@ SCREENSAVER_FALSE = @SCREENSAVER_FALSE@ SCREENSAVER_TRUE = @SCREENSAVER_TRUE@ +SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SECURE_RPC_FALSE = @SECURE_RPC_FALSE@ SECURE_RPC_TRUE = @SECURE_RPC_TRUE@ SED = @SED@ @@ -463,6 +464,7 @@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ XLIB_CFLAGS = @XLIB_CFLAGS@ XLIB_LIBS = @XLIB_LIBS@ +XMLTO = @XMLTO@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_FALSE = @XNEST_FALSE@ diff --git a/xserver/dbe/dbe.c b/xserver/dbe/dbe.c index 825d2e08f..77b616b6a 100644 --- a/xserver/dbe/dbe.c +++ b/xserver/dbe/dbe.c @@ -57,15 +57,13 @@ /* GLOBALS */ -/* These are static globals copied to DBE's screen private for use by DDX */ -static int dbeScreenPrivKeyIndex; -static DevPrivateKey dbeScreenPrivKey = &dbeScreenPrivKeyIndex; -static int dbeWindowPrivKeyIndex; -static DevPrivateKey dbeWindowPrivKey = &dbeWindowPrivKeyIndex; +/* These are globals for use by DDX */ +DevPrivateKeyRec dbeScreenPrivKeyRec; +DevPrivateKeyRec dbeWindowPrivKeyRec; -/* These are static globals copied to DBE's screen private for use by DDX */ -static RESTYPE dbeDrawableResType; -static RESTYPE dbeWindowPrivResType; +/* These are globals for use by DDX */ +RESTYPE dbeDrawableResType; +RESTYPE dbeWindowPrivResType; /* Used to generate DBE's BadBuffer error. */ static int dbeErrorBase; @@ -147,7 +145,7 @@ ProcDbeGetVersion(ClientPtr client) WriteToClient(client, sizeof(xDbeGetVersionReply), (char *)&rep); - return(client->noClientException); + return Success; } /* ProcDbeGetVersion() */ @@ -201,7 +199,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client) /* The window must be InputOutput. */ if (pWin->drawable.class != InputOutput) { - return(BadMatch); + return BadMatch; } /* The swap action must be valid. */ @@ -211,7 +209,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client) (swapAction != XdbeUntouched ) && (swapAction != XdbeCopied )) { - return(BadValue); + return BadValue; } /* The id must be in range and not already in use. */ @@ -222,12 +220,12 @@ ProcDbeAllocateBackBufferName(ClientPtr client) */ pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin); if (!pDbeScreenPriv->GetVisualInfo) - return(BadMatch); /* screen doesn't support double buffering */ + return BadMatch; /* screen doesn't support double buffering */ if (!(*pDbeScreenPriv->GetVisualInfo)(pWin->drawable.pScreen, &scrVisInfo)) { /* GetVisualInfo() failed to allocate visual info data. */ - return(BadAlloc); + return BadAlloc; } /* See if the window's visual is on the list. */ @@ -241,11 +239,11 @@ ProcDbeAllocateBackBufferName(ClientPtr client) } /* Free what was allocated by the GetVisualInfo() call above. */ - xfree(scrVisInfo.visinfo); + free(scrVisInfo.visinfo); if (!visualMatched) { - return(BadMatch); + return BadMatch; } if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)) == NULL) @@ -254,9 +252,9 @@ ProcDbeAllocateBackBufferName(ClientPtr client) * Allocate a window priv. */ - pDbeWindowPriv = xcalloc(1, sizeof(DbeWindowPrivRec)); + pDbeWindowPriv = dixAllocateObjectWithPrivates(DbeWindowPrivRec, PRIVATE_DBE_WINDOW); if (!pDbeWindowPriv) - return(BadAlloc); + return BadAlloc; /* Fill out window priv information. */ pDbeWindowPriv->pWindow = pWin; @@ -319,11 +317,11 @@ ProcDbeAllocateBackBufferName(ClientPtr client) } /* malloc/realloc a new array and initialize all elements to 0. */ - pDbeWindowPriv->IDs = (XID *)xrealloc(pIDs, + pDbeWindowPriv->IDs = (XID *)realloc(pIDs, (pDbeWindowPriv->maxAvailableIDs+DBE_INCR_MAX_IDS)*sizeof(XID)); if (!pDbeWindowPriv->IDs) { - return(BadAlloc); + return BadAlloc; } memset(&pDbeWindowPriv->IDs[pDbeWindowPriv->nBufferIDs], 0, (pDbeWindowPriv->maxAvailableIDs + DBE_INCR_MAX_IDS - @@ -379,12 +377,12 @@ ProcDbeAllocateBackBufferName(ClientPtr client) /* Set swap action on all calls. */ pDbeWindowPriv->swapAction = stuff->swapAction; - return(status); + return status; out_free: dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, NULL); - xfree(pDbeWindowPriv); - return (status); + free(pDbeWindowPriv); + return status; } /* ProcDbeAllocateBackBufferName() */ @@ -422,12 +420,12 @@ ProcDbeDeallocateBackBufferName(ClientPtr client) dbeWindowPrivResType, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? dbeErrorBase + DbeBadBuffer : rc; + return rc; rc = dixLookupResourceByType(&val, stuff->buffer, dbeDrawableResType, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? dbeErrorBase + DbeBadBuffer : rc; + return rc; /* Make sure that the id is valid for the window. * This is paranoid code since we already looked up the ID by type @@ -447,12 +445,12 @@ ProcDbeDeallocateBackBufferName(ClientPtr client) { /* We did not find the ID in the ID list. */ client->errorValue = stuff->buffer; - return(dbeErrorBase + DbeBadBuffer); + return dbeErrorBase + DbeBadBuffer; } FreeResource(stuff->buffer, RT_NONE); - return(Success); + return Success; } /* ProcDbeDeallocateBackBufferName() */ @@ -498,7 +496,7 @@ ProcDbeSwapBuffers(ClientPtr client) if (nStuff == 0) { - return(Success); + return Success; } if (nStuff > UINT32_MAX / sizeof(DbeSwapInfoRec)) @@ -508,10 +506,10 @@ ProcDbeSwapBuffers(ClientPtr client) dbeSwapInfo = (xDbeSwapInfo *)&stuff[1]; /* Allocate array to record swap information. */ - swapInfo = (DbeSwapInfoPtr)Xalloc(nStuff * sizeof(DbeSwapInfoRec)); + swapInfo = (DbeSwapInfoPtr)malloc(nStuff * sizeof(DbeSwapInfoRec)); if (swapInfo == NULL) { - return(BadAlloc); + return BadAlloc; } @@ -523,15 +521,15 @@ ProcDbeSwapBuffers(ClientPtr client) error = dixLookupWindow(&pWin, dbeSwapInfo[i].window, client, DixWriteAccess); if (error != Success) { - Xfree(swapInfo); + free(swapInfo); return error; } /* Each window must be double-buffered - BadMatch. */ if (DBE_WINDOW_PRIV(pWin) == NULL) { - Xfree(swapInfo); - return(BadMatch); + free(swapInfo); + return BadMatch; } /* Each window must only be specified once - BadMatch. */ @@ -539,8 +537,8 @@ ProcDbeSwapBuffers(ClientPtr client) { if (dbeSwapInfo[i].window == dbeSwapInfo[j].window) { - Xfree(swapInfo); - return(BadMatch); + free(swapInfo); + return BadMatch; } } @@ -550,8 +548,8 @@ ProcDbeSwapBuffers(ClientPtr client) (dbeSwapInfo[i].swapAction != XdbeUntouched ) && (dbeSwapInfo[i].swapAction != XdbeCopied )) { - Xfree(swapInfo); - return(BadValue); + free(swapInfo); + return BadValue; } /* Everything checks out OK. Fill in the swap info array. */ @@ -580,13 +578,13 @@ ProcDbeSwapBuffers(ClientPtr client) error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff, swapInfo); if (error != Success) { - Xfree(swapInfo); - return(error); + free(swapInfo); + return error; } } - Xfree(swapInfo); - return(Success); + free(swapInfo); + return Success; } /* ProcDbeSwapBuffers() */ @@ -628,7 +626,7 @@ ProcDbeBeginIdiom(ClientPtr client) } } - return(Success); + return Success; } /* ProcDbeBeginIdiom() */ @@ -672,10 +670,10 @@ ProcDbeGetVisualInfo(ClientPtr client) /* Make sure any specified drawables are valid. */ if (stuff->n != 0) { - if (!(pDrawables = (DrawablePtr *)Xalloc(stuff->n * + if (!(pDrawables = (DrawablePtr *)malloc(stuff->n * sizeof(DrawablePtr)))) { - return(BadAlloc); + return BadAlloc; } drawables = (Drawable *)&stuff[1]; @@ -685,22 +683,19 @@ ProcDbeGetVisualInfo(ClientPtr client) rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0, DixGetAttrAccess); if (rc != Success) { - Xfree(pDrawables); + free(pDrawables); return rc; } } } count = (stuff->n == 0) ? screenInfo.numScreens : stuff->n; - if (!(pScrVisInfo = (XdbeScreenVisualInfo *)xalloc(count * + if (!(pScrVisInfo = (XdbeScreenVisualInfo *)malloc(count * sizeof(XdbeScreenVisualInfo)))) { - if (pDrawables) - { - Xfree(pDrawables); - } + free(pDrawables); - return(BadAlloc); + return BadAlloc; } length = 0; @@ -720,14 +715,11 @@ ProcDbeGetVisualInfo(ClientPtr client) /* Free visinfos that we allocated for previous screen infos.*/ for (j = 0; j < i; j++) { - xfree(pScrVisInfo[j].visinfo); + free(pScrVisInfo[j].visinfo); } /* Free pDrawables if we needed to allocate it above. */ - if (pDrawables) - { - Xfree(pDrawables); - } + free(pDrawables); return (rc == Success) ? BadAlloc : rc; } @@ -801,16 +793,13 @@ ProcDbeGetVisualInfo(ClientPtr client) /* Clean up memory. */ for (i = 0; i < count; i++) { - xfree(pScrVisInfo[i].visinfo); + free(pScrVisInfo[i].visinfo); } - xfree(pScrVisInfo); + free(pScrVisInfo); - if (pDrawables) - { - Xfree(pDrawables); - } + free(pDrawables); - return(client->noClientException); + return Success; } /* ProcDbeGetVisualInfo() */ @@ -866,7 +855,7 @@ ProcDbeGetBackBufferAttributes(ClientPtr client) WriteToClient(client, sizeof(xDbeGetBackBufferAttributesReply), (char *)&rep); - return(client->noClientException); + return Success; } /* ProcDbeGetbackBufferAttributes() */ @@ -905,7 +894,7 @@ ProcDbeDispatch(ClientPtr client) return(ProcDbeBeginIdiom(client)); case X_DbeEndIdiom: - return(Success); + return Success; case X_DbeGetVisualInfo: return(ProcDbeGetVisualInfo(client)); @@ -914,7 +903,7 @@ ProcDbeDispatch(ClientPtr client) return(ProcDbeGetBackBufferAttributes(client)); default: - return(BadRequest); + return BadRequest; } } /* ProcDbeDispatch() */ @@ -1206,7 +1195,7 @@ SProcDbeDispatch(ClientPtr client) return(SProcDbeBeginIdiom(client)); case X_DbeEndIdiom: - return(Success); + return Success; case X_DbeGetVisualInfo: return(SProcDbeGetVisualInfo(client)); @@ -1215,7 +1204,7 @@ SProcDbeDispatch(ClientPtr client) return(SProcDbeGetBackBufferAttributes(client)); default: - return (BadRequest); + return BadRequest; } } /* SProcDbeDispatch() */ @@ -1239,7 +1228,7 @@ SProcDbeDispatch(ClientPtr client) static Bool DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC) { - pointer gcvalues[4]; + ChangeGCVal gcvalues[4]; int ts_x_origin, ts_y_origin; PixUnion background; int backgroundState; @@ -1265,31 +1254,25 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC) switch (backgroundState) { case BackgroundPixel: - gcvalues[0] = (pointer)background.pixel; - gcvalues[1] = (pointer)FillSolid; + gcvalues[0].val = background.pixel; + gcvalues[1].val = FillSolid; gcmask = GCForeground|GCFillStyle; break; case BackgroundPixmap: - gcvalues[0] = (pointer)FillTiled; - gcvalues[1] = (pointer)background.pixmap; - gcvalues[2] = (pointer)(long)ts_x_origin; - gcvalues[3] = (pointer)(long)ts_y_origin; + gcvalues[0].val = FillTiled; + gcvalues[1].ptr = background.pixmap; + gcvalues[2].val = ts_x_origin; + gcvalues[3].val = ts_y_origin; gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin; break; default: /* pWin->backgroundState == None */ - return(FALSE); - } - - if (DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE) != 0) - { - return(FALSE); + return FALSE; } - return(TRUE); - + return ChangeGC(NullClient, pGC, gcmask, gcvalues) == 0; } /* DbeSetupBackgroundPainter() */ @@ -1312,7 +1295,7 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC) static int DbeDrawableDelete(pointer pDrawable, XID id) { - return(Success); + return Success; } /* DbeDrawableDelete() */ @@ -1352,7 +1335,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id) if (i == pDbeWindowPriv->nBufferIDs) { /* We did not find the ID in the array. We should never get here. */ - return(BadValue); + return BadValue; } /* Remove the ID from the array. */ @@ -1385,7 +1368,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id) DBE_INIT_MAX_IDS * sizeof(XID)); /* Free the extended array; use the static array. */ - xfree(pDbeWindowPriv->IDs); + free(pDbeWindowPriv->IDs); pDbeWindowPriv->IDs = pDbeWindowPriv->initIDs; pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS; } @@ -1416,11 +1399,10 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id) NULL); /* We are done with the window priv. */ - dixFreePrivates(pDbeWindowPriv->devPrivates); - xfree(pDbeWindowPriv); + dixFreeObjectWithPrivates(pDbeWindowPriv, PRIVATE_DBE_WINDOW); } - return(Success); + return Success; } /* DbeWindowPrivDelete() */ @@ -1456,8 +1438,7 @@ DbeResetProc(ExtensionEntry *extEntry) if (pDbeScreenPriv->ResetProc) (*pDbeScreenPriv->ResetProc)(pScreen); - dixFreePrivates(pDbeScreenPriv->devPrivates); - xfree(pDbeScreenPriv); + free(pDbeScreenPriv); } } } /* DbeResetProc() */ @@ -1542,7 +1523,7 @@ DbeDestroyWindow(WindowPtr pWin) ************************************************************************** */ - return(ret); + return ret; } /* DbeDestroyWindow() */ @@ -1583,8 +1564,10 @@ DbeExtensionInit(void) if (!dbeWindowPrivResType) return; - if (!dixRegisterPrivateOffset(dbeDrawableResType, - offsetof(PixmapRec, devPrivates))) + if (!dixRegisterPrivateKey(&dbeScreenPrivKeyRec, PRIVATE_SCREEN, 0)) + return; + + if (!dixRegisterPrivateKey(&dbeWindowPrivKeyRec, PRIVATE_WINDOW, 0)) return; for (i = 0; i < screenInfo.numScreens; i++) @@ -1595,8 +1578,7 @@ DbeExtensionInit(void) pScreen = screenInfo.screens[i]; - if (!(pDbeScreenPriv = - (DbeScreenPrivPtr)Xcalloc(sizeof(DbeScreenPrivRec)))) + if (!(pDbeScreenPriv = malloc (sizeof (DbeScreenPrivRec)))) { /* If we can not alloc a window or screen private, * then free any privates that we already alloc'ed and return @@ -1604,7 +1586,7 @@ DbeExtensionInit(void) for (j = 0; j < i; j++) { - xfree(dixLookupPrivate(&screenInfo.screens[j]->devPrivates, + free(dixLookupPrivate(&screenInfo.screens[j]->devPrivates, dbeScreenPrivKey)); dixSetPrivate(&screenInfo.screens[j]->devPrivates, dbeScreenPrivKey, NULL); @@ -1614,14 +1596,6 @@ DbeExtensionInit(void) dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, pDbeScreenPriv); - /* Copy the resource types */ - pDbeScreenPriv->dbeDrawableResType = dbeDrawableResType; - pDbeScreenPriv->dbeWindowPrivResType = dbeWindowPrivResType; - - /* Copy the private indices */ - pDbeScreenPriv->dbeScreenPrivKey = dbeScreenPrivKey; - pDbeScreenPriv->dbeWindowPrivKey = dbeWindowPrivKey; - { /* We don't have DDX support for DBE anymore */ @@ -1666,7 +1640,7 @@ DbeExtensionInit(void) for (i = 0; i < screenInfo.numScreens; i++) { - xfree(dixLookupPrivate(&screenInfo.screens[i]->devPrivates, + free(dixLookupPrivate(&screenInfo.screens[i]->devPrivates, dbeScreenPrivKey)); dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, NULL); } @@ -1680,6 +1654,8 @@ DbeExtensionInit(void) DbeResetProc, StandardMinorOpcode); dbeErrorBase = extEntry->errorBase; + SetResourceTypeErrorValue(dbeWindowPrivResType, dbeErrorBase + DbeBadBuffer); + SetResourceTypeErrorValue(dbeDrawableResType, dbeErrorBase + DbeBadBuffer); } /* DbeExtensionInit() */ diff --git a/xserver/dbe/dbestruct.h b/xserver/dbe/dbestruct.h index 002ffbeb2..9c383cef8 100644 --- a/xserver/dbe/dbestruct.h +++ b/xserver/dbe/dbestruct.h @@ -167,14 +167,6 @@ typedef struct _DbeWindowPrivRec typedef struct _DbeScreenPrivRec { - /* Resources created by DIX to be used by DDX */ - RESTYPE dbeDrawableResType; - RESTYPE dbeWindowPrivResType; - - /* Private indices created by DIX to be used by DDX */ - DevPrivateKey dbeScreenPrivKey; - DevPrivateKey dbeWindowPrivKey; - /* Wrapped functions * It is the responsibilty of the DDX layer to wrap PositionWindow(). * DbeExtensionInit wraps DestroyWindow(). @@ -217,10 +209,6 @@ typedef struct _DbeScreenPrivRec ScreenPtr /*pScreen*/ ); - /* Device-specific private information. - */ - PrivateRec *devPrivates; - } DbeScreenPrivRec, *DbeScreenPrivPtr; #endif /* DBE_STRUCT_H */ diff --git a/xserver/dbe/midbe.c b/xserver/dbe/midbe.c index bdea35851..b43ac1b3d 100644 --- a/xserver/dbe/midbe.c +++ b/xserver/dbe/midbe.c @@ -58,14 +58,8 @@ #include <stdio.h> -static int miDbeWindowPrivPrivKeyIndex; -static DevPrivateKey miDbeWindowPrivPrivKey = &miDbeWindowPrivPrivKeyIndex; -static RESTYPE dbeDrawableResType; -static RESTYPE dbeWindowPrivResType; -static int dbeScreenPrivKeyIndex; -static DevPrivateKey dbeScreenPrivKey = &dbeScreenPrivKeyIndex; -static int dbeWindowPrivKeyIndex; -static DevPrivateKey dbeWindowPrivKey = &dbeWindowPrivKeyIndex; +static DevPrivateKeyRec miDbeWindowPrivPrivKeyRec; +#define miDbeWindowPrivPrivKey (&miDbeWindowPrivPrivKeyRec) /****************************************************************************** @@ -100,9 +94,9 @@ miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo) } /* Allocate an array of XdbeVisualInfo items. */ - if (!(visInfo = (XdbeVisualInfo *)xalloc(count * sizeof(XdbeVisualInfo)))) + if (!(visInfo = (XdbeVisualInfo *)malloc(count * sizeof(XdbeVisualInfo)))) { - return(FALSE); /* memory alloc failure */ + return FALSE; /* memory alloc failure */ } for (i = 0, k = 0; i < pScreen->numDepths; i++) @@ -131,7 +125,7 @@ miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo) pScrVisInfo->count = count; pScrVisInfo->visinfo = visInfo; - return(TRUE); /* success */ + return TRUE; /* success */ } /* miDbeGetVisualInfo() */ @@ -181,7 +175,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) pDbeWindowPriv->height, pWin->drawable.depth, 0))) { - return(BadAlloc); + return BadAlloc; } /* Get a back pixmap. */ @@ -191,7 +185,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) pWin->drawable.depth, 0))) { (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer); - return(BadAlloc); + return BadAlloc; } /* Security creation/labeling check. */ @@ -208,12 +202,6 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) return (rc == Success) ? BadAlloc : rc; } - - /* Attach the priv priv to the priv. */ - dixSetPrivate(&pDbeWindowPriv->devPrivates, miDbeWindowPrivPrivKey, - pDbeWindowPrivPriv); - - /* Clear the back buffer. */ pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC)) @@ -241,12 +229,12 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) if (!AddResource(bufId, dbeDrawableResType, (pointer)pDbeWindowPrivPriv->pBackBuffer)) { - return(BadAlloc); + return BadAlloc; } } - return(Success); + return Success; } /* miDbeAllocBackBufferName() */ @@ -415,7 +403,7 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo) FreeScratchGC(pGC); - return(Success); + return Success; } /* miSwapBuffers() */ @@ -577,13 +565,13 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) { - return(ret); + return ret; } if (pDbeWindowPriv->width == pWin->drawable.width && pDbeWindowPriv->height == pWin->drawable.height) { - return(ret); + return ret; } width = pWin->drawable.width; @@ -684,7 +672,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) } FreeScratchGC(pGC); - return(FALSE); + return FALSE; } else @@ -743,7 +731,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) FreeScratchGC(pGC); } - return(ret); + return ret; } /* miDbePositionWindow() */ @@ -787,17 +775,9 @@ miDbeResetProc(ScreenPtr pScreen) Bool miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv) { - /* Copy resource types created by DIX */ - dbeDrawableResType = pDbeScreenPriv->dbeDrawableResType; - dbeWindowPrivResType = pDbeScreenPriv->dbeWindowPrivResType; - - /* Copy private indices created by DIX */ - dbeScreenPrivKey = pDbeScreenPriv->dbeScreenPrivKey; - dbeWindowPrivKey = pDbeScreenPriv->dbeWindowPrivKey; - - if (!dixRequestPrivate(miDbeWindowPrivPrivKey, - sizeof(MiDbeWindowPrivPrivRec))) - return(FALSE); + if (!dixRegisterPrivateKey(&miDbeWindowPrivPrivKeyRec, PRIVATE_DBE_WINDOW, + sizeof(MiDbeWindowPrivPrivRec))) + return FALSE; /* Wrap functions. */ pDbeScreenPriv->PositionWindow = pScreen->PositionWindow; @@ -812,6 +792,6 @@ miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv) pDbeScreenPriv->ResetProc = miDbeResetProc; pDbeScreenPriv->WinPrivDelete = miDbeWinPrivDelete; - return(TRUE); + return TRUE; } /* miDbeInit() */ diff --git a/xserver/dbe/midbe.h b/xserver/dbe/midbe.h index 1780c3fc3..cff36d038 100644 --- a/xserver/dbe/midbe.h +++ b/xserver/dbe/midbe.h @@ -1,5 +1,4 @@ /****************************************************************************** - * * Copyright (c) 1994, 1995 Hewlett-Packard Company * * Permission is hereby granted, free of charge, to any person obtaining @@ -29,8 +28,6 @@ * Header file for users of machine-independent DBE code * *****************************************************************************/ -/* $XFree86$ */ - #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -39,6 +36,8 @@ #ifndef MIDBE_H #define MIDBE_H +#include "privates.h" + /* EXTERNS */ extern Bool miDbeInit( @@ -46,5 +45,14 @@ extern Bool miDbeInit( DbeScreenPrivPtr pDbeScreenPriv ); +extern DevPrivateKeyRec dbeScreenPrivKeyRec; +#define dbeScreenPrivKey (&dbeScreenPrivKeyRec) + +extern DevPrivateKeyRec dbeWindowPrivKeyRec; +#define dbeWindowPrivKey (&dbeWindowPrivKeyRec) + +extern RESTYPE dbeDrawableResType; +extern RESTYPE dbeWindowPrivResType; + #endif /* MIDBE_H */ diff --git a/xserver/dbe/midbestr.h b/xserver/dbe/midbestr.h index ae9f206fc..a47d8d9f1 100644 --- a/xserver/dbe/midbestr.h +++ b/xserver/dbe/midbestr.h @@ -48,11 +48,6 @@ #define MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin)\ MI_DBE_WINDOW_PRIV_PRIV(DBE_WINDOW_PRIV(pWin)) -#define MI_DBE_SCREEN_PRIV_PRIV(pDbeScreenPriv) \ - (!(pDbeScreenPriv) ? NULL : (MiDbeScreenPrivPrivPtr) \ - dixLookupPrivate(&(pDbeScreenPriv)->devPrivates, miDbeScreenPrivPrivKey)) - - /* TYPEDEFS */ typedef struct _MiDbeWindowPrivPrivRec @@ -80,16 +75,5 @@ typedef struct _MiDbeWindowPrivPrivRec } MiDbeWindowPrivPrivRec, *MiDbeWindowPrivPrivPtr; -typedef struct _MiDbeScreenPrivPrivRec -{ - /* Place machine-specific fields in here. - * Since this is mi code, we do not really have machine-specific fields. - */ - - /* Pointer back to our screen private with which we are associated. */ - DbeScreenPrivPtr pDbeScreenPriv; - -} MiDbeScreenPrivPrivRec, *MiDbeScreenPrivPrivPtr; - #endif /* MIDBE_STRUCT_H */ |