summaryrefslogtreecommitdiff
path: root/xserver/dbe
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
commitdbca69c8a4f3e2d1ccb4f89152213b2861b33af6 (patch)
treef8963ef73903a7b4374adc2354dffbaa905112ac /xserver/dbe
parent33b2029f322f3c238b7ba528083195ad8dde33e1 (diff)
xserver 1.5.2. tested by ckuethe@, oga@, and others.
Diffstat (limited to 'xserver/dbe')
-rw-r--r--xserver/dbe/Makefile.in70
-rw-r--r--xserver/dbe/dbe.c267
-rw-r--r--xserver/dbe/dbestruct.h43
-rw-r--r--xserver/dbe/midbe.c78
-rw-r--r--xserver/dbe/midbestr.h12
5 files changed, 130 insertions, 340 deletions
diff --git a/xserver/dbe/Makefile.in b/xserver/dbe/Makefile.in
index c09416d26..2c5b91866 100644
--- a/xserver/dbe/Makefile.in
+++ b/xserver/dbe/Makefile.in
@@ -123,8 +123,6 @@ BSD_KQUEUE_APM_FALSE = @BSD_KQUEUE_APM_FALSE@
BSD_KQUEUE_APM_TRUE = @BSD_KQUEUE_APM_TRUE@
BUILDDOCS_FALSE = @BUILDDOCS_FALSE@
BUILDDOCS_TRUE = @BUILDDOCS_TRUE@
-BUILD_DARWIN_FALSE = @BUILD_DARWIN_FALSE@
-BUILD_DARWIN_TRUE = @BUILD_DARWIN_TRUE@
BUILD_DATE = @BUILD_DATE@
BUILD_IOPORT_FALSE = @BUILD_IOPORT_FALSE@
BUILD_IOPORT_TRUE = @BUILD_IOPORT_TRUE@
@@ -196,6 +194,10 @@ DMX_FALSE = @DMX_FALSE@
DMX_TRUE = @DMX_TRUE@
DPMSExtension_FALSE = @DPMSExtension_FALSE@
DPMSExtension_TRUE = @DPMSExtension_TRUE@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRI2_FALSE = @DRI2_FALSE@
+DRI2_TRUE = @DRI2_TRUE@
DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
DRIPROTO_LIBS = @DRIPROTO_LIBS@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
@@ -225,7 +227,7 @@ FREEBSD_KLDLOAD_FALSE = @FREEBSD_KLDLOAD_FALSE@
FREEBSD_KLDLOAD_TRUE = @FREEBSD_KLDLOAD_TRUE@
FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
FREETYPE_LIBS = @FREETYPE_LIBS@
-FREETYPE_REQUIRES = @FREETYPE_REQUIRES@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GLX_FALSE = @GLX_FALSE@
GLX_TRUE = @GLX_TRUE@
@@ -239,8 +241,8 @@ HAVE_AGL_FRAMEWORK_FALSE = @HAVE_AGL_FRAMEWORK_FALSE@
HAVE_AGL_FRAMEWORK_TRUE = @HAVE_AGL_FRAMEWORK_TRUE@
HAVE_DBUS_FALSE = @HAVE_DBUS_FALSE@
HAVE_DBUS_TRUE = @HAVE_DBUS_TRUE@
-HAVE_X_PLUGIN_FALSE = @HAVE_X_PLUGIN_FALSE@
-HAVE_X_PLUGIN_TRUE = @HAVE_X_PLUGIN_TRUE@
+HAVE_XPLUGIN_FALSE = @HAVE_XPLUGIN_FALSE@
+HAVE_XPLUGIN_TRUE = @HAVE_XPLUGIN_TRUE@
HP300_VIDEO_FALSE = @HP300_VIDEO_FALSE@
HP300_VIDEO_TRUE = @HP300_VIDEO_TRUE@
HPPA_VIDEO_FALSE = @HPPA_VIDEO_FALSE@
@@ -281,6 +283,9 @@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
KDRIVE_TRUE = @KDRIVE_TRUE@
+LAUNCHD = @LAUNCHD@
+LAUNCHD_FALSE = @LAUNCHD_FALSE@
+LAUNCHD_TRUE = @LAUNCHD_TRUE@
LDFLAGS = @LDFLAGS@
LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
LEX = @LEX@
@@ -335,6 +340,8 @@ OBJCFLAGS = @OBJCFLAGS@
OBJCLINK = @OBJCLINK@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -342,12 +349,11 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+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@
-PLIST_VENDOR_WEB = @PLIST_VENDOR_WEB@
-PLIST_VERSION_STRING = @PLIST_VERSION_STRING@
PPC_VIDEO_FALSE = @PPC_VIDEO_FALSE@
PPC_VIDEO_TRUE = @PPC_VIDEO_TRUE@
PROJECTROOT = @PROJECTROOT@
@@ -359,13 +365,12 @@ RECORD_FALSE = @RECORD_FALSE@
RECORD_TRUE = @RECORD_TRUE@
RES_FALSE = @RES_FALSE@
RES_TRUE = @RES_TRUE@
-RGB_DB = @RGB_DB@
SCREENSAVER_FALSE = @SCREENSAVER_FALSE@
SCREENSAVER_TRUE = @SCREENSAVER_TRUE@
SECURE_RPC_FALSE = @SECURE_RPC_FALSE@
SECURE_RPC_TRUE = @SECURE_RPC_TRUE@
SED = @SED@
-SERVERCONFIGdir = @SERVERCONFIGdir@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SGI_VIDEO_FALSE = @SGI_VIDEO_FALSE@
SGI_VIDEO_TRUE = @SGI_VIDEO_TRUE@
@@ -381,20 +386,21 @@ SPARC64_VIDEO_TRUE = @SPARC64_VIDEO_TRUE@
STRIP = @STRIP@
SUN_KBD_MODE_FALSE = @SUN_KBD_MODE_FALSE@
SUN_KBD_MODE_TRUE = @SUN_KBD_MODE_TRUE@
-SYS_LIBS = @SYS_LIBS@
TSLIB_CFLAGS = @TSLIB_CFLAGS@
TSLIB_FALSE = @TSLIB_FALSE@
TSLIB_LIBS = @TSLIB_LIBS@
TSLIB_TRUE = @TSLIB_TRUE@
USE_CURSES_FALSE = @USE_CURSES_FALSE@
USE_CURSES_TRUE = @USE_CURSES_TRUE@
-USE_RGB_BUILTIN_FALSE = @USE_RGB_BUILTIN_FALSE@
-USE_RGB_BUILTIN_TRUE = @USE_RGB_BUILTIN_TRUE@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
VENDOR_NAME = @VENDOR_NAME@
VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
VENDOR_RELEASE = @VENDOR_RELEASE@
VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11APP_FALSE = @X11APP_FALSE@
+X11APP_TRUE = @X11APP_TRUE@
X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
XACE_FALSE = @XACE_FALSE@
@@ -411,18 +417,22 @@ XDMCP_LIBS = @XDMCP_LIBS@
XDMCP_TRUE = @XDMCP_TRUE@
XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
-XEGLMODULES_LIBS = @XEGLMODULES_LIBS@
XEGL_FALSE = @XEGL_FALSE@
XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
XEGL_TRUE = @XEGL_TRUE@
XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
XEPHYR_FALSE = @XEPHYR_FALSE@
+XEPHYR_HAS_DRI_FALSE = @XEPHYR_HAS_DRI_FALSE@
+XEPHYR_HAS_DRI_TRUE = @XEPHYR_HAS_DRI_TRUE@
XEPHYR_INCS = @XEPHYR_INCS@
XEPHYR_LIBS = @XEPHYR_LIBS@
XEPHYR_TRUE = @XEPHYR_TRUE@
-XERRORDB_PATH = @XERRORDB_PATH@
XEVIE_FALSE = @XEVIE_FALSE@
XEVIE_TRUE = @XEVIE_TRUE@
XF86BIGFONT_FALSE = @XF86BIGFONT_FALSE@
@@ -446,10 +456,12 @@ XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
XGLX_FALSE = @XGLX_FALSE@
XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
XGLX_TRUE = @XGLX_TRUE@
XGL_FALSE = @XGL_FALSE@
XGL_LIBS = @XGL_LIBS@
XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
XGL_TRUE = @XGL_TRUE@
XINERAMA_FALSE = @XINERAMA_FALSE@
XINERAMA_TRUE = @XINERAMA_TRUE@
@@ -463,19 +475,18 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
XNEST_FALSE = @XNEST_FALSE@
XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
XNEST_TRUE = @XNEST_TRUE@
XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
-XORG_BUS_FREEBSDPCI_FALSE = @XORG_BUS_FREEBSDPCI_FALSE@
-XORG_BUS_FREEBSDPCI_TRUE = @XORG_BUS_FREEBSDPCI_TRUE@
+XORG_BUS_BSDPCI_FALSE = @XORG_BUS_BSDPCI_FALSE@
+XORG_BUS_BSDPCI_TRUE = @XORG_BUS_BSDPCI_TRUE@
XORG_BUS_IX86PCI_FALSE = @XORG_BUS_IX86PCI_FALSE@
XORG_BUS_IX86PCI_TRUE = @XORG_BUS_IX86PCI_TRUE@
XORG_BUS_LINUXPCI_FALSE = @XORG_BUS_LINUXPCI_FALSE@
XORG_BUS_LINUXPCI_TRUE = @XORG_BUS_LINUXPCI_TRUE@
-XORG_BUS_NETBSDPCI_FALSE = @XORG_BUS_NETBSDPCI_FALSE@
-XORG_BUS_NETBSDPCI_TRUE = @XORG_BUS_NETBSDPCI_TRUE@
XORG_BUS_PPCPCI_FALSE = @XORG_BUS_PPCPCI_FALSE@
XORG_BUS_PPCPCI_TRUE = @XORG_BUS_PPCPCI_TRUE@
XORG_BUS_SPARCPCI_FALSE = @XORG_BUS_SPARCPCI_FALSE@
@@ -483,7 +494,6 @@ XORG_BUS_SPARCPCI_TRUE = @XORG_BUS_SPARCPCI_TRUE@
XORG_BUS_SPARC_FALSE = @XORG_BUS_SPARC_FALSE@
XORG_BUS_SPARC_TRUE = @XORG_BUS_SPARC_TRUE@
XORG_CFLAGS = @XORG_CFLAGS@
-XORG_CORE_LIBS = @XORG_CORE_LIBS@
XORG_FALSE = @XORG_FALSE@
XORG_INCS = @XORG_INCS@
XORG_LIBS = @XORG_LIBS@
@@ -493,23 +503,31 @@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
XORG_OS = @XORG_OS@
XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
XORG_TRUE = @XORG_TRUE@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
XPRINT_CFLAGS = @XPRINT_CFLAGS@
XPRINT_FALSE = @XPRINT_FALSE@
XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
XPRINT_TRUE = @XPRINT_TRUE@
XP_USE_FREETYPE_FALSE = @XP_USE_FREETYPE_FALSE@
XP_USE_FREETYPE_TRUE = @XP_USE_FREETYPE_TRUE@
XQUARTZ_FALSE = @XQUARTZ_FALSE@
XQUARTZ_TRUE = @XQUARTZ_TRUE@
+XREGISTRY_FALSE = @XREGISTRY_FALSE@
+XREGISTRY_TRUE = @XREGISTRY_TRUE@
XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
XSDLSERVER_FALSE = @XSDLSERVER_FALSE@
XSDLSERVER_TRUE = @XSDLSERVER_TRUE@
XSDL_INCS = @XSDL_INCS@
XSDL_LIBS = @XSDL_LIBS@
+XSELINUX_FALSE = @XSELINUX_FALSE@
+XSELINUX_TRUE = @XSELINUX_TRUE@
XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
@@ -517,12 +535,14 @@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
XSERVER_DTRACE_FALSE = @XSERVER_DTRACE_FALSE@
XSERVER_DTRACE_TRUE = @XSERVER_DTRACE_TRUE@
XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
XTRAP_FALSE = @XTRAP_FALSE@
XTRAP_TRUE = @XTRAP_TRUE@
XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
XVFB_FALSE = @XVFB_FALSE@
XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
XVFB_TRUE = @XVFB_TRUE@
XVMC_FALSE = @XVMC_FALSE@
XVMC_TRUE = @XVMC_TRUE@
@@ -547,7 +567,7 @@ XWIN_PRIMARYFB_TRUE = @XWIN_PRIMARYFB_TRUE@
XWIN_RANDR_FALSE = @XWIN_RANDR_FALSE@
XWIN_RANDR_TRUE = @XWIN_RANDR_TRUE@
XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
-XWIN_SYSTEM_LIBS = @XWIN_SYSTEM_LIBS@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
XWIN_TRUE = @XWIN_TRUE@
XWIN_XV_FALSE = @XWIN_XV_FALSE@
XWIN_XV_TRUE = @XWIN_XV_TRUE@
@@ -555,6 +575,11 @@ X_PRIVSEP_FALSE = @X_PRIVSEP_FALSE@
X_PRIVSEP_TRUE = @X_PRIVSEP_TRUE@
YACC = @YACC@
__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
ac_ct_AR = @ac_ct_AR@
ac_ct_AS = @ac_ct_AS@
ac_ct_CC = @ac_ct_CC@
@@ -597,6 +622,7 @@ host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
diff --git a/xserver/dbe/dbe.c b/xserver/dbe/dbe.c
index b90100aff..d34708d38 100644
--- a/xserver/dbe/dbe.c
+++ b/xserver/dbe/dbe.c
@@ -54,23 +54,21 @@
#define NEED_DBE_PROTOCOL
#include "dbestruct.h"
#include "midbe.h"
+#include "xace.h"
/* GLOBALS */
/* Per-screen initialization functions [init'ed by DbeRegisterFunction()] */
-static Bool (* DbeInitFunct[MAXSCREENS])(); /* pScreen, pDbeScreenPriv */
+static Bool (* DbeInitFunct[MAXSCREENS])(); /* pScreen, pDbeScreenPriv */
/* These are static globals copied to DBE's screen private for use by DDX */
-static int dbeScreenPrivIndex;
-static int dbeWindowPrivIndex;
+static DevPrivateKey dbeScreenPrivKey = &dbeScreenPrivKey;
+static DevPrivateKey dbeWindowPrivKey = &dbeWindowPrivKey;
/* These are static globals copied to DBE's screen private for use by DDX */
static RESTYPE dbeDrawableResType;
static RESTYPE dbeWindowPrivResType;
-/* This global is used by DbeAllocWinPrivPrivIndex() */
-static int winPrivPrivCount = 0;
-
/* Used to generate DBE's BadBuffer error. */
static int dbeErrorBase;
@@ -115,146 +113,6 @@ DbeRegisterFunction(ScreenPtr pScreen, Bool (*funct) (/* ??? */))
/******************************************************************************
*
- * DBE DIX Procedure: DbeAllocWinPriv
- *
- * Description:
- *
- * This function was cloned from AllocateWindow() in window.c.
- * This function allocates a window priv structure to be associated
- * with a double-buffered window.
- *
- *****************************************************************************/
-static DbeWindowPrivPtr
-DbeAllocWinPriv(ScreenPtr pScreen)
-{
- DbeWindowPrivPtr pDbeWindowPriv;
- DbeScreenPrivPtr pDbeScreenPriv;
- register char *ptr;
- register DevUnion *ppriv;
- register unsigned int *sizes;
- register unsigned int size;
- register int i;
-
- pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
- pDbeWindowPriv = (DbeWindowPrivPtr)xalloc(pDbeScreenPriv->totalWinPrivSize);
-
- if (pDbeWindowPriv)
- {
- ppriv = (DevUnion *)(pDbeWindowPriv + 1);
- pDbeWindowPriv->devPrivates = ppriv;
- sizes = pDbeScreenPriv->winPrivPrivSizes;
- ptr = (char *)(ppriv + pDbeScreenPriv->winPrivPrivLen);
- for (i = pDbeScreenPriv->winPrivPrivLen; --i >= 0; ppriv++, sizes++)
- {
- if ((size = *sizes))
- {
- ppriv->ptr = (pointer)ptr;
- ptr += size;
- }
- else
- ppriv->ptr = (pointer)NULL;
- }
- }
-
- return(pDbeWindowPriv);
-
-} /* DbeAllocWinPriv() */
-
-
-/******************************************************************************
- *
- * DBE DIX Procedure: DbeFallbackAllocWinPriv
- *
- * Description:
- *
- * This is a fallback function for AllocWinPriv().
- *
- *****************************************************************************/
-
-#if 0 /* NOT USED */
-static DbeWindowPrivPtr
-DbeFallbackAllocWinPriv(pScreen)
- ScreenPtr pScreen;
-{
- return (NULL);
-} /* DbeFallbackAllocWinPriv() */
-#endif
-
-
-/******************************************************************************
- *
- * DBE DIX Procedure: DbeAllocWinPrivPrivIndex
- *
- * Description:
- *
- * This function was cloned from AllocateWindowPrivateIndex() in window.c.
- * This function allocates a new window priv priv index by simply returning
- * an incremented private counter.
- *
- *****************************************************************************/
-
-static int
-DbeAllocWinPrivPrivIndex(void)
-{
- return winPrivPrivCount++;
-
-} /* DbeAllocWinPrivPrivIndex() */
-
-
-/******************************************************************************
- *
- * DBE DIX Procedure: DbeAllocWinPrivPriv
- *
- * Description:
- *
- * This function was cloned from AllocateWindowPrivate() in privates.c.
- * This function allocates a private structure to be hung off
- * a window private.
- *
- *****************************************************************************/
-
-static Bool
-DbeAllocWinPrivPriv(register ScreenPtr pScreen, int index, unsigned int amount)
-{
- DbeScreenPrivPtr pDbeScreenPriv;
- unsigned int oldamount;
-
-
- pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
-
- if (index >= pDbeScreenPriv->winPrivPrivLen)
- {
- unsigned *nsizes;
- nsizes = (unsigned *)xrealloc(pDbeScreenPriv->winPrivPrivSizes,
- (index + 1) * sizeof(unsigned));
- if (!nsizes)
- {
- return(FALSE);
- }
-
- while (pDbeScreenPriv->winPrivPrivLen <= index)
- {
- nsizes[pDbeScreenPriv->winPrivPrivLen++] = 0;
- pDbeScreenPriv->totalWinPrivSize += sizeof(DevUnion);
- }
-
- pDbeScreenPriv->winPrivPrivSizes = nsizes;
- }
-
- oldamount = pDbeScreenPriv->winPrivPrivSizes[index];
-
- if (amount > oldamount)
- {
- pDbeScreenPriv->winPrivPrivSizes[index] = amount;
- pDbeScreenPriv->totalWinPrivSize += (amount - oldamount);
- }
- return(TRUE);
-
-} /* DbeAllocWinPrivPriv() */
-
-
-/******************************************************************************
- *
* DBE DIX Procedure: DbeStubScreen
*
* Description:
@@ -269,9 +127,6 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens)
{
/* Stub DIX. */
pDbeScreenPriv->SetupBackgroundPainter = NULL;
- pDbeScreenPriv->AllocWinPriv = NULL;
- pDbeScreenPriv->AllocWinPrivPrivIndex = NULL;
- pDbeScreenPriv->AllocWinPrivPriv = NULL;
/* Do not unwrap PositionWindow nor DestroyWindow. If the DDX
* initialization function failed, we assume that it did not wrap
@@ -376,10 +231,11 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
int status;
int add_index;
+
REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
/* The window must be valid. */
- status = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+ status = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
if (status != Success)
return status;
@@ -439,11 +295,10 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
* Allocate a window priv.
*/
- if (!(pDbeWindowPriv =
- (*pDbeScreenPriv->AllocWinPriv)(pWin->drawable.pScreen)))
- {
+ pDbeWindowPriv = (DbeWindowPrivPtr)xalloc(sizeof(DbeWindowPrivRec));
+ if (!pDbeWindowPriv)
return(BadAlloc);
- }
+ bzero(pDbeWindowPriv, sizeof(DbeWindowPrivRec));
/* Fill out window priv information. */
pDbeWindowPriv->pWindow = pWin;
@@ -458,15 +313,16 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
/* Initialize the buffer ID list. */
pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS;
-
- add_index = 0;
- for (i = 1; i < DBE_INIT_MAX_IDS; i++)
- {
+ pDbeWindowPriv->IDs[0] = stuff->buffer;
+
+ add_index = 0;
+ for (i = 0; i < DBE_INIT_MAX_IDS; i++)
+ {
pDbeWindowPriv->IDs[i] = DBE_FREE_ID_ELEMENT;
}
/* Actually connect the window priv to the window. */
- pWin->devPrivates[dbeWindowPrivIndex].ptr = (pointer)pDbeWindowPriv;
+ dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, pDbeWindowPriv);
} /* if -- There is no buffer associated with the window. */
@@ -492,7 +348,6 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
/* No more room in the ID array -- reallocate another array. */
XID *pIDs;
-
/* Setup an array pointer for the realloc operation below. */
if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS)
{
@@ -529,7 +384,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
pDbeWindowPriv->maxAvailableIDs += DBE_INCR_MAX_IDS;
}
- add_index = i;
+ add_index = i;
} /* else -- A buffer is already associated with the window. */
@@ -540,10 +395,10 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
if (status == Success)
{
- pDbeWindowPriv->IDs[add_index] = stuff->buffer;
+ pDbeWindowPriv->IDs[add_index] = stuff->buffer;
if (!AddResource(stuff->buffer, dbeWindowPrivResType,
(pointer)pDbeWindowPriv))
- {
+ {
pDbeWindowPriv->IDs[add_index] = DBE_FREE_ID_ELEMENT;
if (pDbeWindowPriv->nBufferIDs == 0) {
@@ -555,7 +410,6 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
/* The DDX buffer allocation routine failed for the first buffer of
* this window.
*/
-
if (pDbeWindowPriv->nBufferIDs == 0) {
goto out_free;
}
@@ -567,13 +421,12 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
/* Set swap action on all calls. */
pDbeWindowPriv->swapAction = stuff->swapAction;
-
return(status);
out_free:
- pWin->devPrivates[dbeWindowPrivIndex].ptr = NULL;
+ dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, NULL);
xfree(pDbeWindowPriv);
- return(status);
+ return (status);
} /* ProcDbeAllocateBackBufferName() */
@@ -869,7 +722,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
for (i = 0; i < stuff->n; i++)
{
rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0,
- DixReadAccess);
+ DixGetAttrAccess);
if (rc != Success) {
Xfree(pDrawables);
return rc;
@@ -897,7 +750,9 @@ ProcDbeGetVisualInfo(ClientPtr client)
pDrawables[i]->pScreen;
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
- if (!(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i]))
+ rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
+ if ((rc != Success) ||
+ !(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i]))
{
/* We failed to alloc pScrVisInfo[i].visinfo. */
@@ -913,7 +768,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
Xfree(pDrawables);
}
- return(BadAlloc);
+ return (rc == Success) ? BadAlloc : rc;
}
/* Account for n, number of xDbeVisInfo items in list. */
@@ -1026,7 +881,7 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client,
- stuff->buffer, dbeWindowPrivResType, DixReadAccess)))
+ stuff->buffer, dbeWindowPrivResType, DixGetAttrAccess)))
{
rep.attributes = None;
}
@@ -1594,10 +1449,11 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
if (pDbeWindowPriv->nBufferIDs == 0)
{
/* Reset the DBE window priv pointer. */
- pDbeWindowPriv->pWindow->devPrivates[dbeWindowPrivIndex].ptr =
- (pointer)NULL;
+ dixSetPrivate(&pDbeWindowPriv->pWindow->devPrivates, dbeWindowPrivKey,
+ NULL);
/* We are done with the window priv. */
+ dixFreePrivates(pDbeWindowPriv->devPrivates);
xfree(pDbeWindowPriv);
}
@@ -1624,12 +1480,6 @@ DbeResetProc(ExtensionEntry *extEntry)
ScreenPtr pScreen;
DbeScreenPrivPtr pDbeScreenPriv;
-
- if (dbeScreenPrivIndex < 0)
- {
- return;
- }
-
for (i = 0; i < screenInfo.numScreens; i++)
{
pScreen = screenInfo.screens[i];
@@ -1643,11 +1493,7 @@ DbeResetProc(ExtensionEntry *extEntry)
if (pDbeScreenPriv->ResetProc)
(*pDbeScreenPriv->ResetProc)(pScreen);
- if (pDbeScreenPriv->winPrivPrivSizes)
- {
- xfree(pDbeScreenPriv->winPrivPrivSizes);
- }
-
+ dixFreePrivates(pDbeScreenPriv->devPrivates);
xfree(pDbeScreenPriv);
}
}
@@ -1768,26 +1614,14 @@ DbeExtensionInit(void)
if(!noPanoramiXExtension) return;
#endif
- /* Allocate private pointers in windows and screens. */
-
- if ((dbeScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
- {
- return;
- }
-
- if ((dbeWindowPrivIndex = AllocateWindowPrivateIndex()) < 0)
- {
- return;
- }
-
- /* Initialize the priv priv counts between server generations. */
- winPrivPrivCount = 0;
-
/* Create the resource types. */
dbeDrawableResType =
- CreateNewResourceType(DbeDrawableDelete) | RC_CACHED | RC_DRAWABLE;
+ CreateNewResourceType(DbeDrawableDelete) | RC_DRAWABLE;
dbeWindowPrivResType =
CreateNewResourceType(DbeWindowPrivDelete);
+ if (!dixRegisterPrivateOffset(dbeDrawableResType,
+ offsetof(PixmapRec, devPrivates)))
+ return;
for (i = 0; i < screenInfo.numScreens; i++)
{
@@ -1797,8 +1631,7 @@ DbeExtensionInit(void)
pScreen = screenInfo.screens[i];
- if (!AllocateWindowPrivate(pScreen, dbeWindowPrivIndex, 0) ||
- !(pDbeScreenPriv =
+ if (!(pDbeScreenPriv =
(DbeScreenPrivPtr)Xcalloc(sizeof(DbeScreenPrivRec))))
{
/* If we can not alloc a window or screen private,
@@ -1807,28 +1640,23 @@ DbeExtensionInit(void)
for (j = 0; j < i; j++)
{
- xfree(screenInfo.screens[j]->devPrivates[dbeScreenPrivIndex].ptr);
- screenInfo.screens[j]->devPrivates[dbeScreenPrivIndex].ptr = NULL;
+ xfree(dixLookupPrivate(&screenInfo.screens[j]->devPrivates,
+ dbeScreenPrivKey));
+ dixSetPrivate(&screenInfo.screens[j]->devPrivates,
+ dbeScreenPrivKey, NULL);
}
return;
}
- pScreen->devPrivates[dbeScreenPrivIndex].ptr = (pointer)pDbeScreenPriv;
-
- /* Store the DBE priv priv size info for later use when allocating
- * priv privs at the driver level.
- */
- pDbeScreenPriv->winPrivPrivLen = 0;
- pDbeScreenPriv->winPrivPrivSizes = (unsigned *)NULL;
- pDbeScreenPriv->totalWinPrivSize = sizeof(DbeWindowPrivRec);
+ dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, pDbeScreenPriv);
/* Copy the resource types */
pDbeScreenPriv->dbeDrawableResType = dbeDrawableResType;
pDbeScreenPriv->dbeWindowPrivResType = dbeWindowPrivResType;
/* Copy the private indices */
- pDbeScreenPriv->dbeScreenPrivIndex = dbeScreenPrivIndex;
- pDbeScreenPriv->dbeWindowPrivIndex = dbeWindowPrivIndex;
+ pDbeScreenPriv->dbeScreenPrivKey = dbeScreenPrivKey;
+ pDbeScreenPriv->dbeWindowPrivKey = dbeWindowPrivKey;
if(DbeInitFunct[i])
{
@@ -1836,9 +1664,6 @@ DbeExtensionInit(void)
/* Setup DIX. */
pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter;
- pDbeScreenPriv->AllocWinPriv = DbeAllocWinPriv;
- pDbeScreenPriv->AllocWinPrivPrivIndex = DbeAllocWinPrivPrivIndex;
- pDbeScreenPriv->AllocWinPrivPriv = DbeAllocWinPrivPriv;
/* Setup DDX. */
ddxInitSuccess = (*DbeInitFunct[i])(pScreen, pDbeScreenPriv);
@@ -1870,9 +1695,6 @@ DbeExtensionInit(void)
#ifndef DISABLE_MI_DBE_BY_DEFAULT
/* Setup DIX. */
pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter;
- pDbeScreenPriv->AllocWinPriv = DbeAllocWinPriv;
- pDbeScreenPriv->AllocWinPrivPrivIndex = DbeAllocWinPrivPrivIndex;
- pDbeScreenPriv->AllocWinPrivPriv = DbeAllocWinPrivPriv;
/* Setup DDX. */
ddxInitSuccess = miDbeInit(pScreen, pDbeScreenPriv);
@@ -1911,8 +1733,9 @@ DbeExtensionInit(void)
for (i = 0; i < screenInfo.numScreens; i++)
{
- xfree(screenInfo.screens[i]->devPrivates[dbeScreenPrivIndex].ptr);
- pScreen->devPrivates[dbeScreenPrivIndex].ptr = NULL;
+ xfree(dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
+ dbeScreenPrivKey));
+ dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, NULL);
}
return;
}
diff --git a/xserver/dbe/dbestruct.h b/xserver/dbe/dbestruct.h
index 460cc7564..7d5a115ad 100644
--- a/xserver/dbe/dbestruct.h
+++ b/xserver/dbe/dbestruct.h
@@ -29,7 +29,6 @@
* Header file for DIX-related DBE
*
*****************************************************************************/
-/* $XFree86$ */
#ifndef DBE_STRUCT_H
#define DBE_STRUCT_H
@@ -40,14 +39,13 @@
#define NEED_DBE_PROTOCOL
#include <X11/extensions/Xdbeproto.h>
#include "windowstr.h"
+#include "privates.h"
/* DEFINES */
-#define DBE_SCREEN_PRIV(pScreen) \
- ((dbeScreenPrivIndex < 0) ? \
- NULL : \
- ((DbeScreenPrivPtr)((pScreen)->devPrivates[dbeScreenPrivIndex].ptr)))
+#define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey))
#define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \
DBE_SCREEN_PRIV((pDrawable)->pScreen)
@@ -64,10 +62,8 @@
#define DBE_SCREEN_PRIV_FROM_GC(pGC)\
DBE_SCREEN_PRIV((pGC)->pScreen)
-#define DBE_WINDOW_PRIV(pWindow)\
- ((dbeWindowPrivIndex < 0) ? \
- NULL : \
- ((DbeWindowPrivPtr)(pWindow->devPrivates[dbeWindowPrivIndex].ptr)))
+#define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey))
/* Initial size of the buffer ID array in the window priv. */
#define DBE_INIT_MAX_IDS 2
@@ -143,7 +139,7 @@ typedef struct _DbeWindowPrivRec
/* Device-specific private information.
*/
- DevUnion *devPrivates;
+ PrivateRec *devPrivates;
} DbeWindowPrivRec, *DbeWindowPrivPtr;
@@ -156,18 +152,13 @@ typedef struct _DbeWindowPrivRec
typedef struct _DbeScreenPrivRec
{
- /* Info for creating window privs */
- int winPrivPrivLen; /* Length of privs in DbeWindowPrivRec */
- unsigned int *winPrivPrivSizes; /* Array of private record sizes */
- unsigned int totalWinPrivSize; /* PrivRec + size of all priv priv ptrs */
-
/* Resources created by DIX to be used by DDX */
RESTYPE dbeDrawableResType;
RESTYPE dbeWindowPrivResType;
/* Private indices created by DIX to be used by DDX */
- int dbeScreenPrivIndex;
- int dbeWindowPrivIndex;
+ DevPrivateKey dbeScreenPrivKey;
+ DevPrivateKey dbeWindowPrivKey;
/* Wrapped functions
* It is the responsibilty of the DDX layer to wrap PositionWindow().
@@ -181,17 +172,6 @@ typedef struct _DbeScreenPrivRec
WindowPtr /*pWin*/,
GCPtr /*pGC*/
);
- DbeWindowPrivPtr (*AllocWinPriv)(
- ScreenPtr /*pScreen*/
-);
- int (*AllocWinPrivPrivIndex)(
- void
-);
- Bool (*AllocWinPrivPriv)(
- ScreenPtr /*pScreen*/,
- int /*index*/,
- unsigned /*amount*/
-);
/* Per-screen DDX routines */
Bool (*GetVisualInfo)(
@@ -221,15 +201,10 @@ typedef struct _DbeScreenPrivRec
void (*ResetProc)(
ScreenPtr /*pScreen*/
);
- void (*ValidateBuffer)(
- WindowPtr /*pWin*/,
- XID /*bufId*/,
- Bool /*dstbuffer*/
-);
/* Device-specific private information.
*/
- DevUnion *devPrivates;
+ PrivateRec *devPrivates;
} DbeScreenPrivRec, *DbeScreenPrivPtr;
diff --git a/xserver/dbe/midbe.c b/xserver/dbe/midbe.c
index e687b98b7..c02e591d0 100644
--- a/xserver/dbe/midbe.c
+++ b/xserver/dbe/midbe.c
@@ -56,24 +56,15 @@
#include "gcstruct.h"
#include "inputstr.h"
#include "midbe.h"
+#include "xace.h"
#include <stdio.h>
-/* DEFINES */
-
-
-/* TYPEDEFS */
-
-
-/* GLOBALS */
-
-static int miDbePrivPrivGeneration = 0;
-static int miDbeWindowPrivPrivIndex = -1;
-RESTYPE dbeDrawableResType;
-RESTYPE dbeWindowPrivResType;
-int dbeScreenPrivIndex = -1;
-int dbeWindowPrivIndex = -1;
-
+static DevPrivateKey miDbeWindowPrivPrivKey = &miDbeWindowPrivPrivKey;
+static RESTYPE dbeDrawableResType;
+static RESTYPE dbeWindowPrivResType;
+static DevPrivateKey dbeScreenPrivKey = &dbeScreenPrivKey;
+static DevPrivateKey dbeWindowPrivKey = &dbeWindowPrivKey;
/******************************************************************************
@@ -163,6 +154,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
DbeScreenPrivPtr pDbeScreenPriv;
GCPtr pGC;
xRectangle clearRect;
+ int rc;
pScreen = pWin->drawable.pScreen;
@@ -186,7 +178,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
if (!(pDbeWindowPrivPriv->pFrontBuffer =
(*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width,
pDbeWindowPriv->height,
- pWin->drawable.depth)))
+ pWin->drawable.depth, 0)))
{
return(BadAlloc);
}
@@ -195,26 +187,30 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
if (!(pDbeWindowPrivPriv->pBackBuffer =
(*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width,
pDbeWindowPriv->height,
- pWin->drawable.depth)))
+ pWin->drawable.depth, 0)))
{
(*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer);
return(BadAlloc);
}
+ /* Security creation/labeling check. */
+ rc = XaceHook(XACE_RESOURCE_ACCESS, serverClient, bufId,
+ dbeDrawableResType, pDbeWindowPrivPriv->pBackBuffer,
+ RT_WINDOW, pWin, DixCreateAccess);
/* Make the back pixmap a DBE drawable resource. */
- if (!AddResource(bufId, dbeDrawableResType,
- (pointer)pDbeWindowPrivPriv->pBackBuffer))
+ if (rc != Success || !AddResource(bufId, dbeDrawableResType,
+ pDbeWindowPrivPriv->pBackBuffer))
{
/* free the buffer and the drawable resource */
FreeResource(bufId, RT_NONE);
- return(BadAlloc);
+ return (rc == Success) ? BadAlloc : rc;
}
/* Attach the priv priv to the priv. */
- pDbeWindowPriv->devPrivates[miDbeWindowPrivPrivIndex].ptr =
- (pointer)pDbeWindowPrivPriv;
+ dixSetPrivate(&pDbeWindowPriv->devPrivates, miDbeWindowPrivPrivKey,
+ pDbeWindowPrivPriv);
/* Clear the back buffer. */
@@ -657,10 +653,10 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
/* Create DBE buffer pixmaps equal to size of resized window. */
pFrontBuffer = (*pScreen->CreatePixmap)(pScreen, width, height,
- pWin->drawable.depth);
+ pWin->drawable.depth, 0);
pBackBuffer = (*pScreen->CreatePixmap)(pScreen, width, height,
- pWin->drawable.depth);
+ pWin->drawable.depth, 0);
if (!pFrontBuffer || !pBackBuffer)
{
@@ -768,11 +764,6 @@ miDbeResetProc(ScreenPtr pScreen)
} /* miDbeResetProc() */
-static void
-miDbeNopValidateBuffer(WindowPtr pWin, XID bufId, Bool dstbuffer)
-{
-}
-
/******************************************************************************
*
@@ -792,30 +783,12 @@ miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv)
dbeWindowPrivResType = pDbeScreenPriv->dbeWindowPrivResType;
/* Copy private indices created by DIX */
- dbeScreenPrivIndex = pDbeScreenPriv->dbeScreenPrivIndex;
- dbeWindowPrivIndex = pDbeScreenPriv->dbeWindowPrivIndex;
-
- /* Reset the window priv privs if generations do not match. */
- if (miDbePrivPrivGeneration != serverGeneration)
- {
- /*
- **********************************************************************
- ** Allocate the window priv priv.
- **********************************************************************
- */
-
- miDbeWindowPrivPrivIndex = (*pDbeScreenPriv->AllocWinPrivPrivIndex)();
+ dbeScreenPrivKey = pDbeScreenPriv->dbeScreenPrivKey;
+ dbeWindowPrivKey = pDbeScreenPriv->dbeWindowPrivKey;
- /* Make sure we only do this code once. */
- miDbePrivPrivGeneration = serverGeneration;
-
- } /* if -- Reset priv privs. */
-
- if (!(*pDbeScreenPriv->AllocWinPrivPriv)(pScreen,
- miDbeWindowPrivPrivIndex, sizeof(MiDbeWindowPrivPrivRec)))
- {
+ if (!dixRequestPrivate(miDbeWindowPrivPrivKey,
+ sizeof(MiDbeWindowPrivPrivRec)))
return(FALSE);
- }
/* Wrap functions. */
pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
@@ -830,9 +803,6 @@ miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv)
pDbeScreenPriv->ResetProc = miDbeResetProc;
pDbeScreenPriv->WinPrivDelete = miDbeWinPrivDelete;
- /* The mi implementation doesn't need buffer validation. */
- pDbeScreenPriv->ValidateBuffer = miDbeNopValidateBuffer;
-
return(TRUE);
} /* miDbeInit() */
diff --git a/xserver/dbe/midbestr.h b/xserver/dbe/midbestr.h
index 1ad0104aa..ae9f206fc 100644
--- a/xserver/dbe/midbestr.h
+++ b/xserver/dbe/midbestr.h
@@ -42,19 +42,15 @@
/* DEFINES */
#define MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv) \
- (((miDbeWindowPrivPrivIndex < 0) || (!pDbeWindowPriv)) ? \
- NULL : \
- ((MiDbeWindowPrivPrivPtr) \
- ((pDbeWindowPriv)->devPrivates[miDbeWindowPrivPrivIndex].ptr)))
+ (!(pDbeWindowPriv) ? NULL : (MiDbeWindowPrivPrivPtr) \
+ dixLookupPrivate(&(pDbeWindowPriv)->devPrivates, miDbeWindowPrivPrivKey))
#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) \
- (((miDbeScreenPrivPrivIndex < 0) || (!pDbeScreenPriv)) ? \
- NULL : \
- ((MiDbeScreenPrivPrivPtr) \
- ((pDbeScreenPriv)->devPrivates[miDbeScreenPrivPrivIndex].ptr)))
+ (!(pDbeScreenPriv) ? NULL : (MiDbeScreenPrivPrivPtr) \
+ dixLookupPrivate(&(pDbeScreenPriv)->devPrivates, miDbeScreenPrivPrivKey))
/* TYPEDEFS */