From 7730cca8d38fd159e500893a2edf2e11bf898980 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 21 Nov 2017 13:28:17 +0100 Subject: [PATCH 1/4] Drop bin wrappers for nxagent and nxproxy, directly install nxproxy and nxagent to BINDIR. Fixes ArcticaProject/nx-libs#546. --- Makefile | 43 ++++++++++++--------------------------- bin/nxagent.in | 24 ---------------------- bin/nxproxy.in | 24 ---------------------- debian/nxagent.install | 3 ++- debian/nxproxy.install | 1 - nx-X11/config/cf/X11.tmpl | 2 +- nx-libs.spec | 7 +------ nxproxy/src/Makefile.am | 2 +- 8 files changed, 18 insertions(+), 88 deletions(-) delete mode 100644 bin/nxagent.in delete mode 100644 bin/nxproxy.in diff --git a/Makefile b/Makefile index 27a6f966c3..95ebd26e32 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ SHLIBDIR ?= $(LIBDIR) NXLIBDIR ?= $(SHLIBDIR)/nx USRLIBDIR ?= $(NXLIBDIR)/X11 INCLUDEDIR ?= $(PREFIX)/include -CONFIGURE ?= ./configure --prefix=$(DESTDIR)$(PREFIX) --libexecdir=$(NXLIBDIR)/bin +CONFIGURE ?= ./configure --prefix=$(DESTDIR)$(PREFIX) # use Xfont2 if available in the build env FONT_DEFINES ?= $(shell pkg-config --modversion xfont2 1>/dev/null 2>/dev/null && echo "-DHAS_XFONT2") @@ -75,8 +75,6 @@ NX_XTRANS_HEADERS = \ rm -Rf nx-X11/extras/Mesa/.pc/; \ rm -f nx-X11/config/cf/nxversion.def; \ rm -f nx-X11/config/cf/date.def; \ - rm -f bin/nxagent; \ - rm -f bin/nxproxy; \ ${MAKE} clean-env; \ fi @@ -168,30 +166,24 @@ install-lite: # install nxcomp library $(MAKE) -C nxcomp install - # install nxproxy wrapper script - $(INSTALL_DIR) $(DESTDIR)$(BINDIR) - sed -e 's|@@NXLIBDIR@@|$(NXLIBDIR)|g' bin/nxproxy.in > bin/nxproxy - $(INSTALL_PROGRAM) bin/nxproxy $(DESTDIR)$(BINDIR) - # install the nxproxy executable and its man page $(MAKE) -C nxproxy install install-full: - # install nxagent wrapper script - $(INSTALL_DIR) $(DESTDIR)$(BINDIR) - sed -e 's|@@NXLIBDIR@@|$(NXLIBDIR)|g' bin/nxagent.in > bin/nxagent - $(INSTALL_PROGRAM) bin/nxagent $(DESTDIR)$(BINDIR) - $(MAKE) -C nxcompshad install + $(INSTALL_DIR) $(DESTDIR)$(BINDIR)/bin + $(INSTALL_PROGRAM) nx-X11/programs/Xserver/nxagent $(DESTDIR)$(BINDIR) + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/pixmaps $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/nxagent.xpm $(DESTDIR)$(PREFIX)/share/pixmaps $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx $(INSTALL_FILE) nx-X11/programs/Xserver/Xext/SecurityPolicy $(DESTDIR)$(PREFIX)/share/nx + # FIXME: Drop this symlink for 3.6.0. Requires that third party frameworks like X2Go have become aware of this... $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/bin - $(INSTALL_PROGRAM) nx-X11/programs/Xserver/nxagent $(DESTDIR)$(NXLIBDIR)/bin + $(INSTALL_SYMLINK) $(BINDIR)/nxagent $(DESTDIR)$(NXLIBDIR)/bin/nxagent $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/man/man1/ $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 $(DESTDIR)$(PREFIX)/share/man/man1/ @@ -243,28 +235,19 @@ uninstall: uninstall-lite: if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi + if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi - # uninstall nproxy wrapper script - $(RM_FILE) $(DESTDIR)$(BINDIR)/nxproxy - # FIXME: don't use uninstall rule in nxproxy/Makefile.in, let's do - # it on our own for now... - $(RM_FILE) $(DESTDIR)$(NXLIBDIR)/bin/nxproxy - $(RM_DIR) $(DESTDIR)$(NXLIBDIR)/bin/ - $(RM_FILE) $(DESTDIR)$(PREFIX)/share/man/man1/*.1 $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy $(RM_DIR) $(DESTDIR)$(PREFIX)/share/nx/ uninstall-full: - for f in nxagent; do \ - $(RM_FILE) $(DESTDIR)$(BINDIR)/$$f; done + if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi + if test -f nx-X11/lib/Makefile; then ${MAKE} -C nx-X11/lib $@; fi + + $(RM_FILE) $(DESTDIR)$(BINDIR)/nxagent $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent $(RM_DIR) $(DESTDIR)$(PREFIX)/share/nx/ - if test -d nx-X11; then \ - if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ - if test -f nx-X11/Makefile; then \ - if test -d $(NXLIBDIR); then rm -rf $(NXLIBDIR); fi; \ - if test -d $(INCLUDEDIR)/nx; then rm -rf $(INCLUDEDIR)/nx; fi; \ - fi; \ - fi + if test -d $(NXLIBDIR); then rm -rf $(NXLIBDIR); fi + if test -d $(INCLUDEDIR)/nx; then rm -rf $(INCLUDEDIR)/nx; fi diff --git a/bin/nxagent.in b/bin/nxagent.in deleted file mode 100644 index 3a9dfc6490..0000000000 --- a/bin/nxagent.in +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2012 Mike Gabriel -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. - -NX_LIBDIR=@@NXLIBDIR@@ - -# make sure nxagent starts properly with pam_tmpdir.so being in use -NX_TEMP=${NX_TEMP:-/tmp} -export NX_TEMP - -exec $NX_LIBDIR/bin/${NXAPP:-"nxagent"} "$@" diff --git a/bin/nxproxy.in b/bin/nxproxy.in deleted file mode 100644 index 0866d25ac6..0000000000 --- a/bin/nxproxy.in +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2012 Mike Gabriel -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. - -NX_LIBDIR=@@NXLIBDIR@@ - -# make sure nxagent starts properly with pam_tmpdir.so being in use -NX_TEMP=${NX_TEMP:-/tmp} -export NX_TEMP - -exec $NX_LIBDIR/bin/${NXAPP:="nxproxy"} "$@" diff --git a/debian/nxagent.install b/debian/nxagent.install index 34f5c3a768..87ba3583fd 100644 --- a/debian/nxagent.install +++ b/debian/nxagent.install @@ -1,8 +1,9 @@ etc/nxagent/keystrokes.cfg usr/share/nx/VERSION.nxagent usr/share/man/man1/nxagent.1* -usr/lib/*/nx/bin/nxagent usr/lib/*/nx/X11/ usr/bin/nxagent usr/share/pixmaps/nxagent.xpm etc/nxagent/nxagent.keyboard +# FIXME: compatibility symlink, drop for 3.6.0 release +usr/lib/*/nx/bin/nxagent diff --git a/debian/nxproxy.install b/debian/nxproxy.install index 8ade77d6da..988f2842f6 100644 --- a/debian/nxproxy.install +++ b/debian/nxproxy.install @@ -1,4 +1,3 @@ -usr/lib/*/nx/bin/nxproxy usr/bin/nxproxy usr/share/man/man1/nxproxy.1* usr/share/nx/VERSION.nxproxy diff --git a/nx-X11/config/cf/X11.tmpl b/nx-X11/config/cf/X11.tmpl index ddd6e0bada..9b3e0e8b3c 100644 --- a/nx-X11/config/cf/X11.tmpl +++ b/nx-X11/config/cf/X11.tmpl @@ -769,7 +769,7 @@ FCHOWN_DEFINES = -DHAS_FCHOWN #ifndef BinDir #ifdef ProjectRoot -#define BinDir Concat(ProjectRoot,/lib/nx/bin) +#define BinDir Concat(ProjectRoot,/bin) #else #define BinDir /usr/bin/X11 #endif diff --git a/nx-libs.spec b/nx-libs.spec index 4a64b8aeda..68bec63972 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -367,10 +367,6 @@ This package provides the NX proxy (client) binary. rm -Rf nx*/configure nx*/autom4te.cache* # Install into /usr sed -i -e 's,/usr/local,/usr,' nx-X11/config/cf/site.def -# Use multilib dirs -# We're installing binaries into %%{_libdir}/nx/bin rather than %%{_libexedir}/nx -# because upstream expects libraries and binaries in the same directory -sed -i -e 's,/lib/nx,/%{_lib}/nx,' nx-X11/config/cf/X11.tmpl # Fix FSF address find -name LICENSE | xargs sed -i \ -e 's/59 Temple Place/51 Franklin Street/' -e 's/Suite 330/Fifth Floor/' \ @@ -575,6 +571,7 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans %config(noreplace) %{_sysconfdir}/nxagent/nxagent.keyboard %doc doc/nxagent/README.keystrokes %{_bindir}/nxagent +# FIXME: compatibility symlink to BINDIR/nxagent, remove for 3.6.0 %dir %{_libdir}/nx/bin %{_libdir}/nx/bin/nxagent %dir %{_libdir}/nx/X11 @@ -590,8 +587,6 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans %doc doc/nxproxy/README-VALGRIND %{_bindir}/nxproxy %{_datadir}/man/man1/nxproxy.1* -%dir %{_libdir}/nx/bin -%{_libdir}/nx/bin/nxproxy %dir %{_datadir}/nx %{_datadir}/nx/VERSION.nxproxy diff --git a/nxproxy/src/Makefile.am b/nxproxy/src/Makefile.am index 7e55900d3d..4fd2eefd69 100644 --- a/nxproxy/src/Makefile.am +++ b/nxproxy/src/Makefile.am @@ -1,6 +1,6 @@ NULL = -nxexecdir = $(libexecdir) +nxexecdir = $(bindir) nxexec_PROGRAMS = nxproxy From ab430228afd5344c90d53640951fb3b5a0441a81 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 21 Nov 2017 13:45:55 +0100 Subject: [PATCH 2/4] Makefile: Don't use DESTDIR in configure. Fixes ArcticaProject/nx-libs#547. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 95ebd26e32..944bf1a60e 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ SHLIBDIR ?= $(LIBDIR) NXLIBDIR ?= $(SHLIBDIR)/nx USRLIBDIR ?= $(NXLIBDIR)/X11 INCLUDEDIR ?= $(PREFIX)/include -CONFIGURE ?= ./configure --prefix=$(DESTDIR)$(PREFIX) +CONFIGURE ?= ./configure --prefix=$(PREFIX) # use Xfont2 if available in the build env FONT_DEFINES ?= $(shell pkg-config --modversion xfont2 1>/dev/null 2>/dev/null && echo "-DHAS_XFONT2") From 12eed42d1c9e0d4bb7de8d79326c607734a96743 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 20 Nov 2017 23:08:48 +0100 Subject: [PATCH 3/4] nxagent: Fake backing store support via Composite extension. --- nx-X11/programs/Xserver/composite/compinit.c | 6 - nx-X11/programs/Xserver/dix/window.c | 6 - nx-X11/programs/Xserver/fb/Imakefile | 3 - nx-X11/programs/Xserver/fb/fb.h | 18 - nx-X11/programs/Xserver/fb/fbbstore.c | 65 - nx-X11/programs/Xserver/fb/fbscreen.c | 37 - nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 18 - nx-X11/programs/Xserver/hw/nxagent/Events.c | 70 +- nx-X11/programs/Xserver/hw/nxagent/Init.c | 2 - .../programs/Xserver/hw/nxagent/NXmiexpose.c | 50 - nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 2 - .../programs/Xserver/hw/nxagent/Reconnect.c | 4 - nx-X11/programs/Xserver/hw/nxagent/Screen.c | 302 -- nx-X11/programs/Xserver/hw/nxagent/Screen.h | 4 - nx-X11/programs/Xserver/hw/nxagent/Visual.c | 1 - nx-X11/programs/Xserver/hw/nxagent/Window.c | 190 - nx-X11/programs/Xserver/hw/nxagent/Windows.h | 6 - nx-X11/programs/Xserver/include/Imakefile | 2 - nx-X11/programs/Xserver/include/bstore.h | 22 - nx-X11/programs/Xserver/include/bstorestr.h | 57 - nx-X11/programs/Xserver/include/scrnintstr.h | 57 - nx-X11/programs/Xserver/include/windowstr.h | 3 - nx-X11/programs/Xserver/mi/Imakefile | 3 - nx-X11/programs/Xserver/mi/mibstore.c | 3897 ----------------- nx-X11/programs/Xserver/mi/mibstore.h | 29 - nx-X11/programs/Xserver/mi/mibstorest.h | 91 - nx-X11/programs/Xserver/mi/midispcur.c | 2 - nx-X11/programs/Xserver/mi/miexpose.c | 56 - nx-X11/programs/Xserver/mi/mioverlay.c | 63 +- nx-X11/programs/Xserver/mi/miscrinit.c | 7 - nx-X11/programs/Xserver/mi/misprite.c | 47 - nx-X11/programs/Xserver/mi/mispritest.h | 3 - nx-X11/programs/Xserver/mi/mivalidate.h | 3 +- nx-X11/programs/Xserver/mi/mivaltree.c | 20 +- nx-X11/programs/Xserver/mi/miwindow.c | 93 +- nx-X11/programs/Xserver/miext/damage/damage.c | 21 - .../programs/Xserver/miext/damage/damagestr.h | 1 - 37 files changed, 5 insertions(+), 5256 deletions(-) delete mode 100644 nx-X11/programs/Xserver/fb/fbbstore.c delete mode 100644 nx-X11/programs/Xserver/include/bstore.h delete mode 100644 nx-X11/programs/Xserver/include/bstorestr.h delete mode 100644 nx-X11/programs/Xserver/mi/mibstore.c delete mode 100644 nx-X11/programs/Xserver/mi/mibstore.h delete mode 100644 nx-X11/programs/Xserver/mi/mibstorest.h diff --git a/nx-X11/programs/Xserver/composite/compinit.c b/nx-X11/programs/Xserver/composite/compinit.c index ff21378873..797dae1596 100644 --- a/nx-X11/programs/Xserver/composite/compinit.c +++ b/nx-X11/programs/Xserver/composite/compinit.c @@ -99,8 +99,6 @@ compInstallColormap (ColormapPtr pColormap) pScreen->InstallColormap = compInstallColormap; } -/* Unsupported by current architecture, drop for now. */ -#if 0 static void compCheckBackingStore(WindowPtr pWin) { @@ -134,7 +132,6 @@ compChangeWindowAttributes(WindowPtr pWin, unsigned long mask) return ret; } -#endif /* 0 */ static void compGetImage(DrawablePtr pDrawable, @@ -464,11 +461,8 @@ compScreenInit (ScreenPtr pScreen) cs->InstallColormap = pScreen->InstallColormap; pScreen->InstallColormap = compInstallColormap; - /* Unsupported by our current architecture, drop for now. */ - /* cs->ChangeWindowAttributes = pScreen->ChangeWindowAttributes; pScreen->ChangeWindowAttributes = compChangeWindowAttributes; - */ cs->BlockHandler = NULL; diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c index ba9cfc2d2b..05fc730d08 100644 --- a/nx-X11/programs/Xserver/dix/window.c +++ b/nx-X11/programs/Xserver/dix/window.c @@ -2928,9 +2928,6 @@ UnrealizeTree( deltaSaveUndersViewable--; #endif pChild->viewable = FALSE; - if (pChild->backStorage) - (*pChild->drawable.pScreen->SaveDoomedAreas)( - pChild, &pChild->clipList, 0, 0); (* MarkUnrealizedWindow)(pChild, pWin, fromConfigure); pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER; } @@ -3061,9 +3058,6 @@ UnmapSubwindows(register WindowPtr pWin) #ifdef DO_SAVE_UNDERS pChild->DIXsaveUnder = FALSE; #endif /* DO_SAVE_UNDERS */ - if (pChild->backStorage) - (*pScreen->SaveDoomedAreas)( - pChild, &pChild->clipList, 0, 0); } } } diff --git a/nx-X11/programs/Xserver/fb/Imakefile b/nx-X11/programs/Xserver/fb/Imakefile index 5daa10c6f0..273b3d5eec 100644 --- a/nx-X11/programs/Xserver/fb/Imakefile +++ b/nx-X11/programs/Xserver/fb/Imakefile @@ -30,7 +30,6 @@ SRCS = $(XFMODSRC) \ fbbits.c \ fbblt.c \ fbbltone.c \ - fbbstore.c \ fbcmap.c \ $(RENDERSRC) \ fbcopy.c \ @@ -66,7 +65,6 @@ OBJS = $(XFMODOBJ) \ fbbits.o \ fbblt.o \ fbbltone.o \ - fbbstore.o \ fbcmap.o \ $(RENDEROBJ) \ fbcopy.o \ @@ -128,7 +126,6 @@ LinkSourceFile(fbarc.c,LinkDirectory) LinkSourceFile(fbbits.c,LinkDirectory) LinkSourceFile(fbblt.c,LinkDirectory) LinkSourceFile(fbbltone.c,LinkDirectory) -LinkSourceFile(fbbstore.c,LinkDirectory) LinkSourceFile(fbcmap.c,LinkDirectory) #if BuildRender LinkSourceFile(fbcompose.c,LinkDirectory) diff --git a/nx-X11/programs/Xserver/fb/fb.h b/nx-X11/programs/Xserver/fb/fb.h index 61bf18caf4..66733fbd9c 100644 --- a/nx-X11/programs/Xserver/fb/fb.h +++ b/nx-X11/programs/Xserver/fb/fb.h @@ -36,7 +36,6 @@ #include "windowstr.h" #include "mi.h" #include "migc.h" -#include "mibstore.h" #ifdef RENDER #include "picturestr.h" #else @@ -1220,23 +1219,6 @@ fbBltPlane (FbBits *src, FbStip bgxor, Pixel planeMask); -/* - * fbbstore.c - */ -void -fbSaveAreas(PixmapPtr pPixmap, - RegionPtr prgnSave, - int xorg, - int yorg, - WindowPtr pWin); - -void -fbRestoreAreas(PixmapPtr pPixmap, - RegionPtr prgnRestore, - int xorg, - int yorg, - WindowPtr pWin); - /* * fbcmap.c */ diff --git a/nx-X11/programs/Xserver/fb/fbbstore.c b/nx-X11/programs/Xserver/fb/fbbstore.c deleted file mode 100644 index 75f6084c07..0000000000 --- a/nx-X11/programs/Xserver/fb/fbbstore.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Id: fbbstore.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ - * - * Copyright © 1998 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 -#endif - -#include "fb.h" - -void -fbSaveAreas(PixmapPtr pPixmap, - RegionPtr prgnSave, - int xorg, - int yorg, - WindowPtr pWin) -{ - fbCopyWindowProc (&pWin->drawable, - &pPixmap->drawable, - 0, - RegionRects(prgnSave), - RegionNumRects(prgnSave), - xorg, yorg, - FALSE, - FALSE, - 0,0); -} - -void -fbRestoreAreas(PixmapPtr pPixmap, - RegionPtr prgnRestore, - int xorg, - int yorg, - WindowPtr pWin) -{ - fbCopyWindowProc (&pPixmap->drawable, - &pWin->drawable, - 0, - RegionRects(prgnRestore), - RegionNumRects(prgnRestore), - -xorg, -yorg, - FALSE, - FALSE, - 0,0); -} diff --git a/nx-X11/programs/Xserver/fb/fbscreen.c b/nx-X11/programs/Xserver/fb/fbscreen.c index b0e6d9a6b3..914e918f19 100644 --- a/nx-X11/programs/Xserver/fb/fbscreen.c +++ b/nx-X11/programs/Xserver/fb/fbscreen.c @@ -146,12 +146,6 @@ fbSetupScreen(ScreenPtr pScreen, #ifndef FB_OLD_SCREEN pScreen->GetWindowPixmap = _fbGetWindowPixmap; pScreen->SetWindowPixmap = _fbSetWindowPixmap; - - pScreen->BackingStoreFuncs.SaveAreas = fbSaveAreas; - pScreen->BackingStoreFuncs.RestoreAreas = fbRestoreAreas; - pScreen->BackingStoreFuncs.SetClipmaskRgn = 0; - pScreen->BackingStoreFuncs.GetImagePixmap = 0; - pScreen->BackingStoreFuncs.GetSpansPixmap = 0; #endif return TRUE; @@ -245,14 +239,6 @@ fbFinishScreenInit(ScreenPtr pScreen, pScreen->ModifyPixmapHeader = fb24_32ModifyPixmapHeader; pScreen->CreateScreenResources = fb24_32CreateScreenResources; } -#endif -#if 0 - /* leave backing store initialization to the enclosing code so - * it can choose the correct order of wrappers - */ - /* init backing store here so we can overwrite CloseScreen without stepping - * on the backing store wrapped version */ - fbInitializeBackingStore (pScreen); #endif return TRUE; } @@ -275,26 +261,3 @@ fbScreenInit(ScreenPtr pScreen, return FALSE; return TRUE; } - - -#ifdef FB_OLD_SCREEN -const miBSFuncRec fbBSFuncRec = { - fbSaveAreas, - fbRestoreAreas, - (void (*)(GCPtr, RegionPtr)) 0, - (PixmapPtr (*)(void)) 0, - (PixmapPtr (*)(void)) 0, -}; -#endif - -#if 0 -void -fbInitializeBackingStore (ScreenPtr pScreen) -{ -#ifdef FB_OLD_SCREEN - miInitializeBackingStore (pScreen, (miBSFuncRec *) &fbBSFuncRec); -#else - miInitializeBackingStore (pScreen); -#endif -} -#endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index c3d27073e3..78e62142e4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -44,8 +44,6 @@ #include "compext/Compext.h" -#include "mibstorest.h" - #define PANIC #define WARNING #undef TEST @@ -3055,7 +3053,6 @@ int nxagentSynchronizationPredicate() void nxagentSendBackgroundExpose(WindowPtr pWin, PixmapPtr pBackground, RegionPtr pExpose) { RegionRec expose; - miBSWindowPtr pBackingStore; RegionInit(&expose, NullBox, 1); @@ -3111,21 +3108,6 @@ void nxagentSendBackgroundExpose(WindowPtr pWin, PixmapPtr pBackground, RegionPt expose.extents.x1, expose.extents.y1, expose.extents.x2, expose.extents.y2); #endif - /* - * This prevents hidden region to be exposed. - */ - - pBackingStore = (miBSWindowPtr)pWin->backStorage; - - if ((pBackingStore != NULL) && (RegionNil(&pBackingStore->SavedRegion) == 0)) - { - RegionTranslate(&expose, -pWin -> drawable.x, -pWin -> drawable.y); - - RegionSubtract(&expose, &expose, &pBackingStore -> SavedRegion); - - RegionTranslate(&expose, pWin -> drawable.x, pWin -> drawable.y); - } - RegionIntersect(&expose, &expose, &pWin -> clipList); /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index e360d21f6a..a27ea40d4a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -38,7 +38,6 @@ #include "selection.h" #include "keysym.h" #include "fb.h" -#include "mibstorest.h" #include "osdep.h" #include "Agent.h" @@ -2537,55 +2536,15 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) { /* * Send an expose event to client, instead of graphics - * expose. If target drawable is a backing pixmap, send - * expose event for the saved window, else do nothing. + * expose. */ RegionPtr exposeRegion; BoxRec rect; WindowPtr pWin; - StoringPixmapPtr pStoringPixmapRec = NULL; - miBSWindowPtr pBSwindow = NULL; - int drawableType; pWin = nxagentWindowPtr(X -> xgraphicsexpose.drawable); - if (pWin != NULL) - { - drawableType = DRAWABLE_WINDOW; - } - else - { - drawableType = DRAWABLE_PIXMAP; - } - - if (drawableType == DRAWABLE_PIXMAP) - { - pStoringPixmapRec = nxagentFindItemBSPixmapList(X -> xgraphicsexpose.drawable); - - if (pStoringPixmapRec == NULL) - { - #ifdef TEST - fprintf(stderr, "nxagentHandleGraphicsExposeEvent: WARNING! Storing pixmap not found.\n"); - #endif - - return 1; - } - - pBSwindow = (miBSWindowPtr) pStoringPixmapRec -> pSavedWindow -> backStorage; - - if (pBSwindow == NULL) - { - #ifdef TEST - fprintf(stderr, "nxagentHandleGraphicsExposeEvent: WARNING! Back storage not found.\n"); - #endif - - return 1; - } - - pWin = pStoringPixmapRec -> pSavedWindow; - } - /* * Rectangle affected by GraphicsExpose * event. @@ -2598,33 +2557,6 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) exposeRegion = RegionCreate(&rect, 0); - if (drawableType == DRAWABLE_PIXMAP) - { - #ifdef TEST - fprintf(stderr, "nxagentHandleGraphicsExposeEvent: Handling GraphicsExpose event on pixmap with id" - " [%lu].\n", X -> xgraphicsexpose.drawable); - #endif - - /* - * The exposeRegion coordinates are relative - * to the pixmap to which GraphicsExpose - * event refers. But the BS coordinates of - * the savedRegion are relative to the - * window. - */ - - RegionTranslate(exposeRegion, pStoringPixmapRec -> backingStoreX, - pStoringPixmapRec -> backingStoreY); - - /* - * We remove from SavedRegion the part - * affected by the GraphicsExpose event. - */ - - RegionSubtract(&(pBSwindow -> SavedRegion), &(pBSwindow -> SavedRegion), - exposeRegion); - } - /* * Store the exposeRegion in order to send * the expose event later. The coordinates diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index a35e3d5a81..18466fae59 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -315,8 +315,6 @@ void InitOutput(ScreenInfo *screenInfo, int argc, char *argv[]) } } - nxagentInitBSPixmapList(); - /* * Open the display. We are at the early startup and * the information we'll get from the remote X server diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c index bcb88d42da..9cca6cb235 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c @@ -257,21 +257,6 @@ miHandleExposures(pSrcDrawable, pDstDrawable, /* now get the hidden parts of the source box*/ RegionSubtract(&rgnExposed, &rgnExposed, prgnSrcClip); - if (pSrcWin && pSrcWin->backStorage) - { - /* - * Copy any areas from the source backing store. Modifies - * rgnExposed. - */ - (* pSrcWin->drawable.pScreen->ExposeCopy) ((WindowPtr)pSrcDrawable, - pDstDrawable, - pGC, - &rgnExposed, - srcx, srcy, - dstx, dsty, - plane); - } - /* move them over the destination */ RegionTranslate(&rgnExposed, dstx-srcx, dsty-srcy); @@ -309,15 +294,6 @@ miHandleExposures(pSrcDrawable, pDstDrawable, expBox = *RegionExtents(&rgnExposed); RegionReset(&rgnExposed, &expBox); - /* need to clear out new areas of backing store */ - if (pWin->backStorage) - (void) (* pWin->drawable.pScreen->ClearBackingStore)( - pWin, - expBox.x1, - expBox.y1, - expBox.x2 - expBox.x1, - expBox.y2 - expBox.y1, - FALSE); } if ((pDstDrawable->type != DRAWABLE_PIXMAP) && (((WindowPtr)pDstDrawable)->backgroundState != None)) @@ -385,18 +361,6 @@ miWindowExposures(pWin, prgn, other_exposed) int total; RegionPtr exposures = prgn; - if (pWin->backStorage && prgn) - /* - * in some cases, backing store will cause a different - * region to be exposed than needs to be repainted - * (like when a window is mapped). RestoreAreas is - * allowed to return a region other than prgn, - * in which case this routine will free the resultant - * region. If exposures is null, then no events will - * be sent to the client; if prgn is empty - * no areas will be repainted. - */ - exposures = (*pWin->drawable.pScreen->RestoreAreas)(pWin, prgn); if ((prgn && !RegionNil(prgn)) || (exposures && !RegionNil(exposures)) || other_exposed) { @@ -450,14 +414,6 @@ miWindowExposures(pWin, prgn, other_exposed) /* PaintWindowBackground doesn't clip, so we have to */ RegionIntersect(prgn, prgn, &pWin->clipList); /* need to clear out new areas of backing store, too */ - if (pWin->backStorage) - (void) (* pWin->drawable.pScreen->ClearBackingStore)( - pWin, - box.x1 - pWin->drawable.x, - box.y1 - pWin->drawable.y, - box.x2 - box.x1, - box.y2 - box.y1, - FALSE); } if (prgn && !RegionNil(prgn)) (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, PW_BACKGROUND); @@ -644,9 +600,6 @@ int what; pWin = pRoot; } - if (pWin->backStorage) - (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); - mask = gcmask; gcmask = 0; i = 0; @@ -725,9 +678,6 @@ int what; (*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect); free(prect); - if (pWin->backStorage) - (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing); - if (usingScratchGC) { if (what == PW_BORDER) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index 853621709c..f7f1fcc173 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -452,8 +452,6 @@ Bool nxagentDestroyPixmap(PixmapPtr pPixmap) (void *) pPixmap); #endif - nxagentRemoveItemBSPixmapList(nxagentPixmap(pPixmap)); - nxagentDestroyVirtualPixmap(pPixmap); if (pPixmapPriv -> corruptedRegion != NullRegion) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index cafa219ec5..1332e85f6f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -394,8 +394,6 @@ void nxagentDisconnectSession(void) nxagentDisconnectAllPicture(); } - nxagentEmptyAllBackingStoreRegions(); - nxagentDisconnectAllWindows(); nxagentDisconnectAllCursor(); nxagentDisconnectAllPixmaps(); @@ -516,8 +514,6 @@ Bool nxagentReconnectSession(void) NXTransContinue(NULL); - nxagentEmptyBSPixmapList(); - if (nxagentReconnectAllPixmaps(reconnectLossyLevel[PIXMAP_STEP]) == 0) { failedStep = PIXMAP_STEP; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 90ebe9829d..f41f6cef0c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -104,8 +104,6 @@ is" without express or implied warranty. #include "compext/Compext.h" -#include "mibstorest.h" - /* * Set here the required log level. */ @@ -1577,26 +1575,11 @@ N/A * Backing store procedures. */ - pScreen->SaveDoomedAreas = (void (*)()) 0; - pScreen->RestoreAreas = (RegionPtr (*)()) 0; - pScreen->ExposeCopy = (void (*)()) 0; - pScreen->TranslateBackingStore = (RegionPtr (*)()) 0; - pScreen->ClearBackingStore = (RegionPtr (*)()) 0; - pScreen->DrawGuarantee = (void (*)()) 0; - if (enableBackingStore == 1) { #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Going to initialize backing store.\n"); #endif - - pScreen -> BackingStoreFuncs.SaveAreas = nxagentSaveAreas; - pScreen -> BackingStoreFuncs.RestoreAreas = nxagentRestoreAreas; - pScreen -> BackingStoreFuncs.SetClipmaskRgn = 0; - pScreen -> BackingStoreFuncs.GetImagePixmap = 0; - pScreen -> BackingStoreFuncs.GetSpansPixmap = 0; - - miInitializeBackingStore(pScreen); } /* @@ -2136,7 +2119,6 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable) WindowPtr pChild; Bool WasViewable = (Bool)(pWin->viewable); Bool anyMarked = FALSE; - RegionPtr pOldClip = NULL, bsExposed; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif @@ -2197,12 +2179,6 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable) if (WasViewable) { - if (pWin->backStorage) - { - pOldClip = RegionCreate(NullBox, 1); - RegionCopy(pOldClip, &pWin->clipList); - } - if (pWin->firstChild) { anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild, @@ -2226,28 +2202,6 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable) (*pScreen->ValidateTree)(pWin, NullWindow, VTOther); } - if (pWin->backStorage && pOldClip && - ((pWin->backingStore == Always) || WasViewable)) - { - if (!WasViewable) - pOldClip = &pWin->clipList; /* a convenient empty region */ - bsExposed = (*pScreen->TranslateBackingStore) - (pWin, 0, 0, pOldClip, - pWin->drawable.x, pWin->drawable.y); - if (WasViewable) - RegionDestroy(pOldClip); - if (bsExposed) - { - RegionPtr valExposed = NullRegion; - - if (pWin->valdata) - valExposed = &pWin->valdata->after.exposed; - (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); - if (valExposed) - RegionEmpty(valExposed); - RegionDestroy(bsExposed); - } - } if (WasViewable) { if (anyMarked) @@ -4136,262 +4090,6 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) return TRUE; } -void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, WindowPtr pWin) -{ - PixmapPtr pVirtualPixmap; - nxagentPrivPixmapPtr pPrivPixmap; - XlibGC gc; - XGCValues values; - int i; - int xSrc, ySrc, xDst, yDst, w, h; - int nRects; - int size; - BoxPtr pBox; - XRectangle *pRects; - BoxRec extents; - RegionRec cleanRegion; - - miBSWindowPtr pBackingStore = (miBSWindowPtr) pWin -> backStorage; - - pVirtualPixmap = nxagentVirtualPixmap(pPixmap); - - pPrivPixmap = nxagentPixmapPriv(pPixmap); - - pPrivPixmap -> isBackingPixmap = 1; - - fbCopyWindowProc(&pWin -> drawable, &pVirtualPixmap -> drawable, 0, RegionRects(prgnSave), - RegionNumRects(prgnSave), xorg, yorg, FALSE, FALSE, 0, 0); - - values.subwindow_mode = IncludeInferiors; - - gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values); - - /* - * Initialize to the corrupted region. - * Coordinates are relative to the window. - */ - - RegionInit(&cleanRegion, NullBox, 1); - - RegionCopy(&cleanRegion, nxagentCorruptedRegion((DrawablePtr) pWin)); - - /* - * Subtract the corrupted region from the saved region. - */ - - RegionSubtract(&pBackingStore -> SavedRegion, &pBackingStore -> SavedRegion, &cleanRegion); - - /* - * Translate the corrupted region. Coordinates - * are relative to the backing store pixmap. - */ - - RegionTranslate(&cleanRegion, -pBackingStore -> x, -pBackingStore -> y); - - /* - * Compute the clean region to be saved: subtract - * the corrupted region from the region to be saved. - */ - - RegionSubtract(&cleanRegion, prgnSave, &cleanRegion); - - nRects = RegionNumRects(&cleanRegion); - size = nRects * sizeof(*pRects); - pRects = (XRectangle *) malloc(size); - pBox = RegionRects(&cleanRegion); - - for (i = nRects; i-- > 0;) - { - pRects[i].x = pBox[i].x1; - pRects[i].y = pBox[i].y1; - pRects[i].width = pBox[i].x2 - pBox[i].x1; - pRects[i].height = pBox[i].y2 - pBox[i].y1; - } - - XSetClipRectangles(nxagentDisplay, gc, 0, 0, pRects, nRects, Unsorted); - - free((char *) pRects); - - extents = *RegionExtents(&cleanRegion); - - RegionUninit(&cleanRegion); - - xDst = extents.x1; - yDst = extents.y1; - -/* - * Left here the wrong solution. The window could be not - * configured yet on the real X, whilst the x and y in the - * WindowRec are the new coordinates. The right solution - * is the other, as it is independent from the window - * coordinates. - * - * xSrc = xDst + xorg - pWin -> drawable.x; - * ySrc = yDst + yorg - pWin -> drawable.y; - */ - - xSrc = xDst + pBackingStore -> x; - ySrc = yDst + pBackingStore -> y; - - w = extents.x2 - extents.x1; - h = extents.y2 - extents.y1; - - XCopyArea(nxagentDisplay, nxagentWindow(pWin), nxagentPixmap(pPixmap), gc, - xSrc, ySrc, w, h, xDst, yDst); - - nxagentAddItemBSPixmapList(nxagentPixmap(pPixmap), pPixmap, pWin, - pBackingStore -> x, pBackingStore -> y); - - #ifdef TEST - fprintf(stderr,"nxagentSaveAreas: Added pixmap [%p] with id [%d] on window [%p] to BSPixmapList.\n", - (void *) pPixmap, nxagentPixmap(pPixmap), (void *) pWin); - #endif - - XFreeGC(nxagentDisplay, gc); - - return; -} - -void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, - int yorg, WindowPtr pWin) -{ - PixmapPtr pVirtualPixmap; - RegionPtr clipRegion; - XlibGC gc; - XGCValues values; - int i; - int xSrc, ySrc, xDst, yDst, w, h; - int nRects; - int size; - BoxPtr pBox; - XRectangle *pRects; - BoxRec extents; - miBSWindowPtr pBackingStore; - - /* - * Limit the area to restore to the - * root window size. - */ - - RegionIntersect(prgnRestore, prgnRestore, - &pWin -> drawable.pScreen -> root -> winSize); - - pBackingStore = (miBSWindowPtr) pWin -> backStorage; - - pVirtualPixmap = nxagentVirtualPixmap(pPixmap); - - fbCopyWindowProc(&pVirtualPixmap -> drawable, &pWin -> drawable, 0, RegionRects(prgnRestore), - RegionNumRects(prgnRestore), -xorg, -yorg, FALSE, FALSE, 0, 0); - - values.subwindow_mode = ClipByChildren; - - gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values); - - /* - * Translate the reference point to the origin of the window. - */ - - RegionTranslate(prgnRestore, - -pWin -> drawable.x - pWin -> borderWidth, - -pWin -> drawable.y - pWin -> borderWidth); - - clipRegion = prgnRestore; - - if (nxagentDrawableStatus((DrawablePtr) pPixmap) == NotSynchronized) - { - clipRegion = RegionCreate(NullBox, 1); - - RegionCopy(clipRegion, - nxagentCorruptedRegion((DrawablePtr) pPixmap)); - - /* - * Translate the reference point to the origin of the window. - */ - - RegionTranslate(clipRegion, - pBackingStore -> x, pBackingStore -> y); - - RegionIntersect(clipRegion, prgnRestore, clipRegion); - - /* - * Subtract the corrupted region from the saved areas. - * miBSRestoreAreas will return the exposure region. - */ - - RegionSubtract(&pBackingStore->SavedRegion, - &pBackingStore->SavedRegion, clipRegion); - - /* - * Store the corrupted region to send expose later. - */ - - if (nxagentRemoteExposeRegion != NULL) - { - RegionTranslate(clipRegion, pWin -> drawable.x, pWin -> drawable.y); - - RegionUnion(nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, clipRegion); - - RegionTranslate(clipRegion, -pWin -> drawable.x, -pWin -> drawable.y); - } - - /* - * Compute the region to be restored. - */ - - RegionSubtract(clipRegion, prgnRestore, clipRegion); - } - - nRects = RegionNumRects(clipRegion); - size = nRects * sizeof(*pRects); - pRects = (XRectangle *) malloc(size); - pBox = RegionRects(clipRegion); - - for (i = nRects; i-- > 0;) - { - pRects[i].x = pBox[i].x1; - pRects[i].y = pBox[i].y1; - pRects[i].width = pBox[i].x2 - pBox[i].x1; - pRects[i].height = pBox[i].y2 - pBox[i].y1; - } - - XSetClipRectangles(nxagentDisplay, gc, 0, 0, pRects, nRects, Unsorted); - - free(pRects); - - extents = *RegionExtents(clipRegion); - - xDst = extents.x1; - yDst = extents.y1; - - xSrc = xDst - xorg + pWin -> drawable.x; - ySrc = yDst - yorg + pWin -> drawable.y; - - w = extents.x2 - extents.x1; - h = extents.y2 - extents.y1; - - nxagentFlushConfigureWindow(); - - XCopyArea(nxagentDisplay, nxagentPixmap(pPixmap), nxagentWindow(pWin), gc, - xSrc, ySrc, w, h, xDst, yDst); - - XFreeGC(nxagentDisplay, gc); - - if (clipRegion != NULL && clipRegion != prgnRestore) - { - RegionDestroy(clipRegion); - } - - /* - * Restore the reference point to the origin of the screen. - */ - - RegionTranslate(prgnRestore, - pWin -> drawable.x - pWin -> borderWidth, - pWin -> drawable.y + pWin -> borderWidth); - - return; -} - void nxagentSetWMNormalHints(int screen) { XSizeHints sizeHints; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.h b/nx-X11/programs/Xserver/hw/nxagent/Screen.h index 3df586fa8a..3ea4d921ec 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.h @@ -116,10 +116,6 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen); extern Bool nxagentReconnectScreen(void *p0); -void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, WindowPtr pWin); - -void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, int yorg, WindowPtr pWin); - extern int monitorResolution; int nxagentShadowCreateMainWindow( ScreenPtr pScreen, WindowPtr pWin,int width, int height); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Visual.c b/nx-X11/programs/Xserver/hw/nxagent/Visual.c index eebd1fcc13..a1829abc70 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Visual.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Visual.c @@ -40,7 +40,6 @@ is" without express or implied warranty. #include "scrnintstr.h" #include "dix.h" #include "mi.h" -#include "mibstore.h" #include "resource.h" #include "X.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 2fa6bc136c..f1bdea731c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -38,7 +38,6 @@ #include "selection.h" #include "mi.h" #include "fb.h" -#include "mibstorest.h" #include "Agent.h" #include "Display.h" @@ -125,14 +124,11 @@ extern Bool nxagentReportPrivateWindowIds; int nxagentSplashCount = 0; #define RECTLIMIT 25 -#define BSPIXMAPLIMIT 128 Bool nxagentExposeArrayIsInitialized = False; Window nxagentConfiguredSynchroWindow; static int nxagentExposeSerial = 0; -StoringPixmapPtr nxagentBSPixmapList[BSPIXMAPLIMIT]; - /* * Used to walk through the window hierarchy * to find a window @@ -3793,189 +3789,3 @@ StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence return ret; } - -void nxagentEmptyBackingStoreRegion(void * param0, XID param1, void * data_buffer) -{ - WindowPtr pWin = (WindowPtr) param0; - - miBSWindowPtr pBackingStore = (miBSWindowPtr)pWin->backStorage; - - if (pBackingStore != NULL) - { - RegionEmpty(&pBackingStore->SavedRegion); - - #ifdef TEST - fprintf(stderr, "nxagentEmptyBackingStoreRegion: Emptying saved region for window at [%p].\n", (void*) pWin); - #endif - - if (pBackingStore -> pBackingPixmap != NULL) - { - #ifdef TEST - fprintf(stderr, "nxagentEmptyBackingStoreRegion: Emptying corrupted region for drawable at [%p].\n", - (void*) pBackingStore -> pBackingPixmap); - #endif - - nxagentUnmarkCorruptedRegion((DrawablePtr) pBackingStore -> pBackingPixmap, NullRegion); - } - } -} - -void nxagentEmptyAllBackingStoreRegions(void) -{ - if (nxagentLoopOverWindows(nxagentEmptyBackingStoreRegion) == 0) - { - #ifdef WARNING - fprintf(stderr, "nxagentEmptyAllSavedRegions: Failed to empty backing store saved regions.\n"); - #endif - } -} - -void nxagentInitBSPixmapList(void) -{ - memset(nxagentBSPixmapList, 0, BSPIXMAPLIMIT * sizeof( StoringPixmapPtr)); -} - -int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pWin, int bsx, int bsy) -{ - int i; - - for (i = 0; i < BSPIXMAPLIMIT; i++) - { - if (nxagentBSPixmapList[i] == NULL) - { - nxagentBSPixmapList[i] = malloc(sizeof(StoringPixmapRec)); - - if (nxagentBSPixmapList[i] == NULL) - { - FatalError("nxagentAddItemBSPixmapList: Failed to allocate memory for nxagentBSPixmapList.\n"); - } - - nxagentBSPixmapList[i] -> storingPixmapId = id; - nxagentBSPixmapList[i] -> pStoringPixmap = pPixmap; - nxagentBSPixmapList[i] -> pSavedWindow = pWin; - nxagentBSPixmapList[i] -> backingStoreX = bsx; - nxagentBSPixmapList[i] -> backingStoreY = bsy; - - #ifdef TEST - fprintf(stderr, "nxagentAddItemBSPixmapList: Added Pixmap with id [%lu] to nxagentBSPixmapList.\n", id); - #endif - - return 1; - } - - if (nxagentBSPixmapList[i] -> storingPixmapId == id) - { - nxagentBSPixmapList[i] -> pStoringPixmap = pPixmap; - nxagentBSPixmapList[i] -> pSavedWindow = pWin; - nxagentBSPixmapList[i] -> backingStoreX = bsx; - nxagentBSPixmapList[i] -> backingStoreY = bsy; - - #ifdef TEST - fprintf(stderr, "nxagentAddItemBSPixmapList: Updated existing item for id [%lu].\n", id); - #endif - - return 1; - } - } - - #ifdef TEST - fprintf(stderr, "nxagentAddItemBSPixmapList: WARNING! List item full.\n"); - #endif - - return 0; -} - -int nxagentRemoveItemBSPixmapList(unsigned long pixmapId) -{ - int i; - int j; - - if (pixmapId == 0 || nxagentBSPixmapList[0] == NULL) - { - return 0; - } - - for (i = 0; i < BSPIXMAPLIMIT; i++) - { - if ((nxagentBSPixmapList[i] != NULL) && - (nxagentBSPixmapList[i] -> storingPixmapId == pixmapId)) - { - free(nxagentBSPixmapList[i]); - nxagentBSPixmapList[i] = NULL; - - if (i < BSPIXMAPLIMIT - 1) - { - for (j = i; j < BSPIXMAPLIMIT -1; j++) - { - nxagentBSPixmapList[j] = nxagentBSPixmapList[j + 1]; - } - - if (nxagentBSPixmapList[j] == nxagentBSPixmapList[j - 1]) - { - nxagentBSPixmapList[j] = NULL; - } - } - - #ifdef TEST - fprintf(stderr, "nxagentRemoveItemBSPixmapList: Removed Pixmap with id [%lu] from list.\n", - pixmapId); - #endif - - return 1; - } - } - - #ifdef TEST - fprintf(stderr, "nxagentRemoveItemBSPixmapList: WARNING! Can't remove item [%lu]: item not found.\n", - pixmapId); - #endif - - return 0; -} - -int nxagentEmptyBSPixmapList() -{ - int i; - - for (i = 0; i < BSPIXMAPLIMIT; i++) - { - free(nxagentBSPixmapList[i]); - nxagentBSPixmapList[i] = NULL; - } - - return 1; -} - -StoringPixmapPtr nxagentFindItemBSPixmapList(unsigned long pixmapId) -{ - int i; - - for (i = 0; i < BSPIXMAPLIMIT; i++) - { - if ((nxagentBSPixmapList[i] != NULL) && - (nxagentBSPixmapList[i] -> storingPixmapId == pixmapId)) - { - #ifdef TEST - fprintf(stderr, "nxagentFindItemBSPixmapList: pixmapId [%lu].\n", pixmapId); - fprintf(stderr, "nxagentFindItemBSPixmapList: nxagentBSPixmapList[%d] -> storingPixmapId [%lu].\n", - i, nxagentBSPixmapList[i] -> storingPixmapId); - #endif - - return nxagentBSPixmapList[i]; - } - } - - #ifdef TEST - fprintf(stderr, "nxagentFindItemBSPixmapList: WARNING! Item not found.\n"); - #endif - - #ifdef TEST - fprintf(stderr, "nxagentFindItemBSPixmapList: Pixmap with id [%lu] not found.\n", - pixmapId); - fprintf(stderr, "nxagentBSPixmapList[%d] = [%p].\n", - i, (void *) nxagentBSPixmapList[i]); - #endif - - return NULL; -} - diff --git a/nx-X11/programs/Xserver/hw/nxagent/Windows.h b/nx-X11/programs/Xserver/hw/nxagent/Windows.h index 8612cdf82d..fb3b383759 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Windows.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Windows.h @@ -102,12 +102,6 @@ typedef struct typedef StoringPixmapRec *StoringPixmapPtr; -int nxagentAddItemBSPixmapList(unsigned long, PixmapPtr, WindowPtr, int, int); -int nxagentRemoveItemBSPixmapList(unsigned long); -void nxagentInitBSPixmapList(void); -int nxagentEmptyBSPixmapList(void); -StoringPixmapPtr nxagentFindItemBSPixmapList (unsigned long); - extern int nxagentWindowPrivateIndex; #define nxagentWindowPriv(pWin) \ diff --git a/nx-X11/programs/Xserver/include/Imakefile b/nx-X11/programs/Xserver/include/Imakefile index 53f193ec89..fb4ef194b3 100644 --- a/nx-X11/programs/Xserver/include/Imakefile +++ b/nx-X11/programs/Xserver/include/Imakefile @@ -14,8 +14,6 @@ all:: depend:: InstallDriverSDKNonExecFile(XIstubs.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(bstore.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(bstorestr.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(client.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(colormap.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(colormapst.h,$(DRIVERSDKINCLUDEDIR)) diff --git a/nx-X11/programs/Xserver/include/bstore.h b/nx-X11/programs/Xserver/include/bstore.h deleted file mode 100644 index 843d6bb359..0000000000 --- a/nx-X11/programs/Xserver/include/bstore.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 1987 by the Regents of the University of California - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies. The University of - * California makes no representations about the suitability of this software - * for any purpose. It is provided "as is" without express or implied - * warranty. - */ - -/* - * Moved here from mi to allow wrapping of lower level backing store functions. - * -- 1997.10.27 Marc Aurele La France (tsi@xfree86.org) - */ - -#ifndef _BSTORE_H_ -#define _BSTORE_H_ - -#include "bstorestr.h" - -#endif /* _BSTORE_H_ */ diff --git a/nx-X11/programs/Xserver/include/bstorestr.h b/nx-X11/programs/Xserver/include/bstorestr.h deleted file mode 100644 index 14e2fe1dac..0000000000 --- a/nx-X11/programs/Xserver/include/bstorestr.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1987 by the Regents of the University of California - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies. The University of - * California makes no representations about the suitability of this software - * for any purpose. It is provided "as is" without express or implied - * warranty. - */ - -/* - * Moved here from mi to allow wrapping of lower level backing store functions. - * -- 1997.10.27 Marc Aurele La France (tsi@xfree86.org) - */ - -#ifndef _BSTORESTR_H_ -#define _BSTORESTR_H_ - -#include "gc.h" -#include "pixmap.h" -#include "region.h" -#include "window.h" - -typedef void (* BackingStoreSaveAreasProcPtr)( - PixmapPtr /*pBackingPixmap*/, - RegionPtr /*pObscured*/, - int /*x*/, - int /*y*/, - WindowPtr /*pWin*/); - -typedef void (* BackingStoreRestoreAreasProcPtr)( - PixmapPtr /*pBackingPixmap*/, - RegionPtr /*pExposed*/, - int /*x*/, - int /*y*/, - WindowPtr /*pWin*/); - -typedef void (* BackingStoreSetClipmaskRgnProcPtr)( - GCPtr /*pBackingGC*/, - RegionPtr /*pbackingCompositeClip*/); - -typedef PixmapPtr (* BackingStoreGetImagePixmapProcPtr)(void); - -typedef PixmapPtr (* BackingStoreGetSpansPixmapProcPtr)(void); - -typedef struct _BSFuncs { - - BackingStoreSaveAreasProcPtr SaveAreas; - BackingStoreRestoreAreasProcPtr RestoreAreas; - BackingStoreSetClipmaskRgnProcPtr SetClipmaskRgn; - BackingStoreGetImagePixmapProcPtr GetImagePixmap; - BackingStoreGetSpansPixmapProcPtr GetSpansPixmap; - -} BSFuncRec, *BSFuncPtr; - -#endif /* _BSTORESTR_H_ */ diff --git a/nx-X11/programs/Xserver/include/scrnintstr.h b/nx-X11/programs/Xserver/include/scrnintstr.h index 5a3f32309e..d8158bfa3d 100644 --- a/nx-X11/programs/Xserver/include/scrnintstr.h +++ b/nx-X11/programs/Xserver/include/scrnintstr.h @@ -50,7 +50,6 @@ SOFTWARE. #include "screenint.h" #include "regionstr.h" -#include "bstore.h" #include "colormap.h" #include "cursor.h" #include "validate.h" @@ -213,48 +212,6 @@ typedef PixmapPtr (* CreatePixmapProcPtr)( typedef Bool (* DestroyPixmapProcPtr)( PixmapPtr /*pPixmap*/); -typedef void (* SaveDoomedAreasProcPtr)( - WindowPtr /*pWindow*/, - RegionPtr /*prgnSave*/, - int /*xorg*/, - int /*yorg*/); - -typedef RegionPtr (* RestoreAreasProcPtr)( - WindowPtr /*pWindow*/, - RegionPtr /*prgnRestore*/); - -typedef void (* ExposeCopyProcPtr)( - WindowPtr /*pSrc*/, - DrawablePtr /*pDst*/, - GCPtr /*pGC*/, - RegionPtr /*prgnExposed*/, - int /*srcx*/, - int /*srcy*/, - int /*dstx*/, - int /*dsty*/, - unsigned long /*plane*/); - -typedef RegionPtr (* TranslateBackingStoreProcPtr)( - WindowPtr /*pWindow*/, - int /*windx*/, - int /*windy*/, - RegionPtr /*oldClip*/, - int /*oldx*/, - int /*oldy*/); - -typedef RegionPtr (* ClearBackingStoreProcPtr)( - WindowPtr /*pWindow*/, - int /*x*/, - int /*y*/, - int /*w*/, - int /*h*/, - Bool /*generateExposures*/); - -typedef void (* DrawGuaranteeProcPtr)( - WindowPtr /*pWindow*/, - GCPtr /*pGC*/, - int /*guarantee*/); - typedef Bool (* RealizeFontProcPtr)( ScreenPtr /*pScreen*/, FontPtr /*pFont*/); @@ -606,20 +563,6 @@ typedef struct _Screen { CreatePixmapProcPtr CreatePixmap; DestroyPixmapProcPtr DestroyPixmap; - /* Backing store procedures */ - - SaveDoomedAreasProcPtr SaveDoomedAreas; - RestoreAreasProcPtr RestoreAreas; - ExposeCopyProcPtr ExposeCopy; - TranslateBackingStoreProcPtr TranslateBackingStore; - ClearBackingStoreProcPtr ClearBackingStore; - DrawGuaranteeProcPtr DrawGuarantee; - /* - * A read/write copy of the lower level backing store vector is needed now - * that the functions can be wrapped. - */ - BSFuncRec BackingStoreFuncs; - /* Font procedures */ RealizeFontProcPtr RealizeFont; diff --git a/nx-X11/programs/Xserver/include/windowstr.h b/nx-X11/programs/Xserver/include/windowstr.h index 36d598c6e5..d8bcd52329 100644 --- a/nx-X11/programs/Xserver/include/windowstr.h +++ b/nx-X11/programs/Xserver/include/windowstr.h @@ -59,9 +59,6 @@ SOFTWARE. #include #include "opaque.h" -#define GuaranteeNothing 0 -#define GuaranteeVisBack 1 - #define SameBackground(as, a, bs, b) \ ((as) == (bs) && ((as) == None || \ (as) == ParentRelative || \ diff --git a/nx-X11/programs/Xserver/mi/Imakefile b/nx-X11/programs/Xserver/mi/Imakefile index 15e897e8bd..c9ce45e7ee 100644 --- a/nx-X11/programs/Xserver/mi/Imakefile +++ b/nx-X11/programs/Xserver/mi/Imakefile @@ -73,7 +73,6 @@ SRCS = $(CBRT_SRC) \ mizerclip.c \ mifpolycon.c \ midash.c \ - mibstore.c \ $(MIINITEXTSRC) \ mieq.c \ mipointer.c \ @@ -112,7 +111,6 @@ OBJS = $(CBRT_OBJ) \ mizerclip.o \ mifpolycon.o \ midash.o \ - mibstore.o \ $(MIINITEXTOBJ) \ mieq.o \ mipointer.o \ @@ -192,7 +190,6 @@ AllTarget($(EXTRAMIINITEXTOBJ)) DependTarget() InstallDriverSDKNonExecFile(mi.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(mibstore.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(micmap.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(migc.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(miline.h,$(DRIVERSDKINCLUDEDIR)) diff --git a/nx-X11/programs/Xserver/mi/mibstore.c b/nx-X11/programs/Xserver/mi/mibstore.c deleted file mode 100644 index 3eafac2353..0000000000 --- a/nx-X11/programs/Xserver/mi/mibstore.c +++ /dev/null @@ -1,3897 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 THE -OPEN GROUP 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. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by the Regents of the University of California - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, 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 The Open Group not be used in advertising or publicity -pertaining to distribution of the software without specific, written prior -permission. - -The University of California makes no representations about the suitability -of this software for any purpose. It is provided "as is" without express or -implied warranty. - -******************************************************************/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "misc.h" -#include "regionstr.h" -#include "scrnintstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include -#include "dixfontstr.h" -#include "dixstruct.h" /* For requestingClient */ -#include "mi.h" -#include "mibstorest.h" - -/* - * When the server fails to allocate a backing store pixmap, if you want - * it to dynamically retry to allocate backing store on every subsequent - * graphics op, you can enable BSEAGER; otherwise, backing store will be - * disabled on the window until it is unmapped and then remapped. - */ -/* #define BSEAGER */ - -/*- - * NOTES ON USAGE: - * - * The functions in this file implement a machine-independent backing-store - * scheme. To use it, the output library must do the following: - * - Provide a SaveAreas function that takes a destination pixmap, a - * region of the areas to save (in the pixmap's coordinate system) - * and the screen origin of the region. It should copy the areas from - * the screen into the pixmap. - * - Provide a RestoreAreas function that takes a source pixmap, a region - * of the areas to restore (in the screen's coordinate system) and the - * origin of the pixmap on the screen. It should copy the areas from - * the pixmap into the screen. - * - Provide a SetClipmaskRgn function that takes a gc and a region - * and merges the region into any CT_PIXMAP client clip that - * is specified in the GC. This routine is only needed if - * miValidateBackingStore will see CT_PIXMAP clip lists; not - * true for any of the sample servers (which convert the PIXMAP - * clip lists into CT_REGION clip lists; an expensive but simple - * to code option). - * - The function placed in a window's ClearToBackground vector must call - * pScreen->ClearBackingStore with the window, followed by - * the window-relative x and y coordinates, followed by the width and - * height of the area to be cleared, followed by the generateExposures - * flag. This has been taken care of in miClearToBackground. - * - Whatever determines GraphicsExpose events for the CopyArea and - * CopyPlane requests should call pWin->backStorage->ExposeCopy - * with the source and destination drawables, the GC used, a source- - * window-relative region of exposed areas, the source and destination - * coordinates and the bitplane copied, if CopyPlane, or 0, if - * CopyArea. - * - * JUSTIFICATION - * This is a cross between saving everything and just saving the - * obscued areas (as in Pike's layers.) This method has the advantage - * of only doing each output operation once per pixel, visible or - * invisible, and avoids having to do all the crufty storage - * management of keeping several separate rectangles. Since the - * ddx layer ouput primitives are required to draw through clipping - * rectangles anyway, sending multiple drawing requests for each of - * several rectangles isn't necessary. (Of course, it could be argued - * that the ddx routines should just take one rectangle each and - * get called multiple times, but that would make taking advantage of - * smart hardware harder, and probably be slower as well.) - */ - -#define SETUP_BACKING_TERSE(pGC) \ - miBSGCPtr pGCPrivate = (miBSGCPtr)(pGC)->devPrivates[miBSGCIndex].ptr; \ - GCFuncs *oldFuncs = pGC->funcs; - -#define SETUP_BACKING(pDrawable,pGC) \ - miBSWindowPtr pBackingStore = \ - (miBSWindowPtr)((WindowPtr)(pDrawable))->backStorage; \ - DrawablePtr pBackingDrawable = (DrawablePtr) \ - pBackingStore->pBackingPixmap; \ - SETUP_BACKING_TERSE(pGC) \ - GCPtr pBackingGC = pGCPrivate->pBackingGC; - -#define PROLOGUE(pGC) { \ - pGC->ops = pGCPrivate->wrapOps;\ - pGC->funcs = pGCPrivate->wrapFuncs; \ - } - -#define EPILOGUE(pGC) { \ - pGCPrivate->wrapOps = (pGC)->ops; \ - (pGC)->ops = &miBSGCOps; \ - (pGC)->funcs = oldFuncs; \ - } - -static void miCreateBSPixmap(WindowPtr pWin, BoxPtr pExtents); -static void miDestroyBSPixmap(WindowPtr pWin); -static void miTileVirtualBS(WindowPtr pWin); -static void miBSAllocate(WindowPtr pWin), miBSFree(WindowPtr pWin); -static Bool miBSCreateGCPrivate(GCPtr pGC); -static void miBSClearBackingRegion(WindowPtr pWin, RegionPtr pRgn); - -#define MoreCopy0 ; -#define MoreCopy2 *dstCopy++ = *srcCopy++; *dstCopy++ = *srcCopy++; -#define MoreCopy4 MoreCopy2 MoreCopy2 - -#define copyData(src,dst,n,morecopy) \ -{ \ - register short *srcCopy = (short *)(src); \ - register short *dstCopy = (short *)(dst); \ - register int i; \ - register int bsx = pBackingStore->x; \ - register int bsy = pBackingStore->y; \ - for (i = n; --i >= 0; ) \ - { \ - *dstCopy++ = *srcCopy++ - bsx; \ - *dstCopy++ = *srcCopy++ - bsy; \ - morecopy \ - } \ -} - -#define copyPoints(src,dst,n,mode) \ -if (mode == CoordModeOrigin) \ -{ \ - copyData(src,dst,n,MoreCopy0); \ -} \ -else \ -{ \ - memmove((char *)(dst), (char *)(src), (n) << 2); \ - *((short *)(dst)) -= pBackingStore->x; \ - *((short *)(dst) + 1) -= pBackingStore->y; \ -} - -/* - * wrappers for screen funcs - */ - -static int miBSScreenIndex; -static unsigned long miBSGeneration = 0; - -static Bool miBSCloseScreen(ScreenPtr pScreen); -static void miBSGetImage(DrawablePtr pDrawable, int sx, int sy, - int w, int h, unsigned int format, - unsigned long planemask, char *pdstLine); -static void miBSGetSpans(DrawablePtr pDrawable, int wMax, - DDXPointPtr ppt, int *pwidth, int nspans, - char *pdstStart); -static Bool miBSChangeWindowAttributes(WindowPtr pWin, - unsigned long mask); -static Bool miBSCreateGC(GCPtr pGC); -static Bool miBSDestroyWindow(WindowPtr pWin); - -/* - * backing store screen functions - */ - -static void miBSSaveDoomedAreas(WindowPtr pWin, RegionPtr pObscured, - int dx, int dy); -static RegionPtr miBSRestoreAreas(WindowPtr pWin, RegionPtr prgnExposed); -static void miBSExposeCopy(WindowPtr pSrc, DrawablePtr pDst, - GCPtr pGC, RegionPtr prgnExposed, - int srcx, int srcy, int dstx, int dsty, - unsigned long plane); -static RegionPtr miBSTranslateBackingStore(WindowPtr pWin, int windx, - int windy, RegionPtr oldClip, - int oldx, int oldy); -static RegionPtr miBSClearBackingStore(WindowPtr pWin, int x, int y, - int w, int h, Bool generateExposures); -static void miBSDrawGuarantee(WindowPtr pWin, GCPtr pGC, - int guarantee); - -/* - * wrapper vectors for GC funcs and ops - */ - -static int miBSGCIndex; - -static void miBSValidateGC(GCPtr pGC, unsigned long stateChanges, - DrawablePtr pDrawable); -static void miBSCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); -static void miBSDestroyGC(GCPtr pGC); -static void miBSChangeGC(GCPtr pGC, unsigned long mask); -static void miBSChangeClip(GCPtr pGC, int type, void * pvalue, int nrects); -static void miBSDestroyClip(GCPtr pGC); -static void miBSCopyClip(GCPtr pgcDst, GCPtr pgcSrc); - -static GCFuncs miBSGCFuncs = { - miBSValidateGC, - miBSChangeGC, - miBSCopyGC, - miBSDestroyGC, - miBSChangeClip, - miBSDestroyClip, - miBSCopyClip, -}; - -static void miBSFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit, - DDXPointPtr pptInit, int *pwidthInit, - int fSorted); -static void miBSSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc, - DDXPointPtr ppt, int *pwidth, int nspans, - int fSorted); -static void miBSPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, - int x, int y, int w, int h, int leftPad, - int format, char *pBits); -static RegionPtr miBSCopyArea(DrawablePtr pSrc, DrawablePtr pDst, - GCPtr pGC, int srcx, int srcy, int w, int h, - int dstx, int dsty); -static RegionPtr miBSCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, - GCPtr pGC, int srcx, int srcy, int w, int h, - int dstx, int dsty, unsigned long plane); -static void miBSPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, - int npt, xPoint *pptInit); -static void miBSPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, - int npt, DDXPointPtr pptInit); -static void miBSPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, - xSegment *pSegs); -static void miBSPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, - int nrects, xRectangle *pRects); -static void miBSPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, - xArc *parcs); -static void miBSFillPolygon(DrawablePtr pDrawable, GCPtr pGC, - int shape, int mode, int count, - DDXPointPtr pPts); -static void miBSPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, - int nrectFill, xRectangle *prectInit); -static void miBSPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, - int narcs, xArc *parcs); -static int miBSPolyText8(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, int count, char *chars); -static int miBSPolyText16(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, int count, - unsigned short *chars); -static void miBSImageText8(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, int count, char *chars); -static void miBSImageText16(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, int count, - unsigned short *chars); -static void miBSImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, void * pglyphBase); -static void miBSPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, void * pglyphBase); -static void miBSPushPixels(GCPtr pGC, PixmapPtr pBitMap, - DrawablePtr pDst, int w, int h, - int x, int y); -#ifdef NEED_LINEHELPER -static void miBSLineHelper(void); -#endif - -static GCOps miBSGCOps = { - miBSFillSpans, miBSSetSpans, miBSPutImage, - miBSCopyArea, miBSCopyPlane, miBSPolyPoint, - miBSPolylines, miBSPolySegment, miBSPolyRectangle, - miBSPolyArc, miBSFillPolygon, miBSPolyFillRect, - miBSPolyFillArc, miBSPolyText8, miBSPolyText16, - miBSImageText8, miBSImageText16, miBSImageGlyphBlt, - miBSPolyGlyphBlt, miBSPushPixels -#ifdef NEED_LINEHELPER - , miBSLineHelper -#endif -}; - -#define FUNC_PROLOGUE(pGC, pPriv) \ - ((pGC)->funcs = pPriv->wrapFuncs),\ - ((pGC)->ops = pPriv->wrapOps) - -#define FUNC_EPILOGUE(pGC, pPriv) \ - ((pGC)->funcs = &miBSGCFuncs),\ - ((pGC)->ops = &miBSGCOps) - -/* - * every GC in the server is initially wrapped with these - * "cheap" functions. This allocates no memory and is used - * to discover GCs used with windows which have backing - * store enabled - */ - -static void miBSCheapValidateGC(GCPtr pGC, unsigned long stateChanges, - DrawablePtr pDrawable); -static void miBSCheapCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); -static void miBSCheapDestroyGC(GCPtr pGC); -static void miBSCheapChangeGC(GCPtr pGC, unsigned long mask); -static void miBSCheapChangeClip(GCPtr pGC, int type, void * pvalue, - int nrects); -static void miBSCheapDestroyClip(GCPtr pGC); -static void miBSCheapCopyClip(GCPtr pgcDst, GCPtr pgcSrc); - -static GCFuncs miBSCheapGCFuncs = { - miBSCheapValidateGC, - miBSCheapChangeGC, - miBSCheapCopyGC, - miBSCheapDestroyGC, - miBSCheapChangeClip, - miBSCheapDestroyClip, - miBSCheapCopyClip, -}; - -#define CHEAP_FUNC_PROLOGUE(pGC) \ - ((pGC)->funcs = (GCFuncs *) (pGC)->devPrivates[miBSGCIndex].ptr) - -#define CHEAP_FUNC_EPILOGUE(pGC) \ - ((pGC)->funcs = &miBSCheapGCFuncs) - -/* - * called from device screen initialization proc. Gets a GCPrivateIndex - * and wraps appropriate per-screen functions. pScreen->BackingStoreFuncs - * must be previously initialized. - */ - -void -miInitializeBackingStore (pScreen) - ScreenPtr pScreen; -{ - miBSScreenPtr pScreenPriv; - - if (miBSGeneration != serverGeneration) - { - miBSScreenIndex = AllocateScreenPrivateIndex (); - if (miBSScreenIndex < 0) - return; - miBSGCIndex = AllocateGCPrivateIndex (); - miBSGeneration = serverGeneration; - } - if (!AllocateGCPrivate(pScreen, miBSGCIndex, 0)) - return; - pScreenPriv = (miBSScreenPtr) malloc (sizeof (miBSScreenRec)); - if (!pScreenPriv) - return; - - pScreenPriv->CloseScreen = pScreen->CloseScreen; - pScreenPriv->GetImage = pScreen->GetImage; - pScreenPriv->GetSpans = pScreen->GetSpans; - pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes; - pScreenPriv->CreateGC = pScreen->CreateGC; - pScreenPriv->DestroyWindow = pScreen->DestroyWindow; - - pScreen->CloseScreen = miBSCloseScreen; - pScreen->GetImage = miBSGetImage; - pScreen->GetSpans = miBSGetSpans; - pScreen->ChangeWindowAttributes = miBSChangeWindowAttributes; - pScreen->CreateGC = miBSCreateGC; - pScreen->DestroyWindow = miBSDestroyWindow; - - pScreen->SaveDoomedAreas = miBSSaveDoomedAreas; - pScreen->RestoreAreas = miBSRestoreAreas; - pScreen->ExposeCopy = miBSExposeCopy; - pScreen->TranslateBackingStore = miBSTranslateBackingStore; - pScreen->ClearBackingStore = miBSClearBackingStore; - pScreen->DrawGuarantee = miBSDrawGuarantee; - - pScreen->devPrivates[miBSScreenIndex].ptr = (void *) pScreenPriv; -} - -/* - * Screen function wrappers - */ - -#define SCREEN_PROLOGUE(pScreen, field)\ - ((pScreen)->field = \ - ((miBSScreenPtr) \ - (pScreen)->devPrivates[miBSScreenIndex].ptr)->field) - -#define SCREEN_EPILOGUE(pScreen, field, wrapper)\ - ((pScreen)->field = wrapper) - -/* - * CloseScreen wrapper -- unwrap everything, free the private data - * and call the wrapped function - */ - -static Bool -miBSCloseScreen (pScreen) - ScreenPtr pScreen; -{ - miBSScreenPtr pScreenPriv; - - pScreenPriv = (miBSScreenPtr) pScreen->devPrivates[miBSScreenIndex].ptr; - - pScreen->CloseScreen = pScreenPriv->CloseScreen; - pScreen->GetImage = pScreenPriv->GetImage; - pScreen->GetSpans = pScreenPriv->GetSpans; - pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes; - pScreen->CreateGC = pScreenPriv->CreateGC; - - free ((void *) pScreenPriv); - - return (*pScreen->CloseScreen) (pScreen); -} - -static void miBSFillVirtualBits(DrawablePtr pDrawable, GCPtr pGC, - RegionPtr pRgn, int x, int y, int state, - PixUnion pixunion, unsigned long planemask); - -static void -miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine) - DrawablePtr pDrawable; - int sx, sy, w, h; - unsigned int format; - unsigned long planemask; - char *pdstLine; -{ - ScreenPtr pScreen = pDrawable->pScreen; - BoxRec bounds; - unsigned char depth; - - SCREEN_PROLOGUE (pScreen, GetImage); - - if (pDrawable->type != DRAWABLE_PIXMAP && - ((WindowPtr) pDrawable)->visibility != VisibilityUnobscured) - { - PixmapPtr pPixmap; - miBSWindowPtr pWindowPriv; - GCPtr pGC = NULL; - WindowPtr pWin, pSrcWin; - int xoff, yoff; - RegionRec Remaining; - RegionRec Border; - RegionRec Inside; - BoxPtr pBox; - int n; - - pWin = (WindowPtr) pDrawable; - pPixmap = 0; - depth = pDrawable->depth; - bounds.x1 = sx + pDrawable->x; - bounds.y1 = sy + pDrawable->y; - bounds.x2 = bounds.x1 + w; - bounds.y2 = bounds.y1 + h; - RegionInit(&Remaining, &bounds, 0); - for (;;) - { - bounds.x1 = sx + pDrawable->x - pWin->drawable.x; - bounds.y1 = sy + pDrawable->y - pWin->drawable.y; - bounds.x2 = bounds.x1 + w; - bounds.y2 = bounds.y1 + h; - if (pWin->viewable && pWin->backStorage && - pWin->drawable.depth == depth && - (RegionContainsRect(&(pWindowPriv = - (miBSWindowPtr) pWin->backStorage)->SavedRegion, - &bounds) != rgnOUT || - RegionContainsRect(&Remaining, - RegionExtents(&pWin->borderSize)) != rgnOUT)) - { - if (!pPixmap) - { - XID subWindowMode = IncludeInferiors; - int x, y; - - pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, depth, - CREATE_PIXMAP_USAGE_SCRATCH); - if (!pPixmap) - goto punt; - pGC = GetScratchGC (depth, pScreen); - if (!pGC) - { - (*pScreen->DestroyPixmap) (pPixmap); - goto punt; - } - ChangeGC (pGC, GCSubwindowMode, &subWindowMode); - ValidateGC ((DrawablePtr)pPixmap, pGC); - RegionNull(&Border); - RegionNull(&Inside); - pSrcWin = (WindowPtr) pDrawable; - x = sx; - y = sy; - if (pSrcWin->parent) - { - x += pSrcWin->origin.x; - y += pSrcWin->origin.y; - pSrcWin = pSrcWin->parent; - } - (*pGC->ops->CopyArea) ((DrawablePtr)pSrcWin, - (DrawablePtr)pPixmap, pGC, - x, y, w, h, - 0, 0); - RegionSubtract(&Remaining, &Remaining, - &((WindowPtr) pDrawable)->borderClip); - } - - RegionIntersect(&Inside, &Remaining, &pWin->winSize); - RegionTranslate(&Inside, - -pWin->drawable.x, - -pWin->drawable.y); - RegionIntersect(&Inside, &Inside, - &pWindowPriv->SavedRegion); - - /* offset of sub-window in GetImage pixmap */ - xoff = pWin->drawable.x - pDrawable->x - sx; - yoff = pWin->drawable.y - pDrawable->y - sy; - - if (RegionNumRects(&Inside) > 0) - { - switch (pWindowPriv->status) - { - case StatusContents: - pBox = RegionRects(&Inside); - for (n = RegionNumRects(&Inside); --n >= 0;) - { - (*pGC->ops->CopyArea) ( - (DrawablePtr)pWindowPriv->pBackingPixmap, - (DrawablePtr)pPixmap, pGC, - pBox->x1 - pWindowPriv->x, - pBox->y1 - pWindowPriv->y, - pBox->x2 - pBox->x1, - pBox->y2 - pBox->y1, - pBox->x1 + xoff, - pBox->y1 + yoff); - ++pBox; - } - break; - case StatusVirtual: - case StatusVDirty: - if (pWindowPriv->backgroundState == BackgroundPixmap || - pWindowPriv->backgroundState == BackgroundPixel) - miBSFillVirtualBits ((DrawablePtr) pPixmap, pGC, &Inside, - xoff, yoff, - (int) pWindowPriv->backgroundState, - pWindowPriv->background, ~0L); - break; - } - } - RegionSubtract(&Border, &pWin->borderSize, - &pWin->winSize); - RegionIntersect(&Border, &Border, &Remaining); - if (RegionNumRects(&Border) > 0) - { - RegionTranslate(&Border, -pWin->drawable.x, - -pWin->drawable.y); - miBSFillVirtualBits ((DrawablePtr) pPixmap, pGC, &Border, - xoff, yoff, - pWin->borderIsPixel ? (int)BackgroundPixel : (int)BackgroundPixmap, - pWin->border, ~0L); - } - } - - if (pWin->viewable && pWin->firstChild) - pWin = pWin->firstChild; - else - { - while (!pWin->nextSib && pWin != (WindowPtr) pDrawable) - pWin = pWin->parent; - if (pWin == (WindowPtr) pDrawable) - break; - pWin = pWin->nextSib; - } - } - - RegionUninit(&Remaining); - - if (pPixmap) - { - RegionUninit(&Border); - RegionUninit(&Inside); - (*pScreen->GetImage) ((DrawablePtr) pPixmap, - 0, 0, w, h, format, planemask, pdstLine); - (*pScreen->DestroyPixmap) (pPixmap); - FreeScratchGC (pGC); - } - else - { - goto punt; - } - } - else - { -punt: ; - (*pScreen->GetImage) (pDrawable, sx, sy, w, h, - format, planemask, pdstLine); - } - - SCREEN_EPILOGUE (pScreen, GetImage, miBSGetImage); -} - -static void -miBSGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart) - DrawablePtr pDrawable; - int wMax; - DDXPointPtr ppt; - int *pwidth; - int nspans; - char *pdstStart; -{ - ScreenPtr pScreen = pDrawable->pScreen; - BoxRec bounds; - int i; - WindowPtr pWin; - int dx, dy; - - SCREEN_PROLOGUE (pScreen, GetSpans); - - if (pDrawable->type != DRAWABLE_PIXMAP && ((WindowPtr) pDrawable)->backStorage) - { - PixmapPtr pPixmap; - miBSWindowPtr pWindowPriv; - GCPtr pGC; - - pWin = (WindowPtr) pDrawable; - pWindowPriv = (miBSWindowPtr) pWin->backStorage; - pPixmap = pWindowPriv->pBackingPixmap; - - bounds.x1 = ppt->x; - bounds.y1 = ppt->y; - bounds.x2 = bounds.x1 + *pwidth; - bounds.y2 = ppt->y; - for (i = 0; i < nspans; i++) - { - if (ppt[i].x < bounds.x1) - bounds.x1 = ppt[i].x; - if (ppt[i].x + pwidth[i] > bounds.x2) - bounds.x2 = ppt[i].x + pwidth[i]; - if (ppt[i].y < bounds.y1) - bounds.y1 = ppt[i].y; - else if (ppt[i].y > bounds.y2) - bounds.y2 = ppt[i].y; - } - - switch (RegionContainsRect(&pWindowPriv->SavedRegion, &bounds)) - { - case rgnPART: - if (!pPixmap) - { - miCreateBSPixmap (pWin, NullBox); - if (!(pPixmap = pWindowPriv->pBackingPixmap)) - break; - } - pWindowPriv->status = StatusNoPixmap; - pGC = GetScratchGC(pPixmap->drawable.depth, - pPixmap->drawable.pScreen); - if (pGC) - { - ValidateGC ((DrawablePtr) pPixmap, pGC); - (*pGC->ops->CopyArea) - (pDrawable, (DrawablePtr) pPixmap, pGC, - bounds.x1, bounds.y1, - bounds.x2 - bounds.x1, bounds.y2 - bounds.y1, - bounds.x1 + pPixmap->drawable.x - pWin->drawable.x - - pWindowPriv->x, - bounds.y1 + pPixmap->drawable.y - pWin->drawable.y - - pWindowPriv->y); - FreeScratchGC(pGC); - } - pWindowPriv->status = StatusContents; - /* fall through */ - case rgnIN: - if (!pPixmap) - { - miCreateBSPixmap (pWin, NullBox); - if (!(pPixmap = pWindowPriv->pBackingPixmap)) - break; - } - dx = pPixmap->drawable.x - pWin->drawable.x - pWindowPriv->x; - dy = pPixmap->drawable.y - pWin->drawable.y - pWindowPriv->y; - for (i = 0; i < nspans; i++) - { - ppt[i].x += dx; - ppt[i].y += dy; - } - (*pScreen->GetSpans) ((DrawablePtr) pPixmap, wMax, ppt, pwidth, - nspans, pdstStart); - break; - case rgnOUT: - (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, - pdstStart); - break; - } - } - else - { - (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); - } - - SCREEN_EPILOGUE (pScreen, GetSpans, miBSGetSpans); -} - -static Bool -miBSChangeWindowAttributes (pWin, mask) - WindowPtr pWin; - unsigned long mask; -{ - ScreenPtr pScreen; - Bool ret; - - pScreen = pWin->drawable.pScreen; - - SCREEN_PROLOGUE (pScreen, ChangeWindowAttributes); - - ret = (*pScreen->ChangeWindowAttributes) (pWin, mask); - - if (ret && (mask & CWBackingStore)) - { - if (pWin->backingStore != NotUseful || pWin->DIXsaveUnder) - miBSAllocate (pWin); - else - miBSFree (pWin); - } - - SCREEN_EPILOGUE (pScreen, ChangeWindowAttributes, miBSChangeWindowAttributes); - - return ret; -} - -/* - * GC Create wrapper. Set up the cheap GC func wrappers to track - * GC validation on BackingStore windows - */ - -static Bool -miBSCreateGC (pGC) - GCPtr pGC; -{ - ScreenPtr pScreen = pGC->pScreen; - Bool ret; - - SCREEN_PROLOGUE (pScreen, CreateGC); - - if ( (ret = (*pScreen->CreateGC) (pGC)) ) - { - pGC->devPrivates[miBSGCIndex].ptr = (void *) pGC->funcs; - pGC->funcs = &miBSCheapGCFuncs; - } - - SCREEN_EPILOGUE (pScreen, CreateGC, miBSCreateGC); - - return ret; -} - -static Bool -miBSDestroyWindow (pWin) - WindowPtr pWin; -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - Bool ret; - - SCREEN_PROLOGUE (pScreen, DestroyWindow); - - ret = (*pScreen->DestroyWindow) (pWin); - - miBSFree (pWin); - - SCREEN_EPILOGUE (pScreen, DestroyWindow, miBSDestroyWindow); - - return ret; -} - -/* - * cheap GC func wrappers. Simply track validation on windows - * with backing store to enable the real func/op wrappers - */ - -static void -miBSCheapValidateGC (pGC, stateChanges, pDrawable) - GCPtr pGC; - unsigned long stateChanges; - DrawablePtr pDrawable; -{ - CHEAP_FUNC_PROLOGUE (pGC); - - if (pDrawable->type != DRAWABLE_PIXMAP && - ((WindowPtr) pDrawable)->backStorage != NULL && - miBSCreateGCPrivate (pGC)) - { - (*pGC->funcs->ValidateGC) (pGC, stateChanges, pDrawable); - } - else - { - (*pGC->funcs->ValidateGC) (pGC, stateChanges, pDrawable); - - /* rewrap funcs as Validate may have changed them */ - pGC->devPrivates[miBSGCIndex].ptr = (void *) pGC->funcs; - - CHEAP_FUNC_EPILOGUE (pGC); - } -} - -static void -miBSCheapChangeGC (pGC, mask) - GCPtr pGC; - unsigned long mask; -{ - CHEAP_FUNC_PROLOGUE (pGC); - - (*pGC->funcs->ChangeGC) (pGC, mask); - - CHEAP_FUNC_EPILOGUE (pGC); -} - -static void -miBSCheapCopyGC (pGCSrc, mask, pGCDst) - GCPtr pGCSrc, pGCDst; - unsigned long mask; -{ - CHEAP_FUNC_PROLOGUE (pGCDst); - - (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); - - CHEAP_FUNC_EPILOGUE (pGCDst); -} - -static void -miBSCheapDestroyGC (pGC) - GCPtr pGC; -{ - CHEAP_FUNC_PROLOGUE (pGC); - - (*pGC->funcs->DestroyGC) (pGC); - - /* leave it unwrapped */ -} - -static void -miBSCheapChangeClip (pGC, type, pvalue, nrects) - GCPtr pGC; - int type; - void * pvalue; - int nrects; -{ - CHEAP_FUNC_PROLOGUE (pGC); - - (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); - - CHEAP_FUNC_EPILOGUE (pGC); -} - -static void -miBSCheapCopyClip(pgcDst, pgcSrc) - GCPtr pgcDst, pgcSrc; -{ - CHEAP_FUNC_PROLOGUE (pgcDst); - - (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); - - CHEAP_FUNC_EPILOGUE (pgcDst); -} - -static void -miBSCheapDestroyClip(pGC) - GCPtr pGC; -{ - CHEAP_FUNC_PROLOGUE (pGC); - - (* pGC->funcs->DestroyClip)(pGC); - - CHEAP_FUNC_EPILOGUE (pGC); -} - -/* - * create the full func/op wrappers for a GC - */ - -static Bool -miBSCreateGCPrivate (pGC) - GCPtr pGC; -{ - miBSGCRec *pPriv; - - pPriv = (miBSGCRec *) malloc (sizeof (miBSGCRec)); - if (!pPriv) - return FALSE; - pPriv->pBackingGC = NULL; - pPriv->guarantee = GuaranteeNothing; - pPriv->serialNumber = 0; - pPriv->stateChanges = (1 << (GCLastBit + 1)) - 1; - pPriv->wrapOps = pGC->ops; - pPriv->wrapFuncs = pGC->funcs; - pGC->funcs = &miBSGCFuncs; - pGC->ops = &miBSGCOps; - pGC->devPrivates[miBSGCIndex].ptr = (void *) pPriv; - return TRUE; -} - -static void -miBSDestroyGCPrivate (GCPtr pGC) -{ - miBSGCRec *pPriv; - - pPriv = (miBSGCRec *) pGC->devPrivates[miBSGCIndex].ptr; - if (pPriv) - { - pGC->devPrivates[miBSGCIndex].ptr = (void *) pPriv->wrapFuncs; - pGC->funcs = &miBSCheapGCFuncs; - pGC->ops = pPriv->wrapOps; - if (pPriv->pBackingGC) - FreeGC (pPriv->pBackingGC, (GContext) 0); - free ((void *) pPriv); - } -} - -/* - * GC ops -- wrap each GC operation with our own function - */ - -/*- - *----------------------------------------------------------------------- - * miBSFillSpans -- - * Perform a FillSpans, routing output to backing-store as needed. - * - * Results: - * None. - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSFillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) - DrawablePtr pDrawable; - GCPtr pGC; - int nInit; /* number of spans to fill */ - DDXPointPtr pptInit; /* pointer to list of start points */ - int *pwidthInit; /* pointer to list of n widths */ - int fSorted; -{ - DDXPointPtr pptCopy, pptReset; - int *pwidthCopy; - SETUP_BACKING (pDrawable, pGC); - - PROLOGUE(pGC); - - pptCopy = (DDXPointPtr)malloc(nInit*sizeof(DDXPointRec)); - pwidthCopy=(int *)malloc(nInit*sizeof(int)); - if (pptCopy && pwidthCopy) - { - copyData(pptInit, pptCopy, nInit, MoreCopy0); - memmove((char *)pwidthCopy,(char *)pwidthInit,nInit*sizeof(int)); - - (* pGC->ops->FillSpans)(pDrawable, pGC, nInit, pptInit, - pwidthInit, fSorted); - if (pGC->miTranslate) - { - int dx, dy; - int nReset; - - pptReset = pptCopy; - dx = pDrawable->x - pBackingDrawable->x; - dy = pDrawable->y - pBackingDrawable->y; - nReset = nInit; - while (nReset--) - { - pptReset->x -= dx; - pptReset->y -= dy; - ++pptReset; - } - } - (* pBackingGC->ops->FillSpans)(pBackingDrawable, - pBackingGC, nInit, pptCopy, pwidthCopy, - fSorted); - } - if (pwidthCopy) free(pwidthCopy); - if (pptCopy) free(pptCopy); - - EPILOGUE (pGC); -} - -/*- - *----------------------------------------------------------------------- - * miBSSetSpans -- - * Perform a SetSpans, routing output to backing-store as needed. - * - * Results: - * None. - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted) - DrawablePtr pDrawable; - GCPtr pGC; - char *psrc; - register DDXPointPtr ppt; - int *pwidth; - int nspans; - int fSorted; -{ - DDXPointPtr pptCopy, pptReset; - int *pwidthCopy; - SETUP_BACKING (pDrawable, pGC); - - PROLOGUE(pGC); - - pptCopy = (DDXPointPtr)malloc(nspans*sizeof(DDXPointRec)); - pwidthCopy=(int *)malloc(nspans*sizeof(int)); - if (pptCopy && pwidthCopy) - { - copyData(ppt, pptCopy, nspans, MoreCopy0); - memmove((char *)pwidthCopy,(char *)pwidth,nspans*sizeof(int)); - - (* pGC->ops->SetSpans)(pDrawable, pGC, psrc, ppt, pwidth, - nspans, fSorted); - if (pGC->miTranslate) - { - int dx, dy; - int nReset; - - pptReset = pptCopy; - dx = pDrawable->x - pBackingDrawable->x; - dy = pDrawable->y - pBackingDrawable->y; - nReset = nspans; - while (nReset--) - { - pptReset->x -= dx; - pptReset->y -= dy; - ++pptReset; - } - } - (* pBackingGC->ops->SetSpans)(pBackingDrawable, pBackingGC, - psrc, pptCopy, pwidthCopy, nspans, fSorted); - } - if (pwidthCopy) free(pwidthCopy); - if (pptCopy) free(pptCopy); - - EPILOGUE (pGC); -} - -/*- - *----------------------------------------------------------------------- - * miBSPutImage -- - * Perform a PutImage, routing output to backing-store as needed. - * - * Results: - * None. - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits) - DrawablePtr pDrawable; - GCPtr pGC; - int depth; - int x; - int y; - int w; - int h; - int leftPad; - int format; - char *pBits; -{ - SETUP_BACKING (pDrawable, pGC); - - PROLOGUE(pGC); - - (*pGC->ops->PutImage)(pDrawable, pGC, - depth, x, y, w, h, leftPad, format, pBits); - (*pBackingGC->ops->PutImage)(pBackingDrawable, pBackingGC, - depth, x - pBackingStore->x, y - pBackingStore->y, - w, h, leftPad, format, pBits); - - EPILOGUE (pGC); -} - -typedef RegionPtr (* CopyAreaProcPtr)(DrawablePtr, DrawablePtr, GCPtr, - int, int, int, int, int, int); -typedef RegionPtr (* CopyPlaneProcPtr)(DrawablePtr, DrawablePtr, GCPtr, - int, int, int, int, int, int, - unsigned long bitPlane); -/*- - *----------------------------------------------------------------------- - * miBSDoCopy -- - * Perform a CopyArea or CopyPlane within a window that has backing - * store enabled. - * - * Results: - * TRUE if the copy was performed or FALSE if a regular one should - * be done. - * - * Side Effects: - * Things are copied (no s***!) - * - * Notes: - * The idea here is to form two regions that cover the source box. - * One contains the exposed rectangles while the other contains - * the obscured ones. An array of pairs is then - * formed where the indicates the area to be copied and the - * indicates from where it is to be copied (exposed regions - * come from the screen while obscured ones come from the backing - * pixmap). The array 'sequence' is then filled with the indices of - * the pairs in the order in which they should be copied to prevent - * things from getting screwed up. A call is also made through the - * backingGC to take care of any copying into the backing pixmap. - * - *----------------------------------------------------------------------- - */ -static Bool -miBSDoCopy( - WindowPtr pWin, /* Window being scrolled */ - GCPtr pGC, /* GC we're called through */ - int srcx, /* X of source rectangle */ - int srcy, /* Y of source rectangle */ - int w, /* Width of source rectangle */ - int h, /* Height of source rectangle */ - int dstx, /* X of destination rectangle */ - int dsty, /* Y of destination rectangle */ - unsigned long plane, /* Plane to copy (0 for CopyArea) */ - CopyPlaneProcPtr copyProc, /* Procedure to call to perform the copy */ - RegionPtr *ppRgn) /* resultant Graphics Expose region */ -{ - RegionPtr pRgnExp; /* Exposed region */ - RegionPtr pRgnObs; /* Obscured region */ - BoxRec box; /* Source box (screen coord) */ - struct BoxDraw { - BoxPtr pBox; /* Source box */ - enum { - win, pix - } source; /* Place from which to copy */ - } *boxes; /* Array of box/drawable pairs covering - * source box. */ - int *sequence; /* Sequence of boxes to move */ - register int i, j, k, l, y; - register BoxPtr pBox; - int dx, dy, nrects; - Bool graphicsExposures; - CopyPlaneProcPtr pixCopyProc; - int numRectsExp, numRectsObs; - BoxPtr pBoxExp, pBoxObs; - - SETUP_BACKING (pWin, pGC); - (void)oldFuncs; - - /* - * Create a region of exposed boxes in pRgnExp. - */ - box.x1 = srcx + pWin->drawable.x; - box.x2 = box.x1 + w; - box.y1 = srcy + pWin->drawable.y; - box.y2 = box.y1 + h; - - pRgnExp = RegionCreate(&box, 1); - RegionIntersect(pRgnExp, pRgnExp, &pWin->clipList); - pRgnObs = RegionCreate(NULL, 1); - RegionInverse(pRgnObs, pRgnExp, &box); - - /* - * Translate regions into window coordinates for proper calls - * to the copyProc, then make sure none of the obscured region sticks - * into invalid areas of the backing pixmap. - */ - RegionTranslate(pRgnExp, - -pWin->drawable.x, - -pWin->drawable.y); - RegionTranslate(pRgnObs, - -pWin->drawable.x, - -pWin->drawable.y); - RegionIntersect(pRgnObs, pRgnObs, &pBackingStore->SavedRegion); - - /* - * If the obscured region is empty, there's no point being fancy. - */ - if (!RegionNotEmpty(pRgnObs)) - { - RegionDestroy(pRgnExp); - RegionDestroy(pRgnObs); - - return (FALSE); - } - - numRectsExp = RegionNumRects(pRgnExp); - pBoxExp = RegionRects(pRgnExp); - pBoxObs = RegionRects(pRgnObs); - numRectsObs = RegionNumRects(pRgnObs); - nrects = numRectsExp + numRectsObs; - - boxes = (struct BoxDraw *)malloc(nrects * sizeof(struct BoxDraw)); - sequence = (int *) malloc(nrects * sizeof(int)); - *ppRgn = NULL; - - if (!boxes || !sequence) - { - if (sequence) free(sequence); - if (boxes) free(boxes); - RegionDestroy(pRgnExp); - RegionDestroy(pRgnObs); - - return(TRUE); - } - - /* - * Order the boxes in the two regions so we know from which drawable - * to copy which box, storing the result in the boxes array - */ - for (i = 0, j = 0, k = 0; - (i < numRectsExp) && (j < numRectsObs); - k++) - { - if (pBoxExp[i].y1 < pBoxObs[j].y1) - { - boxes[k].pBox = &pBoxExp[i]; - boxes[k].source = win; - i++; - } - else if ((pBoxObs[j].y1 < pBoxExp[i].y1) || - (pBoxObs[j].x1 < pBoxExp[i].x1)) - { - boxes[k].pBox = &pBoxObs[j]; - boxes[k].source = pix; - j++; - } - else - { - boxes[k].pBox = &pBoxExp[i]; - boxes[k].source = win; - i++; - } - } - - /* - * Catch any leftover boxes from either region (note that only - * one can have leftover boxes...) - */ - if (i != numRectsExp) - { - do - { - boxes[k].pBox = &pBoxExp[i]; - boxes[k].source = win; - i++; - k++; - } while (i < numRectsExp); - - } - else - { - do - { - boxes[k].pBox = &pBoxObs[j]; - boxes[k].source = pix; - j++; - k++; - } while (j < numRectsObs); - } - - if (dsty <= srcy) - { - /* - * Scroll up or vertically stationary, so vertical order is ok. - */ - if (dstx <= srcx) - { - /* - * Scroll left or horizontally stationary, so horizontal order - * is ok as well. - */ - for (i = 0; i < nrects; i++) - { - sequence[i] = i; - } - } - else - { - /* - * Scroll right. Need to reverse the rectangles within each - * band. - */ - for (i = 0, j = 1, k = 0; - i < nrects; - j = i + 1, k = i) - { - y = boxes[i].pBox->y1; - while ((j < nrects) && (boxes[j].pBox->y1 == y)) - { - j++; - } - for (j--; j >= k; j--, i++) - { - sequence[i] = j; - } - } - } - } - else - { - /* - * Scroll down. Must reverse vertical banding, at least. - */ - if (dstx < srcx) - { - /* - * Scroll left. Horizontal order is ok. - */ - for (i = nrects - 1, j = i - 1, k = i, l = 0; - i >= 0; - j = i - 1, k = i) - { - /* - * Find extent of current horizontal band, then reverse - * the order of the whole band. - */ - y = boxes[i].pBox->y1; - while ((j >= 0) && (boxes[j].pBox->y1 == y)) - { - j--; - } - for (j++; j <= k; j++, i--, l++) - { - sequence[l] = j; - } - } - } - else - { - /* - * Scroll right or horizontal stationary. - * Reverse horizontal order as well (if stationary, horizontal - * order can be swapped without penalty and this is faster - * to compute). - */ - for (i = 0, j = nrects - 1; i < nrects; i++, j--) - { - sequence[i] = j; - } - } - } - - /* - * XXX: To avoid getting multiple NoExpose events from this operation, - * we turn OFF graphicsExposures in the gc and deal with any uncopied - * areas later, if there's something not in backing-store. - */ - - graphicsExposures = pGC->graphicsExposures; - pGC->graphicsExposures = FALSE; - - dx = dstx - srcx; - dy = dsty - srcy; - - /* - * Figure out which copy procedure to use from the backing GC. Note we - * must do this because some implementations (sun's, e.g.) have - * pBackingGC a fake GC with the real one below it, thus the devPriv for - * pBackingGC won't be what the output library expects. - */ - if (plane != 0) - { - pixCopyProc = pBackingGC->ops->CopyPlane; - } - else - { - pixCopyProc = (CopyPlaneProcPtr)pBackingGC->ops->CopyArea; - } - - for (i = 0; i < nrects; i++) - { - pBox = boxes[sequence[i]].pBox; - - /* - * If we're copying from the pixmap, we need to place its contents - * onto the screen before scrolling the pixmap itself. If we're copying - * from the window, we need to copy its contents into the pixmap before - * we scroll the window itself. - */ - if (boxes[sequence[i]].source == pix) - { - (void) (* copyProc) (pBackingDrawable, &(pWin->drawable), pGC, - pBox->x1 - pBackingStore->x, - pBox->y1 - pBackingStore->y, - pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, - pBox->x1 + dx, pBox->y1 + dy, plane); - (void) (* pixCopyProc) (pBackingDrawable, pBackingDrawable, pBackingGC, - pBox->x1 - pBackingStore->x, - pBox->y1 - pBackingStore->y, - pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, - pBox->x1 + dx - pBackingStore->x, - pBox->y1 + dy - pBackingStore->y, plane); - } - else - { - (void) (* pixCopyProc) (&(pWin->drawable), pBackingDrawable, pBackingGC, - pBox->x1, pBox->y1, - pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, - pBox->x1 + dx - pBackingStore->x, - pBox->y1 + dy - pBackingStore->y, plane); - (void) (* copyProc) (&(pWin->drawable), &(pWin->drawable), pGC, - pBox->x1, pBox->y1, - pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, - pBox->x1 + dx, pBox->y1 + dy, plane); - } - } - free(sequence); - free(boxes); - - pGC->graphicsExposures = graphicsExposures; - /* - * Form union of rgnExp and rgnObs and see if covers entire area - * to be copied. Store the resultant region for miBSCopyArea - * to return to dispatch which will send the appropriate expose - * events. - */ - RegionUnion(pRgnExp, pRgnExp, pRgnObs); - box.x1 = srcx; - box.x2 = srcx + w; - box.y1 = srcy; - box.y2 = srcy + h; - if (RegionContainsRect(pRgnExp, &box) == rgnIN) - { - RegionEmpty(pRgnExp); - } - else - { - RegionInverse(pRgnExp, pRgnExp, &box); - RegionTranslate(pRgnExp, - dx + pWin->drawable.x, - dy + pWin->drawable.y); - RegionIntersect(pRgnObs, pRgnExp, &pWin->clipList); - (*pWin->drawable.pScreen->PaintWindowBackground) (pWin, - pRgnObs, PW_BACKGROUND); - RegionTranslate(pRgnExp, - -pWin->drawable.x, - -pWin->drawable.y); - miBSClearBackingRegion (pWin, pRgnExp); - } - if (graphicsExposures) - *ppRgn = pRgnExp; - else - RegionDestroy(pRgnExp); - RegionDestroy(pRgnObs); - - return (TRUE); -} - -/*- - *----------------------------------------------------------------------- - * miBSCopyArea -- - * Perform a CopyArea from the source to the destination, extracting - * from the source's backing-store and storing into the destination's - * backing-store without messing anything up. If the source and - * destination are different, there's not too much to worry about: - * we can just issue several calls to the regular CopyArea function. - * - * Results: - * None. - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static RegionPtr -miBSCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty) - DrawablePtr pSrc; - DrawablePtr pDst; - GCPtr pGC; - int srcx; - int srcy; - int w; - int h; - int dstx; - int dsty; -{ - BoxPtr pExtents; - long dx, dy; - int bsrcx, bsrcy, bw, bh, bdstx, bdsty; - RegionPtr pixExposed = 0, winExposed = 0; - - SETUP_BACKING(pDst, pGC); - - PROLOGUE(pGC); - - if ((pSrc != pDst) || - (!miBSDoCopy((WindowPtr)pSrc, pGC, srcx, srcy, w, h, dstx, dsty, - (unsigned long) 0, (CopyPlaneProcPtr)pGC->ops->CopyArea, - &winExposed))) - { - /* - * always copy to the backing store first, miBSDoCopy - * returns FALSE if the *source* region is disjoint - * from the backing store saved region. So, copying - * *to* the backing store is always safe - */ - if (pGC->clientClipType != CT_PIXMAP) - { - /* - * adjust srcx, srcy, w, h, dstx, dsty to be clipped to - * the backing store. An unnecessary optimisation, - * but a useful one when GetSpans is slow. - */ - pExtents = RegionExtents( - (RegionPtr)pBackingGC->clientClip); - bsrcx = srcx; - bsrcy = srcy; - bw = w; - bh = h; - bdstx = dstx; - bdsty = dsty; - dx = pExtents->x1 - bdstx; - if (dx > 0) - { - bsrcx += dx; - bdstx += dx; - bw -= dx; - } - dy = pExtents->y1 - bdsty; - if (dy > 0) - { - bsrcy += dy; - bdsty += dy; - bh -= dy; - } - dx = (bdstx + bw) - pExtents->x2; - if (dx > 0) - bw -= dx; - dy = (bdsty + bh) - pExtents->y2; - if (dy > 0) - bh -= dy; - if (bw > 0 && bh > 0) - pixExposed = (* pBackingGC->ops->CopyArea) (pSrc, - pBackingDrawable, pBackingGC, - bsrcx, bsrcy, bw, bh, bdstx - pBackingStore->x, - bdsty - pBackingStore->y); - } - else - pixExposed = (* pBackingGC->ops->CopyArea) (pSrc, - pBackingDrawable, pBackingGC, - srcx, srcy, w, h, - dstx - pBackingStore->x, dsty - pBackingStore->y); - - winExposed = (* pGC->ops->CopyArea) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); - } - - /* - * compute the composite graphics exposure region - */ - if (winExposed) - { - if (pixExposed){ - RegionUnion(winExposed, winExposed, pixExposed); - RegionDestroy(pixExposed); - } - } else - winExposed = pixExposed; - - EPILOGUE (pGC); - - return winExposed; -} - -/*- - *----------------------------------------------------------------------- - * miBSCopyPlane -- - * - * Results: - * None. - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static RegionPtr -miBSCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane) - DrawablePtr pSrc; - DrawablePtr pDst; - register GC *pGC; - int srcx, - srcy; - int w, - h; - int dstx, - dsty; - unsigned long plane; -{ - BoxPtr pExtents; - long dx, dy; - int bsrcx, bsrcy, bw, bh, bdstx, bdsty; - RegionPtr winExposed = 0, pixExposed = 0; - SETUP_BACKING(pDst, pGC); - - PROLOGUE(pGC); - - if ((pSrc != pDst) || - (!miBSDoCopy((WindowPtr)pSrc, pGC, srcx, srcy, w, h, dstx, dsty, - plane, pGC->ops->CopyPlane, &winExposed))) - { - /* - * always copy to the backing store first, miBSDoCopy - * returns FALSE if the *source* region is disjoint - * from the backing store saved region. So, copying - * *to* the backing store is always safe - */ - if (pGC->clientClipType != CT_PIXMAP) - { - /* - * adjust srcx, srcy, w, h, dstx, dsty to be clipped to - * the backing store. An unnecessary optimisation, - * but a useful one when GetSpans is slow. - */ - pExtents = RegionExtents( - (RegionPtr)pBackingGC->clientClip); - bsrcx = srcx; - bsrcy = srcy; - bw = w; - bh = h; - bdstx = dstx; - bdsty = dsty; - dx = pExtents->x1 - bdstx; - if (dx > 0) - { - bsrcx += dx; - bdstx += dx; - bw -= dx; - } - dy = pExtents->y1 - bdsty; - if (dy > 0) - { - bsrcy += dy; - bdsty += dy; - bh -= dy; - } - dx = (bdstx + bw) - pExtents->x2; - if (dx > 0) - bw -= dx; - dy = (bdsty + bh) - pExtents->y2; - if (dy > 0) - bh -= dy; - if (bw > 0 && bh > 0) - pixExposed = (* pBackingGC->ops->CopyPlane) (pSrc, - pBackingDrawable, - pBackingGC, bsrcx, bsrcy, bw, bh, - bdstx - pBackingStore->x, - bdsty - pBackingStore->y, plane); - } - else - pixExposed = (* pBackingGC->ops->CopyPlane) (pSrc, - pBackingDrawable, - pBackingGC, srcx, srcy, w, h, - dstx - pBackingStore->x, - dsty - pBackingStore->y, plane); - - winExposed = (* pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h, - dstx, dsty, plane); - - } - - /* - * compute the composite graphics exposure region - */ - if (winExposed) - { - if (pixExposed) - { - RegionUnion(winExposed, winExposed, pixExposed); - RegionDestroy(pixExposed); - } - } else - winExposed = pixExposed; - - EPILOGUE (pGC); - - return winExposed; -} - -/*- - *----------------------------------------------------------------------- - * miBSPolyPoint -- - * Perform a PolyPoint, routing output to backing-store as needed. - * - * Results: - * None. - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSPolyPoint (pDrawable, pGC, mode, npt, pptInit) - DrawablePtr pDrawable; - GCPtr pGC; - int mode; /* Origin or Previous */ - int npt; - xPoint *pptInit; -{ - xPoint *pptCopy; - SETUP_BACKING (pDrawable, pGC); - - PROLOGUE(pGC); - - pptCopy = (xPoint *)malloc(npt*sizeof(xPoint)); - if (pptCopy) - { - copyPoints(pptInit, pptCopy, npt, mode); - - (* pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pptInit); - - (* pBackingGC->ops->PolyPoint) (pBackingDrawable, - pBackingGC, mode, npt, pptCopy); - - free(pptCopy); - } - - EPILOGUE (pGC); -} - -/*- - *----------------------------------------------------------------------- - * miBSPolyLines -- - * Perform a Polylines, routing output to backing-store as needed. - * - * Results: - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSPolylines (pDrawable, pGC, mode, npt, pptInit) - DrawablePtr pDrawable; - GCPtr pGC; - int mode; - int npt; - DDXPointPtr pptInit; -{ - DDXPointPtr pptCopy; - SETUP_BACKING (pDrawable, pGC); - - PROLOGUE(pGC); - - pptCopy = (DDXPointPtr)malloc(npt*sizeof(DDXPointRec)); - if (pptCopy) - { - copyPoints(pptInit, pptCopy, npt, mode); - - (* pGC->ops->Polylines)(pDrawable, pGC, mode, npt, pptInit); - (* pBackingGC->ops->Polylines)(pBackingDrawable, - pBackingGC, mode, npt, pptCopy); - free(pptCopy); - } - - EPILOGUE (pGC); -} - -/*- - *----------------------------------------------------------------------- - * miBSPolySegment -- - * Perform a PolySegment, routing output to backing-store as needed. - * - * Results: - * None. - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSPolySegment(pDrawable, pGC, nseg, pSegs) - DrawablePtr pDrawable; - GCPtr pGC; - int nseg; - xSegment *pSegs; -{ - xSegment *pSegsCopy; - - SETUP_BACKING (pDrawable, pGC); - - PROLOGUE(pGC); - - pSegsCopy = (xSegment *)malloc(nseg*sizeof(xSegment)); - if (pSegsCopy) - { - copyData(pSegs, pSegsCopy, nseg << 1, MoreCopy0); - - (* pGC->ops->PolySegment)(pDrawable, pGC, nseg, pSegs); - (* pBackingGC->ops->PolySegment)(pBackingDrawable, - pBackingGC, nseg, pSegsCopy); - - free(pSegsCopy); - } - - EPILOGUE (pGC); -} - -/*- - *----------------------------------------------------------------------- - * miBSPolyRectangle -- - * Perform a PolyRectangle, routing output to backing-store as needed. - * - * Results: - * None - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSPolyRectangle(pDrawable, pGC, nrects, pRects) - DrawablePtr pDrawable; - GCPtr pGC; - int nrects; - xRectangle *pRects; -{ - xRectangle *pRectsCopy; - SETUP_BACKING (pDrawable, pGC); - - PROLOGUE(pGC); - - pRectsCopy =(xRectangle *)malloc(nrects*sizeof(xRectangle)); - if (pRectsCopy) - { - copyData(pRects, pRectsCopy, nrects, MoreCopy2); - - (* pGC->ops->PolyRectangle)(pDrawable, pGC, nrects, pRects); - (* pBackingGC->ops->PolyRectangle)(pBackingDrawable, - pBackingGC, nrects, pRectsCopy); - - free(pRectsCopy); - } - - EPILOGUE (pGC); -} - -/*- - *----------------------------------------------------------------------- - * miBSPolyArc -- - * Perform a PolyArc, routing output to backing-store as needed. - * - * Results: - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSPolyArc(pDrawable, pGC, narcs, parcs) - DrawablePtr pDrawable; - GCPtr pGC; - int narcs; - xArc *parcs; -{ - xArc *pArcsCopy; - SETUP_BACKING (pDrawable, pGC); - - PROLOGUE(pGC); - - pArcsCopy = (xArc *)malloc(narcs*sizeof(xArc)); - if (pArcsCopy) - { - copyData(parcs, pArcsCopy, narcs, MoreCopy4); - - (* pGC->ops->PolyArc)(pDrawable, pGC, narcs, parcs); - (* pBackingGC->ops->PolyArc)(pBackingDrawable, pBackingGC, - narcs, pArcsCopy); - - free(pArcsCopy); - } - - EPILOGUE (pGC); -} - -/*- - *----------------------------------------------------------------------- - * miBSFillPolygon -- - * Perform a FillPolygon, routing output to backing-store as needed. - * - * Results: - * None. - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSFillPolygon(pDrawable, pGC, shape, mode, count, pPts) - DrawablePtr pDrawable; - register GCPtr pGC; - int shape, mode; - register int count; - DDXPointPtr pPts; -{ - DDXPointPtr pPtsCopy; - SETUP_BACKING (pDrawable, pGC); - - PROLOGUE(pGC); - - pPtsCopy = (DDXPointPtr)malloc(count*sizeof(DDXPointRec)); - if (pPtsCopy) - { - copyPoints(pPts, pPtsCopy, count, mode); - (* pGC->ops->FillPolygon)(pDrawable, pGC, shape, mode, count, pPts); - (* pBackingGC->ops->FillPolygon)(pBackingDrawable, - pBackingGC, shape, mode, - count, pPtsCopy); - - free(pPtsCopy); - } - - EPILOGUE (pGC); -} - -/*- - *----------------------------------------------------------------------- - * miBSPolyFillRect -- - * Perform a PolyFillRect, routing output to backing-store as needed. - * - * Results: - * None. - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSPolyFillRect(pDrawable, pGC, nrectFill, prectInit) - DrawablePtr pDrawable; - GCPtr pGC; - int nrectFill; /* number of rectangles to fill */ - xRectangle *prectInit; /* Pointer to first rectangle to fill */ -{ - xRectangle *pRectCopy; - SETUP_BACKING (pDrawable, pGC); - - PROLOGUE(pGC); - - pRectCopy = - (xRectangle *)malloc(nrectFill*sizeof(xRectangle)); - if (pRectCopy) - { - copyData(prectInit, pRectCopy, nrectFill, MoreCopy2); - - (* pGC->ops->PolyFillRect)(pDrawable, pGC, nrectFill, prectInit); - (* pBackingGC->ops->PolyFillRect)(pBackingDrawable, - pBackingGC, nrectFill, pRectCopy); - - free(pRectCopy); - } - - EPILOGUE (pGC); -} - -/*- - *----------------------------------------------------------------------- - * miBSPolyFillArc -- - * Perform a PolyFillArc, routing output to backing-store as needed. - * - * Results: - * None. - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSPolyFillArc(pDrawable, pGC, narcs, parcs) - DrawablePtr pDrawable; - GCPtr pGC; - int narcs; - xArc *parcs; -{ - xArc *pArcsCopy; - SETUP_BACKING (pDrawable, pGC); - - PROLOGUE(pGC); - - pArcsCopy = (xArc *)malloc(narcs*sizeof(xArc)); - if (pArcsCopy) - { - copyData(parcs, pArcsCopy, narcs, MoreCopy4); - (* pGC->ops->PolyFillArc)(pDrawable, pGC, narcs, parcs); - (* pBackingGC->ops->PolyFillArc)(pBackingDrawable, - pBackingGC, narcs, pArcsCopy); - free(pArcsCopy); - } - - EPILOGUE (pGC); -} - - -/*- - *----------------------------------------------------------------------- - * miBSPolyText8 -- - * Perform a PolyText8, routing output to backing-store as needed. - * - * Results: - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static int -miBSPolyText8(pDrawable, pGC, x, y, count, chars) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - int count; - char *chars; -{ - int result; - SETUP_BACKING (pDrawable, pGC); - - PROLOGUE(pGC); - - result = (* pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars); - (* pBackingGC->ops->PolyText8)(pBackingDrawable, pBackingGC, - x - pBackingStore->x, y - pBackingStore->y, - count, chars); - - EPILOGUE (pGC); - return result; -} - -/*- - *----------------------------------------------------------------------- - * miBSPolyText16 -- - * Perform a PolyText16, routing output to backing-store as needed. - * - * Results: - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static int -miBSPolyText16(pDrawable, pGC, x, y, count, chars) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - int count; - unsigned short *chars; -{ - int result; - SETUP_BACKING (pDrawable, pGC); - - PROLOGUE(pGC); - - result = (* pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars); - (* pBackingGC->ops->PolyText16)(pBackingDrawable, pBackingGC, - x - pBackingStore->x, y - pBackingStore->y, - count, chars); - - EPILOGUE (pGC); - - return result; -} - -/*- - *----------------------------------------------------------------------- - * miBSImageText8 -- - * Perform a ImageText8, routing output to backing-store as needed. - * - * Results: - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSImageText8(pDrawable, pGC, x, y, count, chars) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - int count; - char *chars; -{ - SETUP_BACKING (pDrawable, pGC); - PROLOGUE(pGC); - - (* pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars); - (* pBackingGC->ops->ImageText8)(pBackingDrawable, pBackingGC, - x - pBackingStore->x, y - pBackingStore->y, - count, chars); - - EPILOGUE (pGC); -} - -/*- - *----------------------------------------------------------------------- - * miBSImageText16 -- - * Perform a ImageText16, routing output to backing-store as needed. - * - * Results: - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSImageText16(pDrawable, pGC, x, y, count, chars) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - int count; - unsigned short *chars; -{ - SETUP_BACKING (pDrawable, pGC); - PROLOGUE(pGC); - - (* pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars); - (* pBackingGC->ops->ImageText16)(pBackingDrawable, pBackingGC, - x - pBackingStore->x, y - pBackingStore->y, - count, chars); - - EPILOGUE (pGC); -} - -/*- - *----------------------------------------------------------------------- - * miBSImageGlyphBlt -- - * Perform a ImageGlyphBlt, routing output to backing-store as needed. - * - * Results: - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - unsigned int nglyph; - CharInfoPtr *ppci; /* array of character info */ - void * pglyphBase; /* start of array of glyphs */ -{ - SETUP_BACKING (pDrawable, pGC); - PROLOGUE(pGC); - - (* pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, - pglyphBase); - (* pBackingGC->ops->ImageGlyphBlt)(pBackingDrawable, pBackingGC, - x - pBackingStore->x, y - pBackingStore->y, - nglyph, ppci, pglyphBase); - - EPILOGUE (pGC); -} - -/*- - *----------------------------------------------------------------------- - * miBSPolyGlyphBlt -- - * Perform a PolyGlyphBlt, routing output to backing-store as needed. - * - * Results: - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - unsigned int nglyph; - CharInfoPtr *ppci; /* array of character info */ - void * pglyphBase; /* start of array of glyphs */ -{ - SETUP_BACKING (pDrawable, pGC); - PROLOGUE(pGC); - - (* pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, - ppci, pglyphBase); - (* pBackingGC->ops->PolyGlyphBlt)(pBackingDrawable, pBackingGC, - x - pBackingStore->x, y - pBackingStore->y, - nglyph, ppci, pglyphBase); - EPILOGUE (pGC); -} - -/*- - *----------------------------------------------------------------------- - * miBSPushPixels -- - * Perform a PushPixels, routing output to backing-store as needed. - * - * Results: - * - * Side Effects: - * - *----------------------------------------------------------------------- - */ -static void -miBSPushPixels(pGC, pBitMap, pDst, w, h, x, y) - GCPtr pGC; - PixmapPtr pBitMap; - DrawablePtr pDst; - int w, h, x, y; -{ - SETUP_BACKING (pDst, pGC); - PROLOGUE(pGC); - - (* pGC->ops->PushPixels)(pGC, pBitMap, pDst, w, h, x, y); - if (pGC->miTranslate) { - x -= pDst->x; - y -= pDst->y; - } - (* pBackingGC->ops->PushPixels)(pBackingGC, pBitMap, - pBackingDrawable, w, h, - x - pBackingStore->x, y - pBackingStore->y); - - EPILOGUE (pGC); -} - -#ifdef NEED_LINEHELPER -/*- - *----------------------------------------------------------------------- - * miBSLineHelper -- - * - * Results: should never be called - * - * Side Effects: server dies - * - *----------------------------------------------------------------------- - */ -static void -miBSLineHelper() -{ - FatalError("miBSLineHelper called\n"); -} -#endif - -/*- - *----------------------------------------------------------------------- - * miBSClearBackingStore -- - * Clear the given area of the backing pixmap with the background of - * the window, whatever it is. If generateExposures is TRUE, generate - * exposure events for the area. Note that if the area has any - * part outside the saved portions of the window, we do not allow the - * count in the expose events to be 0, since there will be more - * expose events to come. - * - * Results: - * None. - * - * Side Effects: - * Areas of pixmap are cleared and Expose events are generated. - * - *----------------------------------------------------------------------- - */ -static RegionPtr -miBSClearBackingStore(pWin, x, y, w, h, generateExposures) - WindowPtr pWin; - int x; - int y; - int w; - int h; - Bool generateExposures; -{ - RegionPtr pRgn; - int i; - miBSWindowPtr pBackingStore; - ScreenPtr pScreen; - GCPtr pGC; - int ts_x_origin, - ts_y_origin; - void *gcvalues[4]; - unsigned long gcmask; - xRectangle *rects; - BoxPtr pBox; - BoxRec box; - PixUnion background; - char backgroundState; - int numRects; - - pBackingStore = (miBSWindowPtr)pWin->backStorage; - pScreen = pWin->drawable.pScreen; - - if ((pBackingStore->status == StatusNoPixmap) || - (pBackingStore->status == StatusBadAlloc)) - return NullRegion; - - if (w == 0) - w = (int) pWin->drawable.width - x; - if (h == 0) - h = (int) pWin->drawable.height - y; - - box.x1 = x; - box.y1 = y; - box.x2 = x + w; - box.y2 = y + h; - pRgn = RegionCreate(&box, 1); - if (!pRgn) - return NullRegion; - RegionIntersect(pRgn, pRgn, &pBackingStore->SavedRegion); - - if (RegionNotEmpty(pRgn)) - { - /* - * if clearing entire window, simply make new virtual - * tile. For the root window, we also destroy the pixmap - * to save a pile of memory - */ - if (x == 0 && y == 0 && - w == pWin->drawable.width && - h == pWin->drawable.height) - { - if (!pWin->parent) - miDestroyBSPixmap (pWin); - if (pBackingStore->status != StatusContents) - miTileVirtualBS (pWin); - } - - ts_x_origin = ts_y_origin = 0; - - backgroundState = pWin->backgroundState; - background = pWin->background; - if (backgroundState == ParentRelative) { - WindowPtr pParent; - - pParent = pWin; - while (pParent->backgroundState == ParentRelative) { - ts_x_origin -= pParent->origin.x; - ts_y_origin -= pParent->origin.y; - pParent = pParent->parent; - } - backgroundState = pParent->backgroundState; - background = pParent->background; - } - - if ((backgroundState != None) && - ((pBackingStore->status == StatusContents) || - !SameBackground (pBackingStore->backgroundState, - pBackingStore->background, - backgroundState, - background))) - { - if (!pBackingStore->pBackingPixmap) - miCreateBSPixmap(pWin, NullBox); - - pGC = GetScratchGC(pWin->drawable.depth, pScreen); - if (pGC && pBackingStore->pBackingPixmap) - { - /* - * First take care of any ParentRelative stuff by altering the - * tile/stipple origin to match the coordinates of the upper-left - * corner of the first ancestor without a ParentRelative background. - * This coordinate is, of course, negative. - */ - - if (backgroundState == BackgroundPixel) - { - gcvalues[0] = (void *) background.pixel; - gcvalues[1] = (void *)FillSolid; - gcmask = GCForeground|GCFillStyle; - } - else - { - gcvalues[0] = (void *)FillTiled; - gcvalues[1] = (void *) background.pixmap; - gcmask = GCFillStyle|GCTile; - } - gcvalues[2] = (void *)(long)(ts_x_origin - pBackingStore->x); - gcvalues[3] = (void *)(long)(ts_y_origin - pBackingStore->y); - gcmask |= GCTileStipXOrigin|GCTileStipYOrigin; - DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE); - ValidateGC((DrawablePtr)pBackingStore->pBackingPixmap, pGC); - - /* - * Figure out the array of rectangles to fill and fill them with - * PolyFillRect in the proper mode, as set in the GC above. - */ - numRects = RegionNumRects(pRgn); - rects = (xRectangle *)malloc(numRects*sizeof(xRectangle)); - - if (rects) - { - for (i = 0, pBox = RegionRects(pRgn); - i < numRects; - i++, pBox++) - { - rects[i].x = pBox->x1 - pBackingStore->x; - rects[i].y = pBox->y1 - pBackingStore->y; - rects[i].width = pBox->x2 - pBox->x1; - rects[i].height = pBox->y2 - pBox->y1; - } - (* pGC->ops->PolyFillRect) ( - (DrawablePtr)pBackingStore->pBackingPixmap, - pGC, numRects, rects); - free(rects); - } - FreeScratchGC(pGC); - } - } - - if (!generateExposures) - { - RegionDestroy(pRgn); - pRgn = NULL; - } - else - { - /* - * result must be screen relative, but is currently - * drawable relative. - */ - RegionTranslate(pRgn, pWin->drawable.x, - pWin->drawable.y); - } - } - else - { - RegionDestroy(pRgn); - pRgn = NULL; - } - return pRgn; -} - -static void -miBSClearBackingRegion (pWin, pRgn) - WindowPtr pWin; - RegionPtr pRgn; -{ - BoxPtr pBox; - int i; - - i = RegionNumRects(pRgn); - pBox = RegionRects(pRgn); - while (i--) - { - (void) miBSClearBackingStore(pWin, pBox->x1, pBox->y1, - pBox->x2 - pBox->x1, - pBox->y2 - pBox->y1, - FALSE); - pBox++; - } -} - -/* - * fill a region of the destination with virtual bits - * - * pRgn is to be translated by (x,y) - */ - -static void -miBSFillVirtualBits (pDrawable, pGC, pRgn, x, y, state, pixunion, planeMask) - DrawablePtr pDrawable; - GCPtr pGC; - RegionPtr pRgn; - int x, y; - int state; - PixUnion pixunion; - unsigned long planeMask; -{ - int i; - BITS32 gcmask; - void * gcval[5]; - xRectangle *pRect; - BoxPtr pBox; - WindowPtr pWin; - int numRects; - - if (state == None) - return; - numRects = RegionNumRects(pRgn); - pRect = (xRectangle *)malloc(numRects * sizeof(xRectangle)); - if (!pRect) - return; - pWin = 0; - if (pDrawable->type != DRAWABLE_PIXMAP) - { - pWin = (WindowPtr) pDrawable; - if (!pWin->backStorage) - pWin = 0; - } - i = 0; - gcmask = 0; - gcval[i++] = (void *)planeMask; - gcmask |= GCPlaneMask; - if (state == BackgroundPixel) - { - if (pGC->fgPixel != pixunion.pixel) - { - gcval[i++] = (void *)pixunion.pixel; - gcmask |= GCForeground; - } - if (pGC->fillStyle != FillSolid) - { - gcval[i++] = (void *)FillSolid; - gcmask |= GCFillStyle; - } - } - else - { - if (pGC->fillStyle != FillTiled) - { - gcval[i++] = (void *)FillTiled; - gcmask |= GCFillStyle; - } - if (pGC->tileIsPixel || pGC->tile.pixmap != pixunion.pixmap) - { - gcval[i++] = (void *)pixunion.pixmap; - gcmask |= GCTile; - } - if (pGC->patOrg.x != x) - { - gcval[i++] = (void *)(long)x; - gcmask |= GCTileStipXOrigin; - } - if (pGC->patOrg.y != y) - { - gcval[i++] = (void *)(long)y; - gcmask |= GCTileStipYOrigin; - } - } - if (gcmask) - DoChangeGC (pGC, gcmask, (XID *)gcval, 1); - - if (pWin) - (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); - - if (pDrawable->serialNumber != pGC->serialNumber) - ValidateGC (pDrawable, pGC); - - pBox = RegionRects(pRgn); - for (i = numRects; --i >= 0; pBox++, pRect++) - { - pRect->x = pBox->x1 + x; - pRect->y = pBox->y1 + y; - pRect->width = pBox->x2 - pBox->x1; - pRect->height = pBox->y2 - pBox->y1; - } - pRect -= numRects; - (*pGC->ops->PolyFillRect) (pDrawable, pGC, numRects, pRect); - if (pWin) - (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing); - free (pRect); -} - -/*- - *----------------------------------------------------------------------- - * miBSAllocate -- - * Create and install backing store info for a window - * - *----------------------------------------------------------------------- - */ - -static void -miBSAllocate(pWin) - WindowPtr pWin; -{ - register miBSWindowPtr pBackingStore; - - if (pWin->drawable.pScreen->backingStoreSupport == NotUseful) - return; - if (!(pBackingStore = (miBSWindowPtr)pWin->backStorage)) - { - - pBackingStore = (miBSWindowPtr)malloc(sizeof(miBSWindowRec)); - if (!pBackingStore) - return; - - pBackingStore->pBackingPixmap = NullPixmap; - pBackingStore->x = 0; - pBackingStore->y = 0; - RegionNull(&pBackingStore->SavedRegion); - pBackingStore->viewable = (char)pWin->viewable; - pBackingStore->status = StatusNoPixmap; - pBackingStore->backgroundState = None; - pWin->backStorage = (void *) pBackingStore; - } - - /* - * Now want to initialize the backing pixmap and SavedRegion if - * necessary. The initialization consists of finding all the - * currently-obscured regions, by taking the inverse of the window's - * clip list, storing the result in SavedRegion, and exposing those - * areas of the window. - */ - - if (pBackingStore->status == StatusNoPixmap && - ((pWin->backingStore == WhenMapped && pWin->viewable) || - (pWin->backingStore == Always))) - { - BoxRec box; - RegionPtr pSavedRegion; - - pSavedRegion = &pBackingStore->SavedRegion; - - box.x1 = pWin->drawable.x; - box.x2 = box.x1 + (int) pWin->drawable.width; - box.y1 = pWin->drawable.y; - box.y2 = pWin->drawable.y + (int) pWin->drawable.height; - - RegionInverse(pSavedRegion, &pWin->clipList, &box); - RegionTranslate(pSavedRegion, - -pWin->drawable.x, - -pWin->drawable.y); -#ifdef SHAPE - if (wBoundingShape (pWin)) - RegionIntersect(pSavedRegion, pSavedRegion, - wBoundingShape (pWin)); - if (wClipShape (pWin)) - RegionIntersect(pSavedRegion, pSavedRegion, - wClipShape (pWin)); -#endif - /* if window is already on-screen, assume it has been drawn to */ - if (pWin->viewable) - pBackingStore->status = StatusVDirty; - miTileVirtualBS (pWin); - - /* - * deliver all the newly available regions - * as exposure events to the window - */ - - miSendExposures(pWin, pSavedRegion, 0, 0); - } - else if (!pWin->viewable) - { - /* - * Turn off backing store when we're not supposed to - * be saving anything - */ - if (pBackingStore->status != StatusNoPixmap) - { - RegionEmpty(&pBackingStore->SavedRegion); - miDestroyBSPixmap (pWin); - } - } -} - -/*- - *----------------------------------------------------------------------- - * miBSFree -- - * Destroy and free all the stuff associated with the backing-store - * for the given window. - * - * Results: - * None. - * - * Side Effects: - * The backing pixmap and all the regions and GC's are destroyed. - * - *----------------------------------------------------------------------- - */ -static void -miBSFree(pWin) - WindowPtr pWin; -{ - miBSWindowPtr pBackingStore; - - pBackingStore = (miBSWindowPtr)pWin->backStorage; - if (pBackingStore) - { - miDestroyBSPixmap (pWin); - - RegionUninit(&pBackingStore->SavedRegion); - - free(pBackingStore); - pWin->backStorage = NULL; - } -} - -/*- - *----------------------------------------------------------------------- - * miResizeBackingStore -- - * Alter the size of the backing pixmap as necessary when the - * SavedRegion changes size. The contents of the old pixmap are - * copied/shifted into the new/same pixmap. - * - * Results: - * The new Pixmap is created as necessary. - * - * Side Effects: - * The old pixmap is destroyed. - * - *----------------------------------------------------------------------- - */ -static void -miResizeBackingStore( - WindowPtr pWin, - int dx, /* bits are moving this far */ - int dy, /* bits are moving this far */ - Bool saveBits) /* bits are useful */ -{ - miBSWindowPtr pBackingStore; - PixmapPtr pBackingPixmap; - ScreenPtr pScreen; - GC *pGC; - BoxPtr extents; - PixmapPtr pNewPixmap; - int nx, ny; - int nw, nh; - - pBackingStore = (miBSWindowPtr)(pWin->backStorage); - pBackingPixmap = pBackingStore->pBackingPixmap; - if (!pBackingPixmap) - return; - pScreen = pWin->drawable.pScreen; - extents = RegionExtents(&pBackingStore->SavedRegion); - pNewPixmap = pBackingPixmap; - - nw = extents->x2 - extents->x1; - nh = extents->y2 - extents->y1; - - /* the policy here could be more sophisticated */ - if (nw != pBackingPixmap->drawable.width || - nh != pBackingPixmap->drawable.height) - { - if (!saveBits || !nw || !nh) - { - pNewPixmap = NullPixmap; - pBackingStore->status = StatusNoPixmap; - } - else - { - pNewPixmap = (PixmapPtr)(*pScreen->CreatePixmap) - (pScreen, - nw, nh, - pWin->drawable.depth, 0); - if (!pNewPixmap) - { -#ifdef BSEAGER - pBackingStore->status = StatusNoPixmap; -#else - pBackingStore->status = StatusBadAlloc; -#endif - } - } - } - if (!pNewPixmap) - { - pBackingStore->x = 0; - pBackingStore->y = 0; - } - else - { - nx = pBackingStore->x - extents->x1 + dx; - ny = pBackingStore->y - extents->y1 + dy; - pBackingStore->x = extents->x1; - pBackingStore->y = extents->y1; - - if (saveBits && (pNewPixmap != pBackingPixmap || nx != 0 || ny != 0)) - { - pGC = GetScratchGC(pNewPixmap->drawable.depth, pScreen); - if (pGC) - { - ValidateGC((DrawablePtr)pNewPixmap, pGC); - /* if we implement a policy where the pixmap can be larger than - * the region extents, we might want to optimize this copyarea - * by only copying the old extents, rather than the entire - * pixmap - */ - (*pGC->ops->CopyArea)((DrawablePtr)pBackingPixmap, - (DrawablePtr)pNewPixmap, pGC, - 0, 0, - pBackingPixmap->drawable.width, - pBackingPixmap->drawable.height, - nx, ny); - FreeScratchGC(pGC); - } - } - } - /* SavedRegion is used in the backingGC clip; force an update */ - pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; - if (pNewPixmap != pBackingPixmap) - { - (* pScreen->DestroyPixmap)(pBackingPixmap); - pBackingStore->pBackingPixmap = pNewPixmap; - } -} - -/*- - *----------------------------------------------------------------------- - * miBSSaveDoomedAreas -- - * Saved the areas of the given window that are about to be - * obscured. If the window has moved, pObscured is expected to - * be at the new screen location and (dx,dy) is expected to be the offset - * to the window's previous location. - * - * Results: - * None. - * - * Side Effects: - * The region is copied from the screen into pBackingPixmap and - * SavedRegion is updated. - * - *----------------------------------------------------------------------- - */ -static void -miBSSaveDoomedAreas(pWin, pObscured, dx, dy) - register WindowPtr pWin; - RegionPtr pObscured; - int dx, dy; -{ - miBSWindowPtr pBackingStore; - ScreenPtr pScreen; - int x, y; - - pBackingStore = (miBSWindowPtr)pWin->backStorage; - pScreen = pWin->drawable.pScreen; - - /* - * If the window isn't realized, it's being unmapped, thus we don't - * want to save anything if backingStore isn't Always. - */ - if (!pWin->realized) - { - pBackingStore->viewable = (char)pWin->viewable; - if (pWin->backingStore != Always) - { - RegionEmpty(&pBackingStore->SavedRegion); - miDestroyBSPixmap (pWin); - return; - } - if (pBackingStore->status == StatusBadAlloc) - pBackingStore->status = StatusNoPixmap; - } - - /* Don't even pretend to save anything for a virtual background None */ - if ((pBackingStore->status == StatusVirtual) && - (pBackingStore->backgroundState == None)) - return; - - if (RegionNotEmpty(pObscured)) - { - BoxRec oldExtents; - x = pWin->drawable.x; - y = pWin->drawable.y; - RegionTranslate(pObscured, -x, -y); - oldExtents = *RegionExtents(&pBackingStore->SavedRegion); - RegionUnion(&pBackingStore->SavedRegion, - &pBackingStore->SavedRegion, - pObscured); - /* - * only save the bits if we've actually - * started using backing store - */ - if (pBackingStore->status != StatusVirtual) - { - if (!pBackingStore->pBackingPixmap) - miCreateBSPixmap (pWin, &oldExtents); - else - miResizeBackingStore(pWin, 0, 0, TRUE); - - if (pBackingStore->pBackingPixmap) { - if (pBackingStore->x | pBackingStore->y) - { - RegionTranslate(pObscured, - -pBackingStore->x, - -pBackingStore->y); - x += pBackingStore->x; - y += pBackingStore->y; - } - (* pScreen->BackingStoreFuncs.SaveAreas) - (pBackingStore->pBackingPixmap, pObscured, - x - dx, y - dy, pWin); - } - } - RegionTranslate(pObscured, x, y); - } - else - { - if (RegionBroken(pObscured)) - { - RegionEmpty(&pBackingStore->SavedRegion); - miDestroyBSPixmap (pWin); - return; - } - } -} - -/*- - *----------------------------------------------------------------------- - * miBSRestoreAreas -- - * Restore areas from backing-store that are no longer obscured. - * expects prgnExposed to contain a screen-relative area. - * - * Results: - * The region to generate exposure events on (which may be - * different from the region to paint). - * - * Side Effects: - * Areas are copied from pBackingPixmap to the screen. prgnExposed - * is altered to contain the region that could not be restored from - * backing-store. - * - * Notes: - * This is called before sending any exposure events to the client, - * and so might be called if the window has grown. Changing the backing - * pixmap doesn't require revalidating the backingGC because the - * client's next output request will result in a call to ValidateGC, - * since the window clip region has changed, which will in turn call - * miValidateBackingStore. - *----------------------------------------------------------------------- - */ -static RegionPtr -miBSRestoreAreas(pWin, prgnExposed) - register WindowPtr pWin; - RegionPtr prgnExposed; -{ - PixmapPtr pBackingPixmap; - miBSWindowPtr pBackingStore; - RegionPtr prgnSaved; - RegionPtr prgnRestored; - register ScreenPtr pScreen; - RegionPtr exposures = prgnExposed; - - pScreen = pWin->drawable.pScreen; - pBackingStore = (miBSWindowPtr)pWin->backStorage; - pBackingPixmap = pBackingStore->pBackingPixmap; - - prgnSaved = &pBackingStore->SavedRegion; - - if (pBackingStore->status == StatusContents) - { - RegionTranslate(prgnSaved, pWin->drawable.x, - pWin->drawable.y); - - prgnRestored = RegionCreate((BoxPtr)NULL, 1); - RegionIntersect(prgnRestored, prgnExposed, prgnSaved); - - /* - * Since prgnExposed is no longer obscured, we no longer - * will have a valid copy of it in backing-store, but there is a valid - * copy of it on screen, so subtract the area we just restored from - * from the area to be exposed. - */ - - if (RegionNotEmpty(prgnRestored)) - { - RegionSubtract(prgnSaved, prgnSaved, prgnExposed); - RegionSubtract(prgnExposed, prgnExposed, prgnRestored); - - /* - * Do the actual restoration - */ - (* pScreen->BackingStoreFuncs.RestoreAreas) (pBackingPixmap, - prgnRestored, - pWin->drawable.x + pBackingStore->x, - pWin->drawable.y + pBackingStore->y, - pWin); - /* - * if the saved region is completely empty, dispose of the - * backing pixmap, otherwise, retranslate the saved - * region to window relative - */ - - if (RegionNotEmpty(prgnSaved)) - { - RegionTranslate(prgnSaved, - -pWin->drawable.x, - -pWin->drawable.y); - miResizeBackingStore(pWin, 0, 0, TRUE); - } - else - miDestroyBSPixmap (pWin); - } - else - RegionTranslate(prgnSaved, - -pWin->drawable.x, -pWin->drawable.y); - RegionDestroy(prgnRestored); - - } - else if ((pBackingStore->status == StatusVirtual) || - (pBackingStore->status == StatusVDirty)) - { - RegionTranslate(prgnSaved, - pWin->drawable.x, pWin->drawable.y); - exposures = RegionCreate(NullBox, 1); - if (SameBackground (pBackingStore->backgroundState, - pBackingStore->background, - pWin->backgroundState, - pWin->background)) - { - RegionSubtract(exposures, prgnExposed, prgnSaved); - } - else - { - miTileVirtualBS(pWin); - - /* we need to expose all we have (virtually) retiled */ - RegionUnion(exposures, prgnExposed, prgnSaved); - } - RegionSubtract(prgnSaved, prgnSaved, prgnExposed); - RegionTranslate(prgnSaved, - -pWin->drawable.x, -pWin->drawable.y); - } - else if (pWin->viewable && !pBackingStore->viewable && - pWin->backingStore != Always) - { - /* - * The window was just mapped and nothing has been saved in - * backing-store from the last time it was mapped. We want to capture - * any output to regions that are already obscured but there are no - * bits to snag off the screen, so we initialize things just as we did - * in miBSAllocate, above. - */ - BoxRec box; - - prgnSaved = &pBackingStore->SavedRegion; - - box.x1 = pWin->drawable.x; - box.x2 = box.x1 + (int) pWin->drawable.width; - box.y1 = pWin->drawable.y; - box.y2 = box.y1 + (int) pWin->drawable.height; - - RegionInverse(prgnSaved, &pWin->clipList, &box); - RegionTranslate(prgnSaved, - -pWin->drawable.x, - -pWin->drawable.y); -#ifdef SHAPE - if (wBoundingShape (pWin)) - RegionIntersect(prgnSaved, prgnSaved, - wBoundingShape (pWin)); - if (wClipShape (pWin)) - RegionIntersect(prgnSaved, prgnSaved, - wClipShape (pWin)); -#endif - miTileVirtualBS(pWin); - - exposures = RegionCreate(&box, 1); - } - pBackingStore->viewable = (char)pWin->viewable; - return exposures; -} - - -/*- - *----------------------------------------------------------------------- - * miBSTranslateBackingStore -- - * Shift the backing-store in the given direction. Called when bit - * gravity is shifting things around. - * - * Results: - * An occluded region of the window which should be sent exposure events. - * This region should be in absolute coordinates (i.e. include - * new window position). - * - * Side Effects: - * If the window changed size as well as position, the backing pixmap - * is resized. The contents of the backing pixmap are shifted - * - * Warning: - * Bob and I have rewritten this routine quite a few times, each - * time it gets a few more cases correct, and introducing some - * interesting bugs. Naturally, I think the code is correct this - * time. - * - * Let me try to explain what this routine is for: - * - * It's called from SlideAndSizeWindow whenever a window - * with backing store is resized. There are two separate - * possibilities: - * - * a) The window has ForgetGravity - * - * In this case, windx, windy will be 0 and oldClip will - * be NULL. This indicates that all of the window contents - * currently saved offscreen should be discarded, and the - * entire window exposed. TranslateBackingStore, then, should - * prepare a completely new backing store region based on the - * new window clipList and return that region for exposure. - * - * b) The window has some other gravity - * - * In this case, windx, windy will be set to the distance - * that the bits should move within the window. oldClip - * will be set to the old visible portion of the window. - * TranslateBackingStore, then, should adjust the backing - * store to accommodate the portion of the existing backing - * store bits which coorespond to backing store bits which - * will still be occluded in the new configuration. oldx,oldy - * are set to the old position of the window on the screen. - * - * Furthermore, in this case any contents of the screen which - * are about to become occluded should be fetched from the screen - * and placed in backing store. This is to avoid the eventual - * occlusion by the win gravity shifting the child window bits around - * on top of this window, and potentially losing information - * - * It's also called from SetShape, but I think (he says not - * really knowing for sure) that this code will even work - * in that case. - *----------------------------------------------------------------------- - */ - -static RegionPtr -miBSTranslateBackingStore(pWin, windx, windy, oldClip, oldx, oldy) - WindowPtr pWin; - int windx; /* bit translation distance in window */ - int windy; - RegionPtr oldClip; /* Region being copied */ - int oldx; /* old window position */ - int oldy; -{ - register miBSWindowPtr pBackingStore; - register RegionPtr pSavedRegion; - register RegionPtr newSaved, doomed; - register ScreenPtr pScreen; - BoxRec extents; - int scrdx; /* bit translation distance on screen */ - int scrdy; - int dx; /* distance window moved on screen */ - int dy; - - pScreen = pWin->drawable.pScreen; - pBackingStore = (miBSWindowPtr)(pWin->backStorage); - if ((pBackingStore->status == StatusNoPixmap) || - (pBackingStore->status == StatusBadAlloc)) - return NullRegion; - - /* - * Compute the new saved region - */ - - newSaved = RegionCreate(NullBox, 1); - extents.x1 = pWin->drawable.x; - extents.x2 = pWin->drawable.x + (int) pWin->drawable.width; - extents.y1 = pWin->drawable.y; - extents.y2 = pWin->drawable.y + (int) pWin->drawable.height; - RegionInverse(newSaved, &pWin->clipList, &extents); - - RegionTranslate(newSaved, - -pWin->drawable.x, -pWin->drawable.y); -#ifdef SHAPE - if (wBoundingShape (pWin) || wClipShape (pWin)) { - if (wBoundingShape (pWin)) - RegionIntersect(newSaved, newSaved, - wBoundingShape (pWin)); - if (wClipShape (pWin)) - RegionIntersect(newSaved, newSaved, wClipShape (pWin)); - } -#endif - - pSavedRegion = &pBackingStore->SavedRegion; - - /* now find any visible areas we can save from the screen */ - /* and then translate newSaved to old local coordinates */ - if (oldClip) - { - /* bit gravity makes things virtually too hard, punt */ - if (((windx != 0) || (windy != 0)) && - (pBackingStore->status != StatusContents)) - miCreateBSPixmap(pWin, NullBox); - - /* - * The window is moving this far on the screen - */ - dx = pWin->drawable.x - oldx; - dy = pWin->drawable.y - oldy; - /* - * The bits will be moving on the screen by the - * amount the window is moving + the amount the - * bits are moving within the window - */ - scrdx = windx + dx; - scrdy = windy + dy; - - /* - * intersect at old bit position to discover the - * bits on the screen which can be put into the - * new backing store - */ - RegionTranslate(oldClip, windx - oldx, windy - oldy); - doomed = RegionCreate(NullBox, 1); - RegionIntersect(doomed, oldClip, newSaved); - RegionTranslate(oldClip, oldx - windx, oldy - windy); - - /* - * Translate the old saved region to the position in the - * window where it will appear to be - */ - RegionTranslate(pSavedRegion, windx, windy); - - /* - * Add the old saved region to the new saved region, so - * that calls to RestoreAreas will be able to fetch those - * bits back - */ - RegionUnion(newSaved, newSaved, pSavedRegion); - - /* - * Swap the new saved region into the window - */ - { - RegionRec tmp; - - tmp = *pSavedRegion; - *pSavedRegion = *newSaved; - *newSaved = tmp; - } - miResizeBackingStore (pWin, windx, windy, TRUE); - - /* - * Compute the newly enabled region - * of backing store. This region will be - * set to background in the backing pixmap and - * sent as exposure events to the client. - */ - RegionSubtract(newSaved, pSavedRegion, newSaved); - - /* - * Fetch bits which will be obscured from - * the screen - */ - if (RegionNotEmpty(doomed)) - { - /* - * Don't clear regions which have bits on the - * screen - */ - RegionSubtract(newSaved, newSaved, doomed); - - /* - * Make the region to SaveDoomedAreas absolute, instead - * of window relative. - */ - RegionTranslate(doomed, - pWin->drawable.x, pWin->drawable.y); - (* pScreen->SaveDoomedAreas) (pWin, doomed, scrdx, scrdy); - } - - RegionDestroy(doomed); - - /* - * and clear whatever there is that's new - */ - if (RegionNotEmpty(newSaved)) - { - miBSClearBackingRegion (pWin, newSaved); - /* - * Make the exposed region absolute - */ - RegionTranslate(newSaved, - pWin->drawable.x, - pWin->drawable.y); - } - else - { - RegionDestroy(newSaved); - newSaved = NullRegion; - } - } - else - { - /* - * ForgetGravity: just reset backing store and - * expose the whole mess - */ - RegionCopy(pSavedRegion, newSaved); - RegionTranslate(newSaved, - pWin->drawable.x, pWin->drawable.y); - - miResizeBackingStore (pWin, 0, 0, FALSE); - (void) miBSClearBackingStore (pWin, 0, 0, 0, 0, FALSE); - } - - return newSaved; -} - -/* - * Inform the backing store layer that you are about to validate - * a gc with a window, and that subsequent output to the window - * is (or is not) guaranteed to be already clipped to the visible - * regions of the window. - */ - -static void -miBSDrawGuarantee (pWin, pGC, guarantee) - WindowPtr pWin; - GCPtr pGC; - int guarantee; -{ - miBSGCPtr pPriv; - - if (pWin->backStorage) - { - pPriv = (miBSGCPtr)pGC->devPrivates[miBSGCIndex].ptr; - if (!pPriv) - (void) miBSCreateGCPrivate (pGC); - pPriv = (miBSGCPtr)pGC->devPrivates[miBSGCIndex].ptr; - if (pPriv) - { - /* - * XXX KLUDGE ALERT - * - * when the GC is Cheap pPriv will point - * at some device's gc func structure. guarantee - * will point at the ChangeGC entry of that struct - * and will never match a valid guarantee value. - */ - switch (pPriv->guarantee) - { - case GuaranteeNothing: - case GuaranteeVisBack: - pPriv->guarantee = guarantee; - break; - } - } - } -} - -#define noBackingCopy (GCGraphicsExposures|GCClipXOrigin|GCClipYOrigin| \ - GCClipMask|GCSubwindowMode| \ - GCTileStipXOrigin|GCTileStipYOrigin) - -/*- - *----------------------------------------------------------------------- - * miBSValidateGC -- - * Wrapper around output-library's ValidateGC routine - * - * Results: - * None. - * - * Side Effects: - * - * Notes: - * The idea here is to perform several functions: - * - All the output calls must be intercepted and routed to - * backing-store as necessary. - * - pGC in the window's devBackingStore must be set up with the - * clip list appropriate for writing to pBackingPixmap (i.e. - * the inverse of the window's clipList intersected with the - * clientClip of the GC). Since the destination for this GC is - * a pixmap, it is sufficient to set the clip list as its - * clientClip. - *----------------------------------------------------------------------- - */ - -static void -miBSValidateGC (pGC, stateChanges, pDrawable) - GCPtr pGC; - unsigned long stateChanges; - DrawablePtr pDrawable; -{ - GCPtr pBackingGC; - miBSWindowPtr pWindowPriv = NULL; - miBSGCPtr pPriv; - WindowPtr pWin; - int lift_functions; - RegionPtr backingCompositeClip = NULL; - - if (pDrawable->type != DRAWABLE_PIXMAP) - { - pWin = (WindowPtr) pDrawable; - pWindowPriv = (miBSWindowPtr) pWin->backStorage; - lift_functions = (pWindowPriv == (miBSWindowPtr) NULL); - } - else - { - pWin = (WindowPtr) NULL; - lift_functions = TRUE; - } - - pPriv = (miBSGCPtr)pGC->devPrivates[miBSGCIndex].ptr; - - FUNC_PROLOGUE (pGC, pPriv); - - (*pGC->funcs->ValidateGC) (pGC, stateChanges, pDrawable); - - /* - * rewrap funcs and ops as Validate may have changed them - */ - - pPriv->wrapFuncs = pGC->funcs; - pPriv->wrapOps = pGC->ops; - - if (!lift_functions && ((pPriv->guarantee == GuaranteeVisBack) || - (pWindowPriv->status == StatusNoPixmap) || - (pWindowPriv->status == StatusBadAlloc))) - lift_functions = TRUE; - - /* - * check to see if a new backingCompositeClip region must - * be generated - */ - - if (!lift_functions && - ((pDrawable->serialNumber != pPriv->serialNumber) || - (stateChanges&(GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)))) - { - if (RegionNotEmpty(&pWindowPriv->SavedRegion)) - { - backingCompositeClip = RegionCreate(NULL, 1); - if ((pGC->clientClipType == CT_NONE) || - (pGC->clientClipType == CT_PIXMAP)) - { - RegionCopy(backingCompositeClip, - &pWindowPriv->SavedRegion); - } - else - { - /* - * Make a new copy of the client clip, translated to - * its proper origin. - */ - - RegionCopy(backingCompositeClip, - pGC->clientClip); - RegionTranslate(backingCompositeClip, - pGC->clipOrg.x, - pGC->clipOrg.y); - RegionIntersect(backingCompositeClip, - backingCompositeClip, - &pWindowPriv->SavedRegion); - } - if (pGC->subWindowMode == IncludeInferiors) - { - RegionPtr translatedClip; - - /* XXX - * any output in IncludeInferiors mode will not - * be redirected to Inferiors backing store. This - * can be fixed only at great cost to the shadow routines. - */ - translatedClip = NotClippedByChildren (pWin); - RegionTranslate(translatedClip, - -pDrawable->x, - -pDrawable->y); - RegionSubtract(backingCompositeClip, - backingCompositeClip, translatedClip); - RegionDestroy(translatedClip); - } - if (!RegionNotEmpty(backingCompositeClip)) - lift_functions = TRUE; - } - else - { - lift_functions = TRUE; - } - - /* Reset the status when drawing to an unoccluded window so that - * future SaveAreas will actually copy bits from the screen. Note that - * output to root window in IncludeInferiors mode will not cause this - * to change. This causes all transient graphics by the window - * manager to the root window to not enable backing store. - */ - if (lift_functions && (pWindowPriv->status == StatusVirtual) && - (pWin->parent || pGC->subWindowMode != IncludeInferiors)) - pWindowPriv->status = StatusVDirty; - } - - /* - * if no backing store has been allocated, and it's needed, - * create it now. - */ - - if (!lift_functions && !pWindowPriv->pBackingPixmap) - { - miCreateBSPixmap (pWin, NullBox); - if (!pWindowPriv->pBackingPixmap) - lift_functions = TRUE; - } - - /* - * create the backing GC if needed, lift functions - * if the creation fails - */ - - if (!lift_functions && !pPriv->pBackingGC) - { - int status; - XID noexpose = xFalse; - - /* We never want ops with the backingGC to generate GraphicsExpose */ - pBackingGC = CreateGC ((DrawablePtr)pWindowPriv->pBackingPixmap, - GCGraphicsExposures, &noexpose, &status); - if (status != Success) - lift_functions = TRUE; - else - pPriv->pBackingGC = pBackingGC; - } - - pBackingGC = pPriv->pBackingGC; - - pPriv->stateChanges |= stateChanges; - - if (lift_functions) - { - if (backingCompositeClip) - RegionDestroy(backingCompositeClip); - - /* unwrap the GC again */ - miBSDestroyGCPrivate (pGC); - - return; - } - - /* - * the rest of this function gets the pBackingGC - * into shape for possible draws - */ - - pPriv->stateChanges &= ~noBackingCopy; - if (pPriv->stateChanges) - CopyGC(pGC, pBackingGC, pPriv->stateChanges); - if ((pGC->patOrg.x - pWindowPriv->x) != pBackingGC->patOrg.x || - (pGC->patOrg.y - pWindowPriv->y) != pBackingGC->patOrg.y) - { - XID vals[2]; - vals[0] = pGC->patOrg.x - pWindowPriv->x; - vals[1] = pGC->patOrg.y - pWindowPriv->y; - DoChangeGC(pBackingGC, GCTileStipXOrigin|GCTileStipYOrigin, vals, 0); - } - pPriv->stateChanges = 0; - - if (backingCompositeClip) - { - XID vals[2]; - - if (pGC->clientClipType == CT_PIXMAP) - { - (*pBackingGC->funcs->CopyClip)(pBackingGC, pGC); - RegionTranslate(backingCompositeClip, - -pGC->clipOrg.x, -pGC->clipOrg.y); - vals[0] = pGC->clipOrg.x - pWindowPriv->x; - vals[1] = pGC->clipOrg.y - pWindowPriv->y; - DoChangeGC(pBackingGC, GCClipXOrigin|GCClipYOrigin, vals, 0); - (* pGC->pScreen->BackingStoreFuncs.SetClipmaskRgn) - (pBackingGC, backingCompositeClip); - RegionDestroy(backingCompositeClip); - } - else - { - vals[0] = -pWindowPriv->x; - vals[1] = -pWindowPriv->y; - DoChangeGC(pBackingGC, GCClipXOrigin|GCClipYOrigin, vals, 0); - (*pBackingGC->funcs->ChangeClip) (pBackingGC, CT_REGION, backingCompositeClip, 0); - } - pPriv->serialNumber = pDrawable->serialNumber; - } - - if (pWindowPriv->pBackingPixmap->drawable.serialNumber - != pBackingGC->serialNumber) - { - ValidateGC((DrawablePtr)pWindowPriv->pBackingPixmap, pBackingGC); - } - - if (pBackingGC->clientClip == 0) - ErrorF ("backing store clip list nil"); - - FUNC_EPILOGUE (pGC, pPriv); -} - -static void -miBSChangeGC (pGC, mask) - GCPtr pGC; - unsigned long mask; -{ - miBSGCPtr pPriv = (miBSGCPtr) (pGC)->devPrivates[miBSGCIndex].ptr; - - FUNC_PROLOGUE (pGC, pPriv); - - (*pGC->funcs->ChangeGC) (pGC, mask); - - FUNC_EPILOGUE (pGC, pPriv); -} - -static void -miBSCopyGC (pGCSrc, mask, pGCDst) - GCPtr pGCSrc, pGCDst; - unsigned long mask; -{ - miBSGCPtr pPriv = (miBSGCPtr) (pGCDst)->devPrivates[miBSGCIndex].ptr; - - FUNC_PROLOGUE (pGCDst, pPriv); - - (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); - - FUNC_EPILOGUE (pGCDst, pPriv); -} - -static void -miBSDestroyGC (pGC) - GCPtr pGC; -{ - miBSGCPtr pPriv = (miBSGCPtr) (pGC)->devPrivates[miBSGCIndex].ptr; - - FUNC_PROLOGUE (pGC, pPriv); - - if (pPriv->pBackingGC) - FreeGC(pPriv->pBackingGC, (GContext)0); - - (*pGC->funcs->DestroyGC) (pGC); - - FUNC_EPILOGUE (pGC, pPriv); - - free(pPriv); -} - -static void -miBSChangeClip(pGC, type, pvalue, nrects) - GCPtr pGC; - int type; - void * pvalue; - int nrects; -{ - miBSGCPtr pPriv = (miBSGCPtr) (pGC)->devPrivates[miBSGCIndex].ptr; - - FUNC_PROLOGUE (pGC, pPriv); - - (* pGC->funcs->ChangeClip)(pGC, type, pvalue, nrects); - - FUNC_EPILOGUE (pGC, pPriv); -} - -static void -miBSCopyClip(pgcDst, pgcSrc) - GCPtr pgcDst, pgcSrc; -{ - miBSGCPtr pPriv = (miBSGCPtr) (pgcDst)->devPrivates[miBSGCIndex].ptr; - - FUNC_PROLOGUE (pgcDst, pPriv); - - (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); - - FUNC_EPILOGUE (pgcDst, pPriv); -} - -static void -miBSDestroyClip(pGC) - GCPtr pGC; -{ - miBSGCPtr pPriv = (miBSGCPtr) (pGC)->devPrivates[miBSGCIndex].ptr; - - FUNC_PROLOGUE (pGC, pPriv); - - (* pGC->funcs->DestroyClip)(pGC); - - FUNC_EPILOGUE (pGC, pPriv); -} - -static void -miDestroyBSPixmap (pWin) - WindowPtr pWin; -{ - miBSWindowPtr pBackingStore; - ScreenPtr pScreen; - - pScreen = pWin->drawable.pScreen; - pBackingStore = (miBSWindowPtr) pWin->backStorage; - if (pBackingStore->pBackingPixmap) - (* pScreen->DestroyPixmap)(pBackingStore->pBackingPixmap); - pBackingStore->pBackingPixmap = NullPixmap; - pBackingStore->x = 0; - pBackingStore->y = 0; - if (pBackingStore->backgroundState == BackgroundPixmap) - (* pScreen->DestroyPixmap)(pBackingStore->background.pixmap); - pBackingStore->backgroundState = None; - pBackingStore->status = StatusNoPixmap; - pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; -} - -static void -miTileVirtualBS (pWin) - WindowPtr pWin; -{ - miBSWindowPtr pBackingStore; - - pBackingStore = (miBSWindowPtr) pWin->backStorage; - if (pBackingStore->backgroundState == BackgroundPixmap) - (* pWin->drawable.pScreen->DestroyPixmap) - (pBackingStore->background.pixmap); - pBackingStore->backgroundState = pWin->backgroundState; - pBackingStore->background = pWin->background; - if (pBackingStore->backgroundState == BackgroundPixmap) - pBackingStore->background.pixmap->refcnt++; - - if (pBackingStore->status != StatusVDirty) - pBackingStore->status = StatusVirtual; - - /* - * punt parent relative tiles and do it now - */ - if (pBackingStore->backgroundState == ParentRelative) - miCreateBSPixmap (pWin, NullBox); -} - -#ifdef DEBUG -static int BSAllocationsFailed = 0; -#define FAILEDSIZE 32 -static struct { int w, h; } failedRecord[FAILEDSIZE]; -static int failedIndex; -#endif - -static void -miCreateBSPixmap (pWin, pExtents) - WindowPtr pWin; - BoxPtr pExtents; -{ - miBSWindowPtr pBackingStore; - ScreenPtr pScreen; - PixUnion background; - char backgroundState = 0; - BoxPtr extents; - Bool backSet; - - pScreen = pWin->drawable.pScreen; - pBackingStore = (miBSWindowPtr) pWin->backStorage; - if (pBackingStore->status == StatusBadAlloc) - return; - backSet = ((pBackingStore->status == StatusVirtual) || - (pBackingStore->status == StatusVDirty)); - - extents = RegionExtents(&pBackingStore->SavedRegion); - - if (!pBackingStore->pBackingPixmap && - extents->x2 != extents->x1 && - extents->y2 != extents->y1) - { - /* the policy here could be more sophisticated */ - pBackingStore->x = extents->x1; - pBackingStore->y = extents->y1; - pBackingStore->pBackingPixmap = - (PixmapPtr)(* pScreen->CreatePixmap) - (pScreen, - extents->x2 - extents->x1, - extents->y2 - extents->y1, - pWin->drawable.depth, 0); - } - if (!pBackingStore->pBackingPixmap) - { -#ifdef DEBUG - BSAllocationsFailed++; - /* - * record failed allocations - */ - failedRecord[failedIndex].w = pWin->drawable.width; - failedRecord[failedIndex].h = pWin->drawable.height; - failedIndex++; - if (failedIndex == FAILEDSIZE) - failedIndex = 0; -#endif -#ifdef BSEAGER - pBackingStore->status = StatusNoPixmap; -#else - pBackingStore->status = StatusBadAlloc; -#endif - return; - } - - pBackingStore->status = StatusContents; - - if (backSet) - { - backgroundState = pWin->backgroundState; - background = pWin->background; - - pWin->backgroundState = pBackingStore->backgroundState; - pWin->background = pBackingStore->background; - if (pWin->backgroundState == BackgroundPixmap) - pWin->background.pixmap->refcnt++; - } - - if (!pExtents) - pExtents = extents; - - if (pExtents->y1 != pExtents->y2) - { - RegionPtr exposed; - - exposed = miBSClearBackingStore(pWin, - pExtents->x1, pExtents->y1, - pExtents->x2 - pExtents->x1, - pExtents->y2 - pExtents->y1, - !backSet); - if (exposed) - { - miSendExposures(pWin, exposed, pWin->drawable.x, pWin->drawable.y); - RegionDestroy(exposed); - } - } - - if (backSet) - { - if (pWin->backgroundState == BackgroundPixmap) - (* pScreen->DestroyPixmap) (pWin->background.pixmap); - pWin->backgroundState = backgroundState; - pWin->background = background; - if (pBackingStore->backgroundState == BackgroundPixmap) - (* pScreen->DestroyPixmap) (pBackingStore->background.pixmap); - pBackingStore->backgroundState = None; - } -} - -/*- - *----------------------------------------------------------------------- - * miBSExposeCopy -- - * Handle the restoration of areas exposed by graphics operations. - * - * Results: - * None. - * - * Side Effects: - * prgnExposed has the areas exposed from backing-store removed - * from it. - * - *----------------------------------------------------------------------- - */ -static void -miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane) - WindowPtr pSrc; - DrawablePtr pDst; - GCPtr pGC; - RegionPtr prgnExposed; - int srcx, srcy; - int dstx, dsty; - unsigned long plane; -{ - RegionRec tempRgn; - miBSWindowPtr pBackingStore; - CopyPlaneProcPtr copyProc; - GCPtr pScratchGC; - register BoxPtr pBox; - register int i; - register int dx, dy; - BITS32 gcMask; - - if (!RegionNotEmpty(prgnExposed)) - return; - pBackingStore = (miBSWindowPtr)pSrc->backStorage; - - if ((pBackingStore->status == StatusNoPixmap) || - (pBackingStore->status == StatusBadAlloc)) - return; - - RegionNull(&tempRgn); - RegionIntersect(&tempRgn, prgnExposed, - &pBackingStore->SavedRegion); - RegionSubtract(prgnExposed, prgnExposed, &tempRgn); - - if (plane != 0) { - copyProc = pGC->ops->CopyPlane; - } else { - copyProc = (CopyPlaneProcPtr)pGC->ops->CopyArea; - } - - dx = dstx - srcx; - dy = dsty - srcy; - - switch (pBackingStore->status) { - case StatusVirtual: - case StatusVDirty: - pScratchGC = GetScratchGC (pDst->depth, pDst->pScreen); - if (pScratchGC) - { - gcMask = 0; - if (pGC->alu != pScratchGC->alu) - gcMask = GCFunction; - if (pGC->planemask != pScratchGC->planemask) - gcMask |= GCPlaneMask; - if (gcMask) - CopyGC (pGC, pScratchGC, gcMask); - miBSFillVirtualBits (pDst, pScratchGC, &tempRgn, dx, dy, - (int) pBackingStore->backgroundState, - pBackingStore->background, - ~0L); - FreeScratchGC (pScratchGC); - } - break; - case StatusContents: - for (i = RegionNumRects(&tempRgn), pBox = RegionRects(&tempRgn); - --i >= 0; - pBox++) - { - (* copyProc) (&(pBackingStore->pBackingPixmap->drawable), pDst, pGC, - pBox->x1 - pBackingStore->x, - pBox->y1 - pBackingStore->y, - pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, - pBox->x1 + dx, pBox->y1 + dy, plane); - } - break; - } - RegionUninit(&tempRgn); -} diff --git a/nx-X11/programs/Xserver/mi/mibstore.h b/nx-X11/programs/Xserver/mi/mibstore.h deleted file mode 100644 index 5f3597074b..0000000000 --- a/nx-X11/programs/Xserver/mi/mibstore.h +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * mibstore.h -- - * Header file for users of the MI backing-store scheme. - * - * Copyright (c) 1987 by the Regents of the University of California - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The University of California - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - * - * "$Xorg: mibstore.h,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ - */ - - - -#ifndef _MIBSTORE_H -#define _MIBSTORE_H - -#include "screenint.h" - -extern void miInitializeBackingStore( - ScreenPtr /*pScreen*/ -); - -#endif /* _MIBSTORE_H */ diff --git a/nx-X11/programs/Xserver/mi/mibstorest.h b/nx-X11/programs/Xserver/mi/mibstorest.h deleted file mode 100644 index ccf4fb7016..0000000000 --- a/nx-X11/programs/Xserver/mi/mibstorest.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * mibstorest.h - * - * internal structure definitions for mi backing store - */ - - -/* - -Copyright 1989, 1998 The Open Group - -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. - -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 THE -OPEN GROUP 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. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. -*/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "mibstore.h" -#include "regionstr.h" - -/* - * One of these structures is allocated per GC used with a backing-store - * drawable. - */ - -typedef struct { - GCPtr pBackingGC; /* Copy of the GC but with graphicsExposures - * set FALSE and the clientClip set to - * clip output to the valid regions of the - * backing pixmap. */ - int guarantee; /* GuaranteeNothing, etc. */ - unsigned long serialNumber; /* clientClip computed time */ - unsigned long stateChanges; /* changes in parent gc since last copy */ - GCOps *wrapOps; /* wrapped ops */ - GCFuncs *wrapFuncs; /* wrapped funcs */ -} miBSGCRec, *miBSGCPtr; - -/* - * one of these structures is allocated per Window with backing store - */ - -typedef struct { - PixmapPtr pBackingPixmap; /* Pixmap for saved areas */ - short x; /* origin of pixmap relative to window */ - short y; - RegionRec SavedRegion; /* Valid area in pBackingPixmap */ - char viewable; /* Tracks pWin->viewable so SavedRegion may - * be initialized correctly when the window - * is first mapped */ - char status; /* StatusNoPixmap, etc. */ - char backgroundState; /* background type */ - PixUnion background; /* background pattern */ -} miBSWindowRec, *miBSWindowPtr; - -#define StatusNoPixmap 1 /* pixmap has not been created */ -#define StatusVirtual 2 /* pixmap is virtual, tiled with background */ -#define StatusVDirty 3 /* pixmap is virtual, visiblt has contents */ -#define StatusBadAlloc 4 /* pixmap create failed, do not try again */ -#define StatusContents 5 /* pixmap is created, has valid contents */ - -typedef struct { - /* - * screen func wrappers - */ - CloseScreenProcPtr CloseScreen; - GetImageProcPtr GetImage; - GetSpansProcPtr GetSpans; - ChangeWindowAttributesProcPtr ChangeWindowAttributes; - CreateGCProcPtr CreateGC; - DestroyWindowProcPtr DestroyWindow; -} miBSScreenRec, *miBSScreenPtr; diff --git a/nx-X11/programs/Xserver/mi/midispcur.c b/nx-X11/programs/Xserver/mi/midispcur.c index 92d0fb15c5..4b30517603 100644 --- a/nx-X11/programs/Xserver/mi/midispcur.c +++ b/nx-X11/programs/Xserver/mi/midispcur.c @@ -448,8 +448,6 @@ miDCMakeGC( gcvals[1] = FALSE; pGC = CreateGC((DrawablePtr)pWin, GCSubwindowMode|GCGraphicsExposures, gcvals, &status); - if (pGC && pWin->drawable.pScreen->DrawGuarantee) - (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); *ppGC = pGC; return pGC; } diff --git a/nx-X11/programs/Xserver/mi/miexpose.c b/nx-X11/programs/Xserver/mi/miexpose.c index c392210000..d69bd9be55 100644 --- a/nx-X11/programs/Xserver/mi/miexpose.c +++ b/nx-X11/programs/Xserver/mi/miexpose.c @@ -118,12 +118,6 @@ background for the region, if the destination is a window. this should generally be called, even if graphicsExposures is false, because this is where bits get recovered from backing store. -NOTE: - added argument 'plane' is used to indicate how exposures from backing -store should be accomplished. If plane is 0 (i.e. no bit plane), CopyArea -should be used, else a CopyPlane of the indicated plane will be used. The -exposing is done by the backing store's GraphicsExpose function, of course. - */ #ifndef NXAGENT_SERVER @@ -255,21 +249,6 @@ miHandleExposures(pSrcDrawable, pDstDrawable, /* now get the hidden parts of the source box*/ RegionSubtract(&rgnExposed, &rgnExposed, prgnSrcClip); - if (pSrcWin && pSrcWin->backStorage) - { - /* - * Copy any areas from the source backing store. Modifies - * rgnExposed. - */ - (* pSrcWin->drawable.pScreen->ExposeCopy) ((WindowPtr)pSrcDrawable, - pDstDrawable, - pGC, - &rgnExposed, - srcx, srcy, - dstx, dsty, - plane); - } - /* move them over the destination */ RegionTranslate(&rgnExposed, dstx-srcx, dsty-srcy); @@ -307,15 +286,6 @@ miHandleExposures(pSrcDrawable, pDstDrawable, expBox = *RegionExtents(&rgnExposed); RegionReset(&rgnExposed, &expBox); - /* need to clear out new areas of backing store */ - if (pWin->backStorage) - (void) (* pWin->drawable.pScreen->ClearBackingStore)( - pWin, - expBox.x1, - expBox.y1, - expBox.x2 - expBox.x1, - expBox.y2 - expBox.y1, - FALSE); } if ((pDstDrawable->type != DRAWABLE_PIXMAP) && (((WindowPtr)pDstDrawable)->backgroundState != None)) @@ -500,18 +470,6 @@ miWindowExposures(pWin, prgn, other_exposed) register RegionPtr prgn, other_exposed; { RegionPtr exposures = prgn; - if (pWin->backStorage && prgn) - /* - * in some cases, backing store will cause a different - * region to be exposed than needs to be repainted - * (like when a window is mapped). RestoreAreas is - * allowed to return a region other than prgn, - * in which case this routine will free the resultant - * region. If exposures is null, then no events will - * be sent to the client; if prgn is empty - * no areas will be repainted. - */ - exposures = (*pWin->drawable.pScreen->RestoreAreas)(pWin, prgn); if ((prgn && !RegionNil(prgn)) || (exposures && !RegionNil(exposures)) || other_exposed) { @@ -556,14 +514,6 @@ miWindowExposures(pWin, prgn, other_exposed) /* PaintWindowBackground doesn't clip, so we have to */ RegionIntersect(prgn, prgn, &pWin->clipList); /* need to clear out new areas of backing store, too */ - if (pWin->backStorage) - (void) (* pWin->drawable.pScreen->ClearBackingStore)( - pWin, - box.x1 - pWin->drawable.x, - box.y1 - pWin->drawable.y, - box.x2 - box.x1, - box.y2 - box.y1, - FALSE); } if (prgn && !RegionNil(prgn)) (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, PW_BACKGROUND); @@ -783,9 +733,6 @@ int what; pWin = pRoot; } - if (pWin->backStorage) - (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); - mask = gcmask; gcmask = 0; i = 0; @@ -864,9 +811,6 @@ int what; (*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect); free(prect); - if (pWin->backStorage) - (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing); - if (usingScratchGC) { if (what == PW_BORDER) diff --git a/nx-X11/programs/Xserver/mi/mioverlay.c b/nx-X11/programs/Xserver/mi/mioverlay.c index c0d923a0f8..75e5ce7bbb 100644 --- a/nx-X11/programs/Xserver/mi/mioverlay.c +++ b/nx-X11/programs/Xserver/mi/mioverlay.c @@ -1025,8 +1025,6 @@ miOverlayWindowExposures( RegionPtr exposures = prgn; ScreenPtr pScreen = pWin->drawable.pScreen; - if (pWin->backStorage && prgn) - exposures = (*pScreen->RestoreAreas)(pWin, prgn); if ((prgn && !RegionNil(prgn)) || (exposures && !RegionNil(exposures)) || other_exposed) { @@ -1067,15 +1065,6 @@ miOverlayWindowExposures( } else RegionIntersect(prgn, prgn, &pWin->clipList); - /* need to clear out new areas of backing store, too */ - if (pWin->backStorage) - (void) (*pScreen->ClearBackingStore)( - pWin, - box.x1 - pWin->drawable.x, - box.y1 - pWin->drawable.y, - box.x2 - box.x1, - box.y2 - box.y1, - FALSE); } if (prgn && !RegionNil(prgn)) (*pScreen->PaintWindowBackground)( @@ -1172,7 +1161,6 @@ miOverlayResizeWindow( RegionPtr oldWinClip = NULL, oldWinClip2 = NULL; RegionPtr borderVisible = NullRegion; RegionPtr borderVisible2 = NullRegion; - RegionPtr bsExposed = NullRegion; /* backing store exposures */ Bool shrunk = FALSE; /* shrunk in an inner dimension */ Bool moved = FALSE; /* window position changed */ #ifdef DO_SAVE_UNDERS @@ -1326,17 +1314,6 @@ miOverlayResizeWindow( GravityTranslate (x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny); - if (pWin->backStorage && ((pWin->backingStore == Always) || WasViewable)) { - if (!WasViewable) - pRegion = &pWin->clipList; /* a convenient empty region */ - if (pWin->bitGravity == ForgetGravity) - bsExposed = (*pScreen->TranslateBackingStore) - (pWin, 0, 0, NullRegion, oldx, oldy); - else - bsExposed = (*pScreen->TranslateBackingStore) - (pWin, nx - x, ny - y, pRegion, oldx, oldy); - } - if (WasViewable) { miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); miOverlayTwoRegions TwoRegions; @@ -1544,16 +1521,6 @@ miOverlayResizeWindow( RegionDestroy(destClip); if (destClip2) RegionDestroy(destClip2); - if (bsExposed) { - RegionPtr valExposed = NullRegion; - - if (pWin->valdata) - valExposed = &pWin->valdata->after.exposed; - (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); - if (valExposed) - RegionEmpty(valExposed); - RegionDestroy(bsExposed); - } (*pScreen->HandleExposures)(pWin->parent); #ifdef DO_SAVE_UNDERS if (dosave) @@ -1562,10 +1529,6 @@ miOverlayResizeWindow( if (pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pWin->parent, pFirstChange, VTOther); } - else if (bsExposed) { - (*pScreen->WindowExposures) (pWin, NullRegion, bsExposed); - RegionDestroy(bsExposed); - } if (pWin->realized) WindowsRestructured (); } @@ -1577,7 +1540,7 @@ miOverlaySetShape(WindowPtr pWin) { Bool WasViewable = (Bool)(pWin->viewable); ScreenPtr pScreen = pWin->drawable.pScreen; - RegionPtr pOldClip = NULL, bsExposed; + RegionPtr pOldClip = NULL; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif @@ -1626,26 +1589,6 @@ miOverlaySetShape(WindowPtr pWin) (*pScreen->ValidateTree)(pWin->parent, NullWindow, VTOther); } - if (pWin->backStorage && ((pWin->backingStore == Always) || WasViewable)) { - if (!WasViewable) - pOldClip = &pWin->clipList; /* a convenient empty region */ - bsExposed = (*pScreen->TranslateBackingStore) - (pWin, 0, 0, pOldClip, - pWin->drawable.x, pWin->drawable.y); - if (WasViewable) - RegionDestroy(pOldClip); - if (bsExposed) - { - RegionPtr valExposed = NullRegion; - - if (pWin->valdata) - valExposed = &pWin->valdata->after.exposed; - (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); - if (valExposed) - RegionEmpty(valExposed); - RegionDestroy(bsExposed); - } - } if (WasViewable) { (*pScreen->HandleExposures)(pWin->parent); #ifdef DO_SAVE_UNDERS @@ -1798,10 +1741,6 @@ miOverlayClearToBackground( box.y1 = y1; box.y2 = y2; RegionInit(®, &box, 1); - if (pWin->backStorage) { - pBSReg = (* pScreen->ClearBackingStore)(pWin, x, y, w, h, - generateExposures); - } RegionIntersect(®, ®, clipList); if (generateExposures) diff --git a/nx-X11/programs/Xserver/mi/miscrinit.c b/nx-X11/programs/Xserver/mi/miscrinit.c index e38284c501..ac74ec214b 100644 --- a/nx-X11/programs/Xserver/mi/miscrinit.c +++ b/nx-X11/programs/Xserver/mi/miscrinit.c @@ -309,13 +309,6 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, #endif pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow; - pScreen->SaveDoomedAreas = 0; - pScreen->RestoreAreas = 0; - pScreen->ExposeCopy = 0; - pScreen->TranslateBackingStore = 0; - pScreen->ClearBackingStore = 0; - pScreen->DrawGuarantee = 0; - miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS); return miScreenDevPrivateInit(pScreen, width, pbits); diff --git a/nx-X11/programs/Xserver/mi/misprite.c b/nx-X11/programs/Xserver/mi/misprite.c index 151de776d3..c36ca7e390 100644 --- a/nx-X11/programs/Xserver/mi/misprite.c +++ b/nx-X11/programs/Xserver/mi/misprite.c @@ -89,9 +89,6 @@ static void miSpriteInstallColormap(ColormapPtr pMap); static void miSpriteStoreColors(ColormapPtr pMap, int ndef, xColorItem *pdef); -static void miSpriteSaveDoomedAreas(WindowPtr pWin, - RegionPtr pObscured, int dx, - int dy); static void miSpriteComputeSaved(ScreenPtr pScreen); #define SCREEN_PROLOGUE(pScreen, field)\ @@ -195,8 +192,6 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs) pScreenPriv->CopyWindow = pScreen->CopyWindow; - pScreenPriv->SaveDoomedAreas = pScreen->SaveDoomedAreas; - pScreenPriv->InstallColormap = pScreen->InstallColormap; pScreenPriv->StoreColors = pScreen->StoreColors; @@ -228,8 +223,6 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs) pScreen->CopyWindow = miSpriteCopyWindow; - pScreen->SaveDoomedAreas = miSpriteSaveDoomedAreas; - pScreen->InstallColormap = miSpriteInstallColormap; pScreen->StoreColors = miSpriteStoreColors; @@ -263,7 +256,6 @@ miSpriteCloseScreen (pScreen) pScreen->InstallColormap = pScreenPriv->InstallColormap; pScreen->StoreColors = pScreenPriv->StoreColors; - pScreen->SaveDoomedAreas = pScreenPriv->SaveDoomedAreas; miSpriteIsUpFALSE (pScreen, pScreenPriv); DamageDestroy (pScreenPriv->pDamage); @@ -556,45 +548,6 @@ miSpriteFindColors (ScreenPtr pScreen) pScreenPriv->checkPixels = FALSE; } -/* - * BackingStore wrappers - */ - -static void -miSpriteSaveDoomedAreas (pWin, pObscured, dx, dy) - WindowPtr pWin; - RegionPtr pObscured; - int dx, dy; -{ - ScreenPtr pScreen; - miSpriteScreenPtr pScreenPriv; - BoxRec cursorBox; - - pScreen = pWin->drawable.pScreen; - - SCREEN_PROLOGUE (pScreen, SaveDoomedAreas); - - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; - if (pScreenPriv->isUp) - { - cursorBox = pScreenPriv->saved; - - if (dx || dy) - { - cursorBox.x1 += dx; - cursorBox.y1 += dy; - cursorBox.x2 += dx; - cursorBox.y2 += dy; - } - if (RegionContainsRect(pObscured, &cursorBox) != rgnOUT) - miSpriteRemoveCursor (pScreen); - } - - (*pScreen->SaveDoomedAreas) (pWin, pObscured, dx, dy); - - SCREEN_EPILOGUE (pScreen, SaveDoomedAreas, miSpriteSaveDoomedAreas); -} - /* * miPointer interface routines */ diff --git a/nx-X11/programs/Xserver/mi/mispritest.h b/nx-X11/programs/Xserver/mi/mispritest.h index 5075f05804..e8251ead22 100644 --- a/nx-X11/programs/Xserver/mi/mispritest.h +++ b/nx-X11/programs/Xserver/mi/mispritest.h @@ -57,9 +57,6 @@ typedef struct { /* window procedures */ CopyWindowProcPtr CopyWindow; - /* backing store procedures */ - SaveDoomedAreasProcPtr SaveDoomedAreas; - /* colormap procedures */ InstallColormapProcPtr InstallColormap; StoreColorsProcPtr StoreColors; diff --git a/nx-X11/programs/Xserver/mi/mivalidate.h b/nx-X11/programs/Xserver/mi/mivalidate.h index ef258c0f89..18700ac79f 100644 --- a/nx-X11/programs/Xserver/mi/mivalidate.h +++ b/nx-X11/programs/Xserver/mi/mivalidate.h @@ -40,8 +40,7 @@ typedef union _Validate { DDXPointRec oldAbsCorner; /* old window position */ RegionPtr borderVisible; /* visible region of border, */ /* non-null when size changes */ - Bool resized; /* unclipped winSize has changed - */ - /* don't call SaveDoomedAreas */ + Bool resized; /* unclipped winSize has changed */ } before; struct AfterValidate { RegionRec exposed; /* exposed regions, absolute pos */ diff --git a/nx-X11/programs/Xserver/mi/mivaltree.c b/nx-X11/programs/Xserver/mi/mivaltree.c index 0435925edb..763aa3b108 100644 --- a/nx-X11/programs/Xserver/mi/mivaltree.c +++ b/nx-X11/programs/Xserver/mi/mivaltree.c @@ -217,7 +217,7 @@ miComputeClips ( RegionRec childUnion; Bool overlap; RegionPtr borderVisible; - Bool resized; + /* * Figure out the new visibility of this window. * The extent of the universe should be the same as the extent of @@ -372,7 +372,6 @@ miComputeClips ( } borderVisible = pParent->valdata->before.borderVisible; - resized = pParent->valdata->before.resized; RegionNull(&pParent->valdata->after.borderExposed); RegionNull(&pParent->valdata->after.exposed); @@ -502,18 +501,6 @@ miComputeClips ( universe, &pParent->clipList); } - /* - * One last thing: backing storage. We have to try to save what parts of - * the window are about to be obscured. We can just subtract the universe - * from the old clipList and get the areas that were in the old but aren't - * in the new and, hence, are about to be obscured. - */ - if (pParent->backStorage && !resized) - { - RegionSubtract(exposed, &pParent->clipList, universe); - (* pScreen->SaveDoomedAreas)(pParent, exposed, dx, dy); - } - /* HACK ALERT - copying contents of regions, instead of regions */ { RegionRec tmp; @@ -805,11 +792,6 @@ miValidateTree (pParent, pChild, kind) &totalClip, &pParent->clipList); /* fall through */ case VTMap: - if (pParent->backStorage) { - RegionSubtract(&exposed, &pParent->clipList, &totalClip); - (* pScreen->SaveDoomedAreas)(pParent, &exposed, 0, 0); - } - RegionCopy(&pParent->clipList, &totalClip); pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; break; diff --git a/nx-X11/programs/Xserver/mi/miwindow.c b/nx-X11/programs/Xserver/mi/miwindow.c index 2a583eda7b..1307b2aba3 100644 --- a/nx-X11/programs/Xserver/mi/miwindow.c +++ b/nx-X11/programs/Xserver/mi/miwindow.c @@ -113,18 +113,6 @@ miClearToBackground(pWin, x, y, w, h, generateExposures) pScreen = pWin->drawable.pScreen; RegionInit(®, &box, 1); - if (pWin->backStorage) - { - /* - * If the window has backing-store on, call through the - * ClearToBackground vector to handle the special semantics - * (i.e. things backing store is to be cleared out and - * an Expose event is to be generated for those areas in backing - * store if generateExposures is TRUE). - */ - pBSReg = (* pScreen->ClearBackingStore)(pWin, x, y, w, h, - generateExposures); - } RegionIntersect(®, ®, &pWin->clipList); if (generateExposures) @@ -621,7 +609,6 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib) RegionPtr destClip; /* portions of destination already written */ RegionPtr oldWinClip = NULL; /* old clip list for window */ RegionPtr borderVisible = NullRegion; /* visible area of the border */ - RegionPtr bsExposed = NullRegion; /* backing store exposures */ Bool shrunk = FALSE; /* shrunk in an inner dimension */ Bool moved = FALSE; /* window position changed */ #ifdef DO_SAVE_UNDERS @@ -725,9 +712,6 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib) if (WasViewable) { pRegion = RegionCreate(NullBox, 1); - if (pWin->backStorage) - RegionCopy(pRegion, &pWin->clipList); - if (pLayerWin == pWin) anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange, (WindowPtr *)NULL); @@ -759,21 +743,6 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib) GravityTranslate (x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny); - if (pWin->backStorage && - ((pWin->backingStore == Always) || WasViewable)) - { - if (!WasViewable) - pRegion = &pWin->clipList; /* a convenient empty region */ - if (pWin->bitGravity == ForgetGravity) - bsExposed = (*pScreen->TranslateBackingStore) - (pWin, 0, 0, NullRegion, oldx, oldy); - else - { - bsExposed = (*pScreen->TranslateBackingStore) - (pWin, nx - x, ny - y, pRegion, oldx, oldy); - } - } - if (WasViewable) { /* avoid the border */ @@ -922,17 +891,6 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib) RegionDestroy(pRegion); if (destClip) RegionDestroy(destClip); - if (bsExposed) - { - RegionPtr valExposed = NullRegion; - - if (pWin->valdata) - valExposed = &pWin->valdata->after.exposed; - (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); - if (valExposed) - RegionEmpty(valExposed); - RegionDestroy(bsExposed); - } if (anyMarked) (*pScreen->HandleExposures)(pLayerWin->parent); #ifdef DO_SAVE_UNDERS @@ -945,11 +903,6 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib) (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstChange, VTOther); } - else if (bsExposed) - { - (*pScreen->WindowExposures) (pWin, NullRegion, bsExposed); - RegionDestroy(bsExposed); - } if (pWin->realized) WindowsRestructured (); } @@ -976,7 +929,7 @@ miSetShape(pWin) Bool WasViewable = (Bool)(pWin->viewable); register ScreenPtr pScreen = pWin->drawable.pScreen; Bool anyMarked = FALSE; - RegionPtr pOldClip = NULL, bsExposed; + RegionPtr pOldClip = NULL; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif @@ -1008,12 +961,6 @@ miSetShape(pWin) if (WasViewable) { - if (pWin->backStorage) - { - pOldClip = RegionCreate(NullBox, 1); - RegionCopy(pOldClip, &pWin->clipList); - } - anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin, (WindowPtr *)NULL); @@ -1026,47 +973,9 @@ miSetShape(pWin) if (anyMarked) (*pScreen->ValidateTree)(pLayerWin->parent, NullWindow, VTOther); - } - - if (pWin->backStorage && - ((pWin->backingStore == Always) || WasViewable)) - { - if (!WasViewable) - pOldClip = &pWin->clipList; /* a convenient empty region */ - bsExposed = (*pScreen->TranslateBackingStore) - (pWin, 0, 0, pOldClip, - pWin->drawable.x, pWin->drawable.y); - - /* - * Applies to NXAGENT_SERVER builds: - * - * We got a few, rare, segfaults here after having - * started using the backing store. It may be a - * different bug but miChangeSaveUnder() calls mi- - * CheckSubSaveUnder() that, in turn, can change - * the backing store attribute of the window. This - * means that we may try to destroy the region - * even if it was not created at the beginning of - * this function as, at the time, the backing store - * was off. miCheckSubSaveUnder() appear to get a - * pointer to the parent, so maybe doesn't change - * the attribute of the window itself. This is to - * be better investigated. - */ if (WasViewable && pOldClip) RegionDestroy(pOldClip); - if (bsExposed) - { - RegionPtr valExposed = NullRegion; - - if (pWin->valdata) - valExposed = &pWin->valdata->after.exposed; - (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); - if (valExposed) - RegionEmpty(valExposed); - RegionDestroy(bsExposed); - } } if (WasViewable) { diff --git a/nx-X11/programs/Xserver/miext/damage/damage.c b/nx-X11/programs/Xserver/miext/damage/damage.c index 9c9161d36b..e23be5acb0 100644 --- a/nx-X11/programs/Xserver/miext/damage/damage.c +++ b/nx-X11/programs/Xserver/miext/damage/damage.c @@ -1655,24 +1655,6 @@ GCOps damageGCOps = { {NULL} /* devPrivate */ }; -static void -damageRestoreAreas (PixmapPtr pPixmap, - RegionPtr prgn, - int xorg, - int yorg, - WindowPtr pWindow) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - damageScrPriv(pScreen); - - damageDamageRegion (&pWindow->drawable, prgn, FALSE, -1); - unwrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas); - (*pScreen->BackingStoreFuncs.RestoreAreas) (pPixmap, prgn, - xorg, yorg, pWindow); - wrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas, - damageRestoreAreas); -} - static void damageSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap) { @@ -1736,7 +1718,6 @@ damageCloseScreen (ScreenPtr pScreen) unwrap (pScrPriv, pScreen, PaintWindowBorder); unwrap (pScrPriv, pScreen, CopyWindow); unwrap (pScrPriv, pScreen, CloseScreen); - unwrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas); free (pScrPriv); return (*pScreen->CloseScreen) (pScreen); } @@ -1806,8 +1787,6 @@ DamageSetup (ScreenPtr pScreen) wrap (pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap); wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow); wrap (pScrPriv, pScreen, CloseScreen, damageCloseScreen); - wrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas, - damageRestoreAreas); #ifdef RENDER if (ps) { wrap (pScrPriv, ps, Glyphs, damageGlyphs); diff --git a/nx-X11/programs/Xserver/miext/damage/damagestr.h b/nx-X11/programs/Xserver/miext/damage/damagestr.h index 62b384167d..481486e7ec 100644 --- a/nx-X11/programs/Xserver/miext/damage/damagestr.h +++ b/nx-X11/programs/Xserver/miext/damage/damagestr.h @@ -70,7 +70,6 @@ typedef struct _damageScrPriv { CompositeProcPtr Composite; GlyphsProcPtr Glyphs; #endif - BSFuncRec BackingStoreFuncs; } DamageScrPrivRec, *DamageScrPrivPtr; typedef struct _damageGCPriv { From 6de61739df59da377d4d4cddc1b45811751fab60 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 21 Nov 2017 16:09:01 +0100 Subject: [PATCH 4/4] dix: Drop the third argument from WindowExposuresProcPtr Backport from X.org: dix: Drop the third argument from WindowExposuresProcPtr A careful read shows that it was always NULL. It hasn't always been; as the DDX spec indicates, it was the "occluded region that has backing store", but since that backing store code is long gone, we can nuke it. mi{,Overlay}WindowExposures get slightly simpler here, and will get even simpler in just a moment. Reviewed-by: Julien Cristau Signed-off-by: Adam Jackson Backported to NX by: Mike Gabriel --- nx-X11/programs/Xserver/dix/window.c | 2 +- nx-X11/programs/Xserver/fb/fboverlay.c | 5 ++-- nx-X11/programs/Xserver/fb/fboverlay.h | 3 +- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 4 +-- nx-X11/programs/Xserver/hw/nxagent/Events.c | 18 ++++++++++-- .../programs/Xserver/hw/nxagent/NXmiexpose.c | 21 +++----------- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Window.c | 23 ++++++--------- nx-X11/programs/Xserver/hw/nxagent/Windows.h | 2 +- nx-X11/programs/Xserver/include/scrnintstr.h | 3 +- nx-X11/programs/Xserver/mi/mi.h | 3 +- nx-X11/programs/Xserver/mi/miexpose.c | 21 +++----------- nx-X11/programs/Xserver/mi/mioverlay.c | 28 ++++++------------- nx-X11/programs/Xserver/mi/miwindow.c | 7 ++--- 14 files changed, 51 insertions(+), 91 deletions(-) diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c index 05fc730d08..1bfba4a6fb 100644 --- a/nx-X11/programs/Xserver/dix/window.c +++ b/nx-X11/programs/Xserver/dix/window.c @@ -2760,7 +2760,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client) (*pScreen->PostValidateTree)(NullWindow, pWin, VTMap); RegionNull(&temp); RegionCopy(&temp, &pWin->clipList); - (*pScreen->WindowExposures) (pWin, &temp, NullRegion); + (*pScreen->WindowExposures) (pWin, &temp); RegionUninit(&temp); } diff --git a/nx-X11/programs/Xserver/fb/fboverlay.c b/nx-X11/programs/Xserver/fb/fboverlay.c index 6e0bbf2522..cf5746d1dc 100644 --- a/nx-X11/programs/Xserver/fb/fboverlay.c +++ b/nx-X11/programs/Xserver/fb/fboverlay.c @@ -270,13 +270,12 @@ fbOverlayCopyWindow(WindowPtr pWin, void fbOverlayWindowExposures (WindowPtr pWin, - RegionPtr prgn, - RegionPtr other_exposed) + RegionPtr prgn) { fbOverlayUpdateLayerRegion (pWin->drawable.pScreen, fbOverlayWindowLayer (pWin), prgn); - miWindowExposures(pWin, prgn, other_exposed); + miWindowExposures(pWin, prgn); } void diff --git a/nx-X11/programs/Xserver/fb/fboverlay.h b/nx-X11/programs/Xserver/fb/fboverlay.h index 2bb8b176a0..5bdc05b646 100644 --- a/nx-X11/programs/Xserver/fb/fboverlay.h +++ b/nx-X11/programs/Xserver/fb/fboverlay.h @@ -89,8 +89,7 @@ fbOverlayCopyWindow(WindowPtr pWin, void fbOverlayWindowExposures (WindowPtr pWin, - RegionPtr prgn, - RegionPtr other_exposed); + RegionPtr prgn); void fbOverlayPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 78e62142e4..a22f0dd4ee 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -3120,7 +3120,7 @@ void nxagentSendBackgroundExpose(WindowPtr pWin, PixmapPtr pBackground, RegionPt RegionTranslate(&expose, pWin -> drawable.x, pWin -> drawable.y); - miWindowExposures(pWin, &expose, &expose); + miWindowExposures(pWin, &expose); nxagentSendBackgroundExposeEnd: @@ -3230,7 +3230,7 @@ int nxagentClipAndSendClearExpose(WindowPtr pWin, void * ptr) RegionSubtract(remoteExposeRgn, remoteExposeRgn, exposeRgn); - miWindowExposures(pWin, exposeRgn, exposeRgn); + miWindowExposures(pWin, exposeRgn); } RegionDestroy(exposeRgn); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index a27ea40d4a..9af1589b4c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -2483,7 +2483,7 @@ FIXME: This can be maybe optimized by consuming the if (index == -1) { - miWindowExposures(pWin, &sum, NullRegion); + miWindowExposures(pWin, &sum); } else { @@ -2545,6 +2545,10 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) pWin = nxagentWindowPtr(X -> xgraphicsexpose.drawable); + if (pWin == 0) { + return 1; + } + /* * Rectangle affected by GraphicsExpose * event. @@ -2563,6 +2567,14 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) * must be relative to the screen. */ +// #ifdef TEST + fprintf(stderr, "nxagentHandleGraphicsExposeEvent: graphics expose event with expose region rectangle " + "x1 [%d], y1 [%d] and x2 [%d] y2 [%d]. and drawable [%ld] with x [%d] and y[%d].\n", + rect.x1, rect.y1, rect.x2, rect.y2, + X -> xgraphicsexpose.drawable, + pWin -> drawable.x, pWin -> drawable.y); +// #endif + RegionTranslate(exposeRegion, pWin -> drawable.x, pWin -> drawable.y); RegionUnion(nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, exposeRegion); @@ -4036,7 +4048,7 @@ void nxagentSynchronizeExpose(void) RegionNumRects(nxagentExposeQueueHead.remoteRegion)); #endif - miWindowExposures(pWin, nxagentExposeQueueHead.remoteRegion, NullRegion); + miWindowExposures(pWin, nxagentExposeQueueHead.remoteRegion); } } } @@ -4271,7 +4283,7 @@ int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) RegionSubtract(remoteExposeRgn, remoteExposeRgn, exposeRgn); - miWindowExposures(pWin, exposeRgn, NullRegion); + miWindowExposures(pWin, exposeRgn); } RegionDestroy(exposeRgn); diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c index 9cca6cb235..233ba2ac73 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c @@ -353,16 +353,15 @@ miHandleExposures(pSrcDrawable, pDstDrawable, } void -miWindowExposures(pWin, prgn, other_exposed) +miWindowExposures(pWin, prgn) WindowPtr pWin; - register RegionPtr prgn, other_exposed; + register RegionPtr prgn; { int total; RegionPtr exposures = prgn; - if ((prgn && !RegionNil(prgn)) || - (exposures && !RegionNil(exposures)) || other_exposed) + if ((prgn && !RegionNil(prgn)) || (exposures && !RegionNil(exposures))) { RegionRec expRec; int clientInterested; @@ -371,18 +370,6 @@ miWindowExposures(pWin, prgn, other_exposed) * Restore from backing-store FIRST. */ clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) & ExposureMask; - if (other_exposed) - { - if (exposures) - { - RegionUnion(other_exposed, - exposures, - other_exposed); - if (exposures != prgn) - RegionDestroy(exposures); - } - exposures = other_exposed; - } /* * If the number of rectangles is greater @@ -424,7 +411,7 @@ miWindowExposures(pWin, prgn, other_exposed) { RegionUninit(exposures); } - else if (exposures && exposures != prgn && exposures != other_exposed) + else if (exposures && exposures != prgn) RegionDestroy(exposures); if (prgn) RegionEmpty(prgn); diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index 44d398304b..5a5c208489 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -929,7 +929,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client) (*pScreen->PostValidateTree)(NullWindow, pWin, VTMap); RegionNull(&temp); RegionCopy(&temp, &pWin->clipList); - (*pScreen->WindowExposures) (pWin, &temp, NullRegion); + (*pScreen->WindowExposures) (pWin, &temp); RegionUninit(&temp); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index f1bdea731c..16f086ffab 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -2110,7 +2110,7 @@ void nxagentClipNotify(WindowPtr pWin, int dx, int dy) #endif /* NXAGENT_SHAPE */ } -void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed) +void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn) { /* * The problem: we want to synthetize the expose events internally, so @@ -2202,11 +2202,6 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo RegionUnion(&temp, &temp, pRgn); } - if (other_exposed != NULL) - { - RegionUnion(&temp, &temp, other_exposed); - } - if (RegionNil(&temp) == 0) { RegionTranslate(&temp, @@ -2281,12 +2276,11 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo fprintf(stderr, "nxagentWindowExposures: WARNING! Reached maximum size of collect exposures vector.\n"); #endif - if ((pRgn != NULL && RegionNotEmpty(pRgn) != 0) || - (other_exposed != NULL && RegionNotEmpty(other_exposed) != 0)) + if (pRgn != NULL && RegionNotEmpty(pRgn) != 0) { - nxagentUnmarkExposedRegion(pWin, pRgn, other_exposed); + nxagentUnmarkExposedRegion(pWin, pRgn, NullRegion); - miWindowExposures(pWin, pRgn, other_exposed); + miWindowExposures(pWin, pRgn); } return; @@ -2296,12 +2290,11 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo RegionUninit(&temp); } - if ((pRgn != NULL && RegionNotEmpty(pRgn) != 0) || - (other_exposed != NULL && RegionNotEmpty(other_exposed) != 0)) + if (pRgn != NULL && RegionNotEmpty(pRgn) != 0) { - nxagentUnmarkExposedRegion(pWin, pRgn, other_exposed); + nxagentUnmarkExposedRegion(pWin, pRgn, NullRegion); - miWindowExposures(pWin, pRgn, other_exposed); + miWindowExposures(pWin, pRgn); } return; @@ -2489,7 +2482,7 @@ static int nxagentForceExposure(WindowPtr pWin, void * ptr) if (exposedRgn != NULL && RegionNotEmpty(exposedRgn) != 0) { - miWindowExposures(pWin, exposedRgn, NullRegion); + miWindowExposures(pWin, exposedRgn); } RegionDestroy(exposedRgn); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Windows.h b/nx-X11/programs/Xserver/hw/nxagent/Windows.h index fb3b383759..f8c0621151 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Windows.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Windows.h @@ -204,7 +204,7 @@ Bool nxagentUnrealizeWindow(WindowPtr pWin); Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask); -void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed); +void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn); void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what); diff --git a/nx-X11/programs/Xserver/include/scrnintstr.h b/nx-X11/programs/Xserver/include/scrnintstr.h index d8158bfa3d..4f0c93788c 100644 --- a/nx-X11/programs/Xserver/include/scrnintstr.h +++ b/nx-X11/programs/Xserver/include/scrnintstr.h @@ -166,8 +166,7 @@ typedef void (* PostValidateTreeProcPtr)( typedef void (* WindowExposuresProcPtr)( WindowPtr /*pWindow*/, - RegionPtr /*prgn*/, - RegionPtr /*other_exposed*/); + RegionPtr /*prgn*/); typedef void (* PaintWindowProcPtr)( WindowPtr /*pWindow*/, diff --git a/nx-X11/programs/Xserver/mi/mi.h b/nx-X11/programs/Xserver/mi/mi.h index 409e21e343..182bcbc818 100644 --- a/nx-X11/programs/Xserver/mi/mi.h +++ b/nx-X11/programs/Xserver/mi/mi.h @@ -228,8 +228,7 @@ extern void miSendExposures( extern void miWindowExposures( WindowPtr /*pWin*/, - RegionPtr /*prgn*/, - RegionPtr /*other_exposed*/ + RegionPtr /*prgn*/ ); extern void miPaintWindow( diff --git a/nx-X11/programs/Xserver/mi/miexpose.c b/nx-X11/programs/Xserver/mi/miexpose.c index d69bd9be55..f109832132 100644 --- a/nx-X11/programs/Xserver/mi/miexpose.c +++ b/nx-X11/programs/Xserver/mi/miexpose.c @@ -465,13 +465,12 @@ miSendExposures(pWin, pRgn, dx, dy) #ifndef NXAGENT_SERVER void -miWindowExposures(pWin, prgn, other_exposed) +miWindowExposures(pWin, prgn) WindowPtr pWin; - register RegionPtr prgn, other_exposed; + register RegionPtr prgn; { RegionPtr exposures = prgn; - if ((prgn && !RegionNil(prgn)) || - (exposures && !RegionNil(exposures)) || other_exposed) + if ((prgn && !RegionNil(prgn)) || (exposures && !RegionNil(exposures))) { RegionRec expRec; int clientInterested; @@ -480,18 +479,6 @@ miWindowExposures(pWin, prgn, other_exposed) * Restore from backing-store FIRST. */ clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) & ExposureMask; - if (other_exposed) - { - if (exposures) - { - RegionUnion(other_exposed, - exposures, - other_exposed); - if (exposures != prgn) - RegionDestroy(exposures); - } - exposures = other_exposed; - } if (clientInterested && exposures && (RegionNumRects(exposures) > RECTLIMIT)) { /* @@ -524,7 +511,7 @@ miWindowExposures(pWin, prgn, other_exposed) { RegionUninit(exposures); } - else if (exposures && exposures != prgn && exposures != other_exposed) + else if (exposures && exposures != prgn) RegionDestroy(exposures); if (prgn) RegionEmpty(prgn); diff --git a/nx-X11/programs/Xserver/mi/mioverlay.c b/nx-X11/programs/Xserver/mi/mioverlay.c index 75e5ce7bbb..ecfd84d769 100644 --- a/nx-X11/programs/Xserver/mi/mioverlay.c +++ b/nx-X11/programs/Xserver/mi/mioverlay.c @@ -75,7 +75,7 @@ static void miOverlayMarkUnrealizedWindow(WindowPtr, WindowPtr, Bool); static int miOverlayValidateTree(WindowPtr, WindowPtr, VTKind); static void miOverlayHandleExposures(WindowPtr); static void miOverlayMoveWindow(WindowPtr, int, int, WindowPtr, VTKind); -static void miOverlayWindowExposures(WindowPtr, RegionPtr, RegionPtr); +static void miOverlayWindowExposures(WindowPtr, RegionPtr); static void miOverlayResizeWindow(WindowPtr, int, int, unsigned int, unsigned int, WindowPtr); static void miOverlayClearToBackground(WindowPtr, int, int, int, int, Bool); @@ -849,7 +849,7 @@ miOverlayHandleExposures(WindowPtr pWin) miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); WindowPtr pChild; ValidatePtr val; - void (* WindowExposures)(WindowPtr, RegionPtr, RegionPtr); + void (* WindowExposures)(WindowPtr, RegionPtr); WindowExposures = pWin->drawable.pScreen->WindowExposures; if(pPriv->underlayMarked) { @@ -870,7 +870,7 @@ miOverlayHandleExposures(WindowPtr pWin) pTree->pWin, &mival->borderExposed, PW_BORDER); RegionUninit(&mival->borderExposed); - (*WindowExposures)(pTree->pWin,&mival->exposed,NullRegion); + (*WindowExposures)(pTree->pWin,&mival->exposed); RegionUninit(&mival->exposed); } free(mival); @@ -907,7 +907,7 @@ miOverlayHandleExposures(WindowPtr pWin) (*pChild->drawable.pScreen->PaintWindowBorder)(pChild, &val->after.borderExposed, PW_BORDER); - (*WindowExposures)(pChild, &val->after.exposed, NullRegion); + (*WindowExposures)(pChild, &val->after.exposed); } RegionUninit(&val->after.borderExposed); RegionUninit(&val->after.exposed); @@ -1019,28 +1019,19 @@ miOverlayMoveWindow( static void miOverlayWindowExposures( WindowPtr pWin, - register RegionPtr prgn, - RegionPtr other_exposed + register RegionPtr prgn ){ RegionPtr exposures = prgn; ScreenPtr pScreen = pWin->drawable.pScreen; if ((prgn && !RegionNil(prgn)) || - (exposures && !RegionNil(exposures)) || other_exposed) + (exposures && !RegionNil(exposures))) { RegionRec expRec; int clientInterested; clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) & ExposureMask; - if (other_exposed) { - if (exposures) { - RegionUnion(other_exposed, exposures, other_exposed); - if (exposures != prgn) - RegionDestroy(exposures); - } - exposures = other_exposed; - } if (clientInterested && exposures && (RegionNumRects(exposures) > RECTLIMIT)) { @@ -1075,7 +1066,7 @@ miOverlayWindowExposures( if (exposures == &expRec) { RegionUninit(exposures); } - else if (exposures && exposures != prgn && exposures != other_exposed) + else if (exposures && exposures != prgn) RegionDestroy(exposures); if (prgn) RegionEmpty(prgn); @@ -1706,7 +1697,6 @@ miOverlayClearToBackground( miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); BoxRec box; RegionRec reg; - RegionPtr pBSReg = NullRegion; ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); RegionPtr clipList; @@ -1744,12 +1734,10 @@ miOverlayClearToBackground( RegionIntersect(®, ®, clipList); if (generateExposures) - (*pScreen->WindowExposures)(pWin, ®, pBSReg); + (*pScreen->WindowExposures)(pWin, ®); else if (pWin->backgroundState != None) (*pScreen->PaintWindowBackground)(pWin, ®, PW_BACKGROUND); RegionUninit(®); - if (pBSReg) - RegionDestroy(pBSReg); } diff --git a/nx-X11/programs/Xserver/mi/miwindow.c b/nx-X11/programs/Xserver/mi/miwindow.c index 1307b2aba3..ed36e93165 100644 --- a/nx-X11/programs/Xserver/mi/miwindow.c +++ b/nx-X11/programs/Xserver/mi/miwindow.c @@ -66,7 +66,6 @@ miClearToBackground(pWin, x, y, w, h, generateExposures) { BoxRec box; RegionRec reg; - RegionPtr pBSReg = NullRegion; ScreenPtr pScreen; BoxPtr extents; int x1, y1, x2, y2; @@ -116,12 +115,10 @@ miClearToBackground(pWin, x, y, w, h, generateExposures) RegionIntersect(®, ®, &pWin->clipList); if (generateExposures) - (*pScreen->WindowExposures)(pWin, ®, pBSReg); + (*pScreen->WindowExposures)(pWin, ®); else if (pWin->backgroundState != None) (*pScreen->PaintWindowBackground)(pWin, ®, PW_BACKGROUND); RegionUninit(®); - if (pBSReg) - RegionDestroy(pBSReg); } /* @@ -447,7 +444,7 @@ miHandleValidateExposures(pWin) &val->after.borderExposed, PW_BORDER); RegionUninit(&val->after.borderExposed); - (*WindowExposures)(pChild, &val->after.exposed, NullRegion); + (*WindowExposures)(pChild, &val->after.exposed); RegionUninit(&val->after.exposed); free(val); pChild->valdata = (ValidatePtr)NULL;