aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xext
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/Xext')
-rw-r--r--xorg-server/Xext/Makefile.am279
-rw-r--r--xorg-server/Xext/geext.c6
-rw-r--r--xorg-server/Xext/geint.h105
-rw-r--r--xorg-server/Xext/panoramiX.c155
-rw-r--r--xorg-server/Xext/panoramiX.h163
-rw-r--r--xorg-server/Xext/panoramiXprocs.c317
-rw-r--r--xorg-server/Xext/panoramiXsrv.h109
-rw-r--r--xorg-server/Xext/saver.c25
-rw-r--r--xorg-server/Xext/security.c18
-rw-r--r--xorg-server/Xext/shape.c70
-rw-r--r--xorg-server/Xext/shm.c63
-rw-r--r--xorg-server/Xext/xace.c21
-rw-r--r--xorg-server/Xext/xf86bigfont.c2
-rw-r--r--xorg-server/Xext/xselinux_hooks.c15
-rw-r--r--xorg-server/Xext/xselinuxint.h9
-rw-r--r--xorg-server/Xext/xtest.c26
-rw-r--r--xorg-server/Xext/xvdisp.c68
-rw-r--r--xorg-server/Xext/xvmain.c15
-rw-r--r--xorg-server/Xext/xvmc.c23
19 files changed, 731 insertions, 758 deletions
diff --git a/xorg-server/Xext/Makefile.am b/xorg-server/Xext/Makefile.am
index fa007aa91..cdf8366c1 100644
--- a/xorg-server/Xext/Makefile.am
+++ b/xorg-server/Xext/Makefile.am
@@ -1,140 +1,139 @@
-# libXext.la: includes all extensions and should be linked into Xvfb,
-# Xnest, Xdmx and Xprt
-# libXextbuiltin.la: includes those extensions that are built directly into
-# Xorg by default
-# libXextmodule.la: includes those extensions that are built into a module
-# that Xorg loads
-if XORG
-noinst_LTLIBRARIES = libXext.la libXextbuiltin.la libXextmodule.la
-else
-noinst_LTLIBRARIES = libXext.la
-endif
-
-INCLUDES = -I$(top_srcdir)/hw/xfree86/dixmods/extmod
-
-AM_CFLAGS = $(DIX_CFLAGS)
-
-if XORG
-sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h
-endif
-
-# Sources always included in libXextbuiltin.la & libXext.la
-BUILTIN_SRCS = \
- bigreq.c \
- geext.c \
- shape.c \
- sleepuntil.c \
- sleepuntil.h \
- sync.c \
- syncsrv.h \
- xcmisc.c \
- xtest.c
-
-# Sources always included in libXextmodule.la & libXext.la. That's right, zero.
-MODULE_SRCS =
-MODULE_LIBS =
-
-# Optional sources included if extension enabled by configure.ac rules
-
-# MIT Shared Memory extension
-MITSHM_SRCS = shm.c shmint.h
-if MITSHM
-BUILTIN_SRCS += $(MITSHM_SRCS)
-endif
-
-# XVideo extension
-XV_SRCS = xvmain.c xvdisp.c xvmc.c xvdix.h xvmcext.h xvdisp.h
-if XV
-MODULE_SRCS += $(XV_SRCS)
-endif
-
-# XResource extension: lets clients get data about per-client resource usage
-RES_SRCS = xres.c
-if RES
-MODULE_SRCS += $(RES_SRCS)
-endif
-
-# MIT ScreenSaver extension
-SCREENSAVER_SRCS = saver.c
-if SCREENSAVER
-MODULE_SRCS += $(SCREENSAVER_SRCS)
-endif
-
-# Xinerama extension: making multiple video devices act as one virtual screen
-XINERAMA_SRCS = panoramiX.c panoramiX.h panoramiXh.h panoramiXsrv.h panoramiXprocs.c panoramiXSwap.c
-if XINERAMA
-BUILTIN_SRCS += $(XINERAMA_SRCS)
-if XORG
-sdk_HEADERS += panoramiXsrv.h panoramiX.h
-endif
-endif
-
-# X-ACE extension: provides hooks for building security policy extensions
-# like XC-Security, X-SELinux & XTSol
-XACE_SRCS = xace.c xace.h xacestr.h
-if XACE
-BUILTIN_SRCS += $(XACE_SRCS)
-if XORG
-sdk_HEADERS += xace.h xacestr.h
-endif
-endif
-
-# SELinux extension: provides SELinux policy support for X objects
-# requires X-ACE extension
-XSELINUX_SRCS = xselinux_ext.c xselinux_hooks.c xselinux_label.c xselinux.h xselinuxint.h
-if XSELINUX
-MODULE_SRCS += $(XSELINUX_SRCS)
-MODULE_LIBS += $(SELINUX_LIBS)
-endif
-
-# Security extension: multi-level security to protect clients from each other
-XCSECURITY_SRCS = security.c securitysrv.h
-if XCSECURITY
-BUILTIN_SRCS += $(XCSECURITY_SRCS)
-endif
-
-XCALIBRATE_SRCS = xcalibrate.c
-if XCALIBRATE
-BUILTIN_SRCS += $(XCALIBRATE_SRCS)
-# XCalibrate needs tslib
-endif
-
-# XF86 Big Font extension
-BIGFONT_SRCS = xf86bigfont.c xf86bigfontsrv.h
-if XF86BIGFONT
-BUILTIN_SRCS += $(BIGFONT_SRCS)
-endif
-
-# DPMS extension
-DPMS_SRCS = dpms.c dpmsproc.h
-if DPMSExtension
-MODULE_SRCS += $(DPMS_SRCS)
-endif
-
-# Now take all of the above, mix well, bake for 10 minutes and get libXext*.la
-
-libXext_la_SOURCES = $(BUILTIN_SRCS) $(MODULE_SRCS)
-libXext_la_LIBADD = $(MODULE_LIBS)
-
-if XORG
-libXextbuiltin_la_SOURCES = $(BUILTIN_SRCS)
-
-libXextmodule_la_SOURCES = $(MODULE_SRCS)
-libXextmodule_la_LIBADD = $(MODULE_LIBS)
-endif
-
-EXTRA_DIST = \
- $(MITSHM_SRCS) \
- $(XV_SRCS) \
- $(RES_SRCS) \
- $(SCREENSAVER_SRCS) \
- $(XACE_SRCS) \
- $(XCSECURITY_SRCS) \
- $(XSELINUX_SRCS) \
- $(XCALIBRATE_SRCS) \
- $(XINERAMA_SRCS) \
- $(FONTCACHE_SRCS) \
- $(BIGFONT_SRCS) \
- $(DPMS_SRCS) \
- $(GE_SRCS)
-
+# libXext.la: includes all extensions and should be linked into Xvfb,
+# Xnest, Xdmx and Xprt
+# libXextbuiltin.la: includes those extensions that are built directly into
+# Xorg by default
+# libXextmodule.la: includes those extensions that are built into a module
+# that Xorg loads
+if XORG
+noinst_LTLIBRARIES = libXext.la libXextbuiltin.la libXextmodule.la
+else
+noinst_LTLIBRARIES = libXext.la
+endif
+
+INCLUDES = -I$(top_srcdir)/hw/xfree86/dixmods/extmod
+
+AM_CFLAGS = $(DIX_CFLAGS)
+
+if XORG
+sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h
+endif
+
+# Sources always included in libXextbuiltin.la & libXext.la
+BUILTIN_SRCS = \
+ bigreq.c \
+ geext.c \
+ shape.c \
+ sleepuntil.c \
+ sleepuntil.h \
+ sync.c \
+ syncsrv.h \
+ xcmisc.c \
+ xtest.c
+
+# Sources always included in libXextmodule.la & libXext.la. That's right, zero.
+MODULE_SRCS =
+MODULE_LIBS =
+
+# Optional sources included if extension enabled by configure.ac rules
+
+# MIT Shared Memory extension
+MITSHM_SRCS = shm.c shmint.h
+if MITSHM
+BUILTIN_SRCS += $(MITSHM_SRCS)
+endif
+
+# XVideo extension
+XV_SRCS = xvmain.c xvdisp.c xvmc.c xvdix.h xvmcext.h xvdisp.h
+if XV
+MODULE_SRCS += $(XV_SRCS)
+endif
+
+# XResource extension: lets clients get data about per-client resource usage
+RES_SRCS = xres.c
+if RES
+MODULE_SRCS += $(RES_SRCS)
+endif
+
+# MIT ScreenSaver extension
+SCREENSAVER_SRCS = saver.c
+if SCREENSAVER
+MODULE_SRCS += $(SCREENSAVER_SRCS)
+endif
+
+# Xinerama extension: making multiple video devices act as one virtual screen
+XINERAMA_SRCS = panoramiX.c panoramiX.h panoramiXh.h panoramiXsrv.h panoramiXprocs.c panoramiXSwap.c
+if XINERAMA
+BUILTIN_SRCS += $(XINERAMA_SRCS)
+if XORG
+sdk_HEADERS += panoramiXsrv.h panoramiX.h
+endif
+endif
+
+# X-ACE extension: provides hooks for building security policy extensions
+# like XC-Security, X-SELinux & XTSol
+XACE_SRCS = xace.c xace.h xacestr.h
+if XACE
+BUILTIN_SRCS += $(XACE_SRCS)
+if XORG
+sdk_HEADERS += xace.h xacestr.h
+endif
+endif
+
+# SELinux extension: provides SELinux policy support for X objects
+# requires X-ACE extension
+XSELINUX_SRCS = xselinux_ext.c xselinux_hooks.c xselinux_label.c xselinux.h xselinuxint.h
+if XSELINUX
+MODULE_SRCS += $(XSELINUX_SRCS)
+MODULE_LIBS += $(SELINUX_LIBS)
+endif
+
+# Security extension: multi-level security to protect clients from each other
+XCSECURITY_SRCS = security.c securitysrv.h
+if XCSECURITY
+BUILTIN_SRCS += $(XCSECURITY_SRCS)
+endif
+
+XCALIBRATE_SRCS = xcalibrate.c
+if XCALIBRATE
+BUILTIN_SRCS += $(XCALIBRATE_SRCS)
+# XCalibrate needs tslib
+endif
+
+# XF86 Big Font extension
+BIGFONT_SRCS = xf86bigfont.c xf86bigfontsrv.h
+if XF86BIGFONT
+BUILTIN_SRCS += $(BIGFONT_SRCS)
+endif
+
+# DPMS extension
+DPMS_SRCS = dpms.c dpmsproc.h
+if DPMSExtension
+MODULE_SRCS += $(DPMS_SRCS)
+endif
+
+# Now take all of the above, mix well, bake for 10 minutes and get libXext*.la
+
+libXext_la_SOURCES = $(BUILTIN_SRCS) $(MODULE_SRCS)
+libXext_la_LIBADD = $(MODULE_LIBS)
+
+if XORG
+libXextbuiltin_la_SOURCES = $(BUILTIN_SRCS)
+
+libXextmodule_la_SOURCES = $(MODULE_SRCS)
+libXextmodule_la_LIBADD = $(MODULE_LIBS)
+endif
+
+EXTRA_DIST = \
+ $(MITSHM_SRCS) \
+ $(XV_SRCS) \
+ $(RES_SRCS) \
+ $(SCREENSAVER_SRCS) \
+ $(XACE_SRCS) \
+ $(XCSECURITY_SRCS) \
+ $(XSELINUX_SRCS) \
+ $(XCALIBRATE_SRCS) \
+ $(XINERAMA_SRCS) \
+ $(BIGFONT_SRCS) \
+ $(DPMS_SRCS) \
+ $(GE_SRCS)
+
diff --git a/xorg-server/Xext/geext.c b/xorg-server/Xext/geext.c
index 253c87bc9..be37843ec 100644
--- a/xorg-server/Xext/geext.c
+++ b/xorg-server/Xext/geext.c
@@ -36,12 +36,10 @@
#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
-static int GEClientPrivateKeyIndex;
-DevPrivateKey GEClientPrivateKey = &GEClientPrivateKeyIndex;
+DevPrivateKeyRec GEClientPrivateKeyRec;
int RT_GECLIENT = 0;
-
GEExtension GEExtensions[MAXEXTENSIONS];
/* Major available requests */
@@ -209,7 +207,7 @@ GEExtensionInit(void)
{
ExtensionEntry *extEntry;
- if (!dixRequestPrivate(GEClientPrivateKey, sizeof(GEClientInfoRec)))
+ if (!dixRegisterPrivateKey(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
FatalError("GEExtensionInit: GE private request failed.\n");
if(!AddCallback(&ClientStateCallback, GEClientCallback, 0))
diff --git a/xorg-server/Xext/geint.h b/xorg-server/Xext/geint.h
index 10a33cea3..5c64a20f4 100644
--- a/xorg-server/Xext/geint.h
+++ b/xorg-server/Xext/geint.h
@@ -1,52 +1,53 @@
-/*
- * Copyright 2007-2008 Peter Hutterer
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Author: Peter Hutterer, University of South Australia, NICTA
- */
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _GEINT_H_
-#define _GEINT_H_
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include <X11/extensions/geproto.h>
-
-extern _X_EXPORT DevPrivateKey GEClientPrivateKey;
-
-typedef struct _GEClientInfo {
- CARD32 major_version;
- CARD32 minor_version;
-} GEClientInfoRec, *GEClientInfoPtr;
-
-#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
-
-extern _X_EXPORT int (*ProcGEVector[/*GENumRequests*/])(ClientPtr);
-extern _X_EXPORT int (*SProcGEVector[/*GENumRequests*/])(ClientPtr);
-
-#endif /* _GEINT_H_ */
+/*
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Peter Hutterer, University of South Australia, NICTA
+ */
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _GEINT_H_
+#define _GEINT_H_
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "os.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include <X11/extensions/geproto.h>
+
+extern _X_EXPORT DevPrivateKeyRec GEClientPrivateKeyRec;
+#define GEClientPrivateKey (&GEClientPrivateKeyRec)
+
+typedef struct _GEClientInfo {
+ CARD32 major_version;
+ CARD32 minor_version;
+} GEClientInfoRec, *GEClientInfoPtr;
+
+#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
+
+extern _X_EXPORT int (*ProcGEVector[/*GENumRequests*/])(ClientPtr);
+extern _X_EXPORT int (*SProcGEVector[/*GENumRequests*/])(ClientPtr);
+
+#endif /* _GEINT_H_ */
diff --git a/xorg-server/Xext/panoramiX.c b/xorg-server/Xext/panoramiX.c
index 65af9a71f..1b340e80e 100644
--- a/xorg-server/Xext/panoramiX.c
+++ b/xorg-server/Xext/panoramiX.c
@@ -70,7 +70,6 @@ int PanoramiXPixWidth = 0;
int PanoramiXPixHeight = 0;
int PanoramiXNumScreens = 0;
-PanoramiXData *panoramiXdataPtr = NULL;
static RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL};
static int PanoramiXNumDepths;
@@ -104,10 +103,10 @@ static void PanoramiXResetProc(ExtensionEntry*);
int (* SavedProcVector[256]) (ClientPtr client) = { NULL, };
-static int PanoramiXGCKeyIndex;
-static DevPrivateKey PanoramiXGCKey = &PanoramiXGCKeyIndex;
-static int PanoramiXScreenKeyIndex;
-static DevPrivateKey PanoramiXScreenKey = &PanoramiXScreenKeyIndex;
+static DevPrivateKeyRec PanoramiXGCKeyRec;
+#define PanoramiXGCKey (&PanoramiXGCKeyRec)
+static DevPrivateKeyRec PanoramiXScreenKeyRec;
+#define PanoramiXScreenKey (&PanoramiXScreenKeyRec)
typedef struct {
DDXPointRec clipOrg;
@@ -120,8 +119,6 @@ typedef struct {
CloseScreenProcPtr CloseScreen;
} PanoramiXScreenRec, *PanoramiXScreenPtr;
-RegionRec XineramaScreenRegions[MAXSCREENS];
-
static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
static void XineramaChangeGC(GCPtr, unsigned long);
static void XineramaCopyGC(GCPtr, unsigned long, GCPtr);
@@ -154,9 +151,8 @@ XineramaCloseScreen (int i, ScreenPtr pScreen)
pScreen->CloseScreen = pScreenPriv->CloseScreen;
pScreen->CreateGC = pScreenPriv->CreateGC;
- REGION_UNINIT(pScreen, &XineramaScreenRegions[pScreen->myNum]);
if (pScreen->myNum == 0)
- REGION_UNINIT(pScreen, &PanoramiXScreenRegion);
+ RegionUninit(&PanoramiXScreenRegion);
free((pointer) pScreenPriv);
@@ -199,8 +195,8 @@ XineramaValidateGC(
if((pDraw->type == DRAWABLE_WINDOW) && !(((WindowPtr)pDraw)->parent)) {
/* the root window */
- int x_off = panoramiXdataPtr[pGC->pScreen->myNum].x;
- int y_off = panoramiXdataPtr[pGC->pScreen->myNum].y;
+ int x_off = pGC->pScreen->x;
+ int y_off = pGC->pScreen->y;
int new_val;
new_val = pGCPriv->clipOrg.x - x_off;
@@ -343,7 +339,7 @@ XineramaFindIDByScrnum(pointer resource, XID id, pointer privdata)
PanoramiXRes *res = (PanoramiXRes*)resource;
PanoramiXSearchData *data = (PanoramiXSearchData*)privdata;
- return (res->info[data->screen].id == data->id);
+ return res->info[data->screen].id == data->id;
}
PanoramiXRes *
@@ -390,33 +386,31 @@ static void XineramaInitData(ScreenPtr pScreen)
{
int i, w, h;
- REGION_NULL(pScreen, &PanoramiXScreenRegion)
+ RegionNull(&PanoramiXScreenRegion);
for (i = 0; i < PanoramiXNumScreens; i++) {
BoxRec TheBox;
+ RegionRec ScreenRegion;
pScreen = screenInfo.screens[i];
- panoramiXdataPtr[i].x = dixScreenOrigins[i].x;
- panoramiXdataPtr[i].y = dixScreenOrigins[i].y;
- panoramiXdataPtr[i].width = pScreen->width;
- panoramiXdataPtr[i].height = pScreen->height;
-
- TheBox.x1 = panoramiXdataPtr[i].x;
- TheBox.x2 = TheBox.x1 + panoramiXdataPtr[i].width;
- TheBox.y1 = panoramiXdataPtr[i].y;
- TheBox.y2 = TheBox.y1 + panoramiXdataPtr[i].height;
+ TheBox.x1 = pScreen->x;
+ TheBox.x2 = TheBox.x1 + pScreen->width;
+ TheBox.y1 = pScreen->y;
+ TheBox.y2 = TheBox.y1 + pScreen->height;
- REGION_INIT(pScreen, &XineramaScreenRegions[i], &TheBox, 1);
- REGION_UNION(pScreen, &PanoramiXScreenRegion, &PanoramiXScreenRegion,
- &XineramaScreenRegions[i]);
+ RegionInit(&ScreenRegion, &TheBox, 1);
+ RegionUnion(&PanoramiXScreenRegion, &PanoramiXScreenRegion,
+ &ScreenRegion);
+ RegionUninit(&ScreenRegion);
}
- PanoramiXPixWidth = panoramiXdataPtr[0].x + panoramiXdataPtr[0].width;
- PanoramiXPixHeight = panoramiXdataPtr[0].y + panoramiXdataPtr[0].height;
+ PanoramiXPixWidth = screenInfo.screens[0]->x + screenInfo.screens[0]->width;
+ PanoramiXPixHeight = screenInfo.screens[0]->y + screenInfo.screens[0]->height;
for (i = 1; i < PanoramiXNumScreens; i++) {
- w = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width;
- h = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height;
+ pScreen = screenInfo.screens[i];
+ w = pScreen->x + pScreen->width;
+ h = pScreen->y + pScreen->height;
if (PanoramiXPixWidth < w)
PanoramiXPixWidth = w;
@@ -427,12 +421,7 @@ static void XineramaInitData(ScreenPtr pScreen)
void XineramaReinitData(ScreenPtr pScreen)
{
- int i;
-
- REGION_UNINIT(pScreen, &PanoramiXScreenRegion);
- for (i = 0; i < PanoramiXNumScreens; i++)
- REGION_UNINIT(pScreen, &XineramaScreenRegions[i]);
-
+ RegionUninit(&PanoramiXScreenRegion);
XineramaInitData(pScreen);
}
@@ -454,6 +443,16 @@ void PanoramiXExtensionInit(int argc, char *argv[])
if (noPanoramiXExtension)
return;
+ if (!dixRegisterPrivateKey(&PanoramiXScreenKeyRec, PRIVATE_SCREEN, 0)) {
+ noPanoramiXExtension = TRUE;
+ return;
+ }
+
+ if (!dixRegisterPrivateKey(&PanoramiXGCKeyRec, PRIVATE_GC, sizeof(PanoramiXGCRec))) {
+ noPanoramiXExtension = TRUE;
+ return;
+ }
+
PanoramiXNumScreens = screenInfo.numScreens;
if (PanoramiXNumScreens == 1) { /* Only 1 screen */
noPanoramiXExtension = TRUE;
@@ -473,17 +472,6 @@ void PanoramiXExtensionInit(int argc, char *argv[])
* run in non-PanoramiXeen mode.
*/
- panoramiXdataPtr = (PanoramiXData *)
- calloc(PanoramiXNumScreens, sizeof(PanoramiXData));
-
- if (!panoramiXdataPtr)
- break;
-
- if (!dixRequestPrivate(PanoramiXGCKey, sizeof(PanoramiXGCRec))) {
- noPanoramiXExtension = TRUE;
- return;
- }
-
for (i = 0; i < PanoramiXNumScreens; i++) {
pScreen = screenInfo.screens[i];
pScreenPriv = malloc(sizeof(PanoramiXScreenRec));
@@ -836,13 +824,14 @@ PanoramiXConsolidate(void)
saver->type = XRT_WINDOW;
for (i = 0; i < PanoramiXNumScreens; i++) {
- root->info[i].id = WindowTable[i]->drawable.id;
+ ScreenPtr pScreen = screenInfo.screens[i];
+ root->info[i].id = pScreen->root->drawable.id;
root->u.win.class = InputOutput;
root->u.win.root = TRUE;
- saver->info[i].id = savedScreenInfo[i].wid;
+ saver->info[i].id = pScreen->screensaver.wid;
saver->u.win.class = InputOutput;
saver->u.win.root = TRUE;
- defmap->info[i].id = (screenInfo.screens[i])->defColormap;
+ defmap->info[i].id = pScreen->defColormap;
}
AddResource(root->info[0].id, XRT_WINDOW, root);
@@ -896,8 +885,6 @@ static void PanoramiXResetProc(ExtensionEntry* extEntry)
screenInfo.numScreens = PanoramiXNumScreens;
for (i = 256; i--; )
ProcVector[i] = SavedProcVector[i];
-
- free(panoramiXdataPtr);
}
@@ -999,8 +986,8 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
/* screen dimensions */
- rep.width = panoramiXdataPtr[stuff->screen].width;
- rep.height = panoramiXdataPtr[stuff->screen].height;
+ rep.width = screenInfo.screens[stuff->screen]->width;
+ rep.height = screenInfo.screens[stuff->screen]->height;
rep.window = stuff->window;
rep.screen = stuff->screen;
if (client->swapped) {
@@ -1072,10 +1059,10 @@ ProcXineramaQueryScreens(ClientPtr client)
int i;
for(i = 0; i < PanoramiXNumScreens; i++) {
- scratch.x_org = panoramiXdataPtr[i].x;
- scratch.y_org = panoramiXdataPtr[i].y;
- scratch.width = panoramiXdataPtr[i].width;
- scratch.height = panoramiXdataPtr[i].height;
+ scratch.x_org = screenInfo.screens[i]->x;
+ scratch.y_org = screenInfo.screens[i]->y;
+ scratch.width = screenInfo.screens[i]->width;
+ scratch.height = screenInfo.screens[i]->height;
if(client->swapped) {
int n;
@@ -1153,7 +1140,7 @@ XineramaGetImageData(
int pitch,
Bool isRoot
){
- RegionRec SrcRegion, GrabRegion;
+ RegionRec SrcRegion, ScreenRegion, GrabRegion;
BoxRec SrcBox, *pbox;
int x, y, w, h, i, j, nbox, size, sizeNeeded, ScratchPitch, inOut, depth;
DrawablePtr pDraw = pDrawables[0];
@@ -1165,38 +1152,47 @@ XineramaGetImageData(
SrcBox.x1 = left;
SrcBox.y1 = top;
if(!isRoot) {
- SrcBox.x1 += pDraw->x + panoramiXdataPtr[0].x;
- SrcBox.y1 += pDraw->y + panoramiXdataPtr[0].y;
+ SrcBox.x1 += pDraw->x + screenInfo.screens[0]->x;
+ SrcBox.y1 += pDraw->y + screenInfo.screens[0]->y;
}
SrcBox.x2 = SrcBox.x1 + width;
SrcBox.y2 = SrcBox.y1 + height;
- REGION_INIT(pScreen, &SrcRegion, &SrcBox, 1);
- REGION_NULL(pScreen, &GrabRegion);
+ RegionInit(&SrcRegion, &SrcBox, 1);
+ RegionNull(&GrabRegion);
depth = (format == XYPixmap) ? 1 : pDraw->depth;
for(i = 0; i < PanoramiXNumScreens; i++) {
+ BoxRec TheBox;
+ ScreenPtr pScreen;
pDraw = pDrawables[i];
+ pScreen = pDraw->pScreen;
+
+ TheBox.x1 = pScreen->x;
+ TheBox.x2 = TheBox.x1 + pScreen->width;
+ TheBox.y1 = pScreen->y;
+ TheBox.y2 = TheBox.y1 + pScreen->height;
- inOut = RECT_IN_REGION(pScreen,&XineramaScreenRegions[i],&SrcBox);
+ RegionInit(&ScreenRegion, &TheBox, 1);
+ inOut = RegionContainsRect(&ScreenRegion, &SrcBox);
+ if(inOut == rgnPART)
+ RegionIntersect(&GrabRegion, &SrcRegion, &ScreenRegion);
+ RegionUninit(&ScreenRegion);
if(inOut == rgnIN) {
- (*pDraw->pScreen->GetImage)(pDraw,
- SrcBox.x1 - pDraw->x - panoramiXdataPtr[i].x,
- SrcBox.y1 - pDraw->y - panoramiXdataPtr[i].y,
+ (*pScreen->GetImage)(pDraw,
+ SrcBox.x1 - pDraw->x - screenInfo.screens[i]->x,
+ SrcBox.y1 - pDraw->y - screenInfo.screens[i]->y,
width, height, format, planemask, data);
break;
} else if (inOut == rgnOUT)
continue;
- REGION_INTERSECT(pScreen, &GrabRegion, &SrcRegion,
- &XineramaScreenRegions[i]);
-
- nbox = REGION_NUM_RECTS(&GrabRegion);
+ nbox = RegionNumRects(&GrabRegion);
if(nbox) {
- pbox = REGION_RECTS(&GrabRegion);
+ pbox = RegionRects(&GrabRegion);
while(nbox--) {
w = pbox->x2 - pbox->x1;
@@ -1215,10 +1211,10 @@ XineramaGetImageData(
}
}
- x = pbox->x1 - pDraw->x - panoramiXdataPtr[i].x;
- y = pbox->y1 - pDraw->y - panoramiXdataPtr[i].y;
+ x = pbox->x1 - pDraw->x - screenInfo.screens[i]->x;
+ y = pbox->y1 - pDraw->y - screenInfo.screens[i]->y;
- (*pDraw->pScreen->GetImage)(pDraw, x, y, w, h,
+ (*pScreen->GetImage)(pDraw, x, y, w, h,
format, planemask, ScratchMem);
/* copy the memory over */
@@ -1273,16 +1269,15 @@ XineramaGetImageData(
pbox++;
}
- REGION_SUBTRACT(pScreen, &SrcRegion, &SrcRegion, &GrabRegion);
- if(!REGION_NOTEMPTY(pScreen, &SrcRegion))
+ RegionSubtract(&SrcRegion, &SrcRegion, &GrabRegion);
+ if(!RegionNotEmpty(&SrcRegion))
break;
}
}
- if(ScratchMem)
- free(ScratchMem);
+ free(ScratchMem);
- REGION_UNINIT(pScreen, &SrcRegion);
- REGION_UNINIT(pScreen, &GrabRegion);
+ RegionUninit(&SrcRegion);
+ RegionUninit(&GrabRegion);
}
diff --git a/xorg-server/Xext/panoramiX.h b/xorg-server/Xext/panoramiX.h
index 35de17951..1bf6194c6 100644
--- a/xorg-server/Xext/panoramiX.h
+++ b/xorg-server/Xext/panoramiX.h
@@ -1,85 +1,78 @@
-/*****************************************************************
-
-Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-
-******************************************************************/
-
-
-/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
-
-/*
- * PanoramiX definitions
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _PANORAMIX_H_
-#define _PANORAMIX_H_
-
-#define _PANORAMIX_SERVER
-#include <X11/extensions/panoramiXproto.h>
-#undef _PANORAMIX_SERVER
-#include "gcstruct.h"
-
-
-typedef struct _PanoramiXData {
- int x;
- int y;
- int width;
- int height;
-} PanoramiXData;
-
-typedef struct _PanoramiXInfo {
- XID id ;
-} PanoramiXInfo;
-
-typedef struct {
- PanoramiXInfo info[MAXSCREENS];
- RESTYPE type;
- union {
- struct {
- char visibility;
- char class;
- char root;
- } win;
- struct {
- Bool shared;
- } pix;
- struct {
- Bool root;
- } pict;
- char raw_data[4];
- } u;
-} PanoramiXRes;
-
-#define FOR_NSCREENS_FORWARD(j) for(j = 0; j < PanoramiXNumScreens; j++)
-#define FOR_NSCREENS_BACKWARD(j) for(j = PanoramiXNumScreens - 1; j >= 0; j--)
-#define FOR_NSCREENS(j) FOR_NSCREENS_FORWARD(j)
-
-#define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared)
-
-#endif /* _PANORAMIX_H_ */
+/*****************************************************************
+
+Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+
+******************************************************************/
+
+
+/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
+
+/*
+ * PanoramiX definitions
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _PANORAMIX_H_
+#define _PANORAMIX_H_
+
+#define _PANORAMIX_SERVER
+#include <X11/extensions/panoramiXproto.h>
+#undef _PANORAMIX_SERVER
+#include "gcstruct.h"
+
+
+typedef struct _PanoramiXInfo {
+ XID id ;
+} PanoramiXInfo;
+
+typedef struct {
+ PanoramiXInfo info[MAXSCREENS];
+ RESTYPE type;
+ union {
+ struct {
+ char visibility;
+ char class;
+ char root;
+ } win;
+ struct {
+ Bool shared;
+ } pix;
+ struct {
+ Bool root;
+ } pict;
+ char raw_data[4];
+ } u;
+} PanoramiXRes;
+
+#define FOR_NSCREENS_FORWARD(j) for(j = 0; j < PanoramiXNumScreens; j++)
+#define FOR_NSCREENS_BACKWARD(j) for(j = PanoramiXNumScreens - 1; j >= 0; j--)
+#define FOR_NSCREENS(j) FOR_NSCREENS_FORWARD(j)
+
+#define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared)
+
+#endif /* _PANORAMIX_H_ */
diff --git a/xorg-server/Xext/panoramiXprocs.c b/xorg-server/Xext/panoramiXprocs.c
index 2fe329886..067fb6cf7 100644
--- a/xorg-server/Xext/panoramiXprocs.c
+++ b/xorg-server/Xext/panoramiXprocs.c
@@ -129,14 +129,14 @@ int PanoramiXCreateWindow(ClientPtr client)
orig_visual = stuff->visual;
orig_x = stuff->x;
orig_y = stuff->y;
- parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id) ||
- (stuff->parent == savedScreenInfo[0].wid);
+ parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) ||
+ (stuff->parent == screenInfo.screens[0]->screensaver.wid);
FOR_NSCREENS_BACKWARD(j) {
stuff->wid = newWin->info[j].id;
stuff->parent = parent->info[j].id;
if (parentIsRoot) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
+ stuff->x = orig_x - screenInfo.screens[j]->x;
+ stuff->y = orig_y - screenInfo.screens[j]->y;
}
if (backPix)
*((CARD32 *) &stuff[1] + pback_offset) = backPix->info[j].id;
@@ -155,7 +155,7 @@ int PanoramiXCreateWindow(ClientPtr client)
else
free(newWin);
- return (result);
+ return result;
}
@@ -227,7 +227,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client)
result = (*SavedProcVector[X_ChangeWindowAttributes])(client);
}
- return (result);
+ return result;
}
@@ -253,7 +253,7 @@ int PanoramiXDestroyWindow(ClientPtr client)
/* Since ProcDestroyWindow is using FreeResource, it will free
our resource for us on the last pass through the loop above */
- return (result);
+ return result;
}
@@ -279,7 +279,7 @@ int PanoramiXDestroySubwindows(ClientPtr client)
/* DestroySubwindows is using FreeResource which will free
our resources for us on the last pass through the loop above */
- return (result);
+ return result;
}
@@ -302,7 +302,7 @@ int PanoramiXChangeSaveSet(ClientPtr client)
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -328,20 +328,20 @@ int PanoramiXReparentWindow(ClientPtr client)
x = stuff->x;
y = stuff->y;
- parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id) ||
- (stuff->parent == savedScreenInfo[0].wid);
+ parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) ||
+ (stuff->parent == screenInfo.screens[0]->screensaver.wid);
FOR_NSCREENS_BACKWARD(j) {
stuff->window = win->info[j].id;
stuff->parent = parent->info[j].id;
if(parentIsRoot) {
- stuff->x = x - panoramiXdataPtr[j].x;
- stuff->y = y - panoramiXdataPtr[j].y;
+ stuff->x = x - screenInfo.screens[j]->x;
+ stuff->y = y - screenInfo.screens[j]->y;
}
result = (*SavedProcVector[X_ReparentWindow])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -364,7 +364,7 @@ int PanoramiXMapWindow(ClientPtr client)
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -387,7 +387,7 @@ int PanoramiXMapSubwindows(ClientPtr client)
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -410,7 +410,7 @@ int PanoramiXUnmapWindow(ClientPtr client)
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -433,7 +433,7 @@ int PanoramiXUnmapSubwindows(ClientPtr client)
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -475,8 +475,8 @@ int PanoramiXConfigureWindow(ClientPtr client)
}
}
- if(pWin->parent && ((pWin->parent == WindowTable[0]) ||
- (pWin->parent->drawable.id == savedScreenInfo[0].wid)))
+ if(pWin->parent && ((pWin->parent == screenInfo.screens[0]->root) ||
+ (pWin->parent->drawable.id == screenInfo.screens[0]->screensaver.wid)))
{
if ((Mask)stuff->mask & CWX) {
x_offset = 0;
@@ -495,14 +495,14 @@ int PanoramiXConfigureWindow(ClientPtr client)
if(sib)
*((CARD32 *) &stuff[1] + sib_offset) = sib->info[j].id;
if(x_offset >= 0)
- *((CARD32 *) &stuff[1] + x_offset) = x - panoramiXdataPtr[j].x;
+ *((CARD32 *) &stuff[1] + x_offset) = x - screenInfo.screens[j]->x;
if(y_offset >= 0)
- *((CARD32 *) &stuff[1] + y_offset) = y - panoramiXdataPtr[j].y;
+ *((CARD32 *) &stuff[1] + y_offset) = y - screenInfo.screens[j]->y;
result = (*SavedProcVector[X_ConfigureWindow])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -525,7 +525,7 @@ int PanoramiXCirculateWindow(ClientPtr client)
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -544,7 +544,7 @@ int PanoramiXGetGeometry(ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.root = WindowTable[0]->drawable.id;
+ rep.root = screenInfo.screens[0]->root->drawable.id;
rep.depth = pDraw->depth;
rep.width = pDraw->width;
rep.height = pDraw->height;
@@ -557,16 +557,16 @@ int PanoramiXGetGeometry(ClientPtr client)
rep.width = root->pixWidth;
rep.height = root->pixHeight;
} else
- if ((pDraw->type == UNDRAWABLE_WINDOW) || (pDraw->type == DRAWABLE_WINDOW))
+ if (WindowDrawable(pDraw->type))
{
WindowPtr pWin = (WindowPtr)pDraw;
rep.x = pWin->origin.x - wBorderWidth (pWin);
rep.y = pWin->origin.y - wBorderWidth (pWin);
- if((pWin->parent == WindowTable[0]) ||
- (pWin->parent->drawable.id == savedScreenInfo[0].wid))
+ if((pWin->parent == screenInfo.screens[0]->root) ||
+ (pWin->parent->drawable.id == screenInfo.screens[0]->screensaver.wid))
{
- rep.x += panoramiXdataPtr[0].x;
- rep.y += panoramiXdataPtr[0].y;
+ rep.x += screenInfo.screens[0]->x;
+ rep.y += screenInfo.screens[0]->y;
}
rep.borderWidth = pWin->borderWidth;
}
@@ -596,11 +596,11 @@ int PanoramiXTranslateCoords(ClientPtr client)
rep.sameScreen = xTrue;
rep.child = None;
- if((pWin == WindowTable[0]) ||
- (pWin->drawable.id == savedScreenInfo[0].wid))
+ if((pWin == screenInfo.screens[0]->root) ||
+ (pWin->drawable.id == screenInfo.screens[0]->screensaver.wid))
{
- x = stuff->srcX - panoramiXdataPtr[0].x;
- y = stuff->srcY - panoramiXdataPtr[0].y;
+ x = stuff->srcX - screenInfo.screens[0]->x;
+ y = stuff->srcY - screenInfo.screens[0]->y;
} else {
x = pWin->drawable.x + stuff->srcX;
y = pWin->drawable.y + stuff->srcY;
@@ -620,8 +620,7 @@ int PanoramiXTranslateCoords(ClientPtr client)
* borderSize
*/
&& (!wBoundingShape(pWin) ||
- POINT_IN_REGION(pWin->drawable.pScreen,
- wBoundingShape(pWin),
+ RegionContainsPoint(wBoundingShape(pWin),
x - pWin->drawable.x,
y - pWin->drawable.y, &box))
)
@@ -634,11 +633,11 @@ int PanoramiXTranslateCoords(ClientPtr client)
}
rep.dstX = x - pDst->drawable.x;
rep.dstY = y - pDst->drawable.y;
- if((pDst == WindowTable[0]) ||
- (pDst->drawable.id == savedScreenInfo[0].wid))
+ if((pDst == screenInfo.screens[0]->root) ||
+ (pWin->drawable.id == screenInfo.screens[0]->screensaver.wid))
{
- rep.dstX += panoramiXdataPtr[0].x;
- rep.dstY += panoramiXdataPtr[0].y;
+ rep.dstX += screenInfo.screens[0]->x;
+ rep.dstY += screenInfo.screens[0]->y;
}
WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
@@ -680,7 +679,7 @@ int PanoramiXCreatePixmap(ClientPtr client)
else
free(newPix);
- return (result);
+ return result;
}
@@ -708,7 +707,7 @@ int PanoramiXFreePixmap(ClientPtr client)
/* Since ProcFreePixmap is using FreeResource, it will free
our resource for us on the last pass through the loop above */
- return (result);
+ return result;
}
@@ -790,7 +789,7 @@ int PanoramiXCreateGC(ClientPtr client)
else
free(newGC);
- return (result);
+ return result;
}
int PanoramiXChangeGC(ClientPtr client)
@@ -856,7 +855,7 @@ int PanoramiXChangeGC(ClientPtr client)
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -885,7 +884,7 @@ int PanoramiXCopyGC(ClientPtr client)
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -908,7 +907,7 @@ int PanoramiXSetDashes(ClientPtr client)
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -931,7 +930,7 @@ int PanoramiXSetClipRectangles(ClientPtr client)
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -957,7 +956,7 @@ int PanoramiXFreeGC(ClientPtr client)
/* Since ProcFreeGC is using FreeResource, it will free
our resource for us on the last pass through the loop above */
- return (result);
+ return result;
}
@@ -981,14 +980,14 @@ int PanoramiXClearToBackground(ClientPtr client)
FOR_NSCREENS_BACKWARD(j) {
stuff->window = win->info[j].id;
if(isRoot) {
- stuff->x = x - panoramiXdataPtr[j].x;
- stuff->y = y - panoramiXdataPtr[j].y;
+ stuff->x = x - screenInfo.screens[j]->x;
+ stuff->y = y - screenInfo.screens[j]->y;
}
result = (*SavedProcVector[X_ClearArea])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -1070,7 +1069,7 @@ int PanoramiXCopyArea(ClientPtr client)
if(drawables[0]->depth != pDst->depth) {
client->errorValue = stuff->dstDrawable;
free(data);
- return (BadMatch);
+ return BadMatch;
}
(*pGC->ops->PutImage) (pDst, pGC, pDst->depth, dstx, dsty,
@@ -1084,20 +1083,22 @@ int PanoramiXCopyArea(ClientPtr client)
} else {
DrawablePtr pDst = NULL, pSrc = NULL;
GCPtr pGC = NULL;
- RegionPtr pRgn[MAXSCREENS];
+ RegionRec totalReg;
int rc;
+ RegionNull(&totalReg);
FOR_NSCREENS_BACKWARD(j) {
+ RegionPtr pRgn;
stuff->dstDrawable = dst->info[j].id;
stuff->srcDrawable = src->info[j].id;
stuff->gc = gc->info[j].id;
if (srcIsRoot) {
- stuff->srcX = srcx - panoramiXdataPtr[j].x;
- stuff->srcY = srcy - panoramiXdataPtr[j].y;
+ stuff->srcX = srcx - screenInfo.screens[j]->x;
+ stuff->srcY = srcy - screenInfo.screens[j]->y;
}
if (dstIsRoot) {
- stuff->dstX = dstx - panoramiXdataPtr[j].x;
- stuff->dstY = dsty - panoramiXdataPtr[j].y;
+ stuff->dstX = dstx - screenInfo.screens[j]->x;
+ stuff->dstY = dsty - screenInfo.screens[j]->y;
}
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
@@ -1111,42 +1112,34 @@ int PanoramiXCopyArea(ClientPtr client)
if ((pDst->pScreen != pSrc->pScreen) ||
(pDst->depth != pSrc->depth)) {
client->errorValue = stuff->dstDrawable;
- return (BadMatch);
+ return BadMatch;
}
} else
pSrc = pDst;
- pRgn[j] = (*pGC->ops->CopyArea)(pSrc, pDst, pGC,
+ pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC,
stuff->srcX, stuff->srcY,
stuff->width, stuff->height,
stuff->dstX, stuff->dstY);
+ if(pGC->graphicsExposures && pRgn) {
+ if(srcIsRoot) {
+ RegionTranslate(pRgn,
+ screenInfo.screens[j]->x, screenInfo.screens[j]->y);
+ }
+ RegionAppend(&totalReg, pRgn);
+ RegionDestroy(pRgn);
+ }
- if(dstShared) {
- while(j--) pRgn[j] = NULL;
+ if(dstShared)
break;
- }
}
if(pGC->graphicsExposures) {
- ScreenPtr pScreen = pDst->pScreen;
- RegionRec totalReg;
Bool overlap;
-
- REGION_NULL(pScreen, &totalReg);
- FOR_NSCREENS_BACKWARD(j) {
- if(pRgn[j]) {
- if(srcIsRoot) {
- REGION_TRANSLATE(pScreen, pRgn[j],
- panoramiXdataPtr[j].x, panoramiXdataPtr[j].y);
- }
- REGION_APPEND(pScreen, &totalReg, pRgn[j]);
- REGION_DESTROY(pScreen, pRgn[j]);
- }
- }
- REGION_VALIDATE(pScreen, &totalReg, &overlap);
- (*pScreen->SendGraphicsExpose)(
+ RegionValidate(&totalReg, &overlap);
+ (*pDst->pScreen->SendGraphicsExpose)(
client, &totalReg, stuff->dstDrawable, X_CopyArea, 0);
- REGION_UNINIT(pScreen, &totalReg);
+ RegionUninit(&totalReg);
}
}
@@ -1163,7 +1156,7 @@ int PanoramiXCopyPlane(ClientPtr client)
Bool srcShared, dstShared;
DrawablePtr psrcDraw, pdstDraw = NULL;
GCPtr pGC = NULL;
- RegionPtr pRgn[MAXSCREENS];
+ RegionRec totalReg;
REQUEST(xCopyPlaneReq);
REQUEST_SIZE_MATCH(xCopyPlaneReq);
@@ -1198,17 +1191,19 @@ int PanoramiXCopyPlane(ClientPtr client)
srcx = stuff->srcX; srcy = stuff->srcY;
dstx = stuff->dstX; dsty = stuff->dstY;
+ RegionNull(&totalReg);
FOR_NSCREENS_BACKWARD(j) {
+ RegionPtr pRgn;
stuff->dstDrawable = dst->info[j].id;
stuff->srcDrawable = src->info[j].id;
stuff->gc = gc->info[j].id;
if (srcIsRoot) {
- stuff->srcX = srcx - panoramiXdataPtr[j].x;
- stuff->srcY = srcy - panoramiXdataPtr[j].y;
+ stuff->srcX = srcx - screenInfo.screens[j]->x;
+ stuff->srcY = srcy - screenInfo.screens[j]->y;
}
if (dstIsRoot) {
- stuff->dstX = dstx - panoramiXdataPtr[j].x;
- stuff->dstY = dsty - panoramiXdataPtr[j].y;
+ stuff->dstX = dstx - screenInfo.screens[j]->x;
+ stuff->dstY = dsty - screenInfo.screens[j]->y;
}
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess);
@@ -1220,7 +1215,7 @@ int PanoramiXCopyPlane(ClientPtr client)
if (pdstDraw->pScreen != psrcDraw->pScreen) {
client->errorValue = stuff->dstDrawable;
- return (BadMatch);
+ return BadMatch;
}
} else
psrcDraw = pdstDraw;
@@ -1228,36 +1223,28 @@ int PanoramiXCopyPlane(ClientPtr client)
if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
(stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) {
client->errorValue = stuff->bitPlane;
- return(BadValue);
+ return BadValue;
}
- pRgn[j] = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC,
+ pRgn = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC,
stuff->srcX, stuff->srcY,
stuff->width, stuff->height,
stuff->dstX, stuff->dstY, stuff->bitPlane);
+ if(pGC->graphicsExposures && pRgn) {
+ RegionAppend(&totalReg, pRgn);
+ RegionDestroy(pRgn);
+ }
- if(dstShared) {
- while(j--) pRgn[j] = NULL;
+ if(dstShared)
break;
- }
}
if(pGC->graphicsExposures) {
- ScreenPtr pScreen = pdstDraw->pScreen;
- RegionRec totalReg;
Bool overlap;
-
- REGION_NULL(pScreen, &totalReg);
- FOR_NSCREENS_BACKWARD(j) {
- if(pRgn[j]) {
- REGION_APPEND(pScreen, &totalReg, pRgn[j]);
- REGION_DESTROY(pScreen, pRgn[j]);
- }
- }
- REGION_VALIDATE(pScreen, &totalReg, &overlap);
- (*pScreen->SendGraphicsExpose)(
+ RegionValidate(&totalReg, &overlap);
+ (*pdstDraw->pScreen->SendGraphicsExpose)(
client, &totalReg, stuff->dstDrawable, X_CopyPlane, 0);
- REGION_UNINIT(pScreen, &totalReg);
+ RegionUninit(&totalReg);
}
return Success;
@@ -1297,8 +1284,8 @@ int PanoramiXPolyPoint(ClientPtr client)
if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
if (isRoot) {
- int x_off = panoramiXdataPtr[j].x;
- int y_off = panoramiXdataPtr[j].y;
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
if(x_off || y_off) {
xPoint *pnts = (xPoint*)&stuff[1];
@@ -1318,7 +1305,7 @@ int PanoramiXPolyPoint(ClientPtr client)
if(result != Success) break;
}
free(origPts);
- return (result);
+ return result;
} else
return Success;
}
@@ -1357,8 +1344,8 @@ int PanoramiXPolyLine(ClientPtr client)
if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
if (isRoot) {
- int x_off = panoramiXdataPtr[j].x;
- int y_off = panoramiXdataPtr[j].y;
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
if(x_off || y_off) {
xPoint *pnts = (xPoint*)&stuff[1];
@@ -1378,7 +1365,7 @@ int PanoramiXPolyLine(ClientPtr client)
if(result != Success) break;
}
free(origPts);
- return (result);
+ return result;
} else
return Success;
}
@@ -1420,8 +1407,8 @@ int PanoramiXPolySegment(ClientPtr client)
if(j) memcpy(&stuff[1], origSegs, nsegs * sizeof(xSegment));
if (isRoot) {
- int x_off = panoramiXdataPtr[j].x;
- int y_off = panoramiXdataPtr[j].y;
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
if(x_off || y_off) {
xSegment *segs = (xSegment*)&stuff[1];
@@ -1441,7 +1428,7 @@ int PanoramiXPolySegment(ClientPtr client)
if(result != Success) break;
}
free(origSegs);
- return (result);
+ return result;
} else
return Success;
}
@@ -1483,8 +1470,8 @@ int PanoramiXPolyRectangle(ClientPtr client)
if(j) memcpy(&stuff[1], origRecs, nrects * sizeof(xRectangle));
if (isRoot) {
- int x_off = panoramiXdataPtr[j].x;
- int y_off = panoramiXdataPtr[j].y;
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
if(x_off || y_off) {
@@ -1503,7 +1490,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
if(result != Success) break;
}
free(origRecs);
- return (result);
+ return result;
} else
return Success;
}
@@ -1545,8 +1532,8 @@ int PanoramiXPolyArc(ClientPtr client)
if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc));
if (isRoot) {
- int x_off = panoramiXdataPtr[j].x;
- int y_off = panoramiXdataPtr[j].y;
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
if(x_off || y_off) {
xArc *arcs = (xArc *) &stuff[1];
@@ -1563,7 +1550,7 @@ int PanoramiXPolyArc(ClientPtr client)
if(result != Success) break;
}
free(origArcs);
- return (result);
+ return result;
} else
return Success;
}
@@ -1603,8 +1590,8 @@ int PanoramiXFillPoly(ClientPtr client)
if(j) memcpy(&stuff[1], locPts, count * sizeof(DDXPointRec));
if (isRoot) {
- int x_off = panoramiXdataPtr[j].x;
- int y_off = panoramiXdataPtr[j].y;
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
if(x_off || y_off) {
DDXPointPtr pnts = (DDXPointPtr)&stuff[1];
@@ -1624,7 +1611,7 @@ int PanoramiXFillPoly(ClientPtr client)
if(result != Success) break;
}
free(locPts);
- return (result);
+ return result;
} else
return Success;
}
@@ -1666,8 +1653,8 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
if(j) memcpy(&stuff[1], origRects, things * sizeof(xRectangle));
if (isRoot) {
- int x_off = panoramiXdataPtr[j].x;
- int y_off = panoramiXdataPtr[j].y;
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
if(x_off || y_off) {
xRectangle *rects = (xRectangle *) &stuff[1];
@@ -1685,7 +1672,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
if(result != Success) break;
}
free(origRects);
- return (result);
+ return result;
} else
return Success;
}
@@ -1727,8 +1714,8 @@ int PanoramiXPolyFillArc(ClientPtr client)
if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc));
if (isRoot) {
- int x_off = panoramiXdataPtr[j].x;
- int y_off = panoramiXdataPtr[j].y;
+ int x_off = screenInfo.screens[j]->x;
+ int y_off = screenInfo.screens[j]->y;
if(x_off || y_off) {
xArc *arcs = (xArc *) &stuff[1];
@@ -1746,7 +1733,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
if(result != Success) break;
}
free(origArcs);
- return (result);
+ return result;
} else
return Success;
}
@@ -1780,15 +1767,15 @@ int PanoramiXPutImage(ClientPtr client)
orig_y = stuff->dstY;
FOR_NSCREENS_BACKWARD(j){
if (isRoot) {
- stuff->dstX = orig_x - panoramiXdataPtr[j].x;
- stuff->dstY = orig_y - panoramiXdataPtr[j].y;
+ stuff->dstX = orig_x - screenInfo.screens[j]->x;
+ stuff->dstY = orig_y - screenInfo.screens[j]->y;
}
stuff->drawable = draw->info[j].id;
stuff->gc = gc->info[j].id;
result = (* SavedProcVector[X_PutImage])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -1811,7 +1798,7 @@ int PanoramiXGetImage(ClientPtr client)
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
client->errorValue = stuff->format;
- return(BadValue);
+ return BadValue;
}
rc = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
@@ -1828,7 +1815,7 @@ int PanoramiXGetImage(ClientPtr client)
return rc;
if(!((WindowPtr)pDraw)->realized)
- return(BadMatch);
+ return BadMatch;
x = stuff->x;
y = stuff->y;
@@ -1843,19 +1830,19 @@ int PanoramiXGetImage(ClientPtr client)
if( /* check for being onscreen */
x < 0 || x + w > PanoramiXPixWidth ||
y < 0 || y + h > PanoramiXPixHeight )
- return(BadMatch);
+ return BadMatch;
} else {
if( /* check for being onscreen */
- panoramiXdataPtr[0].x + pDraw->x + x < 0 ||
- panoramiXdataPtr[0].x + pDraw->x + x + w > PanoramiXPixWidth ||
- panoramiXdataPtr[0].y + pDraw->y + y < 0 ||
- panoramiXdataPtr[0].y + pDraw->y + y + h > PanoramiXPixHeight ||
+ screenInfo.screens[0]->x + pDraw->x + x < 0 ||
+ screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth ||
+ screenInfo.screens[0]->y + pDraw->y + y < 0 ||
+ screenInfo.screens[0]->y + pDraw->y + y + h > PanoramiXPixHeight ||
/* check for being inside of border */
x < - wBorderWidth((WindowPtr)pDraw) ||
x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
y < -wBorderWidth((WindowPtr)pDraw) ||
y + h > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height)
- return(BadMatch);
+ return BadMatch;
}
drawables[0] = pDraw;
@@ -1897,7 +1884,7 @@ int PanoramiXGetImage(ClientPtr client)
}
length = linesPerBuf * widthBytesLine;
if(!(pBuf = malloc(length)))
- return (BadAlloc);
+ return BadAlloc;
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
@@ -1910,7 +1897,7 @@ int PanoramiXGetImage(ClientPtr client)
nlines = min(linesPerBuf, h - linesDone);
if(pDraw->depth == 1)
- bzero(pBuf, nlines * widthBytesLine);
+ memset(pBuf, 0, nlines * widthBytesLine);
XineramaGetImageData(drawables, x, y + linesDone, w, nlines,
format, planemask, pBuf, widthBytesLine, isRoot);
@@ -1927,7 +1914,7 @@ int PanoramiXGetImage(ClientPtr client)
while (h - linesDone > 0) {
nlines = min(linesPerBuf, h - linesDone);
- bzero(pBuf, nlines * widthBytesLine);
+ memset(pBuf, 0, nlines * widthBytesLine);
XineramaGetImageData(drawables, x, y + linesDone, w,
nlines, format, plane, pBuf,
@@ -1983,13 +1970,13 @@ PanoramiXPolyText8(ClientPtr client)
stuff->drawable = draw->info[j].id;
stuff->gc = gc->info[j].id;
if (isRoot) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
+ stuff->x = orig_x - screenInfo.screens[j]->x;
+ stuff->y = orig_y - screenInfo.screens[j]->y;
}
result = (*SavedProcVector[X_PolyText8])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
int
@@ -2024,13 +2011,13 @@ PanoramiXPolyText16(ClientPtr client)
stuff->drawable = draw->info[j].id;
stuff->gc = gc->info[j].id;
if (isRoot) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
+ stuff->x = orig_x - screenInfo.screens[j]->x;
+ stuff->y = orig_y - screenInfo.screens[j]->y;
}
result = (*SavedProcVector[X_PolyText16])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -2065,13 +2052,13 @@ int PanoramiXImageText8(ClientPtr client)
stuff->drawable = draw->info[j].id;
stuff->gc = gc->info[j].id;
if (isRoot) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
+ stuff->x = orig_x - screenInfo.screens[j]->x;
+ stuff->y = orig_y - screenInfo.screens[j]->y;
}
result = (*SavedProcVector[X_ImageText8])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -2106,13 +2093,13 @@ int PanoramiXImageText16(ClientPtr client)
stuff->drawable = draw->info[j].id;
stuff->gc = gc->info[j].id;
if (isRoot) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
+ stuff->x = orig_x - screenInfo.screens[j]->x;
+ stuff->y = orig_y - screenInfo.screens[j]->y;
}
result = (*SavedProcVector[X_ImageText16])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -2152,7 +2139,7 @@ int PanoramiXCreateColormap(ClientPtr client)
else
free(newCmap);
- return (result);
+ return result;
}
@@ -2180,7 +2167,7 @@ int PanoramiXFreeColormap(ClientPtr client)
/* Since ProcFreeColormap is using FreeResource, it will free
our resource for us on the last pass through the loop above */
- return (result);
+ return result;
}
@@ -2221,7 +2208,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
else
free(newCmap);
- return (result);
+ return result;
}
@@ -2245,7 +2232,7 @@ int PanoramiXInstallColormap(ClientPtr client)
result = (* SavedProcVector[X_InstallColormap])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -2269,7 +2256,7 @@ int PanoramiXUninstallColormap(ClientPtr client)
result = (* SavedProcVector[X_UninstallColormap])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -2293,7 +2280,7 @@ int PanoramiXAllocColor(ClientPtr client)
result = (* SavedProcVector[X_AllocColor])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -2317,7 +2304,7 @@ int PanoramiXAllocNamedColor(ClientPtr client)
result = (* SavedProcVector[X_AllocNamedColor])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -2341,7 +2328,7 @@ int PanoramiXAllocColorCells(ClientPtr client)
result = (* SavedProcVector[X_AllocColorCells])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -2365,7 +2352,7 @@ int PanoramiXAllocColorPlanes(ClientPtr client)
result = (* SavedProcVector[X_AllocColorPlanes])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -2389,7 +2376,7 @@ int PanoramiXFreeColors(ClientPtr client)
stuff->cmap = cmap->info[j].id;
result = (* SavedProcVector[X_FreeColors])(client);
}
- return (result);
+ return result;
}
@@ -2413,7 +2400,7 @@ int PanoramiXStoreColors(ClientPtr client)
result = (* SavedProcVector[X_StoreColors])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
@@ -2437,5 +2424,5 @@ int PanoramiXStoreNamedColor(ClientPtr client)
result = (* SavedProcVector[X_StoreNamedColor])(client);
if(result != Success) break;
}
- return (result);
+ return result;
}
diff --git a/xorg-server/Xext/panoramiXsrv.h b/xorg-server/Xext/panoramiXsrv.h
index c77b11927..28b039458 100644
--- a/xorg-server/Xext/panoramiXsrv.h
+++ b/xorg-server/Xext/panoramiXsrv.h
@@ -1,56 +1,53 @@
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _PANORAMIXSRV_H_
-#define _PANORAMIXSRV_H_
-
-#include "panoramiX.h"
-
-extern _X_EXPORT int PanoramiXNumScreens;
-extern _X_EXPORT PanoramiXData *panoramiXdataPtr;
-extern _X_EXPORT int PanoramiXPixWidth;
-extern _X_EXPORT int PanoramiXPixHeight;
-
-extern _X_EXPORT VisualID PanoramiXTranslateVisualID(int screen, VisualID orig);
-extern _X_EXPORT void PanoramiXConsolidate(void);
-extern _X_EXPORT Bool PanoramiXCreateConnectionBlock(void);
-extern _X_EXPORT PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int);
-extern _X_EXPORT Bool XineramaRegisterConnectionBlockCallback(void (*func)(void));
-extern _X_EXPORT int XineramaDeleteResource(pointer, XID);
-
-extern _X_EXPORT void XineramaReinitData(ScreenPtr);
-
-extern _X_EXPORT RegionRec XineramaScreenRegions[MAXSCREENS];
-
-extern _X_EXPORT unsigned long XRC_DRAWABLE;
-extern _X_EXPORT unsigned long XRT_WINDOW;
-extern _X_EXPORT unsigned long XRT_PIXMAP;
-extern _X_EXPORT unsigned long XRT_GC;
-extern _X_EXPORT unsigned long XRT_COLORMAP;
-
-/*
- * Drivers are allowed to wrap this function. Each wrapper can decide that the
- * two visuals are unequal, but if they are deemed equal, the wrapper must call
- * down and return FALSE if the wrapped function does. This ensures that all
- * layers agree that the visuals are equal. The first visual is always from
- * screen 0.
- */
-typedef Bool (*XineramaVisualsEqualProcPtr)(VisualPtr, ScreenPtr, VisualPtr);
-extern _X_EXPORT XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr;
-
-extern _X_EXPORT void XineramaGetImageData(
- DrawablePtr *pDrawables,
- int left,
- int top,
- int width,
- int height,
- unsigned int format,
- unsigned long planemask,
- char *data,
- int pitch,
- Bool isRoot
-);
-
-#endif /* _PANORAMIXSRV_H_ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _PANORAMIXSRV_H_
+#define _PANORAMIXSRV_H_
+
+#include "panoramiX.h"
+
+extern _X_EXPORT int PanoramiXNumScreens;
+extern _X_EXPORT int PanoramiXPixWidth;
+extern _X_EXPORT int PanoramiXPixHeight;
+
+extern _X_EXPORT VisualID PanoramiXTranslateVisualID(int screen, VisualID orig);
+extern _X_EXPORT void PanoramiXConsolidate(void);
+extern _X_EXPORT Bool PanoramiXCreateConnectionBlock(void);
+extern _X_EXPORT PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int);
+extern _X_EXPORT Bool XineramaRegisterConnectionBlockCallback(void (*func)(void));
+extern _X_EXPORT int XineramaDeleteResource(pointer, XID);
+
+extern _X_EXPORT void XineramaReinitData(ScreenPtr);
+
+extern _X_EXPORT unsigned long XRC_DRAWABLE;
+extern _X_EXPORT unsigned long XRT_WINDOW;
+extern _X_EXPORT unsigned long XRT_PIXMAP;
+extern _X_EXPORT unsigned long XRT_GC;
+extern _X_EXPORT unsigned long XRT_COLORMAP;
+
+/*
+ * Drivers are allowed to wrap this function. Each wrapper can decide that the
+ * two visuals are unequal, but if they are deemed equal, the wrapper must call
+ * down and return FALSE if the wrapped function does. This ensures that all
+ * layers agree that the visuals are equal. The first visual is always from
+ * screen 0.
+ */
+typedef Bool (*XineramaVisualsEqualProcPtr)(VisualPtr, ScreenPtr, VisualPtr);
+extern _X_EXPORT XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr;
+
+extern _X_EXPORT void XineramaGetImageData(
+ DrawablePtr *pDrawables,
+ int left,
+ int top,
+ int width,
+ int height,
+ unsigned int format,
+ unsigned long planemask,
+ char *data,
+ int pitch,
+ Bool isRoot
+);
+
+#endif /* _PANORAMIXSRV_H_ */
diff --git a/xorg-server/Xext/saver.c b/xorg-server/Xext/saver.c
index 0efe5bf2a..7ac437d15 100644
--- a/xorg-server/Xext/saver.c
+++ b/xorg-server/Xext/saver.c
@@ -226,8 +226,8 @@ MakeScreenPrivate (
ScreenPtr /* pScreen */
);
-static int ScreenPrivateKeyIndex;
-static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKeyIndex;
+static DevPrivateKeyRec ScreenPrivateKeyRec;
+#define ScreenPrivateKey (&ScreenPrivateKeyRec)
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
dixLookupPrivate(&(s)->devPrivates, ScreenPrivateKey))
@@ -252,6 +252,9 @@ ScreenSaverExtensionInit(INITARGS)
int i;
ScreenPtr pScreen;
+ if (!dixRegisterPrivateKey(&ScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return;
+
AttrType = CreateNewResourceType(ScreenSaverFreeAttr, "SaverAttr");
SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents,
"SaverEvent");
@@ -285,7 +288,7 @@ CheckScreenPrivate (ScreenPtr pScreen)
{
free(pPriv);
SetScreenPrivate (pScreen, NULL);
- savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL;
+ pScreen->screensaver.ExternalScreenSaver = NULL;
}
}
@@ -304,7 +307,7 @@ MakeScreenPrivate (ScreenPtr pScreen)
pPriv->hasWindow = FALSE;
pPriv->installedMap = None;
SetScreenPrivate (pScreen, pPriv);
- savedScreenInfo[pScreen->myNum].ExternalScreenSaver = ScreenSaverHandle;
+ pScreen->screensaver.ExternalScreenSaver = ScreenSaverHandle;
return pPriv;
}
@@ -503,8 +506,8 @@ SendScreenSaverNotify (ScreenPtr pScreen, int state, Bool forced)
ev.type = ScreenSaverNotify + ScreenSaverEventBase;
ev.state = state;
ev.timestamp = currentTime.milliseconds;
- ev.root = WindowTable[pScreen->myNum]->drawable.id;
- ev.window = savedScreenInfo[pScreen->myNum].wid;
+ ev.root = pScreen->root->drawable.id;
+ ev.window = pScreen->screensaver.wid;
ev.kind = kind;
ev.forced = forced;
WriteEventsToClient (pEv->client, 1, (xEvent *) &ev);
@@ -559,7 +562,7 @@ CreateSaverWindow (ScreenPtr pScreen)
Colormap wantMap;
ColormapPtr pCmap;
- pSaver = &savedScreenInfo[pScreen->myNum];
+ pSaver = &pScreen->screensaver;
if (pSaver->pWindow)
{
pSaver->pWindow = NullWindow;
@@ -580,7 +583,7 @@ CreateSaverWindow (ScreenPtr pScreen)
if (GrabInProgress && GrabInProgress != pAttr->client->index)
return FALSE;
- pWin = CreateWindow (pSaver->wid, WindowTable[pScreen->myNum],
+ pWin = CreateWindow (pSaver->wid, pScreen->root,
pAttr->x, pAttr->y, pAttr->width, pAttr->height,
pAttr->borderWidth, pAttr->class,
pAttr->mask, (XID *)pAttr->values,
@@ -672,7 +675,7 @@ DestroySaverWindow (ScreenPtr pScreen)
if (!pPriv || !pPriv->hasWindow)
return FALSE;
- pSaver = &savedScreenInfo[pScreen->myNum];
+ pSaver = &pScreen->screensaver;
if (pSaver->pWindow)
{
pSaver->pWindow = NullWindow;
@@ -756,7 +759,7 @@ ProcScreenSaverQueryInfo (ClientPtr client)
if (rc != Success)
return rc;
- pSaver = &savedScreenInfo[pDraw->pScreen->myNum];
+ pSaver = &pDraw->pScreen->screensaver;
pPriv = GetScreenPrivate (pDraw->pScreen);
UpdateCurrentTime ();
@@ -866,7 +869,7 @@ ScreenSaverSetAttributes (ClientPtr client)
if (ret != Success)
return ret;
pScreen = pDraw->pScreen;
- pParent = WindowTable[pScreen->myNum];
+ pParent = pScreen->root;
ret = XaceHook(XACE_SCREENSAVER_ACCESS, client, pScreen, DixSetAttrAccess);
if (ret != Success)
diff --git a/xorg-server/Xext/security.c b/xorg-server/Xext/security.c
index 4201e583d..183fa06c7 100644
--- a/xorg-server/Xext/security.c
+++ b/xorg-server/Xext/security.c
@@ -51,8 +51,8 @@ static RESTYPE RTEventClient;
static CallbackListPtr SecurityValidateGroupCallback = NULL;
/* Private state record */
-static int stateKeyIndex;
-static DevPrivateKey stateKey = &stateKeyIndex;
+static DevPrivateKeyRec stateKeyRec;
+#define stateKey (&stateKeyRec)
/* This is what we store as client security state */
typedef struct {
@@ -242,7 +242,7 @@ SecurityDeleteAuthorizationEventClient(
else
pAuth->eventClients = pEventClient->next;
free(pEventClient);
- return(Success);
+ return Success;
}
prev = pEventClient;
}
@@ -604,7 +604,7 @@ bailout:
if (removeAuth)
RemoveAuthorization(stuff->nbytesAuthProto, protoname,
authdata_len, pAuthdata);
- if (pAuth) free(pAuth);
+ free(pAuth);
return err;
} /* ProcSecurityGenerateAuthorization */
@@ -805,7 +805,6 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
Mask allowed = SecurityResourceMask;
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
- obj = dixLookupPrivate(&clients[cid]->devPrivates, stateKey);
/* disable background None for untrusted windows */
if ((requested & DixCreateAccess) && (rec->rtype == RT_WINDOW))
@@ -831,8 +830,11 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
allowed |= DixReadAccess;
}
- if (SecurityDoCheck(subj, obj, requested, allowed) == Success)
- return;
+ if (clients[cid] != NULL) {
+ obj = dixLookupPrivate(&clients[cid]->devPrivates, stateKey);
+ if (SecurityDoCheck(subj, obj, requested, allowed) == Success)
+ return;
+ }
SecurityAudit("Security: denied client %d access %x to resource 0x%x "
"of client %d on request %s\n", rec->client->index,
@@ -1108,7 +1110,7 @@ SecurityExtensionInit(INITARGS)
RTEventClient |= RC_NEVERRETAIN;
/* Allocate the private storage */
- if (!dixRequestPrivate(stateKey, sizeof(SecurityStateRec)))
+ if (!dixRegisterPrivateKey(stateKey, PRIVATE_CLIENT, sizeof(SecurityStateRec)))
FatalError("SecurityExtensionSetup: Can't allocate client private.\n");
/* Register callbacks */
diff --git a/xorg-server/Xext/shape.c b/xorg-server/Xext/shape.c
index f57a20cbf..d0eac294e 100644
--- a/xorg-server/Xext/shape.c
+++ b/xorg-server/Xext/shape.c
@@ -150,14 +150,12 @@ RegionOperate (
int xoff, int yoff,
CreateDftPtr create)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
if (srcRgn && (xoff || yoff))
- REGION_TRANSLATE(pScreen, srcRgn, xoff, yoff);
+ RegionTranslate(srcRgn, xoff, yoff);
if (!pWin->parent)
{
if (srcRgn)
- REGION_DESTROY(pScreen, srcRgn);
+ RegionDestroy(srcRgn);
return Success;
}
@@ -168,7 +166,7 @@ RegionOperate (
*/
if (srcRgn == NULL) {
if (*destRgnp != NULL) {
- REGION_DESTROY (pScreen, *destRgnp);
+ RegionDestroy(*destRgnp);
*destRgnp = 0;
/* go on to remove shape and generate ShapeNotify */
}
@@ -187,17 +185,17 @@ RegionOperate (
else switch (op) {
case ShapeSet:
if (*destRgnp)
- REGION_DESTROY(pScreen, *destRgnp);
+ RegionDestroy(*destRgnp);
*destRgnp = srcRgn;
srcRgn = 0;
break;
case ShapeUnion:
if (*destRgnp)
- REGION_UNION(pScreen, *destRgnp, *destRgnp, srcRgn);
+ RegionUnion(*destRgnp, *destRgnp, srcRgn);
break;
case ShapeIntersect:
if (*destRgnp)
- REGION_INTERSECT(pScreen, *destRgnp, *destRgnp, srcRgn);
+ RegionIntersect(*destRgnp, *destRgnp, srcRgn);
else {
*destRgnp = srcRgn;
srcRgn = 0;
@@ -206,21 +204,21 @@ RegionOperate (
case ShapeSubtract:
if (!*destRgnp)
*destRgnp = (*create)(pWin);
- REGION_SUBTRACT(pScreen, *destRgnp, *destRgnp, srcRgn);
+ RegionSubtract(*destRgnp, *destRgnp, srcRgn);
break;
case ShapeInvert:
if (!*destRgnp)
- *destRgnp = REGION_CREATE(pScreen, (BoxPtr) 0, 0);
+ *destRgnp = RegionCreate((BoxPtr) 0, 0);
else
- REGION_SUBTRACT(pScreen, *destRgnp, srcRgn, *destRgnp);
+ RegionSubtract(*destRgnp, srcRgn, *destRgnp);
break;
default:
client->errorValue = op;
return BadValue;
}
if (srcRgn)
- REGION_DESTROY(pScreen, srcRgn);
- (*pScreen->SetShape) (pWin);
+ RegionDestroy(srcRgn);
+ (*pWin->drawable.pScreen->SetShape) (pWin, kind);
SendShapeNotify (pWin, kind);
return Success;
}
@@ -234,7 +232,7 @@ CreateBoundingShape (WindowPtr pWin)
extents.y1 = -wBorderWidth (pWin);
extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
- return REGION_CREATE(pWin->drawable.pScreen, &extents, 1);
+ return RegionCreate(&extents, 1);
}
RegionPtr
@@ -246,7 +244,7 @@ CreateClipShape (WindowPtr pWin)
extents.y1 = 0;
extents.x2 = pWin->drawable.width;
extents.y2 = pWin->drawable.height;
- return REGION_CREATE(pWin->drawable.pScreen, &extents, 1);
+ return RegionCreate(&extents, 1);
}
static int
@@ -281,7 +279,6 @@ static int
ProcShapeRectangles (ClientPtr client)
{
WindowPtr pWin;
- ScreenPtr pScreen;
REQUEST(xShapeRectanglesReq);
xRectangle *prects;
int nrects, ctype, rc;
@@ -314,7 +311,6 @@ ProcShapeRectangles (ClientPtr client)
client->errorValue = stuff->ordering;
return BadValue;
}
- pScreen = pWin->drawable.pScreen;
nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
if (nrects & 4)
return BadLength;
@@ -323,7 +319,7 @@ ProcShapeRectangles (ClientPtr client)
ctype = VerifyRectOrder(nrects, prects, (int)stuff->ordering);
if (ctype < 0)
return BadMatch;
- srcRgn = RECTS_TO_REGION(pScreen, nrects, prects, ctype);
+ srcRgn = RegionFromRects(nrects, prects, ctype);
if (!pWin->optional)
MakeWindowOptional (pWin);
@@ -367,7 +363,7 @@ ProcPanoramiXShapeRectangles(
result = ProcShapeRectangles (client);
if (result != Success) break;
}
- return (result);
+ return result;
}
#endif
@@ -419,7 +415,7 @@ ProcShapeMask (ClientPtr client)
if (pPixmap->drawable.pScreen != pScreen ||
pPixmap->drawable.depth != 1)
return BadMatch;
- srcRgn = BITMAP_TO_REGION(pScreen, pPixmap);
+ srcRgn = BitmapToRegion(pScreen, pPixmap);
if (!srcRgn)
return BadAlloc;
}
@@ -476,7 +472,7 @@ ProcPanoramiXShapeMask(
result = ProcShapeMask (client);
if (result != Success) break;
}
- return (result);
+ return result;
}
#endif
@@ -489,7 +485,6 @@ static int
ProcShapeCombine (ClientPtr client)
{
WindowPtr pSrcWin, pDestWin;
- ScreenPtr pScreen;
REQUEST(xShapeCombineReq);
RegionPtr srcRgn;
RegionPtr *destRgn;
@@ -519,7 +514,6 @@ ProcShapeCombine (ClientPtr client)
client->errorValue = stuff->destKind;
return BadValue;
}
- pScreen = pDestWin->drawable.pScreen;
rc = dixLookupWindow(&pSrcWin, stuff->src, client, DixGetAttrAccess);
if (rc != Success)
@@ -541,14 +535,14 @@ ProcShapeCombine (ClientPtr client)
client->errorValue = stuff->srcKind;
return BadValue;
}
- if (pSrcWin->drawable.pScreen != pScreen)
+ if (pSrcWin->drawable.pScreen != pDestWin->drawable.pScreen)
{
return BadMatch;
}
if (srcRgn) {
- tmp = REGION_CREATE(pScreen, (BoxPtr) 0, 0);
- REGION_COPY(pScreen, tmp, srcRgn);
+ tmp = RegionCreate((BoxPtr) 0, 0);
+ RegionCopy(tmp, srcRgn);
srcRgn = tmp;
} else
srcRgn = (*createSrc) (pSrcWin);
@@ -602,7 +596,7 @@ ProcPanoramiXShapeCombine(
result = ProcShapeCombine (client);
if (result != Success) break;
}
- return (result);
+ return result;
}
#endif
@@ -614,7 +608,6 @@ static int
ProcShapeOffset (ClientPtr client)
{
WindowPtr pWin;
- ScreenPtr pScreen;
REQUEST(xShapeOffsetReq);
RegionPtr srcRgn;
int rc;
@@ -638,11 +631,10 @@ ProcShapeOffset (ClientPtr client)
client->errorValue = stuff->destKind;
return BadValue;
}
- pScreen = pWin->drawable.pScreen;
if (srcRgn)
{
- REGION_TRANSLATE(pScreen, srcRgn, stuff->xOff, stuff->yOff);
- (*pScreen->SetShape) (pWin);
+ RegionTranslate(srcRgn, stuff->xOff, stuff->yOff);
+ (*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind);
}
SendShapeNotify (pWin, (int)stuff->destKind);
return Success;
@@ -670,7 +662,7 @@ ProcPanoramiXShapeOffset(
result = ProcShapeOffset (client);
if(result != Success) break;
}
- return (result);
+ return result;
}
#endif
@@ -697,7 +689,7 @@ ProcShapeQueryExtents (ClientPtr client)
rep.clipShaped = (wClipShape(pWin) != 0);
if ((region = wBoundingShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
- pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
+ pExtents = RegionExtents(region);
extents = *pExtents;
} else {
extents.x1 = -wBorderWidth (pWin);
@@ -711,7 +703,7 @@ ProcShapeQueryExtents (ClientPtr client)
rep.heightBoundingShape = extents.y2 - extents.y1;
if ((region = wClipShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
- pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
+ pExtents = RegionExtents(region);
extents = *pExtents;
} else {
extents.x1 = 0;
@@ -899,7 +891,7 @@ SendShapeNotify (WindowPtr pWin, int which)
case ShapeBounding:
region = wBoundingShape(pWin);
if (region) {
- extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
+ extents = *RegionExtents(region);
shaped = xTrue;
} else {
extents.x1 = -wBorderWidth (pWin);
@@ -912,7 +904,7 @@ SendShapeNotify (WindowPtr pWin, int which)
case ShapeClip:
region = wClipShape(pWin);
if (region) {
- extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
+ extents = *RegionExtents(region);
shaped = xTrue;
} else {
extents.x1 = 0;
@@ -925,7 +917,7 @@ SendShapeNotify (WindowPtr pWin, int which)
case ShapeInput:
region = wInputShape(pWin);
if (region) {
- extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
+ extents = *RegionExtents(region);
shaped = xTrue;
} else {
extents.x1 = -wBorderWidth (pWin);
@@ -1050,8 +1042,8 @@ ProcShapeGetRectangles (ClientPtr client)
}
} else {
BoxPtr box;
- nrects = REGION_NUM_RECTS(region);
- box = REGION_RECTS(region);
+ nrects = RegionNumRects(region);
+ box = RegionRects(region);
rects = malloc(nrects * sizeof (xRectangle));
if (!rects && nrects)
return BadAlloc;
diff --git a/xorg-server/Xext/shm.c b/xorg-server/Xext/shm.c
index 885fd61ef..9bc39b4c6 100644
--- a/xorg-server/Xext/shm.c
+++ b/xorg-server/Xext/shm.c
@@ -141,10 +141,10 @@ int BadShmSegCode;
RESTYPE ShmSegType;
static ShmDescPtr Shmsegs;
static Bool sharedPixmaps;
-static int shmScrPrivateKeyIndex;
-static DevPrivateKey shmScrPrivateKey = &shmScrPrivateKeyIndex;
-static int shmPixmapPrivateIndex;
-static DevPrivateKey shmPixmapPrivate = &shmPixmapPrivateIndex;
+static DevPrivateKeyRec shmScrPrivateKeyRec;
+#define shmScrPrivateKey (&shmScrPrivateKeyRec)
+static DevPrivateKeyRec shmPixmapPrivateKeyRec;
+#define shmPixmapPrivateKey (&shmPixmapPrivateKeyRec)
static ShmFuncs miFuncs = {NULL, NULL};
static ShmFuncs fbFuncs = {fbShmCreatePixmap, NULL};
@@ -213,7 +213,7 @@ static Bool CheckForShmSyscall(void)
badSysCall = TRUE;
}
signal(SIGSYS, oldHandler);
- return(!badSysCall);
+ return !badSysCall;
}
#define MUST_CHECK_FOR_SHM_SYSCALL
@@ -244,6 +244,16 @@ ShmInitScreenPriv(ScreenPtr pScreen)
return screen_priv;
}
+static Bool
+ShmRegisterPrivates(void)
+{
+ if (!dixRegisterPrivateKey(&shmScrPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&shmPixmapPrivateKeyRec, PRIVATE_PIXMAP, 0))
+ return FALSE;
+ return TRUE;
+}
+
void
ShmExtensionInit(INITARGS)
{
@@ -258,6 +268,9 @@ ShmExtensionInit(INITARGS)
}
#endif
+ if (!ShmRegisterPrivates())
+ return;
+
sharedPixmaps = xFalse;
{
sharedPixmaps = xTrue;
@@ -303,6 +316,8 @@ ShmResetProc(ExtensionEntry *extEntry)
void
ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs)
{
+ if (!ShmRegisterPrivates())
+ return;
ShmInitScreenPriv(pScreen)->shmFuncs = funcs;
}
@@ -316,7 +331,7 @@ ShmDestroyPixmap (PixmapPtr pPixmap)
{
ShmDescPtr shmdesc;
shmdesc = (ShmDescPtr)dixLookupPrivate(&pPixmap->devPrivates,
- shmPixmapPrivate);
+ shmPixmapPrivateKey);
if (shmdesc)
ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id);
}
@@ -441,7 +456,7 @@ ProcShmAttach(ClientPtr client)
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse))
{
client->errorValue = stuff->readOnly;
- return(BadValue);
+ return BadValue;
}
for (shmdesc = Shmsegs;
shmdesc && (shmdesc->shmid != stuff->shmid);
@@ -598,13 +613,13 @@ ProcPanoramiXShmPutImage(ClientPtr client)
stuff->drawable = draw->info[j].id;
stuff->gc = gc->info[j].id;
if (isRoot) {
- stuff->dstX = orig_x - panoramiXdataPtr[j].x;
- stuff->dstY = orig_y - panoramiXdataPtr[j].y;
+ stuff->dstX = orig_x - screenInfo.screens[j]->x;
+ stuff->dstY = orig_y - screenInfo.screens[j]->y;
}
result = ProcShmPutImage(client);
if(result != Success) break;
}
- return(result);
+ return result;
}
static int
@@ -626,7 +641,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
client->errorValue = stuff->format;
- return(BadValue);
+ return BadValue;
}
rc = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
@@ -657,24 +672,24 @@ ProcPanoramiXShmGetImage(ClientPtr client)
if( /* check for being onscreen */
x < 0 || x + w > PanoramiXPixWidth ||
y < 0 || y + h > PanoramiXPixHeight )
- return(BadMatch);
+ return BadMatch;
} else {
if( /* check for being onscreen */
- panoramiXdataPtr[0].x + pDraw->x + x < 0 ||
- panoramiXdataPtr[0].x + pDraw->x + x + w > PanoramiXPixWidth ||
- panoramiXdataPtr[0].y + pDraw->y + y < 0 ||
- panoramiXdataPtr[0].y + pDraw->y + y + h > PanoramiXPixHeight ||
+ screenInfo.screens[0]->x + pDraw->x + x < 0 ||
+ screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth ||
+ screenInfo.screens[0]->y + pDraw->y + y < 0 ||
+ screenInfo.screens[0]->y + pDraw->y + y + h > PanoramiXPixHeight ||
/* check for being inside of border */
x < - wBorderWidth((WindowPtr)pDraw) ||
x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
y < -wBorderWidth((WindowPtr)pDraw) ||
y + h > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height)
- return(BadMatch);
+ return BadMatch;
}
drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
if(!drawables)
- return(BadAlloc);
+ return BadAlloc;
drawables[0] = pDraw;
for(i = 1; i < PanoramiXNumScreens; i++) {
@@ -817,7 +832,7 @@ CreatePmap:
shmdesc->addr + stuff->offset);
if (pMap) {
- dixSetPrivate(&pMap->devPrivates, shmPixmapPrivate, shmdesc);
+ dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = newPix->info[j].id;
@@ -972,7 +987,7 @@ ProcShmGetImage(ClientPtr client)
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap))
{
client->errorValue = stuff->format;
- return(BadValue);
+ return BadValue;
}
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixReadAccess);
@@ -996,7 +1011,7 @@ ProcShmGetImage(ClientPtr client)
stuff->y + (int)stuff->height >
wBorderWidth((WindowPtr)pDraw) + (int)pDraw->height
)
- return(BadMatch);
+ return BadMatch;
xgi.visual = wVisual(((WindowPtr)pDraw));
}
else
@@ -1006,7 +1021,7 @@ ProcShmGetImage(ClientPtr client)
stuff->y < 0 ||
stuff->y+(int)stuff->height > pDraw->height
)
- return(BadMatch);
+ return BadMatch;
xgi.visual = None;
}
xgi.type = X_Reply;
@@ -1156,7 +1171,7 @@ CreatePmap:
pDraw->pScreen->DestroyPixmap(pMap);
return rc;
}
- dixSetPrivate(&pMap->devPrivates, shmPixmapPrivate, shmdesc);
+ dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = stuff->pid;
@@ -1166,7 +1181,7 @@ CreatePmap:
}
pDraw->pScreen->DestroyPixmap(pMap);
}
- return (BadAlloc);
+ return BadAlloc;
}
static int
diff --git a/xorg-server/Xext/xace.c b/xorg-server/Xext/xace.c
index 648de53fe..bc621ff85 100644
--- a/xorg-server/Xext/xace.c
+++ b/xorg-server/Xext/xace.c
@@ -243,24 +243,21 @@ XaceCensorImage(
unsigned int format,
char *pBuf)
{
- ScreenPtr pScreen;
RegionRec imageRegion; /* region representing x,y,w,h */
RegionRec censorRegion; /* region to obliterate */
BoxRec imageBox;
int nRects;
- pScreen = pDraw->pScreen;
-
imageBox.x1 = x;
imageBox.y1 = y;
imageBox.x2 = x + w;
imageBox.y2 = y + h;
- REGION_INIT(pScreen, &imageRegion, &imageBox, 1);
- REGION_NULL(pScreen, &censorRegion);
+ RegionInit(&imageRegion, &imageBox, 1);
+ RegionNull(&censorRegion);
/* censorRegion = imageRegion - visibleRegion */
- REGION_SUBTRACT(pScreen, &censorRegion, &imageRegion, pVisibleRegion);
- nRects = REGION_NUM_RECTS(&censorRegion);
+ RegionSubtract(&censorRegion, &imageRegion, pVisibleRegion);
+ nRects = RegionNumRects(&censorRegion);
if (nRects > 0)
{ /* we have something to censor */
GCPtr pScratchGC = NULL;
@@ -280,7 +277,7 @@ XaceCensorImage(
failed = TRUE;
goto failSafe;
}
- for (pBox = REGION_RECTS(&censorRegion), i = 0;
+ for (pBox = RegionRects(&censorRegion), i = 0;
i < nRects;
i++, pBox++)
{
@@ -324,14 +321,14 @@ XaceCensorImage(
/* Censoring was not completed above. To be safe, wipe out
* all the image data so that nothing trusted gets out.
*/
- bzero(pBuf, (int)(widthBytesLine * h));
+ memset(pBuf, 0, (int)(widthBytesLine * h));
}
- if (pRects) free(pRects);
+ free(pRects);
if (pScratchGC) FreeScratchGC(pScratchGC);
if (pPix) FreeScratchPixmapHeader(pPix);
}
- REGION_UNINIT(pScreen, &imageRegion);
- REGION_UNINIT(pScreen, &censorRegion);
+ RegionUninit(&imageRegion);
+ RegionUninit(&censorRegion);
} /* XaceCensorImage */
/*
diff --git a/xorg-server/Xext/xf86bigfont.c b/xorg-server/Xext/xf86bigfont.c
index 2f0875faa..9d1223677 100644
--- a/xorg-server/Xext/xf86bigfont.c
+++ b/xorg-server/Xext/xf86bigfont.c
@@ -134,7 +134,7 @@ CheckForShmSyscall(void)
badSysCall = TRUE;
}
signal(SIGSYS, oldHandler);
- return (!badSysCall);
+ return !badSysCall;
}
#define MUST_CHECK_FOR_SHM_SYSCALL
diff --git a/xorg-server/Xext/xselinux_hooks.c b/xorg-server/Xext/xselinux_hooks.c
index 6075a34e8..57e49c090 100644
--- a/xorg-server/Xext/xselinux_hooks.c
+++ b/xorg-server/Xext/xselinux_hooks.c
@@ -59,12 +59,9 @@ typedef struct {
} SELinuxAuditRec;
/* private state keys */
-static int subjectKeyIndex;
-DevPrivateKey subjectKey = &subjectKeyIndex;
-static int objectKeyIndex;
-DevPrivateKey objectKey = &objectKeyIndex;
-static int dataKeyIndex;
-DevPrivateKey dataKey = &dataKeyIndex;
+DevPrivateKeyRec subjectKeyRec;
+DevPrivateKeyRec objectKeyRec;
+DevPrivateKeyRec dataKeyRec;
/* audit file descriptor */
static int audit_fd;
@@ -896,9 +893,9 @@ SELinuxFlaskInit(void)
FatalError("SELinux: Failed to open the system audit log\n");
/* Allocate private storage */
- if (!dixRequestPrivate(subjectKey, sizeof(SELinuxSubjectRec)) ||
- !dixRequestPrivate(objectKey, sizeof(SELinuxObjectRec)) ||
- !dixRequestPrivate(dataKey, sizeof(SELinuxObjectRec)))
+ if (!dixRegisterPrivateKey(subjectKey, PRIVATE_XSELINUX, sizeof(SELinuxSubjectRec)) ||
+ !dixRegisterPrivateKey(objectKey, PRIVATE_XSELINUX, sizeof(SELinuxObjectRec)) ||
+ !dixRegisterPrivateKey(dataKey, PRIVATE_XSELINUX, sizeof(SELinuxObjectRec)))
FatalError("SELinux: Failed to allocate private storage.\n");
/* Create atoms for doing window labeling */
diff --git a/xorg-server/Xext/xselinuxint.h b/xorg-server/Xext/xselinuxint.h
index f084b94b2..fb1d7f4c7 100644
--- a/xorg-server/Xext/xselinuxint.h
+++ b/xorg-server/Xext/xselinuxint.h
@@ -62,9 +62,12 @@ typedef struct {
* Globals
*/
-extern DevPrivateKey subjectKey;
-extern DevPrivateKey objectKey;
-extern DevPrivateKey dataKey;
+extern DevPrivateKeyRec subjectKeyRec;
+#define subjectKey (&subjectKeyRec)
+extern DevPrivateKeyRec objectKeyRec;
+#define objectKey (&objectKeyRec)
+extern DevPrivateKeyRec dataKeyRec;
+#define dataKey (&dataKeyRec)
/*
* Label functions
diff --git a/xorg-server/Xext/xtest.c b/xorg-server/Xext/xtest.c
index b8f5e86d8..9873f662a 100644
--- a/xorg-server/Xext/xtest.c
+++ b/xorg-server/Xext/xtest.c
@@ -62,10 +62,6 @@ extern int DeviceValuator;
* other's memory */
static EventListPtr xtest_evlist;
-/* Used to store if a device is an XTest Virtual device */
-static int XTestDevicePrivateKeyIndex;
-DevPrivateKey XTestDevicePrivateKey = &XTestDevicePrivateKeyIndex;
-
/**
* xtestpointer
* is the virtual pointer for XTest. It is the first slave
@@ -469,7 +465,7 @@ ProcXTestGrabControl(ClientPtr client)
if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse))
{
client->errorValue = stuff->impervious;
- return(BadValue);
+ return BadValue;
}
if (stuff->impervious)
MakeClientGrabImpervious(client);
@@ -645,8 +641,8 @@ int AllocXTestDevice (ClientPtr client, char* name,
retval = AllocDevicePair( client, xtestname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
if ( retval == Success ){
- dixSetPrivate(&((*ptr)->devPrivates), XTestDevicePrivateKey, (void *)(intptr_t)master_ptr->id);
- dixSetPrivate(&((*keybd)->devPrivates), XTestDevicePrivateKey, (void *)(intptr_t)master_keybd->id);
+ (*ptr)->xtest_master_id = master_ptr->id;
+ (*keybd)->xtest_master_id = master_keybd->id;
XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
@@ -674,23 +670,15 @@ int AllocXTestDevice (ClientPtr client, char* name,
BOOL
IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master)
{
- int is_XTest = FALSE;
- int mid;
- void *tmp; /* shut up, gcc! */
-
if (IsMaster(dev))
- return is_XTest;
-
- tmp = dixLookupPrivate(&dev->devPrivates, XTestDevicePrivateKey);
- mid = (intptr_t)tmp;
+ return FALSE;
/* deviceid 0 is reserved for XIAllDevices, non-zero mid means XTest
* device */
- if ((!master && mid) ||
- (master && mid == master->id))
- is_XTest = TRUE;
+ if (master)
+ return dev->xtest_master_id == master->id;
- return is_XTest;
+ return dev->xtest_master_id != 0;
}
/**
diff --git a/xorg-server/Xext/xvdisp.c b/xorg-server/Xext/xvdisp.c
index f346b6cea..e723fd84b 100644
--- a/xorg-server/Xext/xvdisp.c
+++ b/xorg-server/Xext/xvdisp.c
@@ -483,7 +483,7 @@ ProcXvQueryEncodings(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
rep.type = X_Reply;
@@ -540,14 +540,14 @@ ProcXvPutVideo(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
if (!(pPort->pAdaptor->type & XvInputMask) ||
!(pPort->pAdaptor->type & XvVideoMask))
{
client->errorValue = stuff->port;
- return (BadMatch);
+ return BadMatch;
}
status = XvdiMatchPort(pPort, pDraw);
@@ -578,14 +578,14 @@ ProcXvPutStill(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
if (!(pPort->pAdaptor->type & XvInputMask) ||
!(pPort->pAdaptor->type & XvStillMask))
{
client->errorValue = stuff->port;
- return (BadMatch);
+ return BadMatch;
}
status = XvdiMatchPort(pPort, pDraw);
@@ -616,14 +616,14 @@ ProcXvGetVideo(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
if (!(pPort->pAdaptor->type & XvOutputMask) ||
!(pPort->pAdaptor->type & XvVideoMask))
{
client->errorValue = stuff->port;
- return (BadMatch);
+ return BadMatch;
}
status = XvdiMatchPort(pPort, pDraw);
@@ -654,14 +654,14 @@ ProcXvGetStill(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
if (!(pPort->pAdaptor->type & XvOutputMask) ||
!(pPort->pAdaptor->type & XvStillMask))
{
client->errorValue = stuff->port;
- return (BadMatch);
+ return BadMatch;
}
status = XvdiMatchPort(pPort, pDraw);
@@ -703,7 +703,7 @@ ProcXvSelectPortNotify(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
return XvdiSelectPortNotify(client, pPort, stuff->onoff);
@@ -723,7 +723,7 @@ ProcXvGrabPort(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
status = XvdiGrabPort(client, pPort, stuff->time, &result);
@@ -756,7 +756,7 @@ ProcXvUngrabPort(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
return XvdiUngrabPort(client, pPort, stuff->time);
@@ -776,7 +776,7 @@ ProcXvStopVideo(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
@@ -799,13 +799,13 @@ ProcXvSetPortAttribute(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
if (!ValidAtom(stuff->attribute))
{
client->errorValue = stuff->attribute;
- return(BadAtom);
+ return BadAtom;
}
status = XvdiSetPortAttribute(client, pPort, stuff->attribute, stuff->value);
@@ -833,13 +833,13 @@ ProcXvGetPortAttribute(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
if (!ValidAtom(stuff->attribute))
{
client->errorValue = stuff->attribute;
- return(BadAtom);
+ return BadAtom;
}
status = XvdiGetPortAttribute(client, pPort, stuff->attribute, &value);
@@ -874,7 +874,7 @@ ProcXvQueryBestSize(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
rep.type = X_Reply;
@@ -911,7 +911,7 @@ ProcXvQueryPortAttributes(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
rep.type = X_Reply;
@@ -967,14 +967,14 @@ ProcXvPutImage(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
if (!(pPort->pAdaptor->type & XvImageMask) ||
!(pPort->pAdaptor->type & XvInputMask))
{
client->errorValue = stuff->port;
- return (BadMatch);
+ return BadMatch;
}
status = XvdiMatchPort(pPort, pDraw);
@@ -1047,14 +1047,14 @@ ProcXvShmPutImage(ClientPtr client)
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
{
client->errorValue = stuff->port;
- return (status);
+ return status;
}
if (!(pPort->pAdaptor->type & XvImageMask) ||
!(pPort->pAdaptor->type & XvInputMask))
{
client->errorValue = stuff->port;
- return (BadMatch);
+ return BadMatch;
}
status = XvdiMatchPort(pPort, pDraw);
@@ -1113,7 +1113,7 @@ static int
ProcXvShmPutImage(ClientPtr client)
{
SendErrorToClient(client, XvReqCode, xv_ShmPutImage, 0, BadImplementation);
- return(BadImplementation);
+ return BadImplementation;
}
#endif
@@ -1267,7 +1267,7 @@ ProcXvDispatch(ClientPtr client)
if (stuff->data > xvNumRequests) {
SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
- return(BadRequest);
+ return BadRequest;
}
return XvProcVector[stuff->data](client);
@@ -1591,7 +1591,7 @@ SProcXvDispatch(ClientPtr client)
if (stuff->data > xvNumRequests) {
SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
- return(BadRequest);
+ return BadRequest;
}
return SXvProcVector[stuff->data](client);
@@ -1690,8 +1690,8 @@ XineramaXvShmPutImage(ClientPtr client)
stuff->drw_x = x;
stuff->drw_y = y;
if(isRoot) {
- stuff->drw_x -= panoramiXdataPtr[i].x;
- stuff->drw_y -= panoramiXdataPtr[i].y;
+ stuff->drw_x -= screenInfo.screens[i]->x;
+ stuff->drw_y -= screenInfo.screens[i]->y;
}
stuff->send_event = (send_event && !i) ? 1 : 0;
@@ -1742,8 +1742,8 @@ XineramaXvPutImage(ClientPtr client)
stuff->drw_x = x;
stuff->drw_y = y;
if(isRoot) {
- stuff->drw_x -= panoramiXdataPtr[i].x;
- stuff->drw_y -= panoramiXdataPtr[i].y;
+ stuff->drw_x -= screenInfo.screens[i]->x;
+ stuff->drw_y -= screenInfo.screens[i]->y;
}
result = ProcXvPutImage(client);
@@ -1790,8 +1790,8 @@ XineramaXvPutVideo(ClientPtr client)
stuff->drw_x = x;
stuff->drw_y = y;
if(isRoot) {
- stuff->drw_x -= panoramiXdataPtr[i].x;
- stuff->drw_y -= panoramiXdataPtr[i].y;
+ stuff->drw_x -= screenInfo.screens[i]->x;
+ stuff->drw_y -= screenInfo.screens[i]->y;
}
result = ProcXvPutVideo(client);
@@ -1838,8 +1838,8 @@ XineramaXvPutStill(ClientPtr client)
stuff->drw_x = x;
stuff->drw_y = y;
if(isRoot) {
- stuff->drw_x -= panoramiXdataPtr[i].x;
- stuff->drw_y -= panoramiXdataPtr[i].y;
+ stuff->drw_x -= screenInfo.screens[i]->x;
+ stuff->drw_y -= screenInfo.screens[i]->y;
}
result = ProcXvPutStill(client);
diff --git a/xorg-server/Xext/xvmain.c b/xorg-server/Xext/xvmain.c
index 58574b956..268947bee 100644
--- a/xorg-server/Xext/xvmain.c
+++ b/xorg-server/Xext/xvmain.c
@@ -105,8 +105,8 @@ SOFTWARE.
#endif
#include "xvdisp.h"
-static int XvScreenKeyIndex;
-static DevPrivateKey XvScreenKey = &XvScreenKeyIndex;
+static DevPrivateKeyRec XvScreenKeyRec;
+#define XvScreenKey (&XvScreenKeyRec)
unsigned long XvExtensionGeneration = 0;
unsigned long XvScreenGeneration = 0;
unsigned long XvResourceGeneration = 0;
@@ -156,6 +156,9 @@ XvExtensionInit(void)
{
ExtensionEntry *extEntry;
+ if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, 0))
+ return;
+
/* LOOK TO SEE IF ANY SCREENS WERE INITIALIZED; IF NOT THEN
INIT GLOBAL VARIABLES SO THE EXTENSION CAN FUNCTION */
if (XvScreenGeneration != serverGeneration)
@@ -269,6 +272,9 @@ XvScreenInit(ScreenPtr pScreen)
XvScreenGeneration = serverGeneration;
}
+ if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, 0))
+ return BadAlloc;
+
if (dixLookupPrivate(&pScreen->devPrivates, XvScreenKey))
{
ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n");
@@ -284,7 +290,6 @@ XvScreenInit(ScreenPtr pScreen)
}
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
-
pxvs->DestroyPixmap = pScreen->DestroyPixmap;
pxvs->DestroyWindow = pScreen->DestroyWindow;
@@ -629,7 +634,7 @@ XvdiPutVideo(
pPort->time = currentTime;
- return (Success);
+ return Success;
}
@@ -759,7 +764,7 @@ XvdiGetVideo(
pPort->time = currentTime;
- return (Success);
+ return Success;
}
diff --git a/xorg-server/Xext/xvmc.c b/xorg-server/Xext/xvmc.c
index 4866d1d45..9b9dd0bc2 100644
--- a/xorg-server/Xext/xvmc.c
+++ b/xorg-server/Xext/xvmc.c
@@ -33,8 +33,9 @@
#define DR_CLIENT_DRIVER_NAME_SIZE 48
#define DR_BUSID_SIZE 48
-static int XvMCScreenKeyIndex;
-static DevPrivateKey XvMCScreenKey;
+static DevPrivateKeyRec XvMCScreenKeyRec;
+#define XvMCScreenKey (&XvMCScreenKeyRec)
+static Bool XvMCInUse;
unsigned long XvMCGeneration = 0;
@@ -138,7 +139,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- if(XvMCScreenKey) { /* any adaptors at all */
+ if(XvMCInUse) { /* any adaptors at all */
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
if((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any this screen */
for(i = 0; i < pScreenPriv->num_adaptors; i++) {
@@ -193,7 +194,7 @@ ProcXvMCCreateContext(ClientPtr client)
pScreen = pPort->pAdaptor->pScreen;
- if(XvMCScreenKey == NULL) /* no XvMC adaptors */
+ if(!XvMCInUse) /* no XvMC adaptors */
return BadMatch;
if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) /* none this screen */
@@ -258,8 +259,7 @@ ProcXvMCCreateContext(ClientPtr client)
WriteToClient(client, dwords << 2, (char*)data);
AddResource(pContext->context_id, XvMCRTContext, pContext);
- if(data)
- free(data);
+ free(data);
return Success;
}
@@ -326,8 +326,7 @@ ProcXvMCCreateSurface(ClientPtr client)
WriteToClient(client, dwords << 2, (char*)data);
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
- if(data)
- free(data);
+ free(data);
pContext->refcnt++;
@@ -443,8 +442,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
WriteToClient(client, dwords << 2, (char*)data);
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
- if(data)
- free(data);
+ free(data);
pContext->refcnt++;
@@ -716,7 +714,8 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
{
XvMCScreenPtr pScreenPriv;
- XvMCScreenKey = &XvMCScreenKeyIndex;
+ if (!dixRegisterPrivateKey(&XvMCScreenKeyRec, PRIVATE_SCREEN, 0))
+ return BadAlloc;
if(!(pScreenPriv = malloc(sizeof(XvMCScreenRec))))
return BadAlloc;
@@ -734,6 +733,8 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
pScreenPriv->minor = 0;
pScreenPriv->patchLevel = 0;
+ XvMCInUse = TRUE;
+
return Success;
}