diff options
author | marha <marha@users.sourceforge.net> | 2009-07-25 20:12:58 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-07-25 20:12:58 +0000 |
commit | 2553bdd7c359cd87525d367761c86932cec5adff (patch) | |
tree | ae71245933c98474a699d3e392de5820879b2018 /xorg-server/composite | |
parent | e2c51f2ee7b0a3ea1a052fc49324057b4a4bbc78 (diff) | |
parent | 4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 (diff) | |
download | vcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.tar.gz vcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.tar.bz2 vcxsrv-2553bdd7c359cd87525d367761c86932cec5adff.zip |
svn merge file:///D:/svnrepos/vcxsrv/branches/released .
Diffstat (limited to 'xorg-server/composite')
-rw-r--r-- | xorg-server/composite/Makefile.am | 1 | ||||
-rw-r--r-- | xorg-server/composite/Makefile.in | 80 | ||||
-rw-r--r-- | xorg-server/composite/compalloc.c | 12 | ||||
-rw-r--r-- | xorg-server/composite/compext.c | 203 | ||||
-rw-r--r-- | xorg-server/composite/compinit.c | 22 | ||||
-rw-r--r-- | xorg-server/composite/compint.h | 24 | ||||
-rw-r--r-- | xorg-server/composite/compoverlay.c | 159 | ||||
-rw-r--r-- | xorg-server/composite/compwindow.c | 72 |
8 files changed, 285 insertions, 288 deletions
diff --git a/xorg-server/composite/Makefile.am b/xorg-server/composite/Makefile.am index 21504e659..d7bead137 100644 --- a/xorg-server/composite/Makefile.am +++ b/xorg-server/composite/Makefile.am @@ -7,4 +7,5 @@ libcomposite_la_SOURCES = \ compext.c \ compint.h \ compinit.c \ + compoverlay.c \ compwindow.c diff --git a/xorg-server/composite/Makefile.in b/xorg-server/composite/Makefile.in index d8211cab5..6dec05164 100644 --- a/xorg-server/composite/Makefile.in +++ b/xorg-server/composite/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -43,7 +43,6 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ - $(top_builddir)/include/xgl-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ @@ -52,16 +51,13 @@ CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcomposite_la_LIBADD = am_libcomposite_la_OBJECTS = compalloc.lo compext.lo compinit.lo \ - compwindow.lo + compoverlay.lo compwindow.lo libcomposite_la_OBJECTS = $(am_libcomposite_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -76,8 +72,9 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ -APPDEFAULTDIR = @APPDEFAULTDIR@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ @@ -98,10 +95,6 @@ CFLAGS = @CFLAGS@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DARWIN_LIBS = @DARWIN_LIBS@ DBUS_CFLAGS = @DBUS_CFLAGS@ @@ -123,6 +116,7 @@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DOLT_BASH = @DOLT_BASH@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ @@ -132,18 +126,15 @@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ -ECHO = @ECHO@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ -FREETYPE_LIBS = @FREETYPE_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ @@ -162,7 +153,7 @@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ -LAUNCHD = @LAUNCHD@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LEX = @LEX@ @@ -176,7 +167,10 @@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LINUXDOC = @LINUXDOC@ +LIPO = @LIPO@ LN_S = @LN_S@ +LTCOMPILE = @LTCOMPILE@ +LTCXXCOMPILE = @LTCXXCOMPILE@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -188,8 +182,7 @@ MESA_SOURCE = @MESA_SOURCE@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ -MKFONTDIR = @MKFONTDIR@ -MKFONTSCALE = @MKFONTSCALE@ +NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ @@ -198,8 +191,8 @@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -232,7 +225,6 @@ VENDOR_NAME = @VENDOR_NAME@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ -X11APP_ARCHS = @X11APP_ARCHS@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ @@ -242,27 +234,12 @@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ -XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ -XEGL_LIBS = @XEGL_LIBS@ -XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ -XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGFILE = @XF86CONFIGFILE@ -XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ -XF86MISC_LIBS = @XF86MISC_LIBS@ XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ -XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ -XGLMODULES_LIBS = @XGLMODULES_LIBS@ -XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ -XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ -XGLX_LIBS = @XGLX_LIBS@ -XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ -XGL_LIBS = @XGL_LIBS@ -XGL_MODULE_PATH = @XGL_MODULE_PATH@ -XGL_SYS_LIBS = @XGL_SYS_LIBS@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ @@ -273,10 +250,6 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ -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_CFLAGS = @XORG_CFLAGS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ @@ -285,13 +258,8 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ -XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ -XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ -XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ -XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ -XPRINT_CFLAGS = @XPRINT_CFLAGS@ -XPRINT_LIBS = @XPRINT_LIBS@ -XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -324,8 +292,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -345,7 +312,6 @@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ -ft_config = @ft_config@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -355,12 +321,12 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ -launchagentsdir = @launchagentsdir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ @@ -378,8 +344,6 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -xglmoduledir = @xglmoduledir@ -xpconfigdir = @xpconfigdir@ noinst_LTLIBRARIES = libcomposite.la AM_CFLAGS = $(DIX_CFLAGS) libcomposite_la_SOURCES = \ @@ -387,6 +351,7 @@ libcomposite_la_SOURCES = \ compext.c \ compint.h \ compinit.c \ + compoverlay.c \ compwindow.c all: all-am @@ -397,8 +362,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -443,6 +408,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compalloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compext.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compinit.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compoverlay.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compwindow.Plo@am__quote@ .c.o: @@ -477,7 +443,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/xorg-server/composite/compalloc.c b/xorg-server/composite/compalloc.c index 19c7db0b3..a2f3f140a 100644 --- a/xorg-server/composite/compalloc.c +++ b/xorg-server/composite/compalloc.c @@ -148,6 +148,16 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update) return BadAlloc; if (ccw->update == CompositeRedirectManual) { + /* If the window was CompositeRedirectAutomatic, then + * unmap the window so that the parent clip list will + * be correctly recomputed. + */ + if (pWin->mapped) + { + DisableMapUnmapEvents (pWin); + UnmapWindow (pWin, FALSE); + EnableMapUnmapEvents (pWin); + } if (cw->damageRegistered) { DamageUnregister (&pWin->drawable, cw->damage); @@ -224,7 +234,7 @@ compFreeClientWindow (WindowPtr pWin, XID id) DamageRegister (&pWin->drawable, cw->damage); cw->damageRegistered = TRUE; pWin->redirectDraw = RedirectDrawAutomatic; - DamageDamageRegion (&pWin->drawable, &pWin->borderSize); + DamageRegionAppend(&pWin->drawable, &pWin->borderSize); } if (wasMapped && !pWin->mapped) { diff --git a/xorg-server/composite/compext.c b/xorg-server/composite/compext.c index b3433f72b..c1544021c 100644 --- a/xorg-server/composite/compext.c +++ b/xorg-server/composite/compext.c @@ -51,13 +51,11 @@ #define SERVER_COMPOSITE_MINOR 4 static CARD8 CompositeReqCode; -static DevPrivateKey CompositeClientPrivateKey = &CompositeClientPrivateKey; +static int CompositeClientPrivateKeyIndex; +static DevPrivateKey CompositeClientPrivateKey = &CompositeClientPrivateKeyIndex; RESTYPE CompositeClientWindowType; RESTYPE CompositeClientSubwindowsType; -static RESTYPE CompositeClientOverlayType; - -static void deleteCompOverlayClient (CompOverlayClientPtr pOcToDel, - ScreenPtr pScreen); +RESTYPE CompositeClientOverlayType; typedef struct _CompositeClient { int major_version; @@ -80,11 +78,6 @@ CompositeClientCallback (CallbackListPtr *list, pCompositeClient->minor_version = 0; } -static void -CompositeResetProc (ExtensionEntry *extEntry) -{ -} - static int FreeCompositeClientWindow (pointer value, XID ccwid) { @@ -107,19 +100,8 @@ static int FreeCompositeClientOverlay (pointer value, XID ccwid) { CompOverlayClientPtr pOc = (CompOverlayClientPtr) value; - ScreenPtr pScreen = pOc->pScreen; - CompScreenPtr cs; - - deleteCompOverlayClient(pOc, pScreen); - - /* Unmap overlay window when there are no more clients using it */ - cs = GetCompScreen(pScreen); - if (cs->pOverlayClients == NULL) { - if (cs->pOverlayWin != NULL) { - UnmapWindow(cs->pOverlayWin, FALSE); - } - } + compFreeOverlayClient (pOc); return Success; } @@ -304,137 +286,6 @@ ProcCompositeNameWindowPixmap (ClientPtr client) } -/* - * Routines for manipulating the per-screen overlay clients list. - * This list indicates which clients have called GetOverlayWindow - * for this screen. - */ - -/* Return the screen's overlay client list element for the given client */ -static CompOverlayClientPtr -findCompOverlayClient (ClientPtr pClient, ScreenPtr pScreen) -{ - CompScreenPtr cs = GetCompScreen(pScreen); - CompOverlayClientPtr pOc; - - for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext) { - if (pOc->pClient == pClient) { - return pOc; - } - } - - return NULL; -} - -static int -createCompOverlayClient (ClientPtr pClient, ScreenPtr pScreen) -{ - CompScreenPtr cs = GetCompScreen(pScreen); - CompOverlayClientPtr pOc; - - pOc = (CompOverlayClientPtr) xalloc(sizeof(CompOverlayClientRec)); - if (pOc == NULL) { - return BadAlloc; - } - pOc->pClient = pClient; - pOc->pScreen = pScreen; - pOc->resource = FakeClientID(pClient->index); - pOc->pNext = cs->pOverlayClients; - cs->pOverlayClients = pOc; - - /* - * Create a resource for this element so it can be deleted - * when the client goes away. - */ - if (!AddResource (pOc->resource, CompositeClientOverlayType, - (pointer) pOc)) { - xfree(pOc); - return BadAlloc; - } - - return Success; -} - -/* - * Delete the given overlay client list element from its screen list. - */ -static void -deleteCompOverlayClient (CompOverlayClientPtr pOcToDel, ScreenPtr pScreen) -{ - CompScreenPtr cs = GetCompScreen(pScreen); - CompOverlayClientPtr pOc, pNext; - CompOverlayClientPtr pOcLast = NULL; - - pOc = cs->pOverlayClients; - while (pOc != NULL) { - pNext = pOc->pNext; - if (pOc == pOcToDel) { - xfree(pOc); - if (pOcLast == NULL) { - cs->pOverlayClients = pNext; - } else { - pOcLast->pNext = pNext; - } - break; - } - pOcLast = pOc; - pOc = pNext; - } -} - -/* - * Delete all the hide-counts list elements for this screen. - */ -void -deleteCompOverlayClientsForScreen (ScreenPtr pScreen) -{ - CompScreenPtr cs = GetCompScreen(pScreen); - CompOverlayClientPtr pOc, pTmp; - - pOc = cs->pOverlayClients; - while (pOc != NULL) { - pTmp = pOc->pNext; - FreeResource(pOc->resource, 0); - pOc = pTmp; - } - cs->pOverlayClients = NULL; -} - -/* -** If necessary, create the overlay window. And map it -** Note: I found it excessively difficult to destroy this window -** during compCloseScreen; DeleteWindow can't be called because -** the input devices are already shut down. So we are going to -** just allocate an overlay window once per screen per X server -** invocation. -*/ - -static WindowPtr -createOverlayWindow (ScreenPtr pScreen) -{ - int wid = FakeClientID(0); - WindowPtr pWin; - XID overrideRedirect = TRUE; - int result; - - pWin = CreateWindow ( - wid, WindowTable[pScreen->myNum], - 0, 0, pScreen->width, pScreen->height, 0, - InputOutput, CWOverrideRedirect, &overrideRedirect, - WindowTable[pScreen->myNum]->drawable.depth, - serverClient, pScreen->rootVisual, &result); - if (pWin == NULL) { - return NULL; - } - - if (!AddResource(wid, RT_WINDOW, (pointer)pWin)) { - DeleteWindow(pWin, None); - return NULL; - } - - return pWin; -} - static int ProcCompositeGetOverlayWindow (ClientPtr client) { @@ -456,28 +307,31 @@ ProcCompositeGetOverlayWindow (ClientPtr client) } pScreen = pWin->drawable.pScreen; + /* + * Create an OverlayClient structure to mark this client's + * interest in the overlay window + */ + pOc = compCreateOverlayClient(pScreen, client); + if (pOc == NULL) + return BadAlloc; + + /* + * Make sure the overlay window exists + */ cs = GetCompScreen(pScreen); - if (cs->pOverlayWin == NULL) { - cs->pOverlayWin = createOverlayWindow(pScreen); - if (cs->pOverlayWin == NULL) { + if (cs->pOverlayWin == NULL) + if (!compCreateOverlayWindow(pScreen)) + { + FreeResource (pOc->resource, RT_NONE); return BadAlloc; } - } rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id, RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess); if (rc != Success) + { + FreeResource (pOc->resource, RT_NONE); return rc; - - MapWindow(cs->pOverlayWin, serverClient); - - /* Record that client is using this overlay window */ - pOc = findCompOverlayClient(client, pScreen); - if (pOc == NULL) { - int ret = createCompOverlayClient(client, pScreen); - if (ret != Success) { - return ret; - } } rep.type = X_Reply; @@ -504,7 +358,6 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client) WindowPtr pWin; ScreenPtr pScreen; CompOverlayClientPtr pOc; - CompScreenPtr cs; REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq); pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); @@ -519,18 +372,12 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client) * Has client queried a reference to the overlay window * on this screen? If not, generate an error. */ - pOc = findCompOverlayClient(client, pWin->drawable.pScreen); - if (pOc == NULL) { + pOc = compFindOverlayClient (pWin->drawable.pScreen, client); + if (pOc == NULL) return BadMatch; - } /* The delete function will free the client structure */ - FreeResource (pOc->resource, 0); - - cs = GetCompScreen(pScreen); - if (cs->pOverlayClients == NULL) { - UnmapWindow(cs->pOverlayWin, FALSE); - } + FreeResource (pOc->resource, RT_NONE); return client->noClientException; } @@ -747,7 +594,7 @@ CompositeExtensionInit (void) extEntry = AddExtension (COMPOSITE_NAME, 0, 0, ProcCompositeDispatch, SProcCompositeDispatch, - CompositeResetProc, StandardMinorOpcode); + NULL, StandardMinorOpcode); if (!extEntry) return; CompositeReqCode = (CARD8) extEntry->base; diff --git a/xorg-server/composite/compinit.c b/xorg-server/composite/compinit.c index 3bf77e0ae..b2a9861ea 100644 --- a/xorg-server/composite/compinit.c +++ b/xorg-server/composite/compinit.c @@ -46,9 +46,12 @@ #include "compint.h" -DevPrivateKey CompScreenPrivateKey = &CompScreenPrivateKey; -DevPrivateKey CompWindowPrivateKey = &CompWindowPrivateKey; -DevPrivateKey CompSubwindowsPrivateKey = &CompSubwindowsPrivateKey; +static int CompScreenPrivateKeyIndex; +DevPrivateKey CompScreenPrivateKey = &CompScreenPrivateKeyIndex; +static int CompWindowPrivateKeyIndex; +DevPrivateKey CompWindowPrivateKey = &CompWindowPrivateKeyIndex; +static int CompSubwindowsPrivateKeyIndex; +DevPrivateKey CompSubwindowsPrivateKey = &CompSubwindowsPrivateKeyIndex; static Bool @@ -76,14 +79,6 @@ compCloseScreen (int index, ScreenPtr pScreen) pScreen->CopyWindow = cs->CopyWindow; pScreen->PositionWindow = cs->PositionWindow; - deleteCompOverlayClientsForScreen(pScreen); - - /* - ** Note: no need to call DeleteWindow; the server has - ** already destroyed it. - */ - cs->pOverlayWin = NULL; - xfree (cs); dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL); ret = (*pScreen->CloseScreen) (index, pScreen); @@ -123,11 +118,11 @@ compChangeWindowAttributes(WindowPtr pWin, unsigned long mask) pScreen->backingStoreSupport != NotUseful) { if (pWin->backingStore != NotUseful) { compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic); - pWin->backStorage = TRUE; + pWin->backStorage = (pointer) (intptr_t) 1; } else { compUnredirectWindow(serverClient, pWin, CompositeRedirectAutomatic); - pWin->backStorage = FALSE; + pWin->backStorage = NULL; } } @@ -381,6 +376,7 @@ compScreenInit (ScreenPtr pScreen) return FALSE; cs->damaged = FALSE; + cs->overlayWid = FakeClientID(0); cs->pOverlayWin = NULL; cs->pOverlayClients = NULL; diff --git a/xorg-server/composite/compint.h b/xorg-server/composite/compint.h index 4b0fe0834..1c19ccd39 100644 --- a/xorg-server/composite/compint.h +++ b/xorg-server/composite/compint.h @@ -155,6 +155,7 @@ typedef struct _CompScreen { VisualID *alternateVisuals; WindowPtr pOverlayWin; + Window overlayWid; CompOverlayClientPtr pOverlayClients; } CompScreenRec, *CompScreenPtr; @@ -172,6 +173,7 @@ extern DevPrivateKey CompSubwindowsPrivateKey; extern RESTYPE CompositeClientWindowType; extern RESTYPE CompositeClientSubwindowsType; +extern RESTYPE CompositeClientOverlayType; /* * compalloc.c @@ -230,6 +232,25 @@ Bool compScreenInit (ScreenPtr pScreen); /* + * compoverlay.c + */ + +void +compFreeOverlayClient (CompOverlayClientPtr pOcToDel); + +CompOverlayClientPtr +compFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient); + +CompOverlayClientPtr +compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient); + +Bool +compCreateOverlayWindow (ScreenPtr pScreen); + +void +compDestroyOverlayWindow (ScreenPtr pScreen); + +/* * compwindow.c */ @@ -292,9 +313,6 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); void compWindowUpdate (WindowPtr pWin); -void -deleteCompOverlayClientsForScreen (ScreenPtr pScreen); - WindowPtr CompositeRealChildHead (WindowPtr pWin); diff --git a/xorg-server/composite/compoverlay.c b/xorg-server/composite/compoverlay.c new file mode 100644 index 000000000..94e5b0346 --- /dev/null +++ b/xorg-server/composite/compoverlay.c @@ -0,0 +1,159 @@ +/* + * Copyright © 2006 Sun Microsystems + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Sun Microsystems not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Sun Microsystems makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Copyright © 2003 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "compint.h" +#include "xace.h" + +/* + * Delete the given overlay client list element from its screen list. + */ +void +compFreeOverlayClient (CompOverlayClientPtr pOcToDel) +{ + ScreenPtr pScreen = pOcToDel->pScreen; + CompScreenPtr cs = GetCompScreen (pScreen); + CompOverlayClientPtr *pPrev, pOc; + + for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext) + { + if (pOc == pOcToDel) { + *pPrev = pOc->pNext; + xfree (pOc); + break; + } + } + + /* Destroy overlay window when there are no more clients using it */ + if (cs->pOverlayClients == NULL) + compDestroyOverlayWindow (pScreen); +} + +/* + * Return the client's first overlay client rec from the given screen + */ +CompOverlayClientPtr +compFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient) +{ + CompScreenPtr cs = GetCompScreen(pScreen); + CompOverlayClientPtr pOc; + + for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext) + if (pOc->pClient == pClient) + return pOc; + + return NULL; +} + +/* + * Create an overlay client object for the given client + */ +CompOverlayClientPtr +compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient) +{ + CompScreenPtr cs = GetCompScreen(pScreen); + CompOverlayClientPtr pOc; + + pOc = (CompOverlayClientPtr) xalloc(sizeof(CompOverlayClientRec)); + if (pOc == NULL) + return NULL; + + pOc->pClient = pClient; + pOc->pScreen = pScreen; + pOc->resource = FakeClientID(pClient->index); + pOc->pNext = cs->pOverlayClients; + cs->pOverlayClients = pOc; + + /* + * Create a resource for this element so it can be deleted + * when the client goes away. + */ + if (!AddResource (pOc->resource, CompositeClientOverlayType, (pointer) pOc)) + return NULL; + + return pOc; +} + +/* + * Create the overlay window and map it + */ +Bool +compCreateOverlayWindow (ScreenPtr pScreen) +{ + CompScreenPtr cs = GetCompScreen(pScreen); + WindowPtr pRoot = WindowTable[pScreen->myNum]; + WindowPtr pWin; + XID overrideRedirect = TRUE; + int result; + + pWin = cs->pOverlayWin = + CreateWindow (cs->overlayWid, pRoot, + 0, 0, pScreen->width, pScreen->height, 0, + InputOutput, CWOverrideRedirect, &overrideRedirect, + pRoot->drawable.depth, + serverClient, pScreen->rootVisual, &result); + if (pWin == NULL) + return FALSE; + + if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin)) + return FALSE; + + MapWindow(pWin, serverClient); + + return TRUE; +} + +/* + * Destroy the overlay window + */ +void +compDestroyOverlayWindow (ScreenPtr pScreen) +{ + CompScreenPtr cs = GetCompScreen(pScreen); + + cs->pOverlayWin = NullWindow; + FreeResource (cs->overlayWid, RT_NONE); +} + diff --git a/xorg-server/composite/compwindow.c b/xorg-server/composite/compwindow.c index 05dc055c2..577fa733e 100644 --- a/xorg-server/composite/compwindow.c +++ b/xorg-server/composite/compwindow.c @@ -54,7 +54,7 @@ compCheckWindow (WindowPtr pWin, pointer data) PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin); PixmapPtr pParentPixmap = pWin->parent ? (*pScreen->GetWindowPixmap) (pWin->parent) : 0; PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen); - + if (!pWin->parent) { assert (pWin->redirectDraw == RedirectDrawNone); @@ -122,7 +122,7 @@ compSetPixmapVisitWindow (WindowPtr pWindow, pointer data) SetWinSize (pWindow); SetBorderSize (pWindow); if (HasBorder (pWindow)) - QueueWorkProc (compRepaintBorder, serverClient, + QueueWorkProc (compRepaintBorder, serverClient, (pointer) pWindow->drawable.id); return WT_WALKCHILDREN; } @@ -153,8 +153,8 @@ compCheckRedirect (WindowPtr pWin) if (pWin == cs->pOverlayWin) { should = FALSE; } - } - + } + if (should != (pWin->redirectDraw != RedirectDrawNone)) { if (should) @@ -276,10 +276,10 @@ compClipNotify (WindowPtr pWin, int dx, int dy) ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); CompWindowPtr cw = GetCompWindow (pWin); - + if (cw) { - if (cw->borderClipX != pWin->drawable.x || + if (cw->borderClipX != pWin->drawable.x || cw->borderClipY != pWin->drawable.y) { REGION_TRANSLATE (pScreen, &cw->borderClip, @@ -324,7 +324,7 @@ compImplicitRedirect (WindowPtr pWin, WindowPtr pParent) ScreenPtr pScreen = pWin->drawable.pScreen; XID winVisual = wVisual (pWin); XID parentVisual = wVisual (pParent); - + if (winVisual != parentVisual && (compIsAlternateVisual (pScreen, winVisual) || compIsAlternateVisual (pScreen, parentVisual))) @@ -345,11 +345,11 @@ compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind) WindowPtr pParent; int draw_x, draw_y; unsigned int w, h, bw; - + /* if this is a root window, can't be moved */ if (!(pParent = pWin->parent)) return; - + bw = wBorderWidth (pWin); draw_x = pParent->drawable.x + x + (int)bw; draw_y = pParent->drawable.y + y + (int)bw; @@ -390,18 +390,18 @@ compResizeWindow (WindowPtr pWin, int x, int y, WindowPtr pParent; int draw_x, draw_y; unsigned int bw; - + /* if this is a root window, can't be moved */ if (!(pParent = pWin->parent)) return; - + bw = wBorderWidth (pWin); draw_x = pParent->drawable.x + x + (int)bw; draw_y = pParent->drawable.y + y + (int)bw; compReallocPixmap (pWin, draw_x, draw_y, w, h, bw); } compCheckTree (pScreen); - + pScreen->ResizeWindow = cs->ResizeWindow; (*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib); cs->ResizeWindow = pScreen->ResizeWindow; @@ -430,11 +430,11 @@ compChangeBorderWidth (WindowPtr pWin, unsigned int bw) WindowPtr pParent; int draw_x, draw_y; unsigned int w, h; - + /* if this is a root window, can't be moved */ if (!(pParent = pWin->parent)) return; - + draw_x = pWin->drawable.x; draw_y = pWin->drawable.y; w = pWin->drawable.width; @@ -481,13 +481,13 @@ compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent) */ if (compImplicitRedirect (pWin, pWin->parent)) compRedirectWindow (serverClient, pWin, CompositeRedirectAutomatic); - + /* * Allocate any necessary redirect pixmap * (this actually should never be true; pWin is always unmapped) */ compCheckRedirect (pWin); - + /* * Reset pixmap pointers as appropriate */ @@ -514,7 +514,7 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); CompWindowPtr cw = GetCompWindow (pWin); - + assert (cw->oldx != COMP_ORIGIN_INVALID); assert (cw->oldy != COMP_ORIGIN_INVALID); if (cw->pOldPixmap) @@ -526,7 +526,7 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) RegionRec rgnDst; PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); GCPtr pGC; - + dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); @@ -535,10 +535,10 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); - - REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst, + + REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst, -pPixmap->screen_x, -pPixmap->screen_y); - + dx = dx + pPixmap->screen_x - cw->oldx; dy = dy + pPixmap->screen_y - cw->oldy; pGC = GetScratchGC (pPixmap->drawable.depth, pScreen); @@ -546,7 +546,7 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { BoxPtr pBox = REGION_RECTS (&rgnDst); int nBox = REGION_NUM_RECTS (&rgnDst); - + ValidateGC(&pPixmap->drawable, pGC); while (nBox--) { @@ -568,7 +568,7 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) ptOldOrg.x += dx; ptOldOrg.y += dy; } - + pScreen->CopyWindow = cs->CopyWindow; if (ptOldOrg.x != pWin->drawable.x || ptOldOrg.y != pWin->drawable.y) { @@ -585,7 +585,7 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) REGION_TRANSLATE (prgnSrc, prgnSrc, pWin->drawable.x - ptOldOrg.x, pWin->drawable.y - ptOldOrg.y); - DamageDamageRegion (&pWin->drawable, prgnSrc); + DamageRegionAppend(&pWin->drawable, prgnSrc); } cs->CopyWindow = pScreen->CopyWindow; pScreen->CopyWindow = compCopyWindow; @@ -634,7 +634,7 @@ compDestroyWindow (WindowPtr pWin) FreeResource (cw->clients->id, RT_NONE); while ((csw = GetCompSubwindows (pWin))) FreeResource (csw->clients->id, RT_NONE); - + if (pWin->redirectDraw != RedirectDrawNone) compFreePixmap (pWin); ret = (*pScreen->DestroyWindow) (pWin); @@ -664,7 +664,7 @@ compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion) /* * Report that as damaged so it will be redrawn */ - DamageDamageRegion (&pWin->drawable, &damage); + DamageRegionAppend(&pWin->drawable, &damage); REGION_UNINIT (pScreen, &damage); /* * Save the new border clip region @@ -699,7 +699,7 @@ PictFormatPtr compWindowFormat (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; - + return PictureMatchVisual (pScreen, pWin->drawable.depth, compGetWindowVisual (pWin)); } @@ -716,24 +716,24 @@ compWindowUpdateAutomatic (WindowPtr pWin) int error; RegionPtr pRegion = DamageRegion (cw->damage); PicturePtr pSrcPicture = CreatePicture (0, &pSrcPixmap->drawable, - pSrcFormat, + pSrcFormat, 0, 0, serverClient, &error); XID subwindowMode = IncludeInferiors; PicturePtr pDstPicture = CreatePicture (0, &pParent->drawable, pDstFormat, - CPSubwindowMode, + CPSubwindowMode, &subwindowMode, serverClient, &error); - + /* * First move the region from window to screen coordinates */ - REGION_TRANSLATE (pScreen, pRegion, + REGION_TRANSLATE (pScreen, pRegion, pWin->drawable.x, pWin->drawable.y); - + /* * Clip against the "real" border clip */ @@ -742,14 +742,14 @@ compWindowUpdateAutomatic (WindowPtr pWin) /* * Now translate from screen to dest coordinates */ - REGION_TRANSLATE (pScreen, pRegion, + REGION_TRANSLATE (pScreen, pRegion, -pParent->drawable.x, -pParent->drawable.y); - + /* * Clip the picture */ SetPictureClipRegion (pDstPicture, 0, 0, pRegion); - + /* * And paint */ @@ -813,7 +813,7 @@ CompositeRealChildHead (WindowPtr pWin) if (!pChild) { return NullWindow; } - + cs = GetCompScreen(pWin->drawable.pScreen); if (pChild == cs->pOverlayWin) { return pChild; |