summaryrefslogtreecommitdiff
path: root/xserver/composite
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/composite
parent33b2029f322f3c238b7ba528083195ad8dde33e1 (diff)
xserver 1.5.2. tested by ckuethe@, oga@, and others.
Diffstat (limited to 'xserver/composite')
-rw-r--r--xserver/composite/Makefile.in70
-rw-r--r--xserver/composite/compalloc.c108
-rw-r--r--xserver/composite/compext.c132
-rw-r--r--xserver/composite/compinit.c270
-rw-r--r--xserver/composite/compint.h45
-rw-r--r--xserver/composite/compwindow.c19
6 files changed, 363 insertions, 281 deletions
diff --git a/xserver/composite/Makefile.in b/xserver/composite/Makefile.in
index f18705942..99e47b92a 100644
--- a/xserver/composite/Makefile.in
+++ b/xserver/composite/Makefile.in
@@ -112,8 +112,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@
@@ -185,6 +183,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@
@@ -214,7 +216,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@
@@ -228,8 +230,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@
@@ -270,6 +272,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@
@@ -324,6 +329,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@
@@ -331,12 +338,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@
@@ -348,13 +354,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@
@@ -370,20 +375,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@
@@ -400,18 +406,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@
@@ -435,10 +445,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@
@@ -452,19 +464,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@
@@ -472,7 +483,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@
@@ -482,23 +492,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@
@@ -506,12 +524,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@
@@ -536,7 +556,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@
@@ -544,6 +564,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@
@@ -586,6 +611,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/composite/compalloc.c b/xserver/composite/compalloc.c
index 8022e1439..19c7db0b3 100644
--- a/xserver/composite/compalloc.c
+++ b/xserver/composite/compalloc.c
@@ -1,6 +1,4 @@
/*
- * $Id: compalloc.c,v 1.1 2006/11/26 18:16:14 matthieu Exp $
- *
* Copyright © 2006 Sun Microsystems
*
* Permission to use, copy, modify, distribute, and sell this software and its
@@ -48,7 +46,7 @@
#include "compint.h"
-void
+static void
compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
{
WindowPtr pWin = (WindowPtr) closure;
@@ -84,6 +82,9 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
return Success;
}
+ if (!pWin->parent)
+ return BadMatch;
+
/*
* Only one Manual update is allowed
*/
@@ -139,7 +140,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
cw->oldy = COMP_ORIGIN_INVALID;
cw->damageRegistered = FALSE;
cw->damaged = FALSE;
- pWin->devPrivates[CompWindowPrivateIndex].ptr = cw;
+ dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw);
}
ccw->next = cw->clients;
cw->clients = ccw;
@@ -206,7 +207,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
EnableMapUnmapEvents (pWin);
}
- if (pWin->redirectDraw)
+ if (pWin->redirectDraw != RedirectDrawNone)
compFreePixmap (pWin);
if (cw->damage)
@@ -214,14 +215,15 @@ compFreeClientWindow (WindowPtr pWin, XID id)
REGION_UNINIT (pScreen, &cw->borderClip);
- pWin->devPrivates[CompWindowPrivateIndex].ptr = 0;
+ dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL);
xfree (cw);
}
else if (cw->update == CompositeRedirectAutomatic &&
- !cw->damageRegistered && pWin->redirectDraw)
+ !cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone)
{
DamageRegister (&pWin->drawable, cw->damage);
cw->damageRegistered = TRUE;
+ pWin->redirectDraw = RedirectDrawAutomatic;
DamageDamageRegion (&pWin->drawable, &pWin->borderSize);
}
if (wasMapped && !pWin->mapped)
@@ -298,7 +300,7 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
}
csw->update = CompositeRedirectAutomatic;
csw->clients = 0;
- pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = csw;
+ dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, csw);
}
/*
* Redirect all existing windows
@@ -313,7 +315,7 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
if (!csw->clients)
{
xfree (csw);
- pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = 0;
+ dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
}
xfree (ccw);
return ret;
@@ -386,7 +388,7 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
*/
if (!csw->clients)
{
- pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = 0;
+ dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
xfree (csw);
}
}
@@ -462,9 +464,9 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
ScreenPtr pScreen = pWin->drawable.pScreen;
WindowPtr pParent = pWin->parent;
PixmapPtr pPixmap;
- GCPtr pGC;
- pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth);
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth,
+ CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
if (!pPixmap)
return 0;
@@ -472,25 +474,63 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
pPixmap->screen_x = x;
pPixmap->screen_y = y;
- pGC = GetScratchGC (pWin->drawable.depth, pScreen);
-
- /*
- * Copy bits from the parent into the new pixmap so that it will
- * have "reasonable" contents in case for background None areas.
- */
- if (pGC)
+ if (pParent->drawable.depth == pWin->drawable.depth)
{
- XID val = IncludeInferiors;
+ GCPtr pGC = GetScratchGC (pWin->drawable.depth, pScreen);
- ValidateGC(&pPixmap->drawable, pGC);
- dixChangeGC (serverClient, pGC, GCSubwindowMode, &val, NULL);
- (*pGC->ops->CopyArea) (&pParent->drawable,
- &pPixmap->drawable,
- pGC,
- x - pParent->drawable.x,
- y - pParent->drawable.y,
- w, h, 0, 0);
- FreeScratchGC (pGC);
+ /*
+ * Copy bits from the parent into the new pixmap so that it will
+ * have "reasonable" contents in case for background None areas.
+ */
+ if (pGC)
+ {
+ XID val = IncludeInferiors;
+
+ ValidateGC(&pPixmap->drawable, pGC);
+ dixChangeGC (serverClient, pGC, GCSubwindowMode, &val, NULL);
+ (*pGC->ops->CopyArea) (&pParent->drawable,
+ &pPixmap->drawable,
+ pGC,
+ x - pParent->drawable.x,
+ y - pParent->drawable.y,
+ w, h, 0, 0);
+ FreeScratchGC (pGC);
+ }
+ }
+ else
+ {
+ PictFormatPtr pSrcFormat = compWindowFormat (pParent);
+ PictFormatPtr pDstFormat = compWindowFormat (pWin);
+ XID inferiors = IncludeInferiors;
+ int error;
+
+ PicturePtr pSrcPicture = CreatePicture (None,
+ &pParent->drawable,
+ pSrcFormat,
+ CPSubwindowMode,
+ &inferiors,
+ serverClient, &error);
+
+ PicturePtr pDstPicture = CreatePicture (None,
+ &pPixmap->drawable,
+ pDstFormat,
+ 0, 0,
+ serverClient, &error);
+
+ if (pSrcPicture && pDstPicture)
+ {
+ CompositePicture (PictOpSrc,
+ pSrcPicture,
+ NULL,
+ pDstPicture,
+ x - pParent->drawable.x,
+ y - pParent->drawable.y,
+ 0, 0, 0, 0, w, h);
+ }
+ if (pSrcPicture)
+ FreePicture (pSrcPicture, 0);
+ if (pDstPicture)
+ FreePicture (pDstPicture, 0);
}
return pPixmap;
}
@@ -508,7 +548,11 @@ compAllocPixmap (WindowPtr pWin)
if (!pPixmap)
return FALSE;
- pWin->redirectDraw = TRUE;
+ if (cw->update == CompositeRedirectAutomatic)
+ pWin->redirectDraw = RedirectDrawAutomatic;
+ else
+ pWin->redirectDraw = RedirectDrawManual;
+
compSetPixmap (pWin, pPixmap);
cw->oldx = COMP_ORIGIN_INVALID;
cw->oldy = COMP_ORIGIN_INVALID;
@@ -543,7 +587,7 @@ compFreePixmap (WindowPtr pWin)
REGION_COPY (pScreen, &pWin->borderClip, &cw->borderClip);
pRedirectPixmap = (*pScreen->GetWindowPixmap) (pWin);
pParentPixmap = (*pScreen->GetWindowPixmap) (pWin->parent);
- pWin->redirectDraw = FALSE;
+ pWin->redirectDraw = RedirectDrawNone;
compSetPixmap (pWin, pParentPixmap);
(*pScreen->DestroyPixmap) (pRedirectPixmap);
}
@@ -564,7 +608,7 @@ compReallocPixmap (WindowPtr pWin, int draw_x, int draw_y,
int pix_x, pix_y;
int pix_w, pix_h;
- assert (cw && pWin->redirectDraw);
+ assert (cw && pWin->redirectDraw != RedirectDrawNone);
cw->oldx = pOld->screen_x;
cw->oldy = pOld->screen_y;
pix_x = draw_x - bw;
diff --git a/xserver/composite/compext.c b/xserver/composite/compext.c
index d4fbba7b9..b3433f72b 100644
--- a/xserver/composite/compext.c
+++ b/xserver/composite/compext.c
@@ -1,7 +1,4 @@
/*
- * $Id: compext.c,v 1.1 2006/11/26 18:16:16 matthieu Exp $
- *
- *
* Copyright © 2006 Sun Microsystems
*
* Permission to use, copy, modify, distribute, and sell this software and its
@@ -48,12 +45,16 @@
#endif
#include "compint.h"
+#include "xace.h"
+
+#define SERVER_COMPOSITE_MAJOR 0
+#define SERVER_COMPOSITE_MINOR 4
static CARD8 CompositeReqCode;
-int CompositeClientPrivateIndex;
+static DevPrivateKey CompositeClientPrivateKey = &CompositeClientPrivateKey;
RESTYPE CompositeClientWindowType;
RESTYPE CompositeClientSubwindowsType;
-RESTYPE CompositeClientOverlayType;
+static RESTYPE CompositeClientOverlayType;
static void deleteCompOverlayClient (CompOverlayClientPtr pOcToDel,
ScreenPtr pScreen);
@@ -63,7 +64,8 @@ typedef struct _CompositeClient {
int minor_version;
} CompositeClientRec, *CompositeClientPtr;
-#define GetCompositeClient(pClient) ((CompositeClientPtr) (pClient)->devPrivates[CompositeClientPrivateIndex].ptr)
+#define GetCompositeClient(pClient) ((CompositeClientPtr) \
+ dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey))
static void
CompositeClientCallback (CallbackListPtr *list,
@@ -133,16 +135,12 @@ ProcCompositeQueryVersion (ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- if (stuff->majorVersion < COMPOSITE_MAJOR) {
+ if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR) {
rep.majorVersion = stuff->majorVersion;
rep.minorVersion = stuff->minorVersion;
} else {
- rep.majorVersion = COMPOSITE_MAJOR;
- if (stuff->majorVersion == COMPOSITE_MAJOR &&
- stuff->minorVersion < COMPOSITE_MINOR)
- rep.minorVersion = stuff->minorVersion;
- else
- rep.minorVersion = COMPOSITE_MINOR;
+ rep.majorVersion = SERVER_COMPOSITE_MAJOR;
+ rep.minorVersion = SERVER_COMPOSITE_MINOR;
}
pCompositeClient->major_version = rep.majorVersion;
pCompositeClient->minor_version = rep.minorVersion;
@@ -160,14 +158,16 @@ static int
ProcCompositeRedirectWindow (ClientPtr client)
{
WindowPtr pWin;
+ int rc;
REQUEST(xCompositeRedirectWindowReq);
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
- pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
- if (!pWin)
+ rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+ DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+ if (rc != Success)
{
client->errorValue = stuff->window;
- return BadWindow;
+ return (rc == BadValue) ? BadWindow : rc;
}
return compRedirectWindow (client, pWin, stuff->update);
}
@@ -176,14 +176,16 @@ static int
ProcCompositeRedirectSubwindows (ClientPtr client)
{
WindowPtr pWin;
+ int rc;
REQUEST(xCompositeRedirectSubwindowsReq);
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
- pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
- if (!pWin)
+ rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+ DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+ if (rc != Success)
{
client->errorValue = stuff->window;
- return BadWindow;
+ return (rc == BadValue) ? BadWindow : rc;
}
return compRedirectSubwindows (client, pWin, stuff->update);
}
@@ -226,14 +228,16 @@ ProcCompositeCreateRegionFromBorderClip (ClientPtr client)
WindowPtr pWin;
CompWindowPtr cw;
RegionPtr pBorderClip, pRegion;
+ int rc;
REQUEST(xCompositeCreateRegionFromBorderClipReq);
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
- pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
- if (!pWin)
+ rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+ DixGetAttrAccess);
+ if (rc != Success)
{
client->errorValue = stuff->window;
- return BadWindow;
+ return (rc == BadValue) ? BadWindow : rc;
}
LEGAL_NEW_RESOURCE (stuff->region, client);
@@ -260,16 +264,21 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
WindowPtr pWin;
CompWindowPtr cw;
PixmapPtr pPixmap;
+ int rc;
REQUEST(xCompositeNameWindowPixmapReq);
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
- pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
- if (!pWin)
+ rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+ DixGetAttrAccess);
+ if (rc != Success)
{
client->errorValue = stuff->window;
- return BadWindow;
+ return (rc == BadValue) ? BadWindow : rc;
}
-
+
+ if (!pWin->viewable)
+ return BadMatch;
+
LEGAL_NEW_RESOURCE (stuff->pixmap, client);
cw = GetCompWindow (pWin);
@@ -280,8 +289,14 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
if (!pPixmap)
return BadMatch;
+ /* security creation/labeling check */
+ rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
+ pPixmap, RT_WINDOW, pWin, DixCreateAccess);
+ if (rc != Success)
+ return rc;
+
++pPixmap->refcnt;
-
+
if (!AddResource (stuff->pixmap, RT_PIXMAP, (pointer) pPixmap))
return BadAlloc;
@@ -420,7 +435,7 @@ createOverlayWindow (ScreenPtr pScreen)
return pWin;
}
-int
+static int
ProcCompositeGetOverlayWindow (ClientPtr client)
{
REQUEST(xCompositeGetOverlayWindowReq);
@@ -429,13 +444,15 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
ScreenPtr pScreen;
CompScreenPtr cs;
CompOverlayClientPtr pOc;
+ int rc;
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
- pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
- if (!pWin)
+ rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+ DixGetAttrAccess);
+ if (rc != Success)
{
client->errorValue = stuff->window;
- return BadWindow;
+ return (rc == BadValue) ? BadWindow : rc;
}
pScreen = pWin->drawable.pScreen;
@@ -446,6 +463,12 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
return BadAlloc;
}
}
+
+ rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id,
+ RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+
MapWindow(cs->pOverlayWin, serverClient);
/* Record that client is using this overlay window */
@@ -474,7 +497,7 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
return client->noClientException;
}
-int
+static int
ProcCompositeReleaseOverlayWindow (ClientPtr client)
{
REQUEST(xCompositeReleaseOverlayWindowReq);
@@ -512,7 +535,7 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client)
return client->noClientException;
}
-int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
+static int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
ProcCompositeQueryVersion,
ProcCompositeRedirectWindow,
ProcCompositeRedirectSubwindows,
@@ -622,7 +645,7 @@ SProcCompositeNameWindowPixmap (ClientPtr client)
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
}
-int
+static int
SProcCompositeGetOverlayWindow (ClientPtr client)
{
int n;
@@ -634,7 +657,7 @@ SProcCompositeGetOverlayWindow (ClientPtr client)
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
}
-int
+static int
SProcCompositeReleaseOverlayWindow (ClientPtr client)
{
int n;
@@ -646,7 +669,7 @@ SProcCompositeReleaseOverlayWindow (ClientPtr client)
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
}
-int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
+static int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
SProcCompositeQueryVersion,
SProcCompositeRedirectWindow,
SProcCompositeRedirectSubwindows,
@@ -675,6 +698,35 @@ CompositeExtensionInit (void)
ExtensionEntry *extEntry;
int s;
+ /* Assume initialization is going to fail */
+ noCompositeExtension = TRUE;
+
+ for (s = 0; s < screenInfo.numScreens; s++) {
+ ScreenPtr pScreen = screenInfo.screens[s];
+ VisualPtr vis;
+
+ /* Composite on 8bpp pseudocolor root windows appears to fail, so
+ * just disable it on anything pseudocolor for safety.
+ */
+ for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++)
+ ;
+ if ((vis->class | DynamicClass) == PseudoColor)
+ return;
+
+ /* Ensure that Render is initialized, which is required for automatic
+ * compositing.
+ */
+ if (GetPictureScreenIfSet(pScreen) == NULL)
+ return;
+ }
+#ifdef PANORAMIX
+ /* Xinerama's rewriting of window drawing before Composite gets to it
+ * breaks Composite.
+ */
+ if (!noPanoramiXExtension)
+ return;
+#endif
+
CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow);
if (!CompositeClientWindowType)
return;
@@ -687,9 +739,8 @@ CompositeExtensionInit (void)
if (!CompositeClientOverlayType)
return;
- CompositeClientPrivateIndex = AllocateClientPrivateIndex ();
- if (!AllocateClientPrivate (CompositeClientPrivateIndex,
- sizeof (CompositeClientRec)))
+ if (!dixRequestPrivate(CompositeClientPrivateKey,
+ sizeof(CompositeClientRec)))
return;
if (!AddCallback (&ClientStateCallback, CompositeClientCallback, 0))
return;
@@ -706,4 +757,7 @@ CompositeExtensionInit (void)
return;
miRegisterRedirectBorderClipProc (compSetRedirectBorderClip,
compGetRedirectBorderClip);
+
+ /* Initialization succeeded */
+ noCompositeExtension = FALSE;
}
diff --git a/xserver/composite/compinit.c b/xserver/composite/compinit.c
index dce07d0ab..3bf77e0ae 100644
--- a/xserver/composite/compinit.c
+++ b/xserver/composite/compinit.c
@@ -1,6 +1,4 @@
/*
- * $Id: compinit.c,v 1.1 2006/11/26 18:16:14 matthieu Exp $
- *
* Copyright © 2006 Sun Microsystems
*
* Permission to use, copy, modify, distribute, and sell this software and its
@@ -48,10 +46,9 @@
#include "compint.h"
-int CompScreenPrivateIndex;
-int CompWindowPrivateIndex;
-int CompSubwindowsPrivateIndex;
-int CompGeneration;
+DevPrivateKey CompScreenPrivateKey = &CompScreenPrivateKey;
+DevPrivateKey CompWindowPrivateKey = &CompWindowPrivateKey;
+DevPrivateKey CompSubwindowsPrivateKey = &CompSubwindowsPrivateKey;
static Bool
@@ -65,13 +62,13 @@ compCloseScreen (int index, ScreenPtr pScreen)
pScreen->CloseScreen = cs->CloseScreen;
pScreen->BlockHandler = cs->BlockHandler;
pScreen->InstallColormap = cs->InstallColormap;
+ pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
pScreen->ReparentWindow = cs->ReparentWindow;
pScreen->MoveWindow = cs->MoveWindow;
pScreen->ResizeWindow = cs->ResizeWindow;
pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
pScreen->ClipNotify = cs->ClipNotify;
- pScreen->PaintWindowBackground = cs->PaintWindowBackground;
pScreen->UnrealizeWindow = cs->UnrealizeWindow;
pScreen->RealizeWindow = cs->RealizeWindow;
pScreen->DestroyWindow = cs->DestroyWindow;
@@ -88,7 +85,7 @@ compCloseScreen (int index, ScreenPtr pScreen)
cs->pOverlayWin = NULL;
xfree (cs);
- pScreen->devPrivates[CompScreenPrivateIndex].ptr = 0;
+ dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
ret = (*pScreen->CloseScreen) (index, pScreen);
return ret;
@@ -111,6 +108,34 @@ compInstallColormap (ColormapPtr pColormap)
pScreen->InstallColormap = compInstallColormap;
}
+/* Fake backing store via automatic redirection */
+static Bool
+compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen (pScreen);
+ Bool ret;
+
+ pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
+ ret = pScreen->ChangeWindowAttributes(pWin, mask);
+
+ if (ret && (mask & CWBackingStore) &&
+ pScreen->backingStoreSupport != NotUseful) {
+ if (pWin->backingStore != NotUseful) {
+ compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
+ pWin->backStorage = TRUE;
+ } else {
+ compUnredirectWindow(serverClient, pWin,
+ CompositeRedirectAutomatic);
+ pWin->backStorage = FALSE;
+ }
+ }
+
+ pScreen->ChangeWindowAttributes = compChangeWindowAttributes;
+
+ return ret;
+}
+
static void
compScreenUpdate (ScreenPtr pScreen)
{
@@ -201,106 +226,84 @@ Bool CompositeRegisterAlternateVisuals (ScreenPtr pScreen, VisualID *vids,
return compRegisterAlternateVisuals(cs, vids, nVisuals);
}
-#if COMP_INCLUDE_RGB24_VISUAL
-#define NUM_COMP_ALTERNATE_VISUALS 2
-#else
-#define NUM_COMP_ALTERNATE_VISUALS 1
-#endif
-
typedef struct _alternateVisual {
int depth;
CARD32 format;
} CompAlternateVisual;
-static CompAlternateVisual altVisuals[NUM_COMP_ALTERNATE_VISUALS] = {
+static CompAlternateVisual altVisuals[] = {
#if COMP_INCLUDE_RGB24_VISUAL
{ 24, PICT_r8g8b8 },
#endif
{ 32, PICT_a8r8g8b8 },
};
+static const int NUM_COMP_ALTERNATE_VISUALS = sizeof(altVisuals) /
+ sizeof(CompAlternateVisual);
+
static Bool
-compAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs)
+compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
+ CompAlternateVisual *alt)
{
- VisualPtr visuals;
- DepthPtr depths[NUM_COMP_ALTERNATE_VISUALS];
- PictFormatPtr pPictFormats[NUM_COMP_ALTERNATE_VISUALS];
+ VisualPtr visual, visuals;
int i;
int numVisuals;
- VisualID *vids[NUM_COMP_ALTERNATE_VISUALS];
XID *installedCmaps;
ColormapPtr installedCmap;
int numInstalledCmaps;
- int numAlternate = 0;
- int alt;
-
- for (alt = 0; alt < NUM_COMP_ALTERNATE_VISUALS; alt++)
- {
- DepthPtr depth;
- PictFormatPtr pPictFormat;
-
- depth = compFindVisuallessDepth (pScreen, altVisuals[alt].depth);
- if (!depth)
- continue;
- /*
- * Find the right picture format
- */
- pPictFormat = PictureMatchFormat (pScreen, altVisuals[alt].depth,
- altVisuals[alt].format);
- if (!pPictFormat)
- continue;
-
- /*
- * Allocate vid list for this depth
- */
- vids[numAlternate] = xalloc (sizeof (VisualID));
- if (!vids[numAlternate])
- continue;
- depths[numAlternate] = depth;
- pPictFormats[numAlternate] = pPictFormat;
- numAlternate++;
- }
-
- if (!numAlternate)
- return TRUE;
+ DepthPtr depth;
+ PictFormatPtr pPictFormat;
+ VisualID *vid;
+ unsigned long alphaMask;
/*
- * Find the installed colormaps
+ * The ARGB32 visual is always available. Other alternate depth visuals
+ * are only provided if their depth is less than the root window depth.
+ * There's no deep reason for this.
*/
+ if (alt->depth >= pScreen->rootDepth && alt->depth != 32)
+ return FALSE;
+
+ depth = compFindVisuallessDepth (pScreen, alt->depth);
+ if (!depth)
+ /* alt->depth doesn't exist or already has alternate visuals. */
+ return TRUE;
+
+ pPictFormat = PictureMatchFormat (pScreen, alt->depth, alt->format);
+ if (!pPictFormat)
+ return FALSE;
+
+ vid = xalloc(sizeof(VisualID));
+ if (!vid)
+ return FALSE;
+
+ /* Find the installed colormaps */
installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID));
- if (!installedCmaps)
- {
- for (alt = 0; alt < numAlternate; alt++)
- xfree (vids[alt]);
+ if (!installedCmaps) {
+ xfree(vid);
return FALSE;
}
- numInstalledCmaps = (*pScreen->ListInstalledColormaps) (pScreen,
- installedCmaps);
-
- /*
- * realloc the visual array to fit the new one in place
- */
+ numInstalledCmaps = pScreen->ListInstalledColormaps(pScreen,
+ installedCmaps);
+
+ /* realloc the visual array to fit the new one in place */
numVisuals = pScreen->numVisuals;
- visuals = xrealloc (pScreen->visuals,
- (numVisuals + numAlternate) * sizeof (VisualRec));
- if (!visuals)
- {
- for (alt = 0; alt < numAlternate; alt++)
- xfree (vids[alt]);
- xfree (installedCmaps);
+ visuals = xrealloc(pScreen->visuals, (numVisuals + 1) * sizeof(VisualRec));
+ if (!visuals) {
+ xfree(vid);
+ xfree(installedCmaps);
return FALSE;
}
-
+
/*
* Fix up any existing installed colormaps -- we'll assume that
* the only ones created so far have been installed. If this
* isn't true, we'll have to walk the resource database looking
* for all colormaps.
*/
- for (i = 0; i < numInstalledCmaps; i++)
- {
+ for (i = 0; i < numInstalledCmaps; i++) {
int j;
-
+
installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP);
if (!installedCmap)
continue;
@@ -308,90 +311,69 @@ compAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs)
installedCmap->pVisual = &visuals[j];
}
- xfree (installedCmaps);
+ xfree(installedCmaps);
pScreen->visuals = visuals;
- pScreen->numVisuals = numVisuals + numAlternate;
-
- for (alt = 0; alt < numAlternate; alt++)
- {
- DepthPtr depth = depths[alt];
- PictFormatPtr pPictFormat = pPictFormats[alt];
- VisualPtr visual = &visuals[numVisuals + alt];
- unsigned long alphaMask;
-
- /*
- * Initialize the visual
- */
+ visual = visuals + pScreen->numVisuals; /* the new one */
+ pScreen->numVisuals++;
+
+ /* Initialize the visual */
+ visual->vid = FakeClientID (0);
+ visual->bitsPerRGBValue = 8;
+ if (PICT_FORMAT_TYPE(alt->format) == PICT_TYPE_COLOR) {
+ visual->class = PseudoColor;
+ visual->nplanes = PICT_FORMAT_BPP(alt->format);
+ visual->ColormapEntries = 1 << visual->nplanes;
+ } else {
+ DirectFormatRec *direct = &pPictFormat->direct;
visual->class = TrueColor;
- visual->bitsPerRGBValue = 8;
-
- visual->vid = FakeClientID (0);
- visual->redMask = (((unsigned long) pPictFormat->direct.redMask) <<
- pPictFormat->direct.red);
- visual->greenMask = (((unsigned long) pPictFormat->direct.greenMask) <<
- pPictFormat->direct.green);
- visual->blueMask = (((unsigned long) pPictFormat->direct.blueMask) <<
- pPictFormat->direct.blue);
- alphaMask = (((unsigned long) pPictFormat->direct.alphaMask) <<
- pPictFormat->direct.alpha);
- visual->offsetRed = pPictFormat->direct.red;
- visual->offsetGreen = pPictFormat->direct.green;
- visual->offsetBlue = pPictFormat->direct.blue;
+ visual->redMask = ((unsigned long)direct->redMask) << direct->red;
+ visual->greenMask = ((unsigned long)direct->greenMask) << direct->green;
+ visual->blueMask = ((unsigned long)direct->blueMask) << direct->blue;
+ alphaMask = ((unsigned long)direct->alphaMask) << direct->alpha;
+ visual->offsetRed = direct->red;
+ visual->offsetGreen = direct->green;
+ visual->offsetBlue = direct->blue;
/*
* Include A bits in this (unlike GLX which includes only RGB)
* This lets DIX compute suitable masks for colormap allocations
*/
visual->nplanes = Ones (visual->redMask |
- visual->greenMask |
- visual->blueMask |
- alphaMask);
- /*
- * find widest component
- */
+ visual->greenMask |
+ visual->blueMask |
+ alphaMask);
+ /* find widest component */
visual->ColormapEntries = (1 << max (Ones (visual->redMask),
- max (Ones (visual->greenMask),
- Ones (visual->blueMask))));
-
- /*
- * remember the visual ID to detect auto-update windows
- */
- compRegisterAlternateVisuals(cs, &visual->vid, 1);
-
- /*
- * Fix up the depth
- */
- vids[alt][0] = visual->vid;
- depth->numVids = 1;
- depth->vids = vids[alt];
+ max (Ones (visual->greenMask),
+ Ones (visual->blueMask))));
}
+
+ /* remember the visual ID to detect auto-update windows */
+ compRegisterAlternateVisuals(cs, &visual->vid, 1);
+
+ /* Fix up the depth */
+ *vid = visual->vid;
+ depth->numVids = 1;
+ depth->vids = vid;
return TRUE;
}
+static Bool
+compAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs)
+{
+ int alt, ret = 0;
+
+ for (alt = 0; alt < NUM_COMP_ALTERNATE_VISUALS; alt++)
+ ret |= compAddAlternateVisual(pScreen, cs, altVisuals + alt);
+
+ return !!ret;
+}
+
Bool
compScreenInit (ScreenPtr pScreen)
{
CompScreenPtr cs;
- if (CompGeneration != serverGeneration)
- {
- CompScreenPrivateIndex = AllocateScreenPrivateIndex ();
- if (CompScreenPrivateIndex == -1)
- return FALSE;
- CompWindowPrivateIndex = AllocateWindowPrivateIndex ();
- if (CompWindowPrivateIndex == -1)
- return FALSE;
- CompSubwindowsPrivateIndex = AllocateWindowPrivateIndex ();
- if (CompSubwindowsPrivateIndex == -1)
- return FALSE;
- CompGeneration = serverGeneration;
- }
- if (!AllocateWindowPrivate (pScreen, CompWindowPrivateIndex, 0))
- return FALSE;
-
- if (!AllocateWindowPrivate (pScreen, CompSubwindowsPrivateIndex, 0))
- return FALSE;
-
if (GetCompScreen (pScreen))
return TRUE;
cs = (CompScreenPtr) xalloc (sizeof (CompScreenRec));
@@ -429,9 +411,6 @@ compScreenInit (ScreenPtr pScreen)
cs->UnrealizeWindow = pScreen->UnrealizeWindow;
pScreen->UnrealizeWindow = compUnrealizeWindow;
- cs->PaintWindowBackground = pScreen->PaintWindowBackground;
- pScreen->PaintWindowBackground = compPaintWindowBackground;
-
cs->ClipNotify = pScreen->ClipNotify;
pScreen->ClipNotify = compClipNotify;
@@ -450,13 +429,16 @@ compScreenInit (ScreenPtr pScreen)
cs->InstallColormap = pScreen->InstallColormap;
pScreen->InstallColormap = compInstallColormap;
+ cs->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
+ pScreen->ChangeWindowAttributes = compChangeWindowAttributes;
+
cs->BlockHandler = pScreen->BlockHandler;
pScreen->BlockHandler = compBlockHandler;
cs->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = compCloseScreen;
- pScreen->devPrivates[CompScreenPrivateIndex].ptr = (pointer) cs;
+ dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, cs);
RegisterRealChildHeadProc(CompositeRealChildHead);
diff --git a/xserver/composite/compint.h b/xserver/composite/compint.h
index dd68105f3..4b0fe0834 100644
--- a/xserver/composite/compint.h
+++ b/xserver/composite/compint.h
@@ -1,6 +1,4 @@
/*
- * $Id: compint.h,v 1.1 2006/11/26 18:16:15 matthieu Exp $
- *
* Copyright © 2006 Sun Microsystems
*
* Permission to use, copy, modify, distribute, and sell this software and its
@@ -66,6 +64,7 @@
#include "globals.h"
#include "picturestr.h"
#include "extnsionst.h"
+#include "privates.h"
#include "mi.h"
#include "damage.h"
#include "damageextint.h"
@@ -125,7 +124,6 @@ typedef struct _CompScreen {
DestroyWindowProcPtr DestroyWindow;
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
- PaintWindowProcPtr PaintWindowBackground;
ClipNotifyProcPtr ClipNotify;
/*
* Called from ConfigureWindow, these
@@ -145,6 +143,11 @@ typedef struct _CompScreen {
*/
InstallColormapProcPtr InstallColormap;
+ /*
+ * Fake backing store via automatic redirection
+ */
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+
ScreenBlockHandlerProcPtr BlockHandler;
CloseScreenProcPtr CloseScreen;
Bool damaged;
@@ -156,13 +159,16 @@ typedef struct _CompScreen {
} CompScreenRec, *CompScreenPtr;
-extern int CompScreenPrivateIndex;
-extern int CompWindowPrivateIndex;
-extern int CompSubwindowsPrivateIndex;
+extern DevPrivateKey CompScreenPrivateKey;
+extern DevPrivateKey CompWindowPrivateKey;
+extern DevPrivateKey CompSubwindowsPrivateKey;
-#define GetCompScreen(s) ((CompScreenPtr) ((s)->devPrivates[CompScreenPrivateIndex].ptr))
-#define GetCompWindow(w) ((CompWindowPtr) ((w)->devPrivates[CompWindowPrivateIndex].ptr))
-#define GetCompSubwindows(w) ((CompSubwindowsPtr) ((w)->devPrivates[CompSubwindowsPrivateIndex].ptr))
+#define GetCompScreen(s) ((CompScreenPtr) \
+ dixLookupPrivate(&(s)->devPrivates, CompScreenPrivateKey))
+#define GetCompWindow(w) ((CompWindowPtr) \
+ dixLookupPrivate(&(w)->devPrivates, CompWindowPrivateKey))
+#define GetCompSubwindows(w) ((CompSubwindowsPtr) \
+ dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey))
extern RESTYPE CompositeClientWindowType;
extern RESTYPE CompositeClientSubwindowsType;
@@ -171,9 +177,6 @@ extern RESTYPE CompositeClientSubwindowsType;
* compalloc.c
*/
-void
-compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure);
-
Bool
compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update);
@@ -237,6 +240,9 @@ compCheckTree (ScreenPtr pScreen);
#define compCheckTree(s)
#endif
+PictFormatPtr
+compWindowFormat (WindowPtr pWin);
+
void
compSetPixmap (WindowPtr pWin, PixmapPtr pPixmap);
@@ -253,9 +259,6 @@ Bool
compUnrealizeWindow (WindowPtr pWin);
void
-compPaintWindowBackground (WindowPtr pWin, RegionPtr pRegion, int what);
-
-void
compClipNotify (WindowPtr pWin, int dx, int dy);
void
@@ -292,18 +295,6 @@ compWindowUpdate (WindowPtr pWin);
void
deleteCompOverlayClientsForScreen (ScreenPtr pScreen);
-int
-ProcCompositeGetOverlayWindow (ClientPtr client);
-
-int
-ProcCompositeReleaseOverlayWindow (ClientPtr client);
-
-int
-SProcCompositeGetOverlayWindow (ClientPtr client);
-
-int
-SProcCompositeReleaseOverlayWindow (ClientPtr client);
-
WindowPtr
CompositeRealChildHead (WindowPtr pWin);
diff --git a/xserver/composite/compwindow.c b/xserver/composite/compwindow.c
index 65f77cfea..05dc055c2 100644
--- a/xserver/composite/compwindow.c
+++ b/xserver/composite/compwindow.c
@@ -92,14 +92,14 @@ static Bool
compRepaintBorder (ClientPtr pClient, pointer closure)
{
WindowPtr pWindow;
- int rc = dixLookupWindow(&pWindow, (XID)closure, pClient,DixUnknownAccess);
+ int rc = dixLookupWindow(&pWindow, (XID)closure, pClient, DixWriteAccess);
if (rc == Success) {
RegionRec exposed;
REGION_NULL(pScreen, &exposed);
REGION_SUBTRACT(pScreen, &exposed, &pWindow->borderClip, &pWindow->winSize);
- (*pWindow->drawable.pScreen->PaintWindowBorder)(pWindow, &exposed, PW_BORDER);
+ miPaintWindow(pWindow, &exposed, PW_BORDER);
REGION_UNINIT(pScreen, &exposed);
}
return TRUE;
@@ -265,21 +265,6 @@ compUnrealizeWindow (WindowPtr pWin)
return ret;
}
-void
-compPaintWindowBackground (WindowPtr pWin, RegionPtr pRegion, int what)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompSubwindowsPtr csw = GetCompSubwindows (pWin);
- CompScreenPtr cs = GetCompScreen (pScreen);
-
- if (csw && csw->update == CompositeRedirectManual)
- return;
- pScreen->PaintWindowBackground = cs->PaintWindowBackground;
- (*pScreen->PaintWindowBackground) (pWin, pRegion, what);
- cs->PaintWindowBackground = pScreen->PaintWindowBackground;
- pScreen->PaintWindowBackground = compPaintWindowBackground;
-}
-
/*
* Called after the borderClip for the window has settled down
* We use this to make sure our extra borderClip has the right origin