aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/mi
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/mi')
-rw-r--r--xorg-server/mi/Makefile.am133
-rw-r--r--xorg-server/mi/mi.h1223
-rw-r--r--xorg-server/mi/miarc.c14
-rw-r--r--xorg-server/mi/mibitblt.c53
-rw-r--r--xorg-server/mi/micmap.c8
-rw-r--r--xorg-server/mi/micmap.h126
-rw-r--r--xorg-server/mi/micopy.c36
-rw-r--r--xorg-server/mi/midispcur.c333
-rw-r--r--xorg-server/mi/miexpose.c120
-rw-r--r--xorg-server/mi/mifillrct.c4
-rw-r--r--xorg-server/mi/mifpolycon.c8
-rw-r--r--xorg-server/mi/migc.c50
-rw-r--r--xorg-server/mi/miline.h345
-rw-r--r--xorg-server/mi/mioverlay.c522
-rw-r--r--xorg-server/mi/mipointer.c12
-rw-r--r--xorg-server/mi/mipointer.h292
-rw-r--r--xorg-server/mi/mipolycon.c14
-rw-r--r--xorg-server/mi/mipolygen.c8
-rw-r--r--xorg-server/mi/mipolyutil.c2
-rw-r--r--xorg-server/mi/miregion.c1845
-rw-r--r--xorg-server/mi/miscrinit.c12
-rw-r--r--xorg-server/mi/mispans.c12
-rw-r--r--xorg-server/mi/mispans.h194
-rw-r--r--xorg-server/mi/misprite.c88
-rw-r--r--xorg-server/mi/misprite.h7
-rw-r--r--xorg-server/mi/mivaltree.c1628
-rw-r--r--xorg-server/mi/miwideline.c4
-rw-r--r--xorg-server/mi/miwindow.c223
28 files changed, 2558 insertions, 4758 deletions
diff --git a/xorg-server/mi/Makefile.am b/xorg-server/mi/Makefile.am
index f22dde9a2..8ec45ecd8 100644
--- a/xorg-server/mi/Makefile.am
+++ b/xorg-server/mi/Makefile.am
@@ -1,67 +1,66 @@
-noinst_LTLIBRARIES = libmi.la
-
-if XORG
-sdk_HEADERS = micmap.h miline.h mipointer.h mi.h mibstore.h \
- migc.h mipointrst.h mizerarc.h micoord.h mifillarc.h \
- mispans.h miwideline.h mistruct.h mifpoly.h mioverlay.h
-endif
-
-AM_CFLAGS = $(DIX_CFLAGS)
-
-libmi_la_SOURCES = \
- mi.h \
- miarc.c \
- mibitblt.c \
- mibstore.c \
- mibstore.h \
- mibstorest.h \
- micmap.c \
- micmap.h \
- micoord.h \
- micopy.c \
- micursor.c \
- midash.c \
- midispcur.c \
- mieq.c \
- miexpose.c \
- mifillarc.c \
- mifillarc.h \
- mifillrct.c \
- mifpolycon.c \
- mifpoly.h \
- migc.c \
- migc.h \
- miglblt.c \
- miline.h \
- mioverlay.c \
- mioverlay.h \
- mipointer.c \
- mipointer.h \
- mipointrst.h \
- mipoly.c \
- mipoly.h \
- mipolycon.c \
- mipolygen.c \
- mipolypnt.c \
- mipolyrect.c \
- mipolyseg.c \
- mipolytext.c \
- mipolyutil.c \
- mipushpxl.c \
- miregion.c \
- miscanfill.h \
- miscrinit.c \
- mispans.c \
- mispans.h \
- misprite.c \
- misprite.h \
- mistruct.h \
- mivaltree.c \
- mivalidate.h \
- miwideline.c \
- miwideline.h \
- miwindow.c \
- mizerarc.c \
- mizerarc.h \
- mizerclip.c \
- mizerline.c
+noinst_LTLIBRARIES = libmi.la
+
+if XORG
+sdk_HEADERS = micmap.h miline.h mipointer.h mi.h mibstore.h \
+ migc.h mipointrst.h mizerarc.h micoord.h mifillarc.h \
+ mispans.h miwideline.h mistruct.h mifpoly.h mioverlay.h
+endif
+
+AM_CFLAGS = $(DIX_CFLAGS)
+
+libmi_la_SOURCES = \
+ mi.h \
+ miarc.c \
+ mibitblt.c \
+ mibstore.c \
+ mibstore.h \
+ mibstorest.h \
+ micmap.c \
+ micmap.h \
+ micoord.h \
+ micopy.c \
+ micursor.c \
+ midash.c \
+ midispcur.c \
+ mieq.c \
+ miexpose.c \
+ mifillarc.c \
+ mifillarc.h \
+ mifillrct.c \
+ mifpolycon.c \
+ mifpoly.h \
+ migc.c \
+ migc.h \
+ miglblt.c \
+ miline.h \
+ mioverlay.c \
+ mioverlay.h \
+ mipointer.c \
+ mipointer.h \
+ mipointrst.h \
+ mipoly.c \
+ mipoly.h \
+ mipolycon.c \
+ mipolygen.c \
+ mipolypnt.c \
+ mipolyrect.c \
+ mipolyseg.c \
+ mipolytext.c \
+ mipolyutil.c \
+ mipushpxl.c \
+ miscanfill.h \
+ miscrinit.c \
+ mispans.c \
+ mispans.h \
+ misprite.c \
+ misprite.h \
+ mistruct.h \
+ mivaltree.c \
+ mivalidate.h \
+ miwideline.c \
+ miwideline.h \
+ miwindow.c \
+ mizerarc.c \
+ mizerarc.h \
+ mizerclip.c \
+ mizerline.c
diff --git a/xorg-server/mi/mi.h b/xorg-server/mi/mi.h
index 812edce94..eca65f20e 100644
--- a/xorg-server/mi/mi.h
+++ b/xorg-server/mi/mi.h
@@ -1,620 +1,603 @@
-/***********************************************************
-
-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 Digital Equipment Corporation, Maynard, Massachusetts.
-
- 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 of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL 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.
-
-******************************************************************/
-
-#ifndef MI_H
-#define MI_H
-#include <X11/X.h>
-#include "region.h"
-#include "validate.h"
-#include "window.h"
-#include "gc.h"
-#include <X11/fonts/font.h>
-#include "input.h"
-#include "cursor.h"
-#include "privates.h"
-#include "colormap.h"
-#include "events.h"
-
-#define MiBits CARD32
-
-typedef struct _miDash *miDashPtr;
-#define EVEN_DASH 0
-#define ODD_DASH ~0
-
-/* miarc.c */
-
-extern _X_EXPORT void miPolyArc(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-);
-
-/* mibitblt.c */
-
-extern _X_EXPORT RegionPtr miCopyArea(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr /*pGC*/,
- int /*xIn*/,
- int /*yIn*/,
- int /*widthSrc*/,
- int /*heightSrc*/,
- int /*xOut*/,
- int /*yOut*/
-);
-
-extern _X_EXPORT RegionPtr miCopyPlane(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr /*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*width*/,
- int /*height*/,
- int /*dstx*/,
- int /*dsty*/,
- unsigned long /*bitPlane*/
-);
-
-extern _X_EXPORT void miGetImage(
- DrawablePtr /*pDraw*/,
- int /*sx*/,
- int /*sy*/,
- int /*w*/,
- int /*h*/,
- unsigned int /*format*/,
- unsigned long /*planeMask*/,
- char * /*pdstLine*/
-);
-
-extern _X_EXPORT void miPutImage(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*depth*/,
- int /*x*/,
- int /*y*/,
- int /*w*/,
- int /*h*/,
- int /*leftPad*/,
- int /*format*/,
- char * /*pImage*/
-);
-
-/* micopy.c */
-
-#define miGetCompositeClip(pGC) ((pGC)->pCompositeClip)
-
-typedef void (*miCopyProc) (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pDstBox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
-
-extern _X_EXPORT void
-miCopyRegion (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- RegionPtr pDstRegion,
- int dx,
- int dy,
- miCopyProc copyProc,
- Pixel bitPlane,
- void *closure);
-
-extern _X_EXPORT RegionPtr
-miDoCopy (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut,
- miCopyProc copyProc,
- Pixel bitplane,
- void *closure);
-
-/* micursor.c */
-
-extern _X_EXPORT void miRecolorCursor(
- DeviceIntPtr /* pDev */,
- ScreenPtr /*pScr*/,
- CursorPtr /*pCurs*/,
- Bool /*displayed*/
-);
-
-/* midash.c */
-
-extern _X_EXPORT void miStepDash(
- int /*dist*/,
- int * /*pDashIndex*/,
- unsigned char * /*pDash*/,
- int /*numInDashList*/,
- int * /*pDashOffset*/
-);
-
-/* mieq.c */
-
-
-#ifndef INPUT_H
-typedef struct _DeviceRec *DevicePtr;
-#endif
-
-extern _X_EXPORT Bool mieqInit(
- void
-);
-
-extern _X_EXPORT void mieqFini(void);
-
-extern _X_EXPORT void mieqEnqueue(
- DeviceIntPtr /*pDev*/,
- InternalEvent* /*e*/
-);
-
-extern _X_EXPORT void mieqSwitchScreen(
- DeviceIntPtr /* pDev */,
- ScreenPtr /*pScreen*/,
- Bool /*fromDIX*/
-);
-
-extern _X_EXPORT void mieqProcessDeviceEvent(
- DeviceIntPtr /* dev*/,
- InternalEvent* /* event */,
- ScreenPtr /* screen*/
-);
-
-extern _X_EXPORT void mieqProcessInputEvents(
- void
-);
-
-extern DeviceIntPtr CopyGetMasterEvent(
- DeviceIntPtr /* sdev */,
- InternalEvent* /* original */,
- InternalEvent* /* copy */
-);
-
-/**
- * Custom input event handler. If you need to process input events in some
- * other way than the default path, register an input event handler for the
- * given internal event type.
- */
-typedef void (*mieqHandler)(int screen, InternalEvent* event, DeviceIntPtr dev);
-void _X_EXPORT mieqSetHandler(int event, mieqHandler handler);
-
-/* miexpose.c */
-
-extern _X_EXPORT RegionPtr miHandleExposures(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr /*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*width*/,
- int /*height*/,
- int /*dstx*/,
- int /*dsty*/,
- unsigned long /*plane*/
-);
-
-extern _X_EXPORT void miSendGraphicsExpose(
- ClientPtr /*client*/,
- RegionPtr /*pRgn*/,
- XID /*drawable*/,
- int /*major*/,
- int /*minor*/
-);
-
-extern _X_EXPORT void miSendExposures(
- WindowPtr /*pWin*/,
- RegionPtr /*pRgn*/,
- int /*dx*/,
- int /*dy*/
-);
-
-extern _X_EXPORT void miWindowExposures(
- WindowPtr /*pWin*/,
- RegionPtr /*prgn*/,
- RegionPtr /*other_exposed*/
-);
-
-extern _X_EXPORT void miPaintWindow(
- WindowPtr /*pWin*/,
- RegionPtr /*prgn*/,
- int /*what*/
-);
-
-extern _X_EXPORT void miClearDrawable(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/
-);
-
-/* mifillrct.c */
-
-extern _X_EXPORT void miPolyFillRect(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nrectFill*/,
- xRectangle * /*prectInit*/
-);
-
-/* miglblt.c */
-
-extern _X_EXPORT void miPolyGlyphBlt(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/
-);
-
-extern _X_EXPORT void miImageGlyphBlt(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/
-);
-
-/* mipoly.c */
-
-extern _X_EXPORT void miFillPolygon(
- DrawablePtr /*dst*/,
- GCPtr /*pgc*/,
- int /*shape*/,
- int /*mode*/,
- int /*count*/,
- DDXPointPtr /*pPts*/
-);
-
-/* mipolycon.c */
-
-extern _X_EXPORT Bool miFillConvexPoly(
- DrawablePtr /*dst*/,
- GCPtr /*pgc*/,
- int /*count*/,
- DDXPointPtr /*ptsIn*/
-);
-
-/* mipolygen.c */
-
-extern _X_EXPORT Bool miFillGeneralPoly(
- DrawablePtr /*dst*/,
- GCPtr /*pgc*/,
- int /*count*/,
- DDXPointPtr /*ptsIn*/
-);
-
-/* mipolypnt.c */
-
-extern _X_EXPORT void miPolyPoint(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- xPoint * /*pptInit*/
-);
-
-/* mipolyrect.c */
-
-extern _X_EXPORT void miPolyRectangle(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*nrects*/,
- xRectangle * /*pRects*/
-);
-
-/* mipolyseg.c */
-
-extern _X_EXPORT void miPolySegment(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*nseg*/,
- xSegment * /*pSegs*/
-);
-
-/* mipolytext.c */
-
-extern _X_EXPORT int miPolyText8(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- char * /*chars*/
-);
-
-extern _X_EXPORT int miPolyText16(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- unsigned short * /*chars*/
-);
-
-extern _X_EXPORT void miImageText8(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- char * /*chars*/
-);
-
-extern _X_EXPORT void miImageText16(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- unsigned short * /*chars*/
-);
-
-/* mipushpxl.c */
-
-extern _X_EXPORT void miPushPixels(
- GCPtr /*pGC*/,
- PixmapPtr /*pBitMap*/,
- DrawablePtr /*pDrawable*/,
- int /*dx*/,
- int /*dy*/,
- int /*xOrg*/,
- int /*yOrg*/
-);
-
-/* miregion.c */
-
-/* see also region.h */
-
-extern _X_EXPORT Bool miRectAlloc(
- RegionPtr /*pRgn*/,
- int /*n*/
-);
-
-#ifdef DEBUG
-extern _X_EXPORT Bool miValidRegion(
- RegionPtr /*prgn*/
-);
-#endif
-
-extern _X_EXPORT Bool miRegionBroken(RegionPtr pReg);
-
-/* miscrinit.c */
-
-extern _X_EXPORT Bool miModifyPixmapHeader(
- PixmapPtr /*pPixmap*/,
- int /*width*/,
- int /*height*/,
- int /*depth*/,
- int /*bitsPerPixel*/,
- int /*devKind*/,
- pointer /*pPixData*/
-);
-
-extern _X_EXPORT Bool miCreateScreenResources(
- ScreenPtr /*pScreen*/
-);
-
-extern _X_EXPORT Bool miScreenDevPrivateInit(
- ScreenPtr /*pScreen*/,
- int /*width*/,
- pointer /*pbits*/
-);
-
-extern _X_EXPORT Bool miScreenInit(
- ScreenPtr /*pScreen*/,
- pointer /*pbits*/,
- int /*xsize*/,
- int /*ysize*/,
- int /*dpix*/,
- int /*dpiy*/,
- int /*width*/,
- int /*rootDepth*/,
- int /*numDepths*/,
- DepthPtr /*depths*/,
- VisualID /*rootVisual*/,
- int /*numVisuals*/,
- VisualPtr /*visuals*/
-);
-
-extern _X_EXPORT DevPrivateKey miAllocateGCPrivateIndex(
- void
-);
-
-/* mivaltree.c */
-
-extern _X_EXPORT int miShapedWindowIn(
- ScreenPtr /*pScreen*/,
- RegionPtr /*universe*/,
- RegionPtr /*bounding*/,
- BoxPtr /*rect*/,
- int /*x*/,
- int /*y*/
-);
-
-typedef void
-(*SetRedirectBorderClipProcPtr) (WindowPtr pWindow, RegionPtr pRegion);
-
-typedef RegionPtr
-(*GetRedirectBorderClipProcPtr) (WindowPtr pWindow);
-
-extern _X_EXPORT void
-miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip,
- GetRedirectBorderClipProcPtr getBorderClip);
-
-extern _X_EXPORT int miValidateTree(
- WindowPtr /*pParent*/,
- WindowPtr /*pChild*/,
- VTKind /*kind*/
-);
-
-extern _X_EXPORT void miWideLine(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pPts*/
-);
-
-extern _X_EXPORT void miWideDash(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pPts*/
-);
-
-/* miwindow.c */
-
-extern _X_EXPORT void miClearToBackground(
- WindowPtr /*pWin*/,
- int /*x*/,
- int /*y*/,
- int /*w*/,
- int /*h*/,
- Bool /*generateExposures*/
-);
-
-extern _X_EXPORT void miMarkWindow(
- WindowPtr /*pWin*/
-);
-
-extern _X_EXPORT Bool miMarkOverlappedWindows(
- WindowPtr /*pWin*/,
- WindowPtr /*pFirst*/,
- WindowPtr * /*ppLayerWin*/
-);
-
-extern _X_EXPORT void miHandleValidateExposures(
- WindowPtr /*pWin*/
-);
-
-extern _X_EXPORT void miMoveWindow(
- WindowPtr /*pWin*/,
- int /*x*/,
- int /*y*/,
- WindowPtr /*pNextSib*/,
- VTKind /*kind*/
-);
-
-extern _X_EXPORT void miSlideAndSizeWindow(
- WindowPtr /*pWin*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*w*/,
- unsigned int /*h*/,
- WindowPtr /*pSib*/
-);
-
-extern _X_EXPORT WindowPtr miGetLayerWindow(
- WindowPtr /*pWin*/
-);
-
-extern _X_EXPORT void miSetShape(
- WindowPtr /*pWin*/
-);
-
-extern _X_EXPORT void miChangeBorderWidth(
- WindowPtr /*pWin*/,
- unsigned int /*width*/
-);
-
-extern _X_EXPORT void miMarkUnrealizedWindow(
- WindowPtr /*pChild*/,
- WindowPtr /*pWin*/,
- Bool /*fromConfigure*/
-);
-
-extern _X_EXPORT void miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth);
-
-/* mizerarc.c */
-
-extern _X_EXPORT void miZeroPolyArc(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-);
-
-/* mizerline.c */
-
-extern _X_EXPORT void miZeroLine(
- DrawablePtr /*dst*/,
- GCPtr /*pgc*/,
- int /*mode*/,
- int /*nptInit*/,
- DDXPointRec * /*pptInit*/
-);
-
-extern _X_EXPORT void miZeroDashLine(
- DrawablePtr /*dst*/,
- GCPtr /*pgc*/,
- int /*mode*/,
- int /*nptInit*/,
- DDXPointRec * /*pptInit*/
-);
-
-extern _X_EXPORT void miPolyFillArc(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-);
-
-#endif /* MI_H */
+/***********************************************************
+
+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 Digital Equipment Corporation, Maynard, Massachusetts.
+
+ 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 of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL 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.
+
+******************************************************************/
+
+#ifndef MI_H
+#define MI_H
+#include <X11/X.h>
+#include "region.h"
+#include "validate.h"
+#include "window.h"
+#include "gc.h"
+#include <X11/fonts/font.h>
+#include "input.h"
+#include "cursor.h"
+#include "privates.h"
+#include "colormap.h"
+#include "events.h"
+
+#define MiBits CARD32
+
+typedef struct _miDash *miDashPtr;
+#define EVEN_DASH 0
+#define ODD_DASH ~0
+
+/* miarc.c */
+
+extern _X_EXPORT void miPolyArc(
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*narcs*/,
+ xArc * /*parcs*/
+);
+
+/* mibitblt.c */
+
+extern _X_EXPORT RegionPtr miCopyArea(
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ GCPtr /*pGC*/,
+ int /*xIn*/,
+ int /*yIn*/,
+ int /*widthSrc*/,
+ int /*heightSrc*/,
+ int /*xOut*/,
+ int /*yOut*/
+);
+
+extern _X_EXPORT RegionPtr miCopyPlane(
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ GCPtr /*pGC*/,
+ int /*srcx*/,
+ int /*srcy*/,
+ int /*width*/,
+ int /*height*/,
+ int /*dstx*/,
+ int /*dsty*/,
+ unsigned long /*bitPlane*/
+);
+
+extern _X_EXPORT void miGetImage(
+ DrawablePtr /*pDraw*/,
+ int /*sx*/,
+ int /*sy*/,
+ int /*w*/,
+ int /*h*/,
+ unsigned int /*format*/,
+ unsigned long /*planeMask*/,
+ char * /*pdstLine*/
+);
+
+extern _X_EXPORT void miPutImage(
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*depth*/,
+ int /*x*/,
+ int /*y*/,
+ int /*w*/,
+ int /*h*/,
+ int /*leftPad*/,
+ int /*format*/,
+ char * /*pImage*/
+);
+
+/* micopy.c */
+
+#define miGetCompositeClip(pGC) ((pGC)->pCompositeClip)
+
+typedef void (*miCopyProc) (DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pDstBox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse,
+ Bool upsidedown,
+ Pixel bitplane,
+ void *closure);
+
+extern _X_EXPORT void
+miCopyRegion (DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ RegionPtr pDstRegion,
+ int dx,
+ int dy,
+ miCopyProc copyProc,
+ Pixel bitPlane,
+ void *closure);
+
+extern _X_EXPORT RegionPtr
+miDoCopy (DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn,
+ int yIn,
+ int widthSrc,
+ int heightSrc,
+ int xOut,
+ int yOut,
+ miCopyProc copyProc,
+ Pixel bitplane,
+ void *closure);
+
+/* micursor.c */
+
+extern _X_EXPORT void miRecolorCursor(
+ DeviceIntPtr /* pDev */,
+ ScreenPtr /*pScr*/,
+ CursorPtr /*pCurs*/,
+ Bool /*displayed*/
+);
+
+/* midash.c */
+
+extern _X_EXPORT void miStepDash(
+ int /*dist*/,
+ int * /*pDashIndex*/,
+ unsigned char * /*pDash*/,
+ int /*numInDashList*/,
+ int * /*pDashOffset*/
+);
+
+/* mieq.c */
+
+
+#ifndef INPUT_H
+typedef struct _DeviceRec *DevicePtr;
+#endif
+
+extern _X_EXPORT Bool mieqInit(
+ void
+);
+
+extern _X_EXPORT void mieqFini(void);
+
+extern _X_EXPORT void mieqEnqueue(
+ DeviceIntPtr /*pDev*/,
+ InternalEvent* /*e*/
+);
+
+extern _X_EXPORT void mieqSwitchScreen(
+ DeviceIntPtr /* pDev */,
+ ScreenPtr /*pScreen*/,
+ Bool /*fromDIX*/
+);
+
+extern _X_EXPORT void mieqProcessDeviceEvent(
+ DeviceIntPtr /* dev*/,
+ InternalEvent* /* event */,
+ ScreenPtr /* screen*/
+);
+
+extern _X_EXPORT void mieqProcessInputEvents(
+ void
+);
+
+extern DeviceIntPtr CopyGetMasterEvent(
+ DeviceIntPtr /* sdev */,
+ InternalEvent* /* original */,
+ InternalEvent* /* copy */
+);
+
+/**
+ * Custom input event handler. If you need to process input events in some
+ * other way than the default path, register an input event handler for the
+ * given internal event type.
+ */
+typedef void (*mieqHandler)(int screen, InternalEvent* event, DeviceIntPtr dev);
+void _X_EXPORT mieqSetHandler(int event, mieqHandler handler);
+
+/* miexpose.c */
+
+extern _X_EXPORT RegionPtr miHandleExposures(
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ GCPtr /*pGC*/,
+ int /*srcx*/,
+ int /*srcy*/,
+ int /*width*/,
+ int /*height*/,
+ int /*dstx*/,
+ int /*dsty*/,
+ unsigned long /*plane*/
+);
+
+extern _X_EXPORT void miSendGraphicsExpose(
+ ClientPtr /*client*/,
+ RegionPtr /*pRgn*/,
+ XID /*drawable*/,
+ int /*major*/,
+ int /*minor*/
+);
+
+extern _X_EXPORT void miSendExposures(
+ WindowPtr /*pWin*/,
+ RegionPtr /*pRgn*/,
+ int /*dx*/,
+ int /*dy*/
+);
+
+extern _X_EXPORT void miWindowExposures(
+ WindowPtr /*pWin*/,
+ RegionPtr /*prgn*/,
+ RegionPtr /*other_exposed*/
+);
+
+extern _X_EXPORT void miPaintWindow(
+ WindowPtr /*pWin*/,
+ RegionPtr /*prgn*/,
+ int /*what*/
+);
+
+extern _X_EXPORT void miClearDrawable(
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/
+);
+
+/* mifillrct.c */
+
+extern _X_EXPORT void miPolyFillRect(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nrectFill*/,
+ xRectangle * /*prectInit*/
+);
+
+/* miglblt.c */
+
+extern _X_EXPORT void miPolyGlyphBlt(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ unsigned int /*nglyph*/,
+ CharInfoPtr * /*ppci*/,
+ pointer /*pglyphBase*/
+);
+
+extern _X_EXPORT void miImageGlyphBlt(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ unsigned int /*nglyph*/,
+ CharInfoPtr * /*ppci*/,
+ pointer /*pglyphBase*/
+);
+
+/* mipoly.c */
+
+extern _X_EXPORT void miFillPolygon(
+ DrawablePtr /*dst*/,
+ GCPtr /*pgc*/,
+ int /*shape*/,
+ int /*mode*/,
+ int /*count*/,
+ DDXPointPtr /*pPts*/
+);
+
+/* mipolycon.c */
+
+extern _X_EXPORT Bool miFillConvexPoly(
+ DrawablePtr /*dst*/,
+ GCPtr /*pgc*/,
+ int /*count*/,
+ DDXPointPtr /*ptsIn*/
+);
+
+/* mipolygen.c */
+
+extern _X_EXPORT Bool miFillGeneralPoly(
+ DrawablePtr /*dst*/,
+ GCPtr /*pgc*/,
+ int /*count*/,
+ DDXPointPtr /*ptsIn*/
+);
+
+/* mipolypnt.c */
+
+extern _X_EXPORT void miPolyPoint(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ xPoint * /*pptInit*/
+);
+
+/* mipolyrect.c */
+
+extern _X_EXPORT void miPolyRectangle(
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*nrects*/,
+ xRectangle * /*pRects*/
+);
+
+/* mipolyseg.c */
+
+extern _X_EXPORT void miPolySegment(
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*nseg*/,
+ xSegment * /*pSegs*/
+);
+
+/* mipolytext.c */
+
+extern _X_EXPORT int miPolyText8(
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ int /*count*/,
+ char * /*chars*/
+);
+
+extern _X_EXPORT int miPolyText16(
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ int /*count*/,
+ unsigned short * /*chars*/
+);
+
+extern _X_EXPORT void miImageText8(
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ int /*count*/,
+ char * /*chars*/
+);
+
+extern _X_EXPORT void miImageText16(
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ int /*count*/,
+ unsigned short * /*chars*/
+);
+
+/* mipushpxl.c */
+
+extern _X_EXPORT void miPushPixels(
+ GCPtr /*pGC*/,
+ PixmapPtr /*pBitMap*/,
+ DrawablePtr /*pDrawable*/,
+ int /*dx*/,
+ int /*dy*/,
+ int /*xOrg*/,
+ int /*yOrg*/
+);
+
+/* miscrinit.c */
+
+extern _X_EXPORT Bool miModifyPixmapHeader(
+ PixmapPtr /*pPixmap*/,
+ int /*width*/,
+ int /*height*/,
+ int /*depth*/,
+ int /*bitsPerPixel*/,
+ int /*devKind*/,
+ pointer /*pPixData*/
+);
+
+extern _X_EXPORT Bool miCreateScreenResources(
+ ScreenPtr /*pScreen*/
+);
+
+extern _X_EXPORT Bool miScreenDevPrivateInit(
+ ScreenPtr /*pScreen*/,
+ int /*width*/,
+ pointer /*pbits*/
+);
+
+extern _X_EXPORT Bool miScreenInit(
+ ScreenPtr /*pScreen*/,
+ pointer /*pbits*/,
+ int /*xsize*/,
+ int /*ysize*/,
+ int /*dpix*/,
+ int /*dpiy*/,
+ int /*width*/,
+ int /*rootDepth*/,
+ int /*numDepths*/,
+ DepthPtr /*depths*/,
+ VisualID /*rootVisual*/,
+ int /*numVisuals*/,
+ VisualPtr /*visuals*/
+);
+
+extern _X_EXPORT DevPrivateKey miAllocateGCPrivateIndex(
+ void
+);
+
+/* mivaltree.c */
+
+extern _X_EXPORT int miShapedWindowIn(
+ RegionPtr /*universe*/,
+ RegionPtr /*bounding*/,
+ BoxPtr /*rect*/,
+ int /*x*/,
+ int /*y*/
+);
+
+typedef void
+(*SetRedirectBorderClipProcPtr) (WindowPtr pWindow, RegionPtr pRegion);
+
+typedef RegionPtr
+(*GetRedirectBorderClipProcPtr) (WindowPtr pWindow);
+
+extern _X_EXPORT void
+miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip,
+ GetRedirectBorderClipProcPtr getBorderClip);
+
+extern _X_EXPORT int miValidateTree(
+ WindowPtr /*pParent*/,
+ WindowPtr /*pChild*/,
+ VTKind /*kind*/
+);
+
+extern _X_EXPORT void miWideLine(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ DDXPointPtr /*pPts*/
+);
+
+extern _X_EXPORT void miWideDash(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ DDXPointPtr /*pPts*/
+);
+
+/* miwindow.c */
+
+extern _X_EXPORT void miClearToBackground(
+ WindowPtr /*pWin*/,
+ int /*x*/,
+ int /*y*/,
+ int /*w*/,
+ int /*h*/,
+ Bool /*generateExposures*/
+);
+
+extern _X_EXPORT void miMarkWindow(
+ WindowPtr /*pWin*/
+);
+
+extern _X_EXPORT Bool miMarkOverlappedWindows(
+ WindowPtr /*pWin*/,
+ WindowPtr /*pFirst*/,
+ WindowPtr * /*ppLayerWin*/
+);
+
+extern _X_EXPORT void miHandleValidateExposures(
+ WindowPtr /*pWin*/
+);
+
+extern _X_EXPORT void miMoveWindow(
+ WindowPtr /*pWin*/,
+ int /*x*/,
+ int /*y*/,
+ WindowPtr /*pNextSib*/,
+ VTKind /*kind*/
+);
+
+extern _X_EXPORT void miSlideAndSizeWindow(
+ WindowPtr /*pWin*/,
+ int /*x*/,
+ int /*y*/,
+ unsigned int /*w*/,
+ unsigned int /*h*/,
+ WindowPtr /*pSib*/
+);
+
+extern _X_EXPORT WindowPtr miGetLayerWindow(
+ WindowPtr /*pWin*/
+);
+
+extern _X_EXPORT void miSetShape(
+ WindowPtr /*pWin*/,
+ int /*kind*/
+);
+
+extern _X_EXPORT void miChangeBorderWidth(
+ WindowPtr /*pWin*/,
+ unsigned int /*width*/
+);
+
+extern _X_EXPORT void miMarkUnrealizedWindow(
+ WindowPtr /*pChild*/,
+ WindowPtr /*pWin*/,
+ Bool /*fromConfigure*/
+);
+
+extern _X_EXPORT void miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth);
+
+/* mizerarc.c */
+
+extern _X_EXPORT void miZeroPolyArc(
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*narcs*/,
+ xArc * /*parcs*/
+);
+
+/* mizerline.c */
+
+extern _X_EXPORT void miZeroLine(
+ DrawablePtr /*dst*/,
+ GCPtr /*pgc*/,
+ int /*mode*/,
+ int /*nptInit*/,
+ DDXPointRec * /*pptInit*/
+);
+
+extern _X_EXPORT void miZeroDashLine(
+ DrawablePtr /*dst*/,
+ GCPtr /*pgc*/,
+ int /*mode*/,
+ int /*nptInit*/,
+ DDXPointRec * /*pptInit*/
+);
+
+extern _X_EXPORT void miPolyFillArc(
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ int /*narcs*/,
+ xArc * /*parcs*/
+);
+
+#endif /* MI_H */
diff --git a/xorg-server/mi/miarc.c b/xorg-server/mi/miarc.c
index 3b4a628e4..c564eb3db 100644
--- a/xorg-server/mi/miarc.c
+++ b/xorg-server/mi/miarc.c
@@ -1561,7 +1561,7 @@ miGetArcPts(
cdt = 2 * miDcos(dt);
if (!(poly = (SppPointPtr) realloc((pointer)*ppPts,
(cpt + count) * sizeof(SppPointRec))))
- return(0);
+ return 0;
*ppPts = poly;
xc = parc->width/2.0; /* store half width and half height */
@@ -1598,7 +1598,7 @@ miGetArcPts(
poly[cpt +i -1].y = (miDsin(st + et) * parc->height/2.0 + yc);
}
- return(count);
+ return count;
}
struct arcData {
@@ -3081,10 +3081,8 @@ fillSpans (
(*pGC->ops->FillSpans) (pDrawable, pGC, i, xSpans, xWidths, TRUE);
}
disposeFinalSpans ();
- if (xSpans)
- free(xSpans);
- if (xWidths)
- free(xWidths);
+ free(xSpans);
+ free(xWidths);
finalMiny = 0;
finalMaxy = -1;
finalSize = 0;
@@ -3135,9 +3133,9 @@ realFindSpan (int y)
free(finalSpans);
}
if ((i = finalMiny - newMiny) > 0)
- bzero ((char *)newSpans, i * sizeof (struct finalSpan *));
+ memset((char *)newSpans, 0, i * sizeof (struct finalSpan *));
if ((i = newMaxy - finalMaxy) > 0)
- bzero ((char *)(newSpans + newSize - i),
+ memset((char *)(newSpans + newSize - i), 0,
i * sizeof (struct finalSpan *));
finalSpans = newSpans;
finalMaxy = newMaxy;
diff --git a/xorg-server/mi/mibitblt.c b/xorg-server/mi/mibitblt.c
index b1e188d5a..3374ae385 100644
--- a/xorg-server/mi/mibitblt.c
+++ b/xorg-server/mi/mibitblt.c
@@ -116,7 +116,7 @@ miCopyArea(DrawablePtr pSrcDrawable,
box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
- prgnSrcClip = REGION_CREATE(pGC->pScreen, &box, 1);
+ prgnSrcClip = RegionCreate(&box, 1);
realSrcClip = 1;
}
else
@@ -145,17 +145,14 @@ miCopyArea(DrawablePtr pSrcDrawable,
pptFirst = ppt = malloc(heightSrc * sizeof(DDXPointRec));
pwidthFirst = pwidth = malloc(heightSrc * sizeof(unsigned int));
- numRects = REGION_NUM_RECTS(prgnSrcClip);
- boxes = REGION_RECTS(prgnSrcClip);
+ numRects = RegionNumRects(prgnSrcClip);
+ boxes = RegionRects(prgnSrcClip);
ordering = malloc(numRects * sizeof(unsigned int));
if(!pptFirst || !pwidthFirst || !ordering)
{
- if (ordering)
- free(ordering);
- if (pwidthFirst)
- free(pwidthFirst);
- if (pptFirst)
- free(pptFirst);
+ free(ordering);
+ free(pwidthFirst);
+ free(pptFirst);
return NULL;
}
@@ -259,7 +256,7 @@ miCopyArea(DrawablePtr pSrcDrawable,
prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
widthSrc, heightSrc, xOut, yOut, (unsigned long)0);
if(realSrcClip)
- REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ RegionDestroy(prgnSrcClip);
free(ordering);
free(pwidthFirst);
@@ -382,7 +379,7 @@ miGetPlane(
pOut += delta;
}
}
- return(result);
+ return result;
}
@@ -433,8 +430,8 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
pwidth = pwidthFirst = malloc(h * sizeof(int));
if(!pptFirst || !pwidthFirst)
{
- if (pwidthFirst) free(pwidthFirst);
- if (pptFirst) free(pptFirst);
+ free(pwidthFirst);
+ free(pptFirst);
FreeScratchGC(pGCT);
return;
}
@@ -443,9 +440,9 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
to destroy what it's sent. note that this means we don't
have to free prgnSrcClip ourselves.
*/
- prgnSrcClip = REGION_CREATE(pGCT->pScreen, NULL, 0);
- REGION_COPY(pGCT->pScreen, prgnSrcClip, prgnSrc);
- REGION_TRANSLATE(pGCT->pScreen, prgnSrcClip, srcx, 0);
+ prgnSrcClip = RegionCreate(NULL, 0);
+ RegionCopy(prgnSrcClip, prgnSrc);
+ RegionTranslate(prgnSrcClip, srcx, 0);
(*pGCT->funcs->ChangeClip)(pGCT, CT_REGION, prgnSrcClip, 0);
ValidateGC((DrawablePtr)pPixmap, pGCT);
@@ -578,7 +575,7 @@ miCopyPlane( DrawablePtr pSrcDrawable,
box.x2 = box.x1;
if (box.y1 > box.y2)
box.y2 = box.y1;
- prgnSrc = REGION_CREATE(pGC->pScreen, &box, 1);
+ prgnSrc = RegionCreate(&box, 1);
if (pSrcDrawable->type != DRAWABLE_PIXMAP) {
/* clip to visible drawable */
@@ -586,15 +583,15 @@ miCopyPlane( DrawablePtr pSrcDrawable,
if (pGC->subWindowMode == IncludeInferiors)
{
RegionPtr clipList = NotClippedByChildren ((WindowPtr) pSrcDrawable);
- REGION_INTERSECT(pGC->pScreen, prgnSrc, prgnSrc, clipList);
- REGION_DESTROY(pGC->pScreen, clipList);
+ RegionIntersect(prgnSrc, prgnSrc, clipList);
+ RegionDestroy(clipList);
} else
- REGION_INTERSECT(pGC->pScreen, prgnSrc, prgnSrc,
+ RegionIntersect(prgnSrc, prgnSrc,
&((WindowPtr)pSrcDrawable)->clipList);
}
- box = *REGION_EXTENTS(pGC->pScreen, prgnSrc);
- REGION_TRANSLATE(pGC->pScreen, prgnSrc, -box.x1, -box.y1);
+ box = *RegionExtents(prgnSrc);
+ RegionTranslate(prgnSrc, -box.x1, -box.y1);
if ((box.x2 > box.x1) && (box.y2 > box.y1))
{
@@ -618,7 +615,7 @@ miCopyPlane( DrawablePtr pSrcDrawable,
}
prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, srcy,
width, height, dstx, dsty, bitPlane);
- REGION_DESTROY(pGC->pScreen, prgnSrc);
+ RegionDestroy(prgnSrc);
return prgnExposed;
}
@@ -761,11 +758,11 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
box.y1 = 0;
box.x2 = w;
box.y2 = h;
- prgnSrc = REGION_CREATE(pGC->pScreen, &box, 1);
+ prgnSrc = RegionCreate(&box, 1);
miOpqStipDrawable(pDraw, pGC, prgnSrc, (MiBits *) pImage,
leftPad, w, h, x, y);
- REGION_DESTROY(pGC->pScreen, prgnSrc);
+ RegionDestroy(prgnSrc);
break;
case XYPixmap:
@@ -801,10 +798,8 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
pwidth = pwidthFirst = malloc(h * sizeof(int));
if(!pptFirst || !pwidthFirst)
{
- if (pwidthFirst)
- free(pwidthFirst);
- if (pptFirst)
- free(pptFirst);
+ free(pwidthFirst);
+ free(pptFirst);
return;
}
if (pGC->miTranslate)
diff --git a/xorg-server/mi/micmap.c b/xorg-server/mi/micmap.c
index ed8641c9e..12aa6a2e5 100644
--- a/xorg-server/mi/micmap.c
+++ b/xorg-server/mi/micmap.c
@@ -40,15 +40,14 @@
#include "globals.h"
#include "micmap.h"
-static int micmapScrPrivateKeyIndex;
-DevPrivateKey micmapScrPrivateKey = &micmapScrPrivateKeyIndex;
+DevPrivateKeyRec micmapScrPrivateKeyRec;
int
miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{
if (GetInstalledmiColormap(pScreen)) {
*pmaps = GetInstalledmiColormap(pScreen)->mid;
- return (1);
+ return 1;
}
return 0;
}
@@ -300,6 +299,9 @@ miCreateDefColormap(ScreenPtr pScreen)
ColormapPtr cmap;
int alloctype;
+ if (!dixRegisterPrivateKey(&micmapScrPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
for (pVisual = pScreen->visuals;
pVisual->vid != pScreen->rootVisual;
pVisual++)
diff --git a/xorg-server/mi/micmap.h b/xorg-server/mi/micmap.h
index 8ad94b9dd..dcfcfd47f 100644
--- a/xorg-server/mi/micmap.h
+++ b/xorg-server/mi/micmap.h
@@ -1,63 +1,63 @@
-
-#include "colormapst.h"
-
-#ifndef _MICMAP_H_
-#define _MICMAP_H_
-
-#define GetInstalledmiColormap(s) \
- ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, micmapScrPrivateKey))
-#define SetInstalledmiColormap(s,c) \
- (dixSetPrivate(&(s)->devPrivates, micmapScrPrivateKey, c))
-
-extern _X_EXPORT DevPrivateKey micmapScrPrivateKey;
-
-
-typedef Bool (* miInitVisualsProcPtr)(VisualPtr *, DepthPtr *, int *, int *,
- int *, VisualID *, unsigned long, int,
- int);
-
-extern _X_EXPORT int miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps);
-extern _X_EXPORT void miInstallColormap(ColormapPtr pmap);
-extern _X_EXPORT void miUninstallColormap(ColormapPtr pmap);
-
-extern _X_EXPORT void miResolveColor(unsigned short *, unsigned short *, unsigned short *,
- VisualPtr);
-extern _X_EXPORT Bool miInitializeColormap(ColormapPtr);
-extern _X_EXPORT int miExpandDirectColors(ColormapPtr, int, xColorItem *, xColorItem *);
-extern _X_EXPORT Bool miCreateDefColormap(ScreenPtr);
-extern _X_EXPORT void miClearVisualTypes(void);
-extern _X_EXPORT Bool miSetVisualTypes(int, int, int, int);
-extern _X_EXPORT Bool miSetPixmapDepths(void);
-extern _X_EXPORT Bool miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
- int preferredCVC,
- Pixel redMask, Pixel greenMask, Pixel blueMask);
-extern _X_EXPORT int miGetDefaultVisualMask(int);
-extern _X_EXPORT Bool miInitVisuals(VisualPtr *, DepthPtr *, int *, int *, int *, VisualID *,
- unsigned long, int, int);
-
-#define MAX_PSEUDO_DEPTH 10
-#define MIN_TRUE_DEPTH 6
-
-#define StaticGrayMask (1 << StaticGray)
-#define GrayScaleMask (1 << GrayScale)
-#define StaticColorMask (1 << StaticColor)
-#define PseudoColorMask (1 << PseudoColor)
-#define TrueColorMask (1 << TrueColor)
-#define DirectColorMask (1 << DirectColor)
-
-#define ALL_VISUALS (StaticGrayMask|\
- GrayScaleMask|\
- StaticColorMask|\
- PseudoColorMask|\
- TrueColorMask|\
- DirectColorMask)
-
-#define LARGE_VISUALS (TrueColorMask|\
- DirectColorMask)
-
-#define SMALL_VISUALS (StaticGrayMask|\
- GrayScaleMask|\
- StaticColorMask|\
- PseudoColorMask)
-
-#endif /* _MICMAP_H_ */
+
+#include "colormapst.h"
+
+#ifndef _MICMAP_H_
+#define _MICMAP_H_
+
+#define GetInstalledmiColormap(s) \
+ ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, micmapScrPrivateKey))
+#define SetInstalledmiColormap(s,c) \
+ (dixSetPrivate(&(s)->devPrivates, micmapScrPrivateKey, c))
+
+extern _X_EXPORT DevPrivateKeyRec micmapScrPrivateKeyRec;
+#define micmapScrPrivateKey (&micmapScrPrivateKeyRec)
+
+typedef Bool (* miInitVisualsProcPtr)(VisualPtr *, DepthPtr *, int *, int *,
+ int *, VisualID *, unsigned long, int,
+ int);
+
+extern _X_EXPORT int miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps);
+extern _X_EXPORT void miInstallColormap(ColormapPtr pmap);
+extern _X_EXPORT void miUninstallColormap(ColormapPtr pmap);
+
+extern _X_EXPORT void miResolveColor(unsigned short *, unsigned short *, unsigned short *,
+ VisualPtr);
+extern _X_EXPORT Bool miInitializeColormap(ColormapPtr);
+extern _X_EXPORT int miExpandDirectColors(ColormapPtr, int, xColorItem *, xColorItem *);
+extern _X_EXPORT Bool miCreateDefColormap(ScreenPtr);
+extern _X_EXPORT void miClearVisualTypes(void);
+extern _X_EXPORT Bool miSetVisualTypes(int, int, int, int);
+extern _X_EXPORT Bool miSetPixmapDepths(void);
+extern _X_EXPORT Bool miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
+ int preferredCVC,
+ Pixel redMask, Pixel greenMask, Pixel blueMask);
+extern _X_EXPORT int miGetDefaultVisualMask(int);
+extern _X_EXPORT Bool miInitVisuals(VisualPtr *, DepthPtr *, int *, int *, int *, VisualID *,
+ unsigned long, int, int);
+
+#define MAX_PSEUDO_DEPTH 10
+#define MIN_TRUE_DEPTH 6
+
+#define StaticGrayMask (1 << StaticGray)
+#define GrayScaleMask (1 << GrayScale)
+#define StaticColorMask (1 << StaticColor)
+#define PseudoColorMask (1 << PseudoColor)
+#define TrueColorMask (1 << TrueColor)
+#define DirectColorMask (1 << DirectColor)
+
+#define ALL_VISUALS (StaticGrayMask|\
+ GrayScaleMask|\
+ StaticColorMask|\
+ PseudoColorMask|\
+ TrueColorMask|\
+ DirectColorMask)
+
+#define LARGE_VISUALS (TrueColorMask|\
+ DirectColorMask)
+
+#define SMALL_VISUALS (StaticGrayMask|\
+ GrayScaleMask|\
+ StaticColorMask|\
+ PseudoColorMask)
+
+#endif /* _MICMAP_H_ */
diff --git a/xorg-server/mi/micopy.c b/xorg-server/mi/micopy.c
index 9d5c5ce5e..da52bc659 100644
--- a/xorg-server/mi/micopy.c
+++ b/xorg-server/mi/micopy.c
@@ -49,8 +49,8 @@ miCopyRegion (DrawablePtr pSrcDrawable,
int nbox;
BoxPtr pboxNew1, pboxNew2, pboxBase, pboxNext, pboxTmp;
- pbox = REGION_RECTS(pDstRegion);
- nbox = REGION_NUM_RECTS(pDstRegion);
+ pbox = RegionRects(pDstRegion);
+ nbox = RegionNumRects(pDstRegion);
/* XXX we have to err on the side of safety when both are windows,
* because we don't know if IncludeInferiors is being used.
@@ -108,8 +108,7 @@ miCopyRegion (DrawablePtr pSrcDrawable,
pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
if(!pboxNew2)
{
- if (pboxNew1)
- free(pboxNew1);
+ free(pboxNew1);
return;
}
pboxBase = pboxNext = pbox;
@@ -143,10 +142,8 @@ miCopyRegion (DrawablePtr pSrcDrawable,
dx, dy,
reverse, upsidedown, bitPlane, closure);
- if (pboxNew1)
- free(pboxNew1);
- if (pboxNew2)
- free(pboxNew2);
+ free(pboxNew1);
+ free(pboxNew2);
}
RegionPtr
@@ -209,8 +206,7 @@ miDoCopy (DrawablePtr pSrcDrawable,
* VT is inactive, make sure the region isn't empty
*/
if (!((WindowPtr) pSrcDrawable)->parent &&
- REGION_NOTEMPTY (pSrcDrawable->pScreen,
- &((WindowPtr) pSrcDrawable)->borderClip))
+ RegionNotEmpty(&((WindowPtr) pSrcDrawable)->borderClip))
{
/*
* special case bitblt from root window in
@@ -291,9 +287,9 @@ miDoCopy (DrawablePtr pSrcDrawable,
blown region and call intersect */
cclip = miGetCompositeClip(pGC);
- if (REGION_NUM_RECTS(cclip) == 1)
+ if (RegionNumRects(cclip) == 1)
{
- BoxPtr pBox = REGION_RECTS(cclip);
+ BoxPtr pBox = RegionRects(cclip);
if (box_x1 < pBox->x1) box_x1 = pBox->x1;
if (box_x2 > pBox->x2) box_x2 = pBox->x2;
@@ -306,7 +302,7 @@ miDoCopy (DrawablePtr pSrcDrawable,
/* Check to see if the region is empty */
if (box_x1 >= box_x2 || box_y1 >= box_y2)
{
- REGION_NULL(pGC->pScreen, &rgnDst);
+ RegionNull(&rgnDst);
}
else
{
@@ -315,25 +311,25 @@ miDoCopy (DrawablePtr pSrcDrawable,
box.y1 = box_y1;
box.x2 = box_x2;
box.y2 = box_y2;
- REGION_INIT(pGC->pScreen, &rgnDst, &box, 1);
+ RegionInit(&rgnDst, &box, 1);
}
/* Clip against complex source if needed */
if (!fastSrc)
{
- REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
- REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
+ RegionIntersect(&rgnDst, &rgnDst, prgnSrcClip);
+ RegionTranslate(&rgnDst, -dx, -dy);
}
/* Clip against complex dest if needed */
if (!fastDst)
{
- REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst,
+ RegionIntersect(&rgnDst, &rgnDst,
miGetCompositeClip(pGC));
}
/* Do bit blitting */
- numRects = REGION_NUM_RECTS(&rgnDst);
+ numRects = RegionNumRects(&rgnDst);
if (numRects && widthSrc && heightSrc)
miCopyRegion (pSrcDrawable, pDstDrawable, pGC,
&rgnDst, dx, dy, copyProc, bitPlane, closure);
@@ -347,8 +343,8 @@ miDoCopy (DrawablePtr pSrcDrawable,
xOut - pDstDrawable->x,
yOut - pDstDrawable->y,
(unsigned long) bitPlane);
- REGION_UNINIT(pGC->pScreen, &rgnDst);
+ RegionUninit(&rgnDst);
if (freeSrcClip)
- REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ RegionDestroy(prgnSrcClip);
return prgnExposed;
}
diff --git a/xorg-server/mi/midispcur.c b/xorg-server/mi/midispcur.c
index d56080488..7d79042f4 100644
--- a/xorg-server/mi/midispcur.c
+++ b/xorg-server/mi/midispcur.c
@@ -54,40 +54,40 @@ in this Software without prior written authorization from The Open Group.
# include "inputstr.h"
/* per-screen private data */
-static int miDCScreenKeyIndex;
-static DevPrivateKey miDCScreenKey = &miDCScreenKeyIndex;
+static DevPrivateKeyRec miDCScreenKeyRec;
+#define miDCScreenKey (&miDCScreenKeyRec)
static Bool miDCCloseScreen(int index, ScreenPtr pScreen);
-/* per device per-screen private data */
-static int miDCSpriteKeyIndex[MAXSCREENS];
-static DevPrivateKey miDCSpriteKey = miDCSpriteKeyIndex;
-
+/* per device private data */
typedef struct {
GCPtr pSourceGC, pMaskGC;
GCPtr pSaveGC, pRestoreGC;
- GCPtr pMoveGC;
- GCPtr pPixSourceGC, pPixMaskGC;
- PixmapPtr pSave, pTemp;
+ PixmapPtr pSave;
#ifdef ARGB_CURSOR
PicturePtr pRootPicture;
- PicturePtr pTempPicture;
#endif
} miDCBufferRec, *miDCBufferPtr;
-#define MIDCBUFFER(dev, screen) \
+#define miGetDCDevice(dev, screen) \
((DevHasCursor(dev)) ? \
- (miDCBufferPtr)dixLookupPrivate(&dev->devPrivates, miDCSpriteKey + (screen)->myNum) : \
- (miDCBufferPtr)dixLookupPrivate(&dev->u.master->devPrivates, miDCSpriteKey + (screen)->myNum))
+ (miDCBufferPtr)dixLookupPrivate(&dev->devPrivates, miDCDeviceKey(screen)) : \
+ (miDCBufferPtr)dixLookupPrivate(&dev->u.master->devPrivates, miDCDeviceKey(screen)))
/*
* The core pointer buffer will point to the index of the virtual core pointer
* in the pCursorBuffers array.
*/
typedef struct {
- CloseScreenProcPtr CloseScreen;
+ CloseScreenProcPtr CloseScreen;
+ DevPrivateKey device_key;
+ DevPrivateKey cursor_bits_key;
} miDCScreenRec, *miDCScreenPtr;
+#define miGetDCScreen(s) ((miDCScreenPtr)(dixLookupPrivate(&(s)->devPrivates, miDCScreenKey)))
+#define miDCDeviceKey(s) (miGetDCScreen(s)->device_key)
+#define miDCCursorBitsKey(s) (miGetDCScreen(s)->cursor_bits_key)
+
/* per-cursor per-screen private data */
typedef struct {
PixmapPtr sourceBits; /* source bits */
@@ -102,11 +102,19 @@ miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
{
miDCScreenPtr pScreenPriv;
+ if (!dixRegisterPrivateKey(&miDCScreenKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
pScreenPriv = malloc(sizeof (miDCScreenRec));
if (!pScreenPriv)
return FALSE;
-
+ pScreenPriv->cursor_bits_key = dixCreatePrivateKey(PRIVATE_CURSOR_BITS, 0);
+ pScreenPriv->device_key = dixCreatePrivateKey(PRIVATE_DEVICE, 0);
+ if (!pScreenPriv->cursor_bits_key || !pScreenPriv->device_key) {
+ free(pScreenPriv);
+ return FALSE;
+ }
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = miDCCloseScreen;
@@ -136,7 +144,7 @@ Bool
miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
{
if (pCursor->bits->refcnt <= 1)
- dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), NULL);
+ dixSetPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey(pScreen), NULL);
return TRUE;
}
@@ -235,7 +243,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
free((pointer) pPriv);
return NULL;
}
- dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv);
+ dixSetPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey(pScreen), pPriv);
return pPriv;
}
pPriv->pPicture = 0;
@@ -253,7 +261,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
free((pointer) pPriv);
return NULL;
}
- dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv);
+ dixSetPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey(pScreen), pPriv);
/* create the two sets of bits, clipping as appropriate */
@@ -298,7 +306,7 @@ miDCUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
miDCCursorPtr pPriv;
pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates,
- CursorScreenKey(pScreen));
+ miDCCursorBitsKey(pScreen));
if (pPriv && (pCursor->bits->refcnt <= 1))
{
if (pPriv->sourceBits)
@@ -310,7 +318,7 @@ miDCUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
FreePicture (pPriv->pPicture, 0);
#endif
free((pointer) pPriv);
- dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), NULL);
+ dixSetPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey(pScreen), NULL);
}
return TRUE;
}
@@ -399,7 +407,7 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
WindowPtr pWin;
pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates,
- CursorScreenKey(pScreen));
+ miDCCursorBitsKey(pScreen));
if (!pPriv)
{
pPriv = miDCRealize(pScreen, pCursor);
@@ -408,8 +416,8 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
}
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pWin = WindowTable[pScreen->myNum];
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pWin = pScreen->root;
+ pBuffer = miGetDCDevice(pDev, pScreen);
#ifdef ARGB_CURSOR
if (pPriv->pPicture)
@@ -448,10 +456,10 @@ miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pBuffer = miGetDCDevice(pDev, pScreen);
pSave = pBuffer->pSave;
- pWin = WindowTable[pScreen->myNum];
+ pWin = pScreen->root;
if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h)
{
if (pSave)
@@ -482,10 +490,10 @@ miDCRestoreUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pBuffer = miGetDCDevice(pDev, pScreen);
pSave = pBuffer->pSave;
- pWin = WindowTable[pScreen->myNum];
+ pWin = pScreen->root;
if (!pSave)
return FALSE;
@@ -498,243 +506,10 @@ miDCRestoreUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
}
Bool
-miDCChangeSave (DeviceIntPtr pDev, ScreenPtr pScreen,
- int x, int y, int w, int h, int dx, int dy)
-{
- miDCScreenPtr pScreenPriv;
- miDCBufferPtr pBuffer;
- PixmapPtr pSave;
- WindowPtr pWin;
- GCPtr pGC;
- int sourcex, sourcey, destx, desty, copyw, copyh;
-
- pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- miDCScreenKey);
- pBuffer = MIDCBUFFER(pDev, pScreen);
-
- pSave = pBuffer->pSave;
- pWin = WindowTable[pScreen->myNum];
- /*
- * restore the bits which are about to get trashed
- */
- if (!pSave)
- return FALSE;
-
- pGC = pBuffer->pRestoreGC;
- if (pWin->drawable.serialNumber != pGC->serialNumber)
- ValidateGC ((DrawablePtr) pWin, pGC);
- /*
- * copy the old bits to the screen.
- */
- if (dy > 0)
- {
- (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC,
- 0, h - dy, w, dy, x + dx, y + h);
- }
- else if (dy < 0)
- {
- (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC,
- 0, 0, w, -dy, x + dx, y + dy);
- }
- if (dy >= 0)
- {
- desty = y + dy;
- sourcey = 0;
- copyh = h - dy;
- }
- else
- {
- desty = y;
- sourcey = - dy;
- copyh = h + dy;
- }
- if (dx > 0)
- {
- (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC,
- w - dx, sourcey, dx, copyh, x + w, desty);
- }
- else if (dx < 0)
- {
- (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC,
- 0, sourcey, -dx, copyh, x + dx, desty);
- }
-
- pGC = pBuffer->pSaveGC;
- if (pSave->drawable.serialNumber != pGC->serialNumber)
- ValidateGC ((DrawablePtr) pSave, pGC);
- /*
- * move the bits that are still valid within the pixmap
- */
- if (dx >= 0)
- {
- sourcex = 0;
- destx = dx;
- copyw = w - dx;
- }
- else
- {
- destx = 0;
- sourcex = - dx;
- copyw = w + dx;
- }
- if (dy >= 0)
- {
- sourcey = 0;
- desty = dy;
- copyh = h - dy;
- }
- else
- {
- desty = 0;
- sourcey = -dy;
- copyh = h + dy;
- }
- (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pSave, pGC,
- sourcex, sourcey, copyw, copyh, destx, desty);
- /*
- * copy the new bits from the screen into the remaining areas of the
- * pixmap
- */
- if (dy > 0)
- {
- (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC,
- x, y, w, dy, 0, 0);
- }
- else if (dy < 0)
- {
- (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC,
- x, y + h + dy, w, -dy, 0, h + dy);
- }
- if (dy >= 0)
- {
- desty = dy;
- sourcey = y + dy;
- copyh = h - dy;
- }
- else
- {
- desty = 0;
- sourcey = y;
- copyh = h + dy;
- }
- if (dx > 0)
- {
- (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC,
- x, sourcey, dx, copyh, 0, desty);
- }
- else if (dx < 0)
- {
- (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC,
- x + w + dx, sourcey, -dx, copyh, w + dx, desty);
- }
- return TRUE;
-}
-
-Bool
-miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
- int x, int y, int w, int h, int dx, int dy,
- unsigned long source, unsigned long mask)
-{
- miDCCursorPtr pPriv;
- miDCScreenPtr pScreenPriv;
- miDCBufferPtr pBuffer;
- int status;
- WindowPtr pWin;
- GCPtr pGC;
- XID gcval = FALSE;
- PixmapPtr pTemp;
-
- pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates,
- CursorScreenKey(pScreen));
- if (!pPriv)
- {
- pPriv = miDCRealize(pScreen, pCursor);
- if (!pPriv)
- return FALSE;
- }
- pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- miDCScreenKey);
- pWin = WindowTable[pScreen->myNum];
- pBuffer = MIDCBUFFER(pDev, pScreen);
-
- pTemp = pBuffer->pTemp;
- if (!pTemp ||
- pTemp->drawable.width != pBuffer->pSave->drawable.width ||
- pTemp->drawable.height != pBuffer->pSave->drawable.height)
- {
- if (pTemp)
- (*pScreen->DestroyPixmap) (pTemp);
-#ifdef ARGB_CURSOR
- if (pBuffer->pTempPicture)
- {
- FreePicture (pBuffer->pTempPicture, 0);
- pBuffer->pTempPicture = 0;
- }
-#endif
- pBuffer->pTemp = pTemp = (*pScreen->CreatePixmap)
- (pScreen, w, h, pBuffer->pSave->drawable.depth, 0);
- if (!pTemp)
- return FALSE;
- }
- if (!pBuffer->pMoveGC)
- {
- pBuffer->pMoveGC = CreateGC ((DrawablePtr)pTemp,
- GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
- if (!pBuffer->pMoveGC)
- return FALSE;
- }
- /*
- * copy the saved area to a temporary pixmap
- */
- pGC = pBuffer->pMoveGC;
- if (pGC->serialNumber != pTemp->drawable.serialNumber)
- ValidateGC ((DrawablePtr) pTemp, pGC);
- (*pGC->ops->CopyArea)((DrawablePtr)pBuffer->pSave,
- (DrawablePtr)pTemp, pGC, 0, 0, w, h, 0, 0);
-
- /*
- * draw the cursor in the temporary pixmap
- */
-#ifdef ARGB_CURSOR
- if (pPriv->pPicture)
- {
- if (!EnsurePicture(pBuffer->pTempPicture, &pTemp->drawable, pWin))
- return FALSE;
- CompositePicture (PictOpOver,
- pPriv->pPicture,
- NULL,
- pBuffer->pTempPicture,
- 0, 0, 0, 0,
- dx, dy,
- pCursor->bits->width,
- pCursor->bits->height);
- }
- else
-#endif
- {
- miDCPutBits ((DrawablePtr)pTemp, pPriv,
- pBuffer->pPixSourceGC, pBuffer->pPixMaskGC,
- dx, dy, pCursor->bits->width, pCursor->bits->height,
- source, mask);
- }
-
- pGC = pBuffer->pRestoreGC;
- if (pWin->drawable.serialNumber != pGC->serialNumber)
- ValidateGC ((DrawablePtr) pWin, pGC);
-
- (*pGC->ops->CopyArea) ((DrawablePtr) pTemp, (DrawablePtr) pWin,
- pGC,
- 0, 0, w, h, x, y);
- return TRUE;
-}
-
-Bool
miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
miDCBufferPtr pBuffer;
WindowPtr pWin;
- XID gcval = FALSE;
- int status;
int i;
if (!DevHasCursor(pDev))
@@ -748,8 +523,8 @@ miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
if (!pBuffer)
goto failure;
- dixSetPrivate(&pDev->devPrivates, miDCSpriteKey + pScreen->myNum, pBuffer);
- pWin = WindowTable[pScreen->myNum];
+ dixSetPrivate(&pDev->devPrivates, miDCDeviceKey(pScreen), pBuffer);
+ pWin = pScreen->root;
pBuffer->pSourceGC = miDCMakeGC(pWin);
if (!pBuffer->pSourceGC)
@@ -767,28 +542,12 @@ miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
if (!pBuffer->pRestoreGC)
goto failure;
- pBuffer->pMoveGC = CreateGC ((DrawablePtr)pWin,
- GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
- if (!pBuffer->pMoveGC)
- goto failure;
-
- pBuffer->pPixSourceGC = CreateGC ((DrawablePtr)pWin,
- GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
- if (!pBuffer->pPixSourceGC)
- goto failure;
-
- pBuffer->pPixMaskGC = CreateGC ((DrawablePtr)pWin,
- GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
- if (!pBuffer->pPixMaskGC)
- goto failure;
-
#ifdef ARGB_CURSOR
pBuffer->pRootPicture = NULL;
- pBuffer->pTempPicture = NULL;
#endif
- // these get (re)allocated lazily depending on the cursor size
- pBuffer->pSave = pBuffer->pTemp = NULL;
+ /* (re)allocated lazily depending on the cursor size */
+ pBuffer->pSave = NULL;
}
return TRUE;
@@ -812,7 +571,7 @@ miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{
pScreen = screenInfo.screens[i];
- pBuffer = MIDCBUFFER(pDev, pScreen);
+ pBuffer = miGetDCDevice(pDev, pScreen);
if (pBuffer)
{
@@ -820,15 +579,17 @@ miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
if (pBuffer->pMaskGC) FreeGC(pBuffer->pMaskGC, (GContext) 0);
if (pBuffer->pSaveGC) FreeGC(pBuffer->pSaveGC, (GContext) 0);
if (pBuffer->pRestoreGC) FreeGC(pBuffer->pRestoreGC, (GContext) 0);
- if (pBuffer->pMoveGC) FreeGC(pBuffer->pMoveGC, (GContext) 0);
- if (pBuffer->pPixSourceGC) FreeGC(pBuffer->pPixSourceGC, (GContext) 0);
- if (pBuffer->pPixMaskGC) FreeGC(pBuffer->pPixMaskGC, (GContext) 0);
+
+#ifdef ARGB_CURSOR
+ /* If a pRootPicture was allocated for a root window, it
+ * is freed when that root window is destroyed, so don't
+ * free it again here. */
+#endif
if (pBuffer->pSave) (*pScreen->DestroyPixmap)(pBuffer->pSave);
- if (pBuffer->pTemp) (*pScreen->DestroyPixmap)(pBuffer->pTemp);
free(pBuffer);
- dixSetPrivate(&pDev->devPrivates, miDCSpriteKey + pScreen->myNum, NULL);
+ dixSetPrivate(&pDev->devPrivates, miDCDeviceKey(pScreen), NULL);
}
}
}
diff --git a/xorg-server/mi/miexpose.c b/xorg-server/mi/miexpose.c
index 2fc19f6ec..89f45016d 100644
--- a/xorg-server/mi/miexpose.c
+++ b/xorg-server/mi/miexpose.c
@@ -131,7 +131,6 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
GCPtr pGC, int srcx, int srcy, int width, int height,
int dstx, int dsty, unsigned long plane)
{
- ScreenPtr pscr;
RegionPtr prgnSrcClip; /* drawable-relative source clip */
RegionRec rgnSrcRec;
RegionPtr prgnDstClip; /* drawable-relative dest clip */
@@ -148,9 +147,6 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
BoxRec expBox;
Bool extents;
- /* This prevents warning about pscr not being used. */
- pGC->pScreen = pscr = pGC->pScreen;
-
/* avoid work if we can */
if (!pGC->graphicsExposures &&
(pDstDrawable->type == DRAWABLE_PIXMAP) &&
@@ -175,21 +171,21 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
if (pGC->subWindowMode == IncludeInferiors)
{
prgnSrcClip = NotClippedByChildren (pSrcWin);
- if ((RECT_IN_REGION(pscr, prgnSrcClip, &TsrcBox)) == rgnIN)
+ if ((RegionContainsRect(prgnSrcClip, &TsrcBox)) == rgnIN)
{
- REGION_DESTROY(pscr, prgnSrcClip);
+ RegionDestroy(prgnSrcClip);
return NULL;
}
}
else
{
- if ((RECT_IN_REGION(pscr, &pSrcWin->clipList, &TsrcBox)) == rgnIN)
+ if ((RegionContainsRect(&pSrcWin->clipList, &TsrcBox)) == rgnIN)
return NULL;
prgnSrcClip = &rgnSrcRec;
- REGION_NULL(pscr, prgnSrcClip);
- REGION_COPY(pscr, prgnSrcClip, &pSrcWin->clipList);
+ RegionNull(prgnSrcClip);
+ RegionCopy(prgnSrcClip, &pSrcWin->clipList);
}
- REGION_TRANSLATE(pscr, prgnSrcClip,
+ RegionTranslate(prgnSrcClip,
-pSrcDrawable->x, -pSrcDrawable->y);
}
else
@@ -206,7 +202,7 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
box.x2 = pSrcDrawable->width;
box.y2 = pSrcDrawable->height;
prgnSrcClip = &rgnSrcRec;
- REGION_INIT(pscr, prgnSrcClip, &box, 1);
+ RegionInit(prgnSrcClip, &box, 1);
pSrcWin = NULL;
}
@@ -223,11 +219,11 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
else
{
prgnDstClip = &rgnDstRec;
- REGION_NULL(pscr, prgnDstClip);
- REGION_COPY(pscr, prgnDstClip,
+ RegionNull(prgnDstClip);
+ RegionCopy(prgnDstClip,
&((WindowPtr)pDstDrawable)->clipList);
}
- REGION_TRANSLATE(pscr, prgnDstClip,
+ RegionTranslate(prgnDstClip,
-pDstDrawable->x, -pDstDrawable->y);
}
else
@@ -239,24 +235,24 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
box.x2 = pDstDrawable->width;
box.y2 = pDstDrawable->height;
prgnDstClip = &rgnDstRec;
- REGION_INIT(pscr, prgnDstClip, &box, 1);
+ RegionInit(prgnDstClip, &box, 1);
}
/* drawable-relative source region */
- REGION_INIT(pscr, &rgnExposed, &srcBox, 1);
+ RegionInit(&rgnExposed, &srcBox, 1);
/* now get the hidden parts of the source box*/
- REGION_SUBTRACT(pscr, &rgnExposed, &rgnExposed, prgnSrcClip);
+ RegionSubtract(&rgnExposed, &rgnExposed, prgnSrcClip);
/* move them over the destination */
- REGION_TRANSLATE(pscr, &rgnExposed, dstx-srcx, dsty-srcy);
+ RegionTranslate(&rgnExposed, dstx-srcx, dsty-srcy);
/* intersect with visible areas of dest */
- REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, prgnDstClip);
+ RegionIntersect(&rgnExposed, &rgnExposed, prgnDstClip);
/* intersect with client clip region. */
if (pGC->clientClipType == CT_REGION)
- REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, pGC->clientClip);
+ RegionIntersect(&rgnExposed, &rgnExposed, pGC->clientClip);
/*
* If we have LOTS of rectangles, we decide to take the extents
@@ -266,7 +262,7 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
* for windows.
*/
extents = pGC->graphicsExposures &&
- (REGION_NUM_RECTS(&rgnExposed) > RECTLIMIT) &&
+ (RegionNumRects(&rgnExposed) > RECTLIMIT) &&
(pDstDrawable->type != DRAWABLE_PIXMAP);
if (pSrcWin)
{
@@ -278,13 +274,13 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
* exposed region will undo all our work!
*/
if (extents && pSrcWin && region &&
- (RECT_IN_REGION(pscr, region, &srcBox) != rgnIN))
+ (RegionContainsRect(region, &srcBox) != rgnIN))
extents = FALSE;
}
if (extents)
{
- expBox = *REGION_EXTENTS(pscr, &rgnExposed);
- REGION_RESET(pscr, &rgnExposed, &expBox);
+ expBox = *RegionExtents(&rgnExposed);
+ RegionReset(&rgnExposed, &expBox);
}
if ((pDstDrawable->type != DRAWABLE_PIXMAP) &&
(((WindowPtr)pDstDrawable)->backgroundState != None))
@@ -292,52 +288,52 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
WindowPtr pWin = (WindowPtr)pDstDrawable;
/* make the exposed area screen-relative */
- REGION_TRANSLATE(pscr, &rgnExposed,
+ RegionTranslate(&rgnExposed,
pDstDrawable->x, pDstDrawable->y);
if (extents)
{
/* miPaintWindow doesn't clip, so we have to */
- REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, &pWin->clipList);
+ RegionIntersect(&rgnExposed, &rgnExposed, &pWin->clipList);
}
miPaintWindow((WindowPtr)pDstDrawable, &rgnExposed, PW_BACKGROUND);
if (extents)
{
- REGION_RESET(pscr, &rgnExposed, &expBox);
+ RegionReset(&rgnExposed, &expBox);
}
else
- REGION_TRANSLATE(pscr, &rgnExposed,
+ RegionTranslate(&rgnExposed,
-pDstDrawable->x, -pDstDrawable->y);
}
if (prgnDstClip == &rgnDstRec)
{
- REGION_UNINIT(pscr, prgnDstClip);
+ RegionUninit(prgnDstClip);
}
else if (prgnDstClip != prgnSrcClip)
{
- REGION_DESTROY(pscr, prgnDstClip);
+ RegionDestroy(prgnDstClip);
}
if (prgnSrcClip == &rgnSrcRec)
{
- REGION_UNINIT(pscr, prgnSrcClip);
+ RegionUninit(prgnSrcClip);
}
else
{
- REGION_DESTROY(pscr, prgnSrcClip);
+ RegionDestroy(prgnSrcClip);
}
if (pGC->graphicsExposures)
{
/* don't look */
- RegionPtr exposed = REGION_CREATE(pscr, NullBox, 0);
+ RegionPtr exposed = RegionCreate(NullBox, 0);
*exposed = rgnExposed;
return exposed;
}
else
{
- REGION_UNINIT(pscr, &rgnExposed);
+ RegionUninit(&rgnExposed);
return NULL;
}
}
@@ -348,7 +344,7 @@ void
miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable,
int major, int minor)
{
- if (pRgn && !REGION_NIL(pRgn))
+ if (pRgn && !RegionNil(pRgn))
{
xEvent *pEvent;
xEvent *pe;
@@ -356,8 +352,8 @@ miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable,
int i;
int numRects;
- numRects = REGION_NUM_RECTS(pRgn);
- pBox = REGION_RECTS(pRgn);
+ numRects = RegionNumRects(pRgn);
+ pBox = RegionRects(pRgn);
if(!(pEvent = malloc(numRects * sizeof(xEvent))))
return;
pe = pEvent;
@@ -401,8 +397,8 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
xEvent *pEvent, *pe;
int i;
- pBox = REGION_RECTS(pRgn);
- numRects = REGION_NUM_RECTS(pRgn);
+ pBox = RegionRects(pRgn);
+ numRects = RegionNumRects(pRgn);
if(!(pEvent = calloc(1, numRects * sizeof(xEvent))))
return;
@@ -424,9 +420,9 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
XID realWin = 0;
if(!pWin->parent) {
- x = panoramiXdataPtr[scrnum].x;
- y = panoramiXdataPtr[scrnum].y;
- pWin = WindowTable[0];
+ x = screenInfo.screens[scrnum]->x;
+ y = screenInfo.screens[scrnum]->y;
+ pWin = screenInfo.screens[0]->root;
realWin = pWin->drawable.id;
} else if (scrnum) {
PanoramiXRes *win;
@@ -457,8 +453,8 @@ void
miWindowExposures( WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed)
{
RegionPtr exposures = prgn;
- if ((prgn && !REGION_NIL(prgn)) ||
- (exposures && !REGION_NIL(exposures)) || other_exposed)
+ if ((prgn && !RegionNil(prgn)) ||
+ (exposures && !RegionNil(exposures)) || other_exposed)
{
RegionRec expRec;
int clientInterested;
@@ -471,15 +467,15 @@ miWindowExposures( WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed)
{
if (exposures)
{
- REGION_UNION(pWin->drawable.pScreen, other_exposed,
+ RegionUnion(other_exposed,
exposures,
other_exposed);
if (exposures != prgn)
- REGION_DESTROY(pWin->drawable.pScreen, exposures);
+ RegionDestroy(exposures);
}
exposures = other_exposed;
}
- if (clientInterested && exposures && (REGION_NUM_RECTS(exposures) > RECTLIMIT))
+ if (clientInterested && exposures && (RegionNumRects(exposures) > RECTLIMIT))
{
/*
* If we have LOTS of rectangles, we decide to take the extents
@@ -489,34 +485,34 @@ miWindowExposures( WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed)
*/
BoxRec box;
- box = *REGION_EXTENTS( pWin->drawable.pScreen, exposures);
+ box = *RegionExtents(exposures);
if (exposures == prgn) {
exposures = &expRec;
- REGION_INIT( pWin->drawable.pScreen, exposures, &box, 1);
- REGION_RESET( pWin->drawable.pScreen, prgn, &box);
+ RegionInit(exposures, &box, 1);
+ RegionReset(prgn, &box);
} else {
- REGION_RESET( pWin->drawable.pScreen, exposures, &box);
- REGION_UNION( pWin->drawable.pScreen, prgn, prgn, exposures);
+ RegionReset(exposures, &box);
+ RegionUnion(prgn, prgn, exposures);
}
/* miPaintWindow doesn't clip, so we have to */
- REGION_INTERSECT( pWin->drawable.pScreen, prgn, prgn, &pWin->clipList);
+ RegionIntersect(prgn, prgn, &pWin->clipList);
}
- if (prgn && !REGION_NIL(prgn))
+ if (prgn && !RegionNil(prgn))
miPaintWindow(pWin, prgn, PW_BACKGROUND);
- if (clientInterested && exposures && !REGION_NIL(exposures))
+ if (clientInterested && exposures && !RegionNil(exposures))
miSendExposures(pWin, exposures,
pWin->drawable.x, pWin->drawable.y);
if (exposures == &expRec)
{
- REGION_UNINIT( pWin->drawable.pScreen, exposures);
+ RegionUninit(exposures);
}
else if (exposures && exposures != prgn && exposures != other_exposed)
- REGION_DESTROY( pWin->drawable.pScreen, exposures);
+ RegionDestroy(exposures);
if (prgn)
- REGION_EMPTY( pWin->drawable.pScreen, prgn);
+ RegionEmpty(prgn);
}
else if (exposures && exposures != prgn)
- REGION_DESTROY( pWin->drawable.pScreen, exposures);
+ RegionDestroy(exposures);
}
#ifdef ROOTLESS
@@ -647,7 +643,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin;
}
- prect = malloc(REGION_NUM_RECTS(prgn) * sizeof(xRectangle));
+ prect = malloc(RegionNumRects(prgn) * sizeof(xRectangle));
if (!prect)
return;
@@ -661,8 +657,8 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
ChangeGC (NullClient, pGC, gcmask, gcval);
ValidateGC (drawable, pGC);
- numRects = REGION_NUM_RECTS(prgn);
- pbox = REGION_RECTS(prgn);
+ numRects = RegionNumRects(prgn);
+ pbox = RegionRects(prgn);
for (i= numRects; --i >= 0; pbox++, prect++)
{
prect->x = pbox->x1 - draw_x_off;
diff --git a/xorg-server/mi/mifillrct.c b/xorg-server/mi/mifillrct.c
index a97e5ced3..f2ca4c432 100644
--- a/xorg-server/mi/mifillrct.c
+++ b/xorg-server/mi/mifillrct.c
@@ -111,8 +111,8 @@ miPolyFillRect(
pwFirst = malloc(maxheight * sizeof(int));
if(!pptFirst || !pwFirst)
{
- if (pwFirst) free(pwFirst);
- if (pptFirst) free(pptFirst);
+ free(pwFirst);
+ free(pptFirst);
return;
}
diff --git a/xorg-server/mi/mifpolycon.c b/xorg-server/mi/mifpolycon.c
index 8411a1570..9d776201c 100644
--- a/xorg-server/mi/mifpolycon.c
+++ b/xorg-server/mi/mifpolycon.c
@@ -122,9 +122,9 @@ miFillSppPoly(
if(!ptsOut || !width || !Marked)
{
- if (Marked) free(Marked);
- if (width) free(width);
- if (ptsOut) free(ptsOut);
+ free(Marked);
+ free(width);
+ free(ptsOut);
return;
}
@@ -276,5 +276,5 @@ GetFPolyYBounds(
*by = ICEIL(ymin + yFtrans);
*ty = ICEIL(ymax + yFtrans - 1);
- return(ptMin-ptsStart);
+ return ptMin-ptsStart;
}
diff --git a/xorg-server/mi/migc.c b/xorg-server/mi/migc.c
index e42f29810..50abefcea 100644
--- a/xorg-server/mi/migc.c
+++ b/xorg-server/mi/migc.c
@@ -50,7 +50,7 @@ miDestroyGC(GCPtr pGC)
if (pGC->pRotatedPixmap)
(*pGC->pScreen->DestroyPixmap) (pGC->pRotatedPixmap);
if (pGC->freeCompClip)
- REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
+ RegionDestroy(pGC->pCompositeClip);
}
void
@@ -68,7 +68,7 @@ miDestroyClip(GCPtr pGC)
* we know we'll never have a list of rectangles, since ChangeClip
* immediately turns them into a region
*/
- REGION_DESTROY(pGC->pScreen, pGC->clientClip);
+ RegionDestroy(pGC->clientClip);
}
pGC->clientClip = NULL;
pGC->clientClipType = CT_NONE;
@@ -81,7 +81,7 @@ miChangeClip( GCPtr pGC, int type, pointer pvalue, int nrects)
if (type == CT_PIXMAP)
{
/* convert the pixmap to a region */
- pGC->clientClip = (pointer) BITMAP_TO_REGION(pGC->pScreen,
+ pGC->clientClip = (pointer) BitmapToRegion(pGC->pScreen,
(PixmapPtr) pvalue);
(*pGC->pScreen->DestroyPixmap) (pvalue);
}
@@ -92,7 +92,7 @@ miChangeClip( GCPtr pGC, int type, pointer pvalue, int nrects)
}
else if (type != CT_NONE)
{
- pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nrects,
+ pGC->clientClip = (pointer) RegionFromRects(nrects,
(xRectangle *) pvalue,
type);
free(pvalue);
@@ -116,9 +116,8 @@ miCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
pgcSrc->clientClip, 0);
break;
case CT_REGION:
- prgnNew = REGION_CREATE(pgcSrc->pScreen, NULL, 1);
- REGION_COPY(pgcDst->pScreen, prgnNew,
- (RegionPtr) (pgcSrc->clientClip));
+ prgnNew = RegionCreate(NULL, 1);
+ RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip));
(*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, (pointer) prgnNew, 0);
break;
}
@@ -134,11 +133,6 @@ miCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst)
void
miComputeCompositeClip( GCPtr pGC, DrawablePtr pDrawable)
{
- ScreenPtr pScreen;
-
- /* This prevents warnings about pScreen not being used. */
- pGC->pScreen = pScreen = pGC->pScreen;
-
if (pDrawable->type == DRAWABLE_WINDOW)
{
WindowPtr pWin = (WindowPtr) pDrawable;
@@ -167,7 +161,7 @@ miComputeCompositeClip( GCPtr pGC, DrawablePtr pDrawable)
if (pGC->clientClipType == CT_NONE)
{
if (freeCompClip)
- REGION_DESTROY(pScreen, pGC->pCompositeClip);
+ RegionDestroy(pGC->pCompositeClip);
pGC->pCompositeClip = pregWin;
pGC->freeCompClip = freeTmpClip;
}
@@ -182,30 +176,30 @@ miComputeCompositeClip( GCPtr pGC, DrawablePtr pDrawable)
* clip. if neither is real, create a new region.
*/
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ RegionTranslate(pGC->clientClip,
pDrawable->x + pGC->clipOrg.x,
pDrawable->y + pGC->clipOrg.y);
if (freeCompClip)
{
- REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ RegionIntersect(pGC->pCompositeClip,
pregWin, pGC->clientClip);
if (freeTmpClip)
- REGION_DESTROY(pScreen, pregWin);
+ RegionDestroy(pregWin);
}
else if (freeTmpClip)
{
- REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip);
+ RegionIntersect(pregWin, pregWin, pGC->clientClip);
pGC->pCompositeClip = pregWin;
}
else
{
- pGC->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
- REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip = RegionCreate(NullBox, 0);
+ RegionIntersect(pGC->pCompositeClip,
pregWin, pGC->clientClip);
}
pGC->freeCompClip = TRUE;
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ RegionTranslate(pGC->clientClip,
-(pDrawable->x + pGC->clipOrg.x),
-(pDrawable->y + pGC->clipOrg.y));
}
@@ -223,31 +217,31 @@ miComputeCompositeClip( GCPtr pGC, DrawablePtr pDrawable)
if (pGC->freeCompClip)
{
- REGION_RESET(pScreen, pGC->pCompositeClip, &pixbounds);
+ RegionReset(pGC->pCompositeClip, &pixbounds);
}
else
{
pGC->freeCompClip = TRUE;
- pGC->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1);
+ pGC->pCompositeClip = RegionCreate(&pixbounds, 1);
}
if (pGC->clientClipType == CT_REGION)
{
if(pDrawable->x || pDrawable->y) {
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ RegionTranslate(pGC->clientClip,
pDrawable->x + pGC->clipOrg.x,
pDrawable->y + pGC->clipOrg.y);
- REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ RegionIntersect(pGC->pCompositeClip,
pGC->pCompositeClip, pGC->clientClip);
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ RegionTranslate(pGC->clientClip,
-(pDrawable->x + pGC->clipOrg.x),
-(pDrawable->y + pGC->clipOrg.y));
} else {
- REGION_TRANSLATE(pScreen, pGC->pCompositeClip,
+ RegionTranslate(pGC->pCompositeClip,
-pGC->clipOrg.x, -pGC->clipOrg.y);
- REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ RegionIntersect(pGC->pCompositeClip,
pGC->pCompositeClip, pGC->clientClip);
- REGION_TRANSLATE(pScreen, pGC->pCompositeClip,
+ RegionTranslate(pGC->pCompositeClip,
pGC->clipOrg.x, pGC->clipOrg.y);
}
}
diff --git a/xorg-server/mi/miline.h b/xorg-server/mi/miline.h
index b5f706dbf..0f2fc3374 100644
--- a/xorg-server/mi/miline.h
+++ b/xorg-server/mi/miline.h
@@ -1,172 +1,173 @@
-
-/*
-
-Copyright 1994, 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.
-
-*/
-
-#ifndef MILINE_H
-
-#include "screenint.h"
-#include "privates.h"
-
-/*
- * Public definitions used for configuring basic pixelization aspects
- * of the sample implementation line-drawing routines provided in
- * {mfb,mi,cfb*} at run-time.
- */
-
-#define XDECREASING 4
-#define YDECREASING 2
-#define YMAJOR 1
-
-#define OCTANT1 (1 << (YDECREASING))
-#define OCTANT2 (1 << (YDECREASING|YMAJOR))
-#define OCTANT3 (1 << (XDECREASING|YDECREASING|YMAJOR))
-#define OCTANT4 (1 << (XDECREASING|YDECREASING))
-#define OCTANT5 (1 << (XDECREASING))
-#define OCTANT6 (1 << (XDECREASING|YMAJOR))
-#define OCTANT7 (1 << (YMAJOR))
-#define OCTANT8 (1 << (0))
-
-#define XMAJOROCTANTS (OCTANT1 | OCTANT4 | OCTANT5 | OCTANT8)
-
-#define DEFAULTZEROLINEBIAS (OCTANT2 | OCTANT3 | OCTANT4 | OCTANT5)
-
-/*
- * Devices can configure the rendering of routines in mi, mfb, and cfb*
- * by specifying a thin line bias to be applied to a particular screen
- * using the following function. The bias parameter is an OR'ing of
- * the appropriate OCTANT constants defined above to indicate which
- * octants to bias a line to prefer an axial step when the Bresenham
- * error term is exactly zero. The octants are mapped as follows:
- *
- * \ | /
- * \ 3 | 2 /
- * \ | /
- * 4 \ | / 1
- * \|/
- * -----------
- * /|\
- * 5 / | \ 8
- * / | \
- * / 6 | 7 \
- * / | \
- *
- * For more information, see "Ambiguities in Incremental Line Rastering,"
- * Jack E. Bresenham, IEEE CG&A, May 1987.
- */
-
-extern _X_EXPORT void miSetZeroLineBias(
- ScreenPtr /* pScreen */,
- unsigned int /* bias */
-);
-
-/*
- * Private definitions needed for drawing thin (zero width) lines
- * Used by the mi, mfb, and all cfb* components.
- */
-
-#define X_AXIS 0
-#define Y_AXIS 1
-
-#define OUT_LEFT 0x08
-#define OUT_RIGHT 0x04
-#define OUT_ABOVE 0x02
-#define OUT_BELOW 0x01
-
-#define OUTCODES(_result, _x, _y, _pbox) \
- if ( (_x) < (_pbox)->x1) (_result) |= OUT_LEFT; \
- else if ( (_x) >= (_pbox)->x2) (_result) |= OUT_RIGHT; \
- if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \
- else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW;
-
-#define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \
-{\
- if (x < xmin) outcode |= OUT_LEFT;\
- if (x > xmax) outcode |= OUT_RIGHT;\
- if (y < ymin) outcode |= OUT_ABOVE;\
- if (y > ymax) outcode |= OUT_BELOW;\
-}
-
-#define SWAPINT(i, j) \
-{ int _t = i; i = j; j = _t; }
-
-#define SWAPPT(i, j) \
-{ DDXPointRec _t; _t = i; i = j; j = _t; }
-
-#define SWAPINT_PAIR(x1, y1, x2, y2)\
-{ int t = x1; x1 = x2; x2 = t;\
- t = y1; y1 = y2; y2 = t;\
-}
-
-#define miGetZeroLineBias(_pScreen) ((unsigned long) (unsigned long*)\
- dixLookupPrivate(&(_pScreen)->devPrivates, miZeroLineScreenKey))
-
-#define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \
- (_octant) = 0; \
- (_sx) = (_SX); \
- if (((_adx) = (_x2) - (_x1)) < 0) { \
- (_adx) = -(_adx); \
- (_sx = -(_sx)); \
- (_octant) |= XDECREASING; \
- } \
- (_sy) = (_SY); \
- if (((_ady) = (_y2) - (_y1)) < 0) { \
- (_ady) = -(_ady); \
- (_sy = -(_sy)); \
- (_octant) |= YDECREASING; \
- }
-
-#define SetYMajorOctant(_octant) ((_octant) |= YMAJOR)
-
-#define FIXUP_ERROR(_e, _octant, _bias) \
- (_e) -= (((_bias) >> (_octant)) & 1)
-
-#define IsXMajorOctant(_octant) (!((_octant) & YMAJOR))
-#define IsYMajorOctant(_octant) ((_octant) & YMAJOR)
-#define IsXDecreasingOctant(_octant) ((_octant) & XDECREASING)
-#define IsYDecreasingOctant(_octant) ((_octant) & YDECREASING)
-
-extern _X_EXPORT DevPrivateKey miZeroLineScreenKey;
-
-extern _X_EXPORT int miZeroClipLine(
- int /*xmin*/,
- int /*ymin*/,
- int /*xmax*/,
- int /*ymax*/,
- int * /*new_x1*/,
- int * /*new_y1*/,
- int * /*new_x2*/,
- int * /*new_y2*/,
- unsigned int /*adx*/,
- unsigned int /*ady*/,
- int * /*pt1_clipped*/,
- int * /*pt2_clipped*/,
- int /*octant*/,
- unsigned int /*bias*/,
- int /*oc1*/,
- int /*oc2*/
-);
-
-#endif /* MILINE_H */
+
+/*
+
+Copyright 1994, 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.
+
+*/
+
+#ifndef MILINE_H
+
+#include "screenint.h"
+#include "privates.h"
+
+/*
+ * Public definitions used for configuring basic pixelization aspects
+ * of the sample implementation line-drawing routines provided in
+ * {mfb,mi,cfb*} at run-time.
+ */
+
+#define XDECREASING 4
+#define YDECREASING 2
+#define YMAJOR 1
+
+#define OCTANT1 (1 << (YDECREASING))
+#define OCTANT2 (1 << (YDECREASING|YMAJOR))
+#define OCTANT3 (1 << (XDECREASING|YDECREASING|YMAJOR))
+#define OCTANT4 (1 << (XDECREASING|YDECREASING))
+#define OCTANT5 (1 << (XDECREASING))
+#define OCTANT6 (1 << (XDECREASING|YMAJOR))
+#define OCTANT7 (1 << (YMAJOR))
+#define OCTANT8 (1 << (0))
+
+#define XMAJOROCTANTS (OCTANT1 | OCTANT4 | OCTANT5 | OCTANT8)
+
+#define DEFAULTZEROLINEBIAS (OCTANT2 | OCTANT3 | OCTANT4 | OCTANT5)
+
+/*
+ * Devices can configure the rendering of routines in mi, mfb, and cfb*
+ * by specifying a thin line bias to be applied to a particular screen
+ * using the following function. The bias parameter is an OR'ing of
+ * the appropriate OCTANT constants defined above to indicate which
+ * octants to bias a line to prefer an axial step when the Bresenham
+ * error term is exactly zero. The octants are mapped as follows:
+ *
+ * \ | /
+ * \ 3 | 2 /
+ * \ | /
+ * 4 \ | / 1
+ * \|/
+ * -----------
+ * /|\
+ * 5 / | \ 8
+ * / | \
+ * / 6 | 7 \
+ * / | \
+ *
+ * For more information, see "Ambiguities in Incremental Line Rastering,"
+ * Jack E. Bresenham, IEEE CG&A, May 1987.
+ */
+
+extern _X_EXPORT void miSetZeroLineBias(
+ ScreenPtr /* pScreen */,
+ unsigned int /* bias */
+);
+
+/*
+ * Private definitions needed for drawing thin (zero width) lines
+ * Used by the mi, mfb, and all cfb* components.
+ */
+
+#define X_AXIS 0
+#define Y_AXIS 1
+
+#define OUT_LEFT 0x08
+#define OUT_RIGHT 0x04
+#define OUT_ABOVE 0x02
+#define OUT_BELOW 0x01
+
+#define OUTCODES(_result, _x, _y, _pbox) \
+ if ( (_x) < (_pbox)->x1) (_result) |= OUT_LEFT; \
+ else if ( (_x) >= (_pbox)->x2) (_result) |= OUT_RIGHT; \
+ if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \
+ else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW;
+
+#define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \
+{\
+ if (x < xmin) outcode |= OUT_LEFT;\
+ if (x > xmax) outcode |= OUT_RIGHT;\
+ if (y < ymin) outcode |= OUT_ABOVE;\
+ if (y > ymax) outcode |= OUT_BELOW;\
+}
+
+#define SWAPINT(i, j) \
+{ int _t = i; i = j; j = _t; }
+
+#define SWAPPT(i, j) \
+{ DDXPointRec _t; _t = i; i = j; j = _t; }
+
+#define SWAPINT_PAIR(x1, y1, x2, y2)\
+{ int t = x1; x1 = x2; x2 = t;\
+ t = y1; y1 = y2; y2 = t;\
+}
+
+#define miGetZeroLineBias(_pScreen) ((unsigned long) (unsigned long*)\
+ dixLookupPrivate(&(_pScreen)->devPrivates, miZeroLineScreenKey))
+
+#define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \
+ (_octant) = 0; \
+ (_sx) = (_SX); \
+ if (((_adx) = (_x2) - (_x1)) < 0) { \
+ (_adx) = -(_adx); \
+ (_sx = -(_sx)); \
+ (_octant) |= XDECREASING; \
+ } \
+ (_sy) = (_SY); \
+ if (((_ady) = (_y2) - (_y1)) < 0) { \
+ (_ady) = -(_ady); \
+ (_sy = -(_sy)); \
+ (_octant) |= YDECREASING; \
+ }
+
+#define SetYMajorOctant(_octant) ((_octant) |= YMAJOR)
+
+#define FIXUP_ERROR(_e, _octant, _bias) \
+ (_e) -= (((_bias) >> (_octant)) & 1)
+
+#define IsXMajorOctant(_octant) (!((_octant) & YMAJOR))
+#define IsYMajorOctant(_octant) ((_octant) & YMAJOR)
+#define IsXDecreasingOctant(_octant) ((_octant) & XDECREASING)
+#define IsYDecreasingOctant(_octant) ((_octant) & YDECREASING)
+
+extern _X_EXPORT DevPrivateKeyRec miZeroLineScreenKeyRec;
+#define miZeroLineScreenKey (&miZeroLineScreenKeyRec)
+
+extern _X_EXPORT int miZeroClipLine(
+ int /*xmin*/,
+ int /*ymin*/,
+ int /*xmax*/,
+ int /*ymax*/,
+ int * /*new_x1*/,
+ int * /*new_y1*/,
+ int * /*new_x2*/,
+ int * /*new_y2*/,
+ unsigned int /*adx*/,
+ unsigned int /*ady*/,
+ int * /*pt1_clipped*/,
+ int * /*pt2_clipped*/,
+ int /*octant*/,
+ unsigned int /*bias*/,
+ int /*oc1*/,
+ int /*oc2*/
+);
+
+#endif /* MILINE_H */
diff --git a/xorg-server/mi/mioverlay.c b/xorg-server/mi/mioverlay.c
index 3de826b74..76484c275 100644
--- a/xorg-server/mi/mioverlay.c
+++ b/xorg-server/mi/mioverlay.c
@@ -5,6 +5,7 @@
#include <X11/X.h>
#include "scrnintstr.h"
+#include <X11/extensions/shapeproto.h>
#include "validate.h"
#include "windowstr.h"
#include "mi.h"
@@ -54,10 +55,10 @@ typedef struct {
Bool copyUnderlay;
} miOverlayScreenRec, *miOverlayScreenPtr;
-static int miOverlayWindowKeyKeyIndex;
-static DevPrivateKey miOverlayWindowKey = &miOverlayWindowKeyKeyIndex;
-static int miOverlayScreenKeyIndex;
-static DevPrivateKey miOverlayScreenKey = &miOverlayScreenKeyIndex;
+static DevPrivateKeyRec miOverlayWindowKeyRec;
+#define miOverlayWindowKey (&miOverlayWindowKeyRec)
+static DevPrivateKeyRec miOverlayScreenKeyRec;
+#define miOverlayScreenKey (&miOverlayScreenKeyRec)
static void RebuildTree(WindowPtr);
static Bool HasUnderlayChildren(WindowPtr);
@@ -82,7 +83,7 @@ static void miOverlayResizeWindow(WindowPtr, int, int, unsigned int,
unsigned int, WindowPtr);
static void miOverlayClearToBackground(WindowPtr, int, int, int, int, Bool);
-static void miOverlaySetShape(WindowPtr);
+static void miOverlaySetShape(WindowPtr, int);
static void miOverlayChangeBorderWidth(WindowPtr, unsigned int);
#define MIOVERLAY_GET_SCREEN_PRIVATE(pScreen) ((miOverlayScreenPtr) \
@@ -112,7 +113,10 @@ miInitOverlay(
if(!inOverlayFunc || !transFunc) return FALSE;
- if(!dixRequestPrivate(miOverlayWindowKey, sizeof(miOverlayWindowRec)))
+ if(!dixRegisterPrivateKey(&miOverlayWindowKeyRec, PRIVATE_WINDOW, sizeof(miOverlayWindowRec)))
+ return FALSE;
+
+ if(!dixRegisterPrivateKey(&miOverlayScreenKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
if(!(pScreenPriv = malloc(sizeof(miOverlayScreenRec))))
@@ -200,8 +204,8 @@ miOverlayCreateWindow(WindowPtr pWin)
pTree->visibility = VisibilityNotViewable;
pWinPriv->tree = pTree;
if(pWin->parent) {
- REGION_NULL(pScreen, &(pTree->borderClip));
- REGION_NULL(pScreen, &(pTree->clipList));
+ RegionNull(&(pTree->borderClip));
+ RegionNull(&(pTree->clipList));
RebuildTree(pWin);
} else {
BoxRec fullBox;
@@ -209,8 +213,8 @@ miOverlayCreateWindow(WindowPtr pWin)
fullBox.y1 = 0;
fullBox.x2 = pScreen->width;
fullBox.y2 = pScreen->height;
- REGION_INIT(pScreen, &(pTree->borderClip), &fullBox, 1);
- REGION_INIT(pScreen, &(pTree->clipList), &fullBox, 1);
+ RegionInit(&(pTree->borderClip), &fullBox, 1);
+ RegionInit(&(pTree->clipList), &fullBox, 1);
}
} else free(pTree);
}
@@ -238,8 +242,8 @@ miOverlayDestroyWindow(WindowPtr pWin)
else if(pTree->parent)
pTree->parent->lastChild = pTree->prevSib;
- REGION_UNINIT(pScreen, &(pTree->borderClip));
- REGION_UNINIT(pScreen, &(pTree->clipList));
+ RegionUninit(&(pTree->borderClip));
+ RegionUninit(&(pTree->clipList));
free(pTree);
}
@@ -305,7 +309,7 @@ miOverlayReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
{
if(IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)) {
/* This could probably be more optimal */
- RebuildTree(WindowTable[pWin->drawable.pScreen->myNum]->firstChild);
+ RebuildTree(pWin->drawable.pScreen->root->firstChild);
}
}
@@ -325,7 +329,6 @@ miOverlayMarkOverlappedWindows(
WindowPtr pFirst,
WindowPtr *pLayerWin
){
- ScreenPtr pScreen = pWin->drawable.pScreen;
WindowPtr pChild, pLast;
Bool overMarked, underMarked, doUnderlay, markAll;
miOverlayTreePtr pTree = NULL, tLast, tChild;
@@ -337,7 +340,7 @@ miOverlayMarkOverlappedWindows(
doUnderlay = (IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin));
- box = REGION_EXTENTS(pScreen, &pWin->borderSize);
+ box = RegionExtents(&pWin->borderSize);
if((pChild = pFirst)) {
pLast = pChild->parent->lastChild;
@@ -348,13 +351,13 @@ miOverlayMarkOverlappedWindows(
pTree = MIOVERLAY_GET_WINDOW_TREE(pChild);
if(pChild->viewable) {
- if (REGION_BROKEN (pScreen, &pChild->winSize))
+ if (RegionBroken(&pChild->winSize))
SetWinSize (pChild);
- if (REGION_BROKEN (pScreen, &pChild->borderSize))
+ if (RegionBroken(&pChild->borderSize))
SetBorderSize (pChild);
if (markAll ||
- RECT_IN_REGION(pScreen, &pChild->borderSize, box))
+ RegionContainsRect(&pChild->borderSize, box))
{
MARK_OVERLAY(pChild);
overMarked = TRUE;
@@ -409,12 +412,12 @@ miOverlayMarkOverlappedWindows(
while(1) {
if(tChild->pWin->viewable) {
- if (REGION_BROKEN (pScreen, &tChild->pWin->winSize))
+ if (RegionBroken(&tChild->pWin->winSize))
SetWinSize (tChild->pWin);
- if (REGION_BROKEN (pScreen, &tChild->pWin->borderSize))
+ if (RegionBroken(&tChild->pWin->borderSize))
SetBorderSize (tChild->pWin);
- if(RECT_IN_REGION(pScreen, &(tChild->pWin->borderSize), box))
+ if(RegionContainsRect(&(tChild->pWin->borderSize), box))
{
MARK_UNDERLAY(tChild->pWin);
underMarked = TRUE;
@@ -436,11 +439,12 @@ miOverlayMarkOverlappedWindows(
}
if(underMarked) {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
MARK_UNDERLAY(pTree->parent->pWin);
MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->underlayMarked = TRUE;
}
- return (underMarked || overMarked);
+ return underMarked || overMarked;
}
@@ -472,7 +476,7 @@ miOverlayComputeClips(
borderSize.y2 = dy;
oldVis = tParent->visibility;
- switch (RECT_IN_REGION( pScreen, universe, &borderSize)) {
+ switch (RegionContainsRect(universe, &borderSize)) {
case rgnIN:
newVis = VisibilityUnobscured;
break;
@@ -482,7 +486,7 @@ miOverlayComputeClips(
RegionPtr pBounding;
if ((pBounding = wBoundingShape (pParent))) {
- switch (miShapedWindowIn (pScreen, universe, pBounding,
+ switch (miShapedWindowIn (universe, pBounding,
&borderSize,
pParent->drawable.x,
pParent->drawable.y))
@@ -520,8 +524,8 @@ miOverlayComputeClips(
while (1) {
if (tChild->pWin->viewable) {
if (tChild->visibility != VisibilityFullyObscured) {
- REGION_TRANSLATE( pScreen, &tChild->borderClip, dx, dy);
- REGION_TRANSLATE( pScreen, &tChild->clipList, dx, dy);
+ RegionTranslate(&tChild->borderClip, dx, dy);
+ RegionTranslate(&tChild->clipList, dx, dy);
tChild->pWin->drawable.serialNumber =
NEXT_SERIAL_NUMBER;
@@ -529,14 +533,13 @@ miOverlayComputeClips(
(* pScreen->ClipNotify) (tChild->pWin, dx, dy);
}
if (tChild->valdata) {
- REGION_NULL(pScreen, &tChild->valdata->borderExposed);
+ RegionNull(&tChild->valdata->borderExposed);
if (HasParentRelativeBorder(tChild->pWin)){
- REGION_SUBTRACT(pScreen,
- &tChild->valdata->borderExposed,
- &tChild->borderClip,
- &tChild->pWin->winSize);
+ RegionSubtract(&tChild->valdata->borderExposed,
+ &tChild->borderClip,
+ &tChild->pWin->winSize);
}
- REGION_NULL(pScreen, &tChild->valdata->exposed);
+ RegionNull(&tChild->valdata->exposed);
}
if (tChild->firstChild) {
tChild = tChild->firstChild;
@@ -554,50 +557,50 @@ miOverlayComputeClips(
/* fall through */
default:
if (dx || dy) {
- REGION_TRANSLATE( pScreen, &tParent->borderClip, dx, dy);
- REGION_TRANSLATE( pScreen, &tParent->clipList, dx, dy);
+ RegionTranslate(&tParent->borderClip, dx, dy);
+ RegionTranslate(&tParent->clipList, dx, dy);
}
break;
case VTBroken:
- REGION_EMPTY (pScreen, &tParent->borderClip);
- REGION_EMPTY (pScreen, &tParent->clipList);
+ RegionEmpty(&tParent->borderClip);
+ RegionEmpty(&tParent->clipList);
break;
}
borderVisible = tParent->valdata->borderVisible;
- REGION_NULL(pScreen, &tParent->valdata->borderExposed);
- REGION_NULL(pScreen, &tParent->valdata->exposed);
+ RegionNull(&tParent->valdata->borderExposed);
+ RegionNull(&tParent->valdata->exposed);
if (HasBorder (pParent)) {
if (borderVisible) {
- REGION_SUBTRACT( pScreen, exposed, universe, borderVisible);
- REGION_DESTROY( pScreen, borderVisible);
+ RegionSubtract(exposed, universe, borderVisible);
+ RegionDestroy(borderVisible);
} else
- REGION_SUBTRACT( pScreen, exposed, universe, &tParent->borderClip);
+ RegionSubtract(exposed, universe, &tParent->borderClip);
if (HasParentRelativeBorder(pParent) && (dx || dy))
- REGION_SUBTRACT( pScreen, &tParent->valdata->borderExposed,
+ RegionSubtract(&tParent->valdata->borderExposed,
universe, &pParent->winSize);
else
- REGION_SUBTRACT( pScreen, &tParent->valdata->borderExposed,
+ RegionSubtract(&tParent->valdata->borderExposed,
exposed, &pParent->winSize);
- REGION_COPY( pScreen, &tParent->borderClip, universe);
- REGION_INTERSECT( pScreen, universe, universe, &pParent->winSize);
+ RegionCopy(&tParent->borderClip, universe);
+ RegionIntersect(universe, universe, &pParent->winSize);
}
else
- REGION_COPY( pScreen, &tParent->borderClip, universe);
+ RegionCopy(&tParent->borderClip, universe);
if ((tChild = tParent->firstChild) && pParent->mapped) {
- REGION_NULL(pScreen, &childUniverse);
- REGION_NULL(pScreen, &childUnion);
+ RegionNull(&childUniverse);
+ RegionNull(&childUnion);
for (; tChild; tChild = tChild->nextSib) {
if (tChild->pWin->viewable)
- REGION_APPEND( pScreen, &childUnion, &tChild->pWin->borderSize);
+ RegionAppend(&childUnion, &tChild->pWin->borderSize);
}
- REGION_VALIDATE( pScreen, &childUnion, &overlap);
+ RegionValidate(&childUnion, &overlap);
for (tChild = tParent->firstChild;
tChild;
@@ -605,31 +608,31 @@ miOverlayComputeClips(
{
if (tChild->pWin->viewable) {
if (tChild->valdata) {
- REGION_INTERSECT( pScreen, &childUniverse, universe,
+ RegionIntersect(&childUniverse, universe,
&tChild->pWin->borderSize);
miOverlayComputeClips (tChild->pWin, &childUniverse,
kind, exposed);
}
if (overlap)
- REGION_SUBTRACT( pScreen, universe, universe,
+ RegionSubtract(universe, universe,
&tChild->pWin->borderSize);
}
}
if (!overlap)
- REGION_SUBTRACT( pScreen, universe, universe, &childUnion);
- REGION_UNINIT( pScreen, &childUnion);
- REGION_UNINIT( pScreen, &childUniverse);
+ RegionSubtract(universe, universe, &childUnion);
+ RegionUninit(&childUnion);
+ RegionUninit(&childUniverse);
}
if (oldVis == VisibilityFullyObscured ||
oldVis == VisibilityNotViewable)
{
- REGION_COPY( pScreen, &tParent->valdata->exposed, universe);
+ RegionCopy(&tParent->valdata->exposed, universe);
}
else if (newVis != VisibilityFullyObscured &&
newVis != VisibilityNotViewable)
{
- REGION_SUBTRACT( pScreen, &tParent->valdata->exposed,
+ RegionSubtract(&tParent->valdata->exposed,
universe, &tParent->clipList);
}
@@ -707,14 +710,14 @@ miOverlayMarkUnrealizedWindow(
if ((pChild != pWin) || fromConfigure) {
miOverlayTreePtr pTree;
- REGION_EMPTY(pChild->drawable.pScreen, &pChild->clipList);
+ RegionEmpty(&pChild->clipList);
if (pChild->drawable.pScreen->ClipNotify)
(* pChild->drawable.pScreen->ClipNotify)(pChild, 0, 0);
- REGION_EMPTY(pChild->drawable.pScreen, &pChild->borderClip);
+ RegionEmpty(&pChild->borderClip);
if((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) {
if(pTree->valdata != (miOverlayValDataPtr)UnmapValData) {
- REGION_EMPTY(pChild->drawable.pScreen, &pTree->clipList);
- REGION_EMPTY(pChild->drawable.pScreen, &pTree->borderClip);
+ RegionEmpty(&pTree->clipList);
+ RegionEmpty(&pTree->borderClip);
}
}
}
@@ -739,9 +742,9 @@ miOverlayValidateTree(
if (!pChild) pChild = pParent->firstChild;
- REGION_NULL(pScreen, &totalClip);
- REGION_NULL(pScreen, &childClip);
- REGION_NULL(pScreen, &exposed);
+ RegionNull(&totalClip);
+ RegionNull(&childClip);
+ RegionNull(&exposed);
newParent = pParent;
@@ -755,52 +758,52 @@ miOverlayValidateTree(
else
tChild = tParent->firstChild;
- if (REGION_BROKEN (pScreen, &tParent->clipList) &&
- !REGION_BROKEN (pScreen, &tParent->borderClip))
+ if (RegionBroken(&tParent->clipList) &&
+ !RegionBroken(&tParent->borderClip))
{
kind = VTBroken;
- REGION_COPY (pScreen, &totalClip, &tParent->borderClip);
- REGION_INTERSECT (pScreen, &totalClip, &totalClip,
+ RegionCopy(&totalClip, &tParent->borderClip);
+ RegionIntersect(&totalClip, &totalClip,
&tParent->pWin->winSize);
for (tWin = tParent->firstChild; tWin != tChild; tWin = tWin->nextSib) {
if (tWin->pWin->viewable)
- REGION_SUBTRACT (pScreen, &totalClip, &totalClip,
+ RegionSubtract(&totalClip, &totalClip,
&tWin->pWin->borderSize);
}
- REGION_EMPTY (pScreen, &tParent->clipList);
+ RegionEmpty(&tParent->clipList);
} else {
for(tWin = tChild; tWin; tWin = tWin->nextSib) {
if(tWin->valdata)
- REGION_APPEND(pScreen, &totalClip, &tWin->borderClip);
+ RegionAppend(&totalClip, &tWin->borderClip);
}
- REGION_VALIDATE(pScreen, &totalClip, &overlap);
+ RegionValidate(&totalClip, &overlap);
}
if(kind != VTStack)
- REGION_UNION(pScreen, &totalClip, &totalClip, &tParent->clipList);
+ RegionUnion(&totalClip, &totalClip, &tParent->clipList);
for(tWin = tChild; tWin; tWin = tWin->nextSib) {
if(tWin->valdata) {
if(tWin->pWin->viewable) {
- REGION_INTERSECT(pScreen, &childClip, &totalClip,
+ RegionIntersect(&childClip, &totalClip,
&tWin->pWin->borderSize);
miOverlayComputeClips(tWin->pWin, &childClip, kind, &exposed);
- REGION_SUBTRACT(pScreen, &totalClip, &totalClip,
+ RegionSubtract(&totalClip, &totalClip,
&tWin->pWin->borderSize);
} else { /* Means we are unmapping */
- REGION_EMPTY(pScreen, &tWin->clipList);
- REGION_EMPTY( pScreen, &tWin->borderClip);
+ RegionEmpty(&tWin->clipList);
+ RegionEmpty(&tWin->borderClip);
tWin->valdata = NULL;
}
}
}
- REGION_UNINIT(pScreen, &childClip);
+ RegionUninit(&childClip);
if(!((*pPriv->InOverlay)(newParent))) {
- REGION_NULL(pScreen, &tParent->valdata->exposed);
- REGION_NULL(pScreen, &tParent->valdata->borderExposed);
+ RegionNull(&tParent->valdata->exposed);
+ RegionNull(&tParent->valdata->borderExposed);
}
switch (kind) {
@@ -808,18 +811,18 @@ miOverlayValidateTree(
break;
default:
if(!((*pPriv->InOverlay)(newParent)))
- REGION_SUBTRACT(pScreen, &tParent->valdata->exposed, &totalClip,
+ RegionSubtract(&tParent->valdata->exposed, &totalClip,
&tParent->clipList);
/* fall through */
case VTMap:
- REGION_COPY( pScreen, &tParent->clipList, &totalClip);
+ RegionCopy(&tParent->clipList, &totalClip);
if(!((*pPriv->InOverlay)(newParent)))
newParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
break;
}
- REGION_UNINIT( pScreen, &totalClip);
- REGION_UNINIT( pScreen, &exposed);
+ RegionUninit(&totalClip);
+ RegionUninit(&exposed);
SKIP_UNDERLAY:
@@ -852,14 +855,14 @@ miOverlayHandleExposures(WindowPtr pWin)
while (1) {
if((mival = pTree->valdata)) {
if(!((*pPriv->InOverlay)(pTree->pWin))) {
- if (REGION_NOTEMPTY(pScreen, &mival->borderExposed)) {
+ if (RegionNotEmpty(&mival->borderExposed)) {
miPaintWindow(pTree->pWin, &mival->borderExposed,
PW_BORDER);
}
- REGION_UNINIT(pScreen, &mival->borderExposed);
+ RegionUninit(&mival->borderExposed);
(*WindowExposures)(pTree->pWin,&mival->exposed,NullRegion);
- REGION_UNINIT(pScreen, &mival->exposed);
+ RegionUninit(&mival->exposed);
}
free(mival);
pTree->valdata = NULL;
@@ -881,24 +884,24 @@ miOverlayHandleExposures(WindowPtr pWin)
while (1) {
if ( (val = pChild->valdata) ) {
if(!((*pPriv->InOverlay)(pChild))) {
- REGION_UNION(pScreen, &val->after.exposed, &val->after.exposed,
+ RegionUnion(&val->after.exposed, &val->after.exposed,
&val->after.borderExposed);
- if (REGION_NOTEMPTY(pScreen, &val->after.exposed)) {
+ if (RegionNotEmpty(&val->after.exposed)) {
(*(MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->MakeTransparent))(
pScreen,
- REGION_NUM_RECTS(&val->after.exposed),
- REGION_RECTS(&val->after.exposed));
+ RegionNumRects(&val->after.exposed),
+ RegionRects(&val->after.exposed));
}
} else {
- if (REGION_NOTEMPTY(pScreen, &val->after.borderExposed)) {
+ if (RegionNotEmpty(&val->after.borderExposed)) {
miPaintWindow(pChild, &val->after.borderExposed,
PW_BORDER);
}
(*WindowExposures)(pChild, &val->after.exposed, NullRegion);
}
- REGION_UNINIT(pScreen, &val->after.borderExposed);
- REGION_UNINIT(pScreen, &val->after.exposed);
+ RegionUninit(&val->after.borderExposed);
+ RegionUninit(&val->after.exposed);
free(val);
pChild->valdata = NULL;
if (pChild->firstChild)
@@ -939,13 +942,13 @@ miOverlayMoveWindow(
oldpt.x = pWin->drawable.x;
oldpt.y = pWin->drawable.y;
if (WasViewable) {
- REGION_NULL(pScreen, &overReg);
- REGION_NULL(pScreen, &underReg);
+ RegionNull(&overReg);
+ RegionNull(&underReg);
if(pTree) {
- REGION_COPY(pScreen, &overReg, &pWin->borderClip);
- REGION_COPY(pScreen, &underReg, &pTree->borderClip);
+ RegionCopy(&overReg, &pWin->borderClip);
+ RegionCopy(&underReg, &pTree->borderClip);
} else {
- REGION_COPY(pScreen, &overReg, &pWin->borderClip);
+ RegionCopy(&overReg, &pWin->borderClip);
CollectUnderlayChildrenRegions(pWin, &underReg);
}
(*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
@@ -970,16 +973,16 @@ miOverlayMoveWindow(
(*pScreen->ValidateTree)(pWin->parent, NullWindow, kind);
- if(REGION_NOTEMPTY(pScreen, &underReg)) {
+ if(RegionNotEmpty(&underReg)) {
pPriv->copyUnderlay = TRUE;
(* pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, &underReg);
}
- REGION_UNINIT(pScreen, &underReg);
- if(REGION_NOTEMPTY(pScreen, &overReg)) {
+ RegionUninit(&underReg);
+ if(RegionNotEmpty(&overReg)) {
pPriv->copyUnderlay = FALSE;
(* pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, &overReg);
}
- REGION_UNINIT(pScreen, &overReg);
+ RegionUninit(&overReg);
(*pScreen->HandleExposures)(pWin->parent);
if (pScreen->PostValidateTree)
@@ -1000,10 +1003,9 @@ miOverlayWindowExposures(
RegionPtr other_exposed
){
RegionPtr exposures = prgn;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- if ((prgn && !REGION_NIL(prgn)) ||
- (exposures && !REGION_NIL(exposures)) || other_exposed)
+ if ((prgn && !RegionNil(prgn)) ||
+ (exposures && !RegionNil(exposures)) || other_exposed)
{
RegionRec expRec;
int clientInterested;
@@ -1012,51 +1014,52 @@ miOverlayWindowExposures(
ExposureMask;
if (other_exposed) {
if (exposures) {
- REGION_UNION(pScreen, other_exposed, exposures, other_exposed);
+ RegionUnion(other_exposed, exposures, other_exposed);
if (exposures != prgn)
- REGION_DESTROY(pScreen, exposures);
+ RegionDestroy(exposures);
}
exposures = other_exposed;
}
if (clientInterested && exposures &&
- (REGION_NUM_RECTS(exposures) > RECTLIMIT))
+ (RegionNumRects(exposures) > RECTLIMIT))
{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
BoxRec box;
- box = *REGION_EXTENTS(pScreen, exposures);
+ box = *RegionExtents(exposures);
if (exposures == prgn) {
exposures = &expRec;
- REGION_INIT(pScreen, exposures, &box, 1);
- REGION_RESET(pScreen, prgn, &box);
+ RegionInit(exposures, &box, 1);
+ RegionReset(prgn, &box);
} else {
- REGION_RESET(pScreen, exposures, &box);
- REGION_UNION(pScreen, prgn, prgn, exposures);
+ RegionReset(exposures, &box);
+ RegionUnion(prgn, prgn, exposures);
}
/* This is the only reason why we are replacing mi's version
of this file */
if(!((*pPriv->InOverlay)(pWin))) {
miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
- REGION_INTERSECT(pScreen, prgn, prgn, &pTree->clipList);
+ RegionIntersect(prgn, prgn, &pTree->clipList);
} else
- REGION_INTERSECT(pScreen, prgn, prgn, &pWin->clipList);
+ RegionIntersect(prgn, prgn, &pWin->clipList);
}
- if (prgn && !REGION_NIL(prgn))
+ if (prgn && !RegionNil(prgn))
miPaintWindow(pWin, prgn, PW_BACKGROUND);
- if (clientInterested && exposures && !REGION_NIL(exposures))
+ if (clientInterested && exposures && !RegionNil(exposures))
miSendExposures(pWin, exposures,
pWin->drawable.x, pWin->drawable.y);
if (exposures == &expRec) {
- REGION_UNINIT(pScreen, exposures);
+ RegionUninit(exposures);
}
else if (exposures && exposures != prgn && exposures != other_exposed)
- REGION_DESTROY(pScreen, exposures);
+ RegionDestroy(exposures);
if (prgn)
- REGION_EMPTY(pScreen, prgn);
+ RegionEmpty(prgn);
}
else if (exposures && exposures != prgn)
- REGION_DESTROY(pScreen, exposures);
+ RegionDestroy(exposures);
}
@@ -1070,34 +1073,30 @@ miOverlayRecomputeExposures (
WindowPtr pWin,
pointer value
){
- ScreenPtr pScreen;
miOverlayTwoRegions *pValid = (miOverlayTwoRegions*)value;
miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
- /* This prevents warning about pScreen not being used. */
- pWin->drawable.pScreen = pScreen = pWin->drawable.pScreen;
-
if (pWin->valdata) {
/*
* compute exposed regions of this window
*/
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.exposed,
+ RegionSubtract(&pWin->valdata->after.exposed,
&pWin->clipList, pValid->over);
/*
* compute exposed regions of the border
*/
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.borderExposed,
+ RegionSubtract(&pWin->valdata->after.borderExposed,
&pWin->borderClip, &pWin->winSize);
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.borderExposed,
+ RegionSubtract(&pWin->valdata->after.borderExposed,
&pWin->valdata->after.borderExposed, pValid->over);
}
if(pTree && pTree->valdata) {
- REGION_SUBTRACT(pScreen, &pTree->valdata->exposed,
+ RegionSubtract(&pTree->valdata->exposed,
&pTree->clipList, pValid->under);
- REGION_SUBTRACT(pScreen, &pTree->valdata->borderExposed,
+ RegionSubtract(&pTree->valdata->borderExposed,
&pTree->borderClip, &pWin->winSize);
- REGION_SUBTRACT(pScreen, &pTree->valdata->borderExposed,
+ RegionSubtract(&pTree->valdata->borderExposed,
&pTree->valdata->borderExposed, pValid->under);
} else if (!pWin->valdata)
return WT_NOMATCH;
@@ -1153,11 +1152,11 @@ miOverlayResizeWindow(
/*
* save the visible region of the window
*/
- oldRegion = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldRegion, &pWin->winSize);
+ oldRegion = RegionCreate(NullBox, 1);
+ RegionCopy(oldRegion, &pWin->winSize);
if(doUnderlay) {
- oldRegion2 = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldRegion2, &pWin->winSize);
+ oldRegion2 = RegionCreate(NullBox, 1);
+ RegionCopy(oldRegion2, &pWin->winSize);
}
/*
@@ -1169,16 +1168,16 @@ miOverlayResizeWindow(
g = pChild->winGravity;
if (g != UnmapGravity) {
if (!gravitate[g])
- gravitate[g] = REGION_CREATE(pScreen, NullBox, 1);
- REGION_UNION(pScreen, gravitate[g],
+ gravitate[g] = RegionCreate(NullBox, 1);
+ RegionUnion(gravitate[g],
gravitate[g], &pChild->borderClip);
if(doUnderlay) {
if (!gravitate2[g])
- gravitate2[g] = REGION_CREATE(pScreen, NullBox, 0);
+ gravitate2[g] = RegionCreate(NullBox, 0);
if((tChild = MIOVERLAY_GET_WINDOW_TREE(pChild))) {
- REGION_UNION(pScreen, gravitate2[g],
+ RegionUnion(gravitate2[g],
gravitate2[g], &tChild->borderClip);
} else
CollectUnderlayChildrenRegions(pChild, gravitate2[g]);
@@ -1192,11 +1191,11 @@ miOverlayResizeWindow(
oldWinClip = oldWinClip2 = NULL;
if (pWin->bitGravity != ForgetGravity) {
- oldWinClip = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldWinClip, &pWin->clipList);
+ oldWinClip = RegionCreate(NullBox, 1);
+ RegionCopy(oldWinClip, &pWin->clipList);
if(pTree) {
- oldWinClip2 = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldWinClip2, &pTree->clipList);
+ oldWinClip2 = RegionCreate(NullBox, 1);
+ RegionCopy(oldWinClip2, &pTree->clipList);
}
}
/*
@@ -1212,26 +1211,26 @@ miOverlayResizeWindow(
if ((pWin->drawable.height != h || pWin->drawable.width != w) &&
HasBorder (pWin))
{
- borderVisible = REGION_CREATE(pScreen, NullBox, 1);
+ borderVisible = RegionCreate(NullBox, 1);
if(pTree)
- borderVisible2 = REGION_CREATE(pScreen, NullBox, 1);
+ borderVisible2 = RegionCreate(NullBox, 1);
/* for tiled borders, we punt and draw the whole thing */
if (pWin->borderIsPixel || !moved)
{
if (shrunk || moved)
- REGION_SUBTRACT(pScreen, borderVisible,
+ RegionSubtract(borderVisible,
&pWin->borderClip,
&pWin->winSize);
else
- REGION_COPY(pScreen, borderVisible,
+ RegionCopy(borderVisible,
&pWin->borderClip);
if(pTree) {
if (shrunk || moved)
- REGION_SUBTRACT(pScreen, borderVisible,
+ RegionSubtract(borderVisible,
&pTree->borderClip,
&pWin->winSize);
else
- REGION_COPY(pScreen, borderVisible,
+ RegionCopy(borderVisible,
&pTree->borderClip);
}
}
@@ -1258,7 +1257,7 @@ miOverlayResizeWindow(
pFirstChange = MoveWindowInStack(pWin, pSib);
if (WasViewable) {
- pRegion = REGION_CREATE(pScreen, NullBox, 1);
+ pRegion = RegionCreate(NullBox, 1);
(*pScreen->MarkOverlappedWindows)(pWin, pFirstChange, NULL);
@@ -1273,9 +1272,9 @@ miOverlayResizeWindow(
* the entire window is trashed unless bitGravity
* recovers portions of it
*/
- REGION_COPY(pScreen, &pWin->valdata->after.exposed, &pWin->clipList);
+ RegionCopy(&pWin->valdata->after.exposed, &pWin->clipList);
if(pTree)
- REGION_COPY(pScreen, &pTree->valdata->exposed, &pTree->clipList);
+ RegionCopy(&pTree->valdata->exposed, &pTree->clipList);
}
GravityTranslate (x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny);
@@ -1303,20 +1302,20 @@ miOverlayResizeWindow(
dx = (oldx - nx) - offx;
dy = (oldy - ny) - offy;
if (dx || dy) {
- REGION_TRANSLATE(pScreen, &pWin->winSize, dx, dy);
+ RegionTranslate(&pWin->winSize, dx, dy);
offx += dx;
offy += dy;
}
if(gravitate[g])
- REGION_INTERSECT(pScreen, gravitate[g], gravitate[g],
+ RegionIntersect(gravitate[g], gravitate[g],
&pWin->winSize);
if(gravitate2[g])
- REGION_INTERSECT(pScreen, gravitate2[g], gravitate2[g],
+ RegionIntersect(gravitate2[g], gravitate2[g],
&pWin->winSize);
}
/* get winSize back where it belongs */
if (offx || offy)
- REGION_TRANSLATE(pScreen, &pWin->winSize, -offx, -offy);
+ RegionTranslate(&pWin->winSize, -offx, -offy);
}
/*
* add screen bits to the appropriate bucket
@@ -1324,22 +1323,22 @@ miOverlayResizeWindow(
if (oldWinClip2)
{
- REGION_COPY(pScreen, pRegion, oldWinClip2);
- REGION_TRANSLATE(pScreen, pRegion, nx - oldx, ny - oldy);
- REGION_INTERSECT(pScreen, oldWinClip2, pRegion, &pTree->clipList);
+ RegionCopy(pRegion, oldWinClip2);
+ RegionTranslate(pRegion, nx - oldx, ny - oldy);
+ RegionIntersect(oldWinClip2, pRegion, &pTree->clipList);
for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) {
if (gravitate2[g])
- REGION_SUBTRACT(pScreen, oldWinClip2, oldWinClip2,
+ RegionSubtract(oldWinClip2, oldWinClip2,
gravitate2[g]);
}
- REGION_TRANSLATE(pScreen, oldWinClip2, oldx - nx, oldy - ny);
+ RegionTranslate(oldWinClip2, oldx - nx, oldy - ny);
g = pWin->bitGravity;
if (!gravitate2[g])
gravitate2[g] = oldWinClip2;
else {
- REGION_UNION(pScreen,gravitate2[g],gravitate2[g],oldWinClip2);
- REGION_DESTROY(pScreen, oldWinClip2);
+ RegionUnion(gravitate2[g],gravitate2[g],oldWinClip2);
+ RegionDestroy(oldWinClip2);
}
}
@@ -1348,9 +1347,9 @@ miOverlayResizeWindow(
/*
* clip to new clipList
*/
- REGION_COPY(pScreen, pRegion, oldWinClip);
- REGION_TRANSLATE(pScreen, pRegion, nx - oldx, ny - oldy);
- REGION_INTERSECT(pScreen, oldWinClip, pRegion, &pWin->clipList);
+ RegionCopy(pRegion, oldWinClip);
+ RegionTranslate(pRegion, nx - oldx, ny - oldy);
+ RegionIntersect(oldWinClip, pRegion, &pWin->clipList);
/*
* don't step on any gravity bits which will be copied after this
* region. Note -- this assumes that the regions will be copied
@@ -1358,16 +1357,16 @@ miOverlayResizeWindow(
*/
for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) {
if (gravitate[g])
- REGION_SUBTRACT(pScreen, oldWinClip, oldWinClip,
+ RegionSubtract(oldWinClip, oldWinClip,
gravitate[g]);
}
- REGION_TRANSLATE(pScreen, oldWinClip, oldx - nx, oldy - ny);
+ RegionTranslate(oldWinClip, oldx - nx, oldy - ny);
g = pWin->bitGravity;
if (!gravitate[g])
gravitate[g] = oldWinClip;
else {
- REGION_UNION(pScreen, gravitate[g], gravitate[g], oldWinClip);
- REGION_DESTROY(pScreen, oldWinClip);
+ RegionUnion(gravitate[g], gravitate[g], oldWinClip);
+ RegionDestroy(oldWinClip);
}
}
@@ -1391,23 +1390,23 @@ miOverlayResizeWindow(
/* only copy the remaining useful bits */
if(gravitate[g])
- REGION_INTERSECT(pScreen, gravitate[g],
+ RegionIntersect(gravitate[g],
gravitate[g], oldRegion);
if(gravitate2[g])
- REGION_INTERSECT(pScreen, gravitate2[g],
+ RegionIntersect(gravitate2[g],
gravitate2[g], oldRegion2);
/* clip to not overwrite already copied areas */
if (destClip && gravitate[g]) {
- REGION_TRANSLATE(pScreen, destClip, oldpt.x - x, oldpt.y - y);
- REGION_SUBTRACT(pScreen, gravitate[g], gravitate[g], destClip);
- REGION_TRANSLATE(pScreen, destClip, x - oldpt.x, y - oldpt.y);
+ RegionTranslate(destClip, oldpt.x - x, oldpt.y - y);
+ RegionSubtract(gravitate[g], gravitate[g], destClip);
+ RegionTranslate(destClip, x - oldpt.x, y - oldpt.y);
}
if (destClip2 && gravitate2[g]) {
- REGION_TRANSLATE(pScreen, destClip2, oldpt.x - x, oldpt.y - y);
- REGION_SUBTRACT(pScreen,gravitate2[g],gravitate2[g],destClip2);
- REGION_TRANSLATE(pScreen, destClip2, x - oldpt.x, y - oldpt.y);
+ RegionTranslate(destClip2, oldpt.x - x, oldpt.y - y);
+ RegionSubtract(gravitate2[g],gravitate2[g],destClip2);
+ RegionTranslate(destClip2, x - oldpt.x, y - oldpt.y);
}
/* and move those bits */
@@ -1415,22 +1414,20 @@ miOverlayResizeWindow(
if (oldpt.x != x || oldpt.y != y) {
if(gravitate2[g]) {
pPriv->copyUnderlay = TRUE;
- (*pWin->drawable.pScreen->CopyWindow)(
- pWin, oldpt, gravitate2[g]);
+ (*pScreen->CopyWindow)(pWin, oldpt, gravitate2[g]);
}
if(gravitate[g]) {
pPriv->copyUnderlay = FALSE;
- (*pWin->drawable.pScreen->CopyWindow)(
- pWin, oldpt, gravitate[g]);
+ (*pScreen->CopyWindow)(pWin, oldpt, gravitate[g]);
}
}
/* remove any overwritten bits from the remaining useful bits */
if(gravitate[g])
- REGION_SUBTRACT(pScreen, oldRegion, oldRegion, gravitate[g]);
+ RegionSubtract(oldRegion, oldRegion, gravitate[g]);
if(gravitate2[g])
- REGION_SUBTRACT(pScreen, oldRegion2, oldRegion2, gravitate2[g]);
+ RegionSubtract(oldRegion2, oldRegion2, gravitate2[g]);
/*
* recompute exposed regions of child windows
@@ -1455,38 +1452,38 @@ miOverlayResizeWindow(
if (g == pWin->bitGravity) {
if(gravitate[g])
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.exposed,
+ RegionSubtract(&pWin->valdata->after.exposed,
&pWin->valdata->after.exposed, gravitate[g]);
if(gravitate2[g] && pTree)
- REGION_SUBTRACT(pScreen, &pTree->valdata->exposed,
+ RegionSubtract(&pTree->valdata->exposed,
&pTree->valdata->exposed, gravitate2[g]);
}
if(gravitate[g]) {
if (!destClip)
destClip = gravitate[g];
else {
- REGION_UNION(pScreen, destClip, destClip, gravitate[g]);
- REGION_DESTROY(pScreen, gravitate[g]);
+ RegionUnion(destClip, destClip, gravitate[g]);
+ RegionDestroy(gravitate[g]);
}
}
if(gravitate2[g]) {
if (!destClip2)
destClip2 = gravitate2[g];
else {
- REGION_UNION(pScreen, destClip2, destClip2, gravitate2[g]);
- REGION_DESTROY(pScreen, gravitate2[g]);
+ RegionUnion(destClip2, destClip2, gravitate2[g]);
+ RegionDestroy(gravitate2[g]);
}
}
}
- REGION_DESTROY(pScreen, pRegion);
- REGION_DESTROY(pScreen, oldRegion);
+ RegionDestroy(pRegion);
+ RegionDestroy(oldRegion);
if(doUnderlay)
- REGION_DESTROY(pScreen, oldRegion2);
+ RegionDestroy(oldRegion2);
if (destClip)
- REGION_DESTROY(pScreen, destClip);
+ RegionDestroy(destClip);
if (destClip2)
- REGION_DESTROY(pScreen, destClip2);
+ RegionDestroy(destClip2);
(*pScreen->HandleExposures)(pWin->parent);
if (pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pWin->parent, pFirstChange, VTOther);
@@ -1497,53 +1494,55 @@ miOverlayResizeWindow(
static void
-miOverlaySetShape(WindowPtr pWin)
+miOverlaySetShape(WindowPtr pWin, int kind)
{
- Bool WasViewable = (Bool)(pWin->viewable);
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- if (WasViewable) {
- (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
-
- if (HasBorder (pWin)) {
- RegionPtr borderVisible;
-
- borderVisible = REGION_CREATE(pScreen, NullBox, 1);
- REGION_SUBTRACT(pScreen, borderVisible,
- &pWin->borderClip, &pWin->winSize);
- pWin->valdata->before.borderVisible = borderVisible;
- pWin->valdata->before.resized = TRUE;
- if(IN_UNDERLAY(pWin)) {
- miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
- RegionPtr borderVisible2;
-
- borderVisible2 = REGION_CREATE(pScreen, NULL, 1);
- REGION_SUBTRACT(pScreen, borderVisible2,
- &pTree->borderClip, &pWin->winSize);
- pTree->valdata->borderVisible = borderVisible2;
- }
- }
- }
+ Bool WasViewable = (Bool)(pWin->viewable);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ if (kind != ShapeInput) {
+ if (WasViewable) {
+ (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
+
+ if (HasBorder (pWin)) {
+ RegionPtr borderVisible;
+
+ borderVisible = RegionCreate(NullBox, 1);
+ RegionSubtract(borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ pWin->valdata->before.resized = TRUE;
+ if(IN_UNDERLAY(pWin)) {
+ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
+ RegionPtr borderVisible2;
+
+ borderVisible2 = RegionCreate(NULL, 1);
+ RegionSubtract(borderVisible2,
+ &pTree->borderClip, &pWin->winSize);
+ pTree->valdata->borderVisible = borderVisible2;
+ }
+ }
+ }
- SetWinSize (pWin);
- SetBorderSize (pWin);
+ SetWinSize (pWin);
+ SetBorderSize (pWin);
- ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
+ ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
- if (WasViewable) {
- (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
+ if (WasViewable) {
+ (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
- (*pScreen->ValidateTree)(pWin->parent, NullWindow, VTOther);
- }
+ (*pScreen->ValidateTree)(pWin->parent, NullWindow, VTOther);
+ }
- if (WasViewable) {
- (*pScreen->HandleExposures)(pWin->parent);
- if (pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin->parent, NullWindow, VTOther);
+ if (WasViewable) {
+ (*pScreen->HandleExposures)(pWin->parent);
+ if (pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pWin->parent, NullWindow, VTOther);
+ }
}
if (pWin->realized)
- WindowsRestructured ();
+ WindowsRestructured ();
CheckCursorConfinement(pWin);
}
@@ -1576,16 +1575,16 @@ miOverlayChangeBorderWidth(
if (HadBorder) {
RegionPtr borderVisible;
- borderVisible = REGION_CREATE(pScreen, NULL, 1);
- REGION_SUBTRACT(pScreen, borderVisible,
+ borderVisible = RegionCreate(NULL, 1);
+ RegionSubtract(borderVisible,
&pWin->borderClip, &pWin->winSize);
pWin->valdata->before.borderVisible = borderVisible;
if(IN_UNDERLAY(pWin)) {
miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
RegionPtr borderVisible2;
- borderVisible2 = REGION_CREATE(pScreen, NULL, 1);
- REGION_SUBTRACT(pScreen, borderVisible2,
+ borderVisible2 = RegionCreate(NULL, 1);
+ RegionSubtract(borderVisible2,
&pTree->borderClip, &pWin->winSize);
pTree->valdata->borderVisible = borderVisible2;
}
@@ -1607,7 +1606,7 @@ miOverlayChangeBorderWidth(
void
miOverlaySetRootClip(ScreenPtr pScreen, Bool enable)
{
- WindowPtr pRoot = WindowTable[pScreen->myNum];
+ WindowPtr pRoot = pScreen->root;
miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pRoot);
MARK_UNDERLAY(pRoot);
@@ -1620,11 +1619,11 @@ miOverlaySetRootClip(ScreenPtr pScreen, Bool enable)
box.x2 = pScreen->width;
box.y2 = pScreen->height;
- REGION_RESET(pScreen, &pTree->borderClip, &box);
+ RegionReset(&pTree->borderClip, &box);
} else
- REGION_EMPTY(pScreen, &pTree->borderClip);
+ RegionEmpty(&pTree->borderClip);
- REGION_BREAK(pScreen, &pTree->clipList);
+ RegionBreak(&pTree->clipList);
}
static void
@@ -1659,7 +1658,7 @@ miOverlayClearToBackground(
clipList = ((*pScreenPriv->InOverlay)(pWin)) ? &pWin->clipList :
&pTree->clipList;
- extents = REGION_EXTENTS(pScreen, clipList);
+ extents = RegionExtents(clipList);
if (x1 < extents->x1) x1 = extents->x1;
if (x2 > extents->x2) x2 = extents->x2;
@@ -1672,16 +1671,16 @@ miOverlayClearToBackground(
box.x1 = x1; box.x2 = x2;
box.y1 = y1; box.y2 = y2;
- REGION_INIT(pScreen, &reg, &box, 1);
+ RegionInit(&reg, &box, 1);
- REGION_INTERSECT(pScreen, &reg, &reg, clipList);
+ RegionIntersect(&reg, &reg, clipList);
if (generateExposures)
(*pScreen->WindowExposures)(pWin, &reg, pBSReg);
else if (pWin->backgroundState != None)
miPaintWindow(pWin, &reg, PW_BACKGROUND);
- REGION_UNINIT(pScreen, &reg);
+ RegionUninit(&reg);
if (pBSReg)
- REGION_DESTROY(pScreen, pBSReg);
+ RegionDestroy(pBSReg);
}
@@ -1724,7 +1723,6 @@ miOverlayCopyUnderlay(ScreenPtr pScreen)
void
miOverlayComputeCompositeClip(GCPtr pGC, WindowPtr pWin)
{
- ScreenPtr pScreen = pGC->pScreen;
miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
RegionPtr pregWin;
Bool freeTmpClip, freeCompClip;
@@ -1735,12 +1733,12 @@ miOverlayComputeCompositeClip(GCPtr pGC, WindowPtr pWin)
}
if (pGC->subWindowMode == IncludeInferiors) {
- pregWin = REGION_CREATE(pScreen, NullBox, 1);
+ pregWin = RegionCreate(NullBox, 1);
freeTmpClip = TRUE;
if (pWin->parent || (screenIsSaved != SCREEN_SAVER_ON) ||
- !HasSaverWindow (pScreen->myNum))
+ !HasSaverWindow (pGC->pScreen))
{
- REGION_INTERSECT(pScreen,pregWin,&pTree->borderClip,&pWin->winSize);
+ RegionIntersect(pregWin,&pTree->borderClip,&pWin->winSize);
}
} else {
pregWin = &pTree->clipList;
@@ -1749,29 +1747,29 @@ miOverlayComputeCompositeClip(GCPtr pGC, WindowPtr pWin)
freeCompClip = pGC->freeCompClip;
if (pGC->clientClipType == CT_NONE) {
if (freeCompClip)
- REGION_DESTROY(pScreen, pGC->pCompositeClip);
+ RegionDestroy(pGC->pCompositeClip);
pGC->pCompositeClip = pregWin;
pGC->freeCompClip = freeTmpClip;
} else {
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ RegionTranslate(pGC->clientClip,
pWin->drawable.x + pGC->clipOrg.x,
pWin->drawable.y + pGC->clipOrg.y);
if (freeCompClip) {
- REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ RegionIntersect(pGC->pCompositeClip,
pregWin, pGC->clientClip);
if (freeTmpClip)
- REGION_DESTROY(pScreen, pregWin);
+ RegionDestroy(pregWin);
} else if (freeTmpClip) {
- REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip);
+ RegionIntersect(pregWin, pregWin, pGC->clientClip);
pGC->pCompositeClip = pregWin;
} else {
- pGC->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
- REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip = RegionCreate(NullBox, 0);
+ RegionIntersect(pGC->pCompositeClip,
pregWin, pGC->clientClip);
}
pGC->freeCompClip = TRUE;
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ RegionTranslate(pGC->clientClip,
-(pWin->drawable.x + pGC->clipOrg.x),
-(pWin->drawable.y + pGC->clipOrg.y));
}
@@ -1789,7 +1787,7 @@ miOverlayCollectUnderlayRegions(
return FALSE;
}
- *region = REGION_CREATE(pWin->drawable.pScreen, NullBox, 0);
+ *region = RegionCreate(NullBox, 0);
CollectUnderlayChildrenRegions(pWin, *region);
@@ -1910,7 +1908,7 @@ CollectUnderlayChildrenRegions(WindowPtr pWin, RegionPtr pReg)
while(1) {
if((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) {
- REGION_APPEND(pScreen, pReg, &pTree->borderClip);
+ RegionAppend(pReg, &pTree->borderClip);
hasUnderlay = TRUE;
} else
if(pChild->firstChild) {
@@ -1928,7 +1926,7 @@ CollectUnderlayChildrenRegions(WindowPtr pWin, RegionPtr pReg)
if(hasUnderlay) {
Bool overlap;
- REGION_VALIDATE(pScreen, pReg, &overlap);
+ RegionValidate(pReg, &overlap);
}
return hasUnderlay;
diff --git a/xorg-server/mi/mipointer.c b/xorg-server/mi/mipointer.c
index 069a38bd8..4b9ce0fa5 100644
--- a/xorg-server/mi/mipointer.c
+++ b/xorg-server/mi/mipointer.c
@@ -40,15 +40,13 @@ in this Software without prior written authorization from The Open Group.
# include "dixstruct.h"
# include "inputstr.h"
-static int miPointerScreenKeyIndex;
-DevPrivateKey miPointerScreenKey = &miPointerScreenKeyIndex;
+DevPrivateKeyRec miPointerScreenKeyRec;
#define GetScreenPrivate(s) ((miPointerScreenPtr) \
dixLookupPrivate(&(s)->devPrivates, miPointerScreenKey))
#define SetupScreen(s) miPointerScreenPtr pScreenPriv = GetScreenPrivate(s)
-static int miPointerPrivKeyIndex;
-static DevPrivateKey miPointerPrivKey = &miPointerPrivKeyIndex;
+DevPrivateKeyRec miPointerPrivKeyRec;
#define MIPOINTER(dev) \
((!IsMaster(dev) && !dev->u.master) ? \
@@ -86,6 +84,12 @@ miPointerInitialize (ScreenPtr pScreen,
{
miPointerScreenPtr pScreenPriv;
+ if (!dixRegisterPrivateKey(&miPointerScreenKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&miPointerPrivKeyRec, PRIVATE_DEVICE, 0))
+ return FALSE;
+
pScreenPriv = malloc(sizeof (miPointerScreenRec));
if (!pScreenPriv)
return FALSE;
diff --git a/xorg-server/mi/mipointer.h b/xorg-server/mi/mipointer.h
index 22575ea21..c48001267 100644
--- a/xorg-server/mi/mipointer.h
+++ b/xorg-server/mi/mipointer.h
@@ -1,144 +1,148 @@
-/*
-
-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.
-*/
-
-#ifndef MIPOINTER_H
-#define MIPOINTER_H
-
-#include "cursor.h"
-#include "input.h"
-#include "privates.h"
-
-typedef struct _miPointerSpriteFuncRec {
- Bool (*RealizeCursor)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */,
- CursorPtr /* pCurs */
- );
- Bool (*UnrealizeCursor)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */,
- CursorPtr /* pCurs */
- );
- void (*SetCursor)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */,
- CursorPtr /* pCurs */,
- int /* x */,
- int /* y */
- );
- void (*MoveCursor)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */,
- int /* x */,
- int /* y */
- );
- Bool (*DeviceCursorInitialize)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */
- );
- void (*DeviceCursorCleanup)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */
- );
-} miPointerSpriteFuncRec, *miPointerSpriteFuncPtr;
-
-typedef struct _miPointerScreenFuncRec {
- Bool (*CursorOffScreen)(
- ScreenPtr* /* ppScr */,
- int* /* px */,
- int* /* py */
- );
- void (*CrossScreen)(
- ScreenPtr /* pScr */,
- int /* entering */
- );
- void (*WarpCursor)(
- DeviceIntPtr /*pDev*/,
- ScreenPtr /* pScr */,
- int /* x */,
- int /* y */
- );
- void (*EnqueueEvent)(
- DeviceIntPtr /* pDev */,
- InternalEvent* /* event */
- );
- void (*NewEventScreen)(
- DeviceIntPtr /* pDev */,
- ScreenPtr /* pScr */,
- Bool /* fromDIX */
- );
-} miPointerScreenFuncRec, *miPointerScreenFuncPtr;
-
-extern _X_EXPORT Bool miDCInitialize(
- ScreenPtr /*pScreen*/,
- miPointerScreenFuncPtr /*screenFuncs*/
-);
-
-extern _X_EXPORT Bool miPointerInitialize(
- ScreenPtr /*pScreen*/,
- miPointerSpriteFuncPtr /*spriteFuncs*/,
- miPointerScreenFuncPtr /*screenFuncs*/,
- Bool /*waitForUpdate*/
-);
-
-extern _X_EXPORT void miPointerWarpCursor(
- DeviceIntPtr /*pDev*/,
- ScreenPtr /*pScreen*/,
- int /*x*/,
- int /*y*/
-);
-
-/* Deprecated in favour of miPointerGetScreen. */
-extern _X_EXPORT ScreenPtr miPointerCurrentScreen(
- void
-) _X_DEPRECATED;
-
-extern _X_EXPORT ScreenPtr miPointerGetScreen(
- DeviceIntPtr pDev);
-extern _X_EXPORT void miPointerSetScreen(
- DeviceIntPtr pDev,
- int screen_num,
- int x,
- int y);
-
-/* Returns the current cursor position. */
-extern _X_EXPORT void miPointerGetPosition(
- DeviceIntPtr pDev,
- int *x,
- int *y);
-
-/* Moves the cursor to the specified position. May clip the co-ordinates:
- * x and y are modified in-place. */
-extern _X_EXPORT void miPointerSetPosition(
- DeviceIntPtr pDev,
- int *x,
- int *y);
-
-extern _X_EXPORT void miPointerUpdateSprite(
- DeviceIntPtr pDev);
-
-extern _X_EXPORT DevPrivateKey miPointerScreenKey;
-
-#endif /* MIPOINTER_H */
+/*
+
+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.
+*/
+
+#ifndef MIPOINTER_H
+#define MIPOINTER_H
+
+#include "cursor.h"
+#include "input.h"
+#include "privates.h"
+
+typedef struct _miPointerSpriteFuncRec {
+ Bool (*RealizeCursor)(
+ DeviceIntPtr /* pDev */,
+ ScreenPtr /* pScr */,
+ CursorPtr /* pCurs */
+ );
+ Bool (*UnrealizeCursor)(
+ DeviceIntPtr /* pDev */,
+ ScreenPtr /* pScr */,
+ CursorPtr /* pCurs */
+ );
+ void (*SetCursor)(
+ DeviceIntPtr /* pDev */,
+ ScreenPtr /* pScr */,
+ CursorPtr /* pCurs */,
+ int /* x */,
+ int /* y */
+ );
+ void (*MoveCursor)(
+ DeviceIntPtr /* pDev */,
+ ScreenPtr /* pScr */,
+ int /* x */,
+ int /* y */
+ );
+ Bool (*DeviceCursorInitialize)(
+ DeviceIntPtr /* pDev */,
+ ScreenPtr /* pScr */
+ );
+ void (*DeviceCursorCleanup)(
+ DeviceIntPtr /* pDev */,
+ ScreenPtr /* pScr */
+ );
+} miPointerSpriteFuncRec, *miPointerSpriteFuncPtr;
+
+typedef struct _miPointerScreenFuncRec {
+ Bool (*CursorOffScreen)(
+ ScreenPtr* /* ppScr */,
+ int* /* px */,
+ int* /* py */
+ );
+ void (*CrossScreen)(
+ ScreenPtr /* pScr */,
+ int /* entering */
+ );
+ void (*WarpCursor)(
+ DeviceIntPtr /*pDev*/,
+ ScreenPtr /* pScr */,
+ int /* x */,
+ int /* y */
+ );
+ void (*EnqueueEvent)(
+ DeviceIntPtr /* pDev */,
+ InternalEvent* /* event */
+ );
+ void (*NewEventScreen)(
+ DeviceIntPtr /* pDev */,
+ ScreenPtr /* pScr */,
+ Bool /* fromDIX */
+ );
+} miPointerScreenFuncRec, *miPointerScreenFuncPtr;
+
+extern _X_EXPORT Bool miDCInitialize(
+ ScreenPtr /*pScreen*/,
+ miPointerScreenFuncPtr /*screenFuncs*/
+);
+
+extern _X_EXPORT Bool miPointerInitialize(
+ ScreenPtr /*pScreen*/,
+ miPointerSpriteFuncPtr /*spriteFuncs*/,
+ miPointerScreenFuncPtr /*screenFuncs*/,
+ Bool /*waitForUpdate*/
+);
+
+extern _X_EXPORT void miPointerWarpCursor(
+ DeviceIntPtr /*pDev*/,
+ ScreenPtr /*pScreen*/,
+ int /*x*/,
+ int /*y*/
+);
+
+/* Deprecated in favour of miPointerGetScreen. */
+extern _X_EXPORT ScreenPtr miPointerCurrentScreen(
+ void
+) _X_DEPRECATED;
+
+extern _X_EXPORT ScreenPtr miPointerGetScreen(
+ DeviceIntPtr pDev);
+extern _X_EXPORT void miPointerSetScreen(
+ DeviceIntPtr pDev,
+ int screen_num,
+ int x,
+ int y);
+
+/* Returns the current cursor position. */
+extern _X_EXPORT void miPointerGetPosition(
+ DeviceIntPtr pDev,
+ int *x,
+ int *y);
+
+/* Moves the cursor to the specified position. May clip the co-ordinates:
+ * x and y are modified in-place. */
+extern _X_EXPORT void miPointerSetPosition(
+ DeviceIntPtr pDev,
+ int *x,
+ int *y);
+
+extern _X_EXPORT void miPointerUpdateSprite(
+ DeviceIntPtr pDev);
+
+extern _X_EXPORT DevPrivateKeyRec miPointerPrivKeyRec;
+#define miPointerPrivKey (&miPointerPrivKeyRec)
+
+extern _X_EXPORT DevPrivateKeyRec miPointerScreenKeyRec;
+#define miPointerScreenKey (&miPointerScreenKeyRec)
+
+#endif /* MIPOINTER_H */
diff --git a/xorg-server/mi/mipolycon.c b/xorg-server/mi/mipolycon.c
index 170b2aa1a..7c9b47747 100644
--- a/xorg-server/mi/mipolycon.c
+++ b/xorg-server/mi/mipolycon.c
@@ -104,14 +104,14 @@ miFillConvexPoly(
dy = ymax - ymin + 1;
if ((count < 3) || (dy < 0))
- return(TRUE);
+ return TRUE;
ptsOut = FirstPoint = malloc(sizeof(DDXPointRec)*dy);
width = FirstWidth = malloc(sizeof(int) * dy);
if(!FirstPoint || !FirstWidth)
{
- if (FirstWidth) free(FirstWidth);
- if (FirstPoint) free(FirstPoint);
- return(FALSE);
+ free(FirstWidth);
+ free(FirstPoint);
+ return FALSE;
}
nextleft = nextright = imin;
@@ -177,7 +177,7 @@ miFillConvexPoly(
{
free(FirstWidth);
free(FirstPoint);
- return(TRUE);
+ return TRUE;
}
while (i-- > 0)
{
@@ -212,7 +212,7 @@ miFillConvexPoly(
1);
free(FirstWidth);
free(FirstPoint);
- return(TRUE);
+ return TRUE;
}
@@ -243,5 +243,5 @@ getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty)
*by = ymin;
*ty = ymax;
- return(ptMin-ptsStart);
+ return ptMin-ptsStart;
}
diff --git a/xorg-server/mi/mipolygen.c b/xorg-server/mi/mipolygen.c
index 3dbf68960..ce65ca370 100644
--- a/xorg-server/mi/mipolygen.c
+++ b/xorg-server/mi/mipolygen.c
@@ -90,16 +90,16 @@ miFillGeneralPoly(
int fixWAET = 0;
if (count < 3)
- return(TRUE);
+ return TRUE;
if(!(pETEs = malloc(sizeof(EdgeTableEntry) * count)))
- return(FALSE);
+ return FALSE;
ptsOut = FirstPoint;
width = FirstWidth;
if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock))
{
free(pETEs);
- return(FALSE);
+ return FALSE;
}
pSLL = ET.scanlines.next;
@@ -226,5 +226,5 @@ miFillGeneralPoly(
(*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1);
free(pETEs);
miFreeStorage(SLLBlock.next);
- return(TRUE);
+ return TRUE;
}
diff --git a/xorg-server/mi/mipolyutil.c b/xorg-server/mi/mipolyutil.c
index fe0d9e5bf..e17fb52e4 100644
--- a/xorg-server/mi/mipolyutil.c
+++ b/xorg-server/mi/mipolyutil.c
@@ -365,7 +365,7 @@ miInsertionSort(EdgeTableEntry *AET)
changed = 1;
}
}
- return(changed);
+ return changed;
}
/*
diff --git a/xorg-server/mi/miregion.c b/xorg-server/mi/miregion.c
deleted file mode 100644
index ff58c0372..000000000
--- a/xorg-server/mi/miregion.c
+++ /dev/null
@@ -1,1845 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988, 1989 by
-Digital Equipment Corporation, Maynard, Massachusetts.
-
- 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 of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL 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.
-
-******************************************************************/
-
-/* The panoramix components contained the following notice */
-/*****************************************************************
-
-Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "regionstr.h"
-#include <X11/Xprotostr.h>
-#include <X11/Xfuncproto.h>
-#include "gc.h"
-#include "mi.h"
-#include "mispans.h"
-#include <pixman.h>
-
-#undef assert
-#ifdef REGION_DEBUG
-#define assert(expr) { \
- CARD32 *foo = NULL; \
- if (!(expr)) { \
- ErrorF("Assertion failed file %s, line %d: %s\n", \
- __FILE__, __LINE__, #expr); \
- *foo = 0xdeadbeef; /* to get a backtrace */ \
- } \
- }
-#else
-#define assert(expr)
-#endif
-
-#define good(reg) assert(miValidRegion(reg))
-
-/*
- * The functions in this file implement the Region abstraction used extensively
- * throughout the X11 sample server. A Region is simply a set of disjoint
- * (non-overlapping) rectangles, plus an "extent" rectangle which is the
- * smallest single rectangle that contains all the non-overlapping rectangles.
- *
- * A Region is implemented as a "y-x-banded" array of rectangles. This array
- * imposes two degrees of order. First, all rectangles are sorted by top side
- * y coordinate first (y1), and then by left side x coordinate (x1).
- *
- * Furthermore, the rectangles are grouped into "bands". Each rectangle in a
- * band has the same top y coordinate (y1), and each has the same bottom y
- * coordinate (y2). Thus all rectangles in a band differ only in their left
- * and right side (x1 and x2). Bands are implicit in the array of rectangles:
- * there is no separate list of band start pointers.
- *
- * The y-x band representation does not minimize rectangles. In particular,
- * if a rectangle vertically crosses a band (the rectangle has scanlines in
- * the y1 to y2 area spanned by the band), then the rectangle may be broken
- * down into two or more smaller rectangles stacked one atop the other.
- *
- * ----------- -----------
- * | | | | band 0
- * | | -------- ----------- --------
- * | | | | in y-x banded | | | | band 1
- * | | | | form is | | | |
- * ----------- | | ----------- --------
- * | | | | band 2
- * -------- --------
- *
- * An added constraint on the rectangles is that they must cover as much
- * horizontal area as possible: no two rectangles within a band are allowed
- * to touch.
- *
- * Whenever possible, bands will be merged together to cover a greater vertical
- * distance (and thus reduce the number of rectangles). Two bands can be merged
- * only if the bottom of one touches the top of the other and they have
- * rectangles in the same places (of the same width, of course).
- *
- * Adam de Boor wrote most of the original region code. Joel McCormack
- * substantially modified or rewrote most of the core arithmetic routines,
- * and added miRegionValidate in order to support several speed improvements
- * to miValidateTree. Bob Scheifler changed the representation to be more
- * compact when empty or a single rectangle, and did a bunch of gratuitous
- * reformatting.
- */
-
-/* true iff two Boxes overlap */
-#define EXTENTCHECK(r1,r2) \
- (!( ((r1)->x2 <= (r2)->x1) || \
- ((r1)->x1 >= (r2)->x2) || \
- ((r1)->y2 <= (r2)->y1) || \
- ((r1)->y1 >= (r2)->y2) ) )
-
-/* true iff (x,y) is in Box */
-#define INBOX(r,x,y) \
- ( ((r)->x2 > x) && \
- ((r)->x1 <= x) && \
- ((r)->y2 > y) && \
- ((r)->y1 <= y) )
-
-/* true iff Box r1 contains Box r2 */
-#define SUBSUMES(r1,r2) \
- ( ((r1)->x1 <= (r2)->x1) && \
- ((r1)->x2 >= (r2)->x2) && \
- ((r1)->y1 <= (r2)->y1) && \
- ((r1)->y2 >= (r2)->y2) )
-
-#define xallocData(n) malloc(REGION_SZOF(n))
-#define xfreeData(reg) if ((reg)->data && (reg)->data->size) free((reg)->data)
-
-#define RECTALLOC_BAIL(pReg,n,bail) \
-if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
- if (!miRectAlloc(pReg, n)) { goto bail; }
-
-#define RECTALLOC(pReg,n) \
-if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
- if (!miRectAlloc(pReg, n)) { return FALSE; }
-
-#define ADDRECT(pNextRect,nx1,ny1,nx2,ny2) \
-{ \
- pNextRect->x1 = nx1; \
- pNextRect->y1 = ny1; \
- pNextRect->x2 = nx2; \
- pNextRect->y2 = ny2; \
- pNextRect++; \
-}
-
-#define NEWRECT(pReg,pNextRect,nx1,ny1,nx2,ny2) \
-{ \
- if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\
- { \
- if (!miRectAlloc(pReg, 1)) \
- return FALSE; \
- pNextRect = REGION_TOP(pReg); \
- } \
- ADDRECT(pNextRect,nx1,ny1,nx2,ny2); \
- pReg->data->numRects++; \
- assert(pReg->data->numRects<=pReg->data->size); \
-}
-
-
-#define DOWNSIZE(reg,numRects) \
-if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \
-{ \
- RegDataPtr NewData; \
- NewData = (RegDataPtr)realloc((reg)->data, REGION_SZOF(numRects)); \
- if (NewData) \
- { \
- NewData->size = (numRects); \
- (reg)->data = NewData; \
- } \
-}
-
-
-BoxRec miEmptyBox = {0, 0, 0, 0};
-RegDataRec miEmptyData = {0, 0};
-
-RegDataRec miBrokenData = {0, 0};
-static RegionRec miBrokenRegion = { { 0, 0, 0, 0 }, &miBrokenData };
-
-void
-InitRegions (void)
-{
- pixman_region_set_static_pointers (&miEmptyBox, &miEmptyData, &miBrokenData);
-}
-
-/*****************************************************************
- * RegionCreate(rect, size)
- * This routine does a simple malloc to make a structure of
- * REGION of "size" number of rectangles.
- *****************************************************************/
-
-RegionPtr
-miRegionCreate(BoxPtr rect, int size)
-{
- RegionPtr pReg;
-
- pReg = (RegionPtr)malloc(sizeof(RegionRec));
- if (!pReg)
- return &miBrokenRegion;
-
- miRegionInit (pReg, rect, size);
-
- return(pReg);
-}
-
-void
-miRegionDestroy(RegionPtr pReg)
-{
- pixman_region_fini (pReg);
- if (pReg != &miBrokenRegion)
- free(pReg);
-}
-
-void
-miPrintRegion(RegionPtr rgn)
-{
- int num, size;
- int i;
- BoxPtr rects;
-
- num = REGION_NUM_RECTS(rgn);
- size = REGION_SIZE(rgn);
- rects = REGION_RECTS(rgn);
- ErrorF("[mi] num: %d size: %d\n", num, size);
- ErrorF("[mi] extents: %d %d %d %d\n",
- rgn->extents.x1, rgn->extents.y1, rgn->extents.x2, rgn->extents.y2);
- for (i = 0; i < num; i++)
- ErrorF("[mi] %d %d %d %d \n",
- rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
- ErrorF("[mi] \n");
-}
-
-Bool
-miRegionEqual(RegionPtr reg1, RegionPtr reg2)
-{
- return pixman_region_equal (reg1, reg2);
-}
-
-#ifdef DEBUG
-Bool
-miValidRegion(RegionPtr reg)
-{
- int i, numRects;
-
- if ((reg->extents.x1 > reg->extents.x2) ||
- (reg->extents.y1 > reg->extents.y2))
- return FALSE;
- numRects = REGION_NUM_RECTS(reg);
- if (!numRects)
- return ((reg->extents.x1 == reg->extents.x2) &&
- (reg->extents.y1 == reg->extents.y2) &&
- (reg->data->size || (reg->data == &miEmptyData)));
- else if (numRects == 1)
- return (!reg->data);
- else
- {
- BoxPtr pboxP, pboxN;
- BoxRec box;
-
- pboxP = REGION_RECTS(reg);
- box = *pboxP;
- box.y2 = pboxP[numRects-1].y2;
- pboxN = pboxP + 1;
- for (i = numRects; --i > 0; pboxP++, pboxN++)
- {
- if ((pboxN->x1 >= pboxN->x2) ||
- (pboxN->y1 >= pboxN->y2))
- return FALSE;
- if (pboxN->x1 < box.x1)
- box.x1 = pboxN->x1;
- if (pboxN->x2 > box.x2)
- box.x2 = pboxN->x2;
- if ((pboxN->y1 < pboxP->y1) ||
- ((pboxN->y1 == pboxP->y1) &&
- ((pboxN->x1 < pboxP->x2) || (pboxN->y2 != pboxP->y2))))
- return FALSE;
- }
- return ((box.x1 == reg->extents.x1) &&
- (box.x2 == reg->extents.x2) &&
- (box.y1 == reg->extents.y1) &&
- (box.y2 == reg->extents.y2));
- }
-}
-#endif /* DEBUG */
-
-/*****************************************************************
- * RegionInit(pReg, rect, size)
- * Outer region rect is statically allocated.
- *****************************************************************/
-
-void
-miRegionInit(RegionPtr pReg, BoxPtr rect, int size)
-{
- if (rect)
- pixman_region_init_with_extents (pReg, rect);
- else
- pixman_region_init (pReg);
-}
-
-void
-miRegionUninit(RegionPtr pReg)
-{
- pixman_region_fini (pReg);
-}
-
-Bool
-miRegionBreak (RegionPtr pReg)
-{
- xfreeData (pReg);
- pReg->extents = miEmptyBox;
- pReg->data = &miBrokenData;
- return FALSE;
-}
-
-Bool
-miRectAlloc(RegionPtr pRgn, int n)
-{
- RegDataPtr data;
-
- if (!pRgn->data)
- {
- n++;
- pRgn->data = xallocData(n);
- if (!pRgn->data)
- return miRegionBreak (pRgn);
- pRgn->data->numRects = 1;
- *REGION_BOXPTR(pRgn) = pRgn->extents;
- }
- else if (!pRgn->data->size)
- {
- pRgn->data = xallocData(n);
- if (!pRgn->data)
- return miRegionBreak (pRgn);
- pRgn->data->numRects = 0;
- }
- else
- {
- if (n == 1)
- {
- n = pRgn->data->numRects;
- if (n > 500) /* XXX pick numbers out of a hat */
- n = 250;
- }
- n += pRgn->data->numRects;
- data = (RegDataPtr)realloc(pRgn->data, REGION_SZOF(n));
- if (!data)
- return miRegionBreak (pRgn);
- pRgn->data = data;
- }
- pRgn->data->size = n;
- return TRUE;
-}
-
-Bool
-miRegionCopy(RegionPtr dst, RegionPtr src)
-{
- return pixman_region_copy (dst, src);
-}
-
-/*======================================================================
- * Generic Region Operator
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miCoalesce --
- * Attempt to merge the boxes in the current band with those in the
- * previous one. We are guaranteed that the current band extends to
- * the end of the rects array. Used only by miRegionOp.
- *
- * Results:
- * The new index for the previous band.
- *
- * Side Effects:
- * If coalescing takes place:
- * - rectangles in the previous band will have their y2 fields
- * altered.
- * - pReg->data->numRects will be decreased.
- *
- *-----------------------------------------------------------------------
- */
-_X_INLINE static int
-miCoalesce (
- RegionPtr pReg, /* Region to coalesce */
- int prevStart, /* Index of start of previous band */
- int curStart) /* Index of start of current band */
-{
- BoxPtr pPrevBox; /* Current box in previous band */
- BoxPtr pCurBox; /* Current box in current band */
- int numRects; /* Number rectangles in both bands */
- int y2; /* Bottom of current band */
- /*
- * Figure out how many rectangles are in the band.
- */
- numRects = curStart - prevStart;
- assert(numRects == pReg->data->numRects - curStart);
-
- if (!numRects) return curStart;
-
- /*
- * The bands may only be coalesced if the bottom of the previous
- * matches the top scanline of the current.
- */
- pPrevBox = REGION_BOX(pReg, prevStart);
- pCurBox = REGION_BOX(pReg, curStart);
- if (pPrevBox->y2 != pCurBox->y1) return curStart;
-
- /*
- * Make sure the bands have boxes in the same places. This
- * assumes that boxes have been added in such a way that they
- * cover the most area possible. I.e. two boxes in a band must
- * have some horizontal space between them.
- */
- y2 = pCurBox->y2;
-
- do {
- if ((pPrevBox->x1 != pCurBox->x1) || (pPrevBox->x2 != pCurBox->x2)) {
- return (curStart);
- }
- pPrevBox++;
- pCurBox++;
- numRects--;
- } while (numRects);
-
- /*
- * The bands may be merged, so set the bottom y of each box
- * in the previous band to the bottom y of the current band.
- */
- numRects = curStart - prevStart;
- pReg->data->numRects -= numRects;
- do {
- pPrevBox--;
- pPrevBox->y2 = y2;
- numRects--;
- } while (numRects);
- return prevStart;
-}
-
-
-/* Quicky macro to avoid trivial reject procedure calls to miCoalesce */
-
-#define Coalesce(newReg, prevBand, curBand) \
- if (curBand - prevBand == newReg->data->numRects - curBand) { \
- prevBand = miCoalesce(newReg, prevBand, curBand); \
- } else { \
- prevBand = curBand; \
- }
-
-/*-
- *-----------------------------------------------------------------------
- * miAppendNonO --
- * Handle a non-overlapping band for the union and subtract operations.
- * Just adds the (top/bottom-clipped) rectangles into the region.
- * Doesn't have to check for subsumption or anything.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * pReg->data->numRects is incremented and the rectangles overwritten
- * with the rectangles we're passed.
- *
- *-----------------------------------------------------------------------
- */
-
-_X_INLINE static Bool
-miAppendNonO (
- RegionPtr pReg,
- BoxPtr r,
- BoxPtr rEnd,
- int y1,
- int y2)
-{
- BoxPtr pNextRect;
- int newRects;
-
- newRects = rEnd - r;
-
- assert(y1 < y2);
- assert(newRects != 0);
-
- /* Make sure we have enough space for all rectangles to be added */
- RECTALLOC(pReg, newRects);
- pNextRect = REGION_TOP(pReg);
- pReg->data->numRects += newRects;
- do {
- assert(r->x1 < r->x2);
- ADDRECT(pNextRect, r->x1, y1, r->x2, y2);
- r++;
- } while (r != rEnd);
-
- return TRUE;
-}
-
-#define FindBand(r, rBandEnd, rEnd, ry1) \
-{ \
- ry1 = r->y1; \
- rBandEnd = r+1; \
- while ((rBandEnd != rEnd) && (rBandEnd->y1 == ry1)) { \
- rBandEnd++; \
- } \
-}
-
-#define AppendRegions(newReg, r, rEnd) \
-{ \
- int newRects; \
- if ((newRects = rEnd - r)) { \
- RECTALLOC(newReg, newRects); \
- memmove((char *)REGION_TOP(newReg),(char *)r, \
- newRects * sizeof(BoxRec)); \
- newReg->data->numRects += newRects; \
- } \
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miRegionOp --
- * Apply an operation to two regions. Called by miUnion, miInverse,
- * miSubtract, miIntersect.... Both regions MUST have at least one
- * rectangle, and cannot be the same object.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * The new region is overwritten.
- * pOverlap set to TRUE if overlapFunc ever returns TRUE.
- *
- * Notes:
- * The idea behind this function is to view the two regions as sets.
- * Together they cover a rectangle of area that this function divides
- * into horizontal bands where points are covered only by one region
- * or by both. For the first case, the nonOverlapFunc is called with
- * each the band and the band's upper and lower extents. For the
- * second, the overlapFunc is called to process the entire band. It
- * is responsible for clipping the rectangles in the band, though
- * this function provides the boundaries.
- * At the end of each band, the new region is coalesced, if possible,
- * to reduce the number of rectangles in the region.
- *
- *-----------------------------------------------------------------------
- */
-
-typedef Bool (*OverlapProcPtr)(
- RegionPtr pReg,
- BoxPtr r1,
- BoxPtr r1End,
- BoxPtr r2,
- BoxPtr r2End,
- short y1,
- short y2,
- Bool *pOverlap);
-
-static Bool
-miRegionOp(
- RegionPtr newReg, /* Place to store result */
- RegionPtr reg1, /* First region in operation */
- RegionPtr reg2, /* 2d region in operation */
- OverlapProcPtr overlapFunc, /* Function to call for over-
- * lapping bands */
- Bool appendNon1, /* Append non-overlapping bands */
- /* in region 1 ? */
- Bool appendNon2, /* Append non-overlapping bands */
- /* in region 2 ? */
- Bool *pOverlap)
-{
- BoxPtr r1; /* Pointer into first region */
- BoxPtr r2; /* Pointer into 2d region */
- BoxPtr r1End; /* End of 1st region */
- BoxPtr r2End; /* End of 2d region */
- short ybot; /* Bottom of intersection */
- short ytop; /* Top of intersection */
- RegDataPtr oldData; /* Old data for newReg */
- int prevBand; /* Index of start of
- * previous band in newReg */
- int curBand; /* Index of start of current
- * band in newReg */
- BoxPtr r1BandEnd; /* End of current band in r1 */
- BoxPtr r2BandEnd; /* End of current band in r2 */
- short top; /* Top of non-overlapping band */
- short bot; /* Bottom of non-overlapping band*/
- int r1y1; /* Temps for r1->y1 and r2->y1 */
- int r2y1;
- int newSize;
- int numRects;
-
- /*
- * Break any region computed from a broken region
- */
- if (REGION_NAR (reg1) || REGION_NAR(reg2))
- return miRegionBreak (newReg);
-
- /*
- * Initialization:
- * set r1, r2, r1End and r2End appropriately, save the rectangles
- * of the destination region until the end in case it's one of
- * the two source regions, then mark the "new" region empty, allocating
- * another array of rectangles for it to use.
- */
-
- r1 = REGION_RECTS(reg1);
- newSize = REGION_NUM_RECTS(reg1);
- r1End = r1 + newSize;
- numRects = REGION_NUM_RECTS(reg2);
- r2 = REGION_RECTS(reg2);
- r2End = r2 + numRects;
- assert(r1 != r1End);
- assert(r2 != r2End);
-
- oldData = NULL;
- if (((newReg == reg1) && (newSize > 1)) ||
- ((newReg == reg2) && (numRects > 1)))
- {
- oldData = newReg->data;
- newReg->data = &miEmptyData;
- }
- /* guess at new size */
- if (numRects > newSize)
- newSize = numRects;
- newSize <<= 1;
- if (!newReg->data)
- newReg->data = &miEmptyData;
- else if (newReg->data->size)
- newReg->data->numRects = 0;
- if (newSize > newReg->data->size)
- if (!miRectAlloc(newReg, newSize))
- return FALSE;
-
- /*
- * Initialize ybot.
- * In the upcoming loop, ybot and ytop serve different functions depending
- * on whether the band being handled is an overlapping or non-overlapping
- * band.
- * In the case of a non-overlapping band (only one of the regions
- * has points in the band), ybot is the bottom of the most recent
- * intersection and thus clips the top of the rectangles in that band.
- * ytop is the top of the next intersection between the two regions and
- * serves to clip the bottom of the rectangles in the current band.
- * For an overlapping band (where the two regions intersect), ytop clips
- * the top of the rectangles of both regions and ybot clips the bottoms.
- */
-
- ybot = min(r1->y1, r2->y1);
-
- /*
- * prevBand serves to mark the start of the previous band so rectangles
- * can be coalesced into larger rectangles. qv. miCoalesce, above.
- * In the beginning, there is no previous band, so prevBand == curBand
- * (curBand is set later on, of course, but the first band will always
- * start at index 0). prevBand and curBand must be indices because of
- * the possible expansion, and resultant moving, of the new region's
- * array of rectangles.
- */
- prevBand = 0;
-
- do {
- /*
- * This algorithm proceeds one source-band (as opposed to a
- * destination band, which is determined by where the two regions
- * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the
- * rectangle after the last one in the current band for their
- * respective regions.
- */
- assert(r1 != r1End);
- assert(r2 != r2End);
-
- FindBand(r1, r1BandEnd, r1End, r1y1);
- FindBand(r2, r2BandEnd, r2End, r2y1);
-
- /*
- * First handle the band that doesn't intersect, if any.
- *
- * Note that attention is restricted to one band in the
- * non-intersecting region at once, so if a region has n
- * bands between the current position and the next place it overlaps
- * the other, this entire loop will be passed through n times.
- */
- if (r1y1 < r2y1) {
- if (appendNon1) {
- top = max(r1y1, ybot);
- bot = min(r1->y2, r2y1);
- if (top != bot) {
- curBand = newReg->data->numRects;
- miAppendNonO(newReg, r1, r1BandEnd, top, bot);
- Coalesce(newReg, prevBand, curBand);
- }
- }
- ytop = r2y1;
- } else if (r2y1 < r1y1) {
- if (appendNon2) {
- top = max(r2y1, ybot);
- bot = min(r2->y2, r1y1);
- if (top != bot) {
- curBand = newReg->data->numRects;
- miAppendNonO(newReg, r2, r2BandEnd, top, bot);
- Coalesce(newReg, prevBand, curBand);
- }
- }
- ytop = r1y1;
- } else {
- ytop = r1y1;
- }
-
- /*
- * Now see if we've hit an intersecting band. The two bands only
- * intersect if ybot > ytop
- */
- ybot = min(r1->y2, r2->y2);
- if (ybot > ytop) {
- curBand = newReg->data->numRects;
- (* overlapFunc)(newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot,
- pOverlap);
- Coalesce(newReg, prevBand, curBand);
- }
-
- /*
- * If we've finished with a band (y2 == ybot) we skip forward
- * in the region to the next band.
- */
- if (r1->y2 == ybot) r1 = r1BandEnd;
- if (r2->y2 == ybot) r2 = r2BandEnd;
-
- } while (r1 != r1End && r2 != r2End);
-
- /*
- * Deal with whichever region (if any) still has rectangles left.
- *
- * We only need to worry about banding and coalescing for the very first
- * band left. After that, we can just group all remaining boxes,
- * regardless of how many bands, into one final append to the list.
- */
-
- if ((r1 != r1End) && appendNon1) {
- /* Do first nonOverlap1Func call, which may be able to coalesce */
- FindBand(r1, r1BandEnd, r1End, r1y1);
- curBand = newReg->data->numRects;
- miAppendNonO(newReg, r1, r1BandEnd, max(r1y1, ybot), r1->y2);
- Coalesce(newReg, prevBand, curBand);
- /* Just append the rest of the boxes */
- AppendRegions(newReg, r1BandEnd, r1End);
-
- } else if ((r2 != r2End) && appendNon2) {
- /* Do first nonOverlap2Func call, which may be able to coalesce */
- FindBand(r2, r2BandEnd, r2End, r2y1);
- curBand = newReg->data->numRects;
- miAppendNonO(newReg, r2, r2BandEnd, max(r2y1, ybot), r2->y2);
- Coalesce(newReg, prevBand, curBand);
- /* Append rest of boxes */
- AppendRegions(newReg, r2BandEnd, r2End);
- }
-
- if (oldData)
- free(oldData);
-
- if (!(numRects = newReg->data->numRects))
- {
- xfreeData(newReg);
- newReg->data = &miEmptyData;
- }
- else if (numRects == 1)
- {
- newReg->extents = *REGION_BOXPTR(newReg);
- xfreeData(newReg);
- newReg->data = NULL;
- }
- else
- {
- DOWNSIZE(newReg, numRects);
- }
-
- return TRUE;
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miSetExtents --
- * Reset the extents of a region to what they should be. Called by
- * miSubtract and miIntersect as they can't figure it out along the
- * way or do so easily, as miUnion can.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * The region's 'extents' structure is overwritten.
- *
- *-----------------------------------------------------------------------
- */
-static void
-miSetExtents (RegionPtr pReg)
-{
- BoxPtr pBox, pBoxEnd;
-
- if (!pReg->data)
- return;
- if (!pReg->data->size)
- {
- pReg->extents.x2 = pReg->extents.x1;
- pReg->extents.y2 = pReg->extents.y1;
- return;
- }
-
- pBox = REGION_BOXPTR(pReg);
- pBoxEnd = REGION_END(pReg);
-
- /*
- * Since pBox is the first rectangle in the region, it must have the
- * smallest y1 and since pBoxEnd is the last rectangle in the region,
- * it must have the largest y2, because of banding. Initialize x1 and
- * x2 from pBox and pBoxEnd, resp., as good things to initialize them
- * to...
- */
- pReg->extents.x1 = pBox->x1;
- pReg->extents.y1 = pBox->y1;
- pReg->extents.x2 = pBoxEnd->x2;
- pReg->extents.y2 = pBoxEnd->y2;
-
- assert(pReg->extents.y1 < pReg->extents.y2);
- while (pBox <= pBoxEnd) {
- if (pBox->x1 < pReg->extents.x1)
- pReg->extents.x1 = pBox->x1;
- if (pBox->x2 > pReg->extents.x2)
- pReg->extents.x2 = pBox->x2;
- pBox++;
- };
-
- assert(pReg->extents.x1 < pReg->extents.x2);
-}
-
-/*======================================================================
- * Region Intersection
- *====================================================================*/
-/*-
- *-----------------------------------------------------------------------
- * miIntersectO --
- * Handle an overlapping band for miIntersect.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * Rectangles may be added to the region.
- *
- *-----------------------------------------------------------------------
- */
-/*ARGSUSED*/
-Bool
-miIntersect(
- RegionPtr newReg, /* destination Region */
- RegionPtr reg1,
- RegionPtr reg2 /* source regions */
- )
-{
- return pixman_region_intersect (newReg, reg1, reg2);
-}
-
-#define MERGERECT(r) \
-{ \
- if (r->x1 <= x2) { \
- /* Merge with current rectangle */ \
- if (r->x1 < x2) *pOverlap = TRUE; \
- if (x2 < r->x2) x2 = r->x2; \
- } else { \
- /* Add current rectangle, start new one */ \
- NEWRECT(pReg, pNextRect, x1, y1, x2, y2); \
- x1 = r->x1; \
- x2 = r->x2; \
- } \
- r++; \
-}
-
-/*======================================================================
- * Region Union
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miUnionO --
- * Handle an overlapping band for the union operation. Picks the
- * left-most rectangle each time and merges it into the region.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * pReg is overwritten.
- * pOverlap is set to TRUE if any boxes overlap.
- *
- *-----------------------------------------------------------------------
- */
-static Bool
-miUnionO (
- RegionPtr pReg,
- BoxPtr r1,
- BoxPtr r1End,
- BoxPtr r2,
- BoxPtr r2End,
- short y1,
- short y2,
- Bool *pOverlap)
-{
- BoxPtr pNextRect;
- int x1; /* left and right side of current union */
- int x2;
-
- assert (y1 < y2);
- assert(r1 != r1End && r2 != r2End);
-
- pNextRect = REGION_TOP(pReg);
-
- /* Start off current rectangle */
- if (r1->x1 < r2->x1)
- {
- x1 = r1->x1;
- x2 = r1->x2;
- r1++;
- }
- else
- {
- x1 = r2->x1;
- x2 = r2->x2;
- r2++;
- }
- while (r1 != r1End && r2 != r2End)
- {
- if (r1->x1 < r2->x1) MERGERECT(r1) else MERGERECT(r2);
- }
-
- /* Finish off whoever (if any) is left */
- if (r1 != r1End)
- {
- do
- {
- MERGERECT(r1);
- } while (r1 != r1End);
- }
- else if (r2 != r2End)
- {
- do
- {
- MERGERECT(r2);
- } while (r2 != r2End);
- }
-
- /* Add current rectangle */
- NEWRECT(pReg, pNextRect, x1, y1, x2, y2);
-
- return TRUE;
-}
-
-Bool
-miUnion(
- RegionPtr newReg, /* destination Region */
- RegionPtr reg1,
- RegionPtr reg2 /* source regions */
- )
-{
- return pixman_region_union (newReg, reg1, reg2);
-}
-
-/*======================================================================
- * Batch Rectangle Union
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miRegionAppend --
- *
- * "Append" the rgn rectangles onto the end of dstrgn, maintaining
- * knowledge of YX-banding when it's easy. Otherwise, dstrgn just
- * becomes a non-y-x-banded random collection of rectangles, and not
- * yet a true region. After a sequence of appends, the caller must
- * call miRegionValidate to ensure that a valid region is constructed.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * dstrgn is modified if rgn has rectangles.
- *
- */
-Bool
-miRegionAppend(RegionPtr dstrgn, RegionPtr rgn)
-{
- int numRects, dnumRects, size;
- BoxPtr new, old;
- Bool prepend;
-
- if (REGION_NAR(rgn))
- return miRegionBreak (dstrgn);
-
- if (!rgn->data && (dstrgn->data == &miEmptyData))
- {
- dstrgn->extents = rgn->extents;
- dstrgn->data = NULL;
- return TRUE;
- }
-
- numRects = REGION_NUM_RECTS(rgn);
- if (!numRects)
- return TRUE;
- prepend = FALSE;
- size = numRects;
- dnumRects = REGION_NUM_RECTS(dstrgn);
- if (!dnumRects && (size < 200))
- size = 200; /* XXX pick numbers out of a hat */
- RECTALLOC(dstrgn, size);
- old = REGION_RECTS(rgn);
- if (!dnumRects)
- dstrgn->extents = rgn->extents;
- else if (dstrgn->extents.x2 > dstrgn->extents.x1)
- {
- BoxPtr first, last;
-
- first = old;
- last = REGION_BOXPTR(dstrgn) + (dnumRects - 1);
- if ((first->y1 > last->y2) ||
- ((first->y1 == last->y1) && (first->y2 == last->y2) &&
- (first->x1 > last->x2)))
- {
- if (rgn->extents.x1 < dstrgn->extents.x1)
- dstrgn->extents.x1 = rgn->extents.x1;
- if (rgn->extents.x2 > dstrgn->extents.x2)
- dstrgn->extents.x2 = rgn->extents.x2;
- dstrgn->extents.y2 = rgn->extents.y2;
- }
- else
- {
- first = REGION_BOXPTR(dstrgn);
- last = old + (numRects - 1);
- if ((first->y1 > last->y2) ||
- ((first->y1 == last->y1) && (first->y2 == last->y2) &&
- (first->x1 > last->x2)))
- {
- prepend = TRUE;
- if (rgn->extents.x1 < dstrgn->extents.x1)
- dstrgn->extents.x1 = rgn->extents.x1;
- if (rgn->extents.x2 > dstrgn->extents.x2)
- dstrgn->extents.x2 = rgn->extents.x2;
- dstrgn->extents.y1 = rgn->extents.y1;
- }
- else
- dstrgn->extents.x2 = dstrgn->extents.x1;
- }
- }
- if (prepend)
- {
- new = REGION_BOX(dstrgn, numRects);
- if (dnumRects == 1)
- *new = *REGION_BOXPTR(dstrgn);
- else
- memmove((char *)new,(char *)REGION_BOXPTR(dstrgn),
- dnumRects * sizeof(BoxRec));
- new = REGION_BOXPTR(dstrgn);
- }
- else
- new = REGION_BOXPTR(dstrgn) + dnumRects;
- if (numRects == 1)
- *new = *old;
- else
- memmove((char *)new, (char *)old, numRects * sizeof(BoxRec));
- dstrgn->data->numRects += numRects;
- return TRUE;
-}
-
-
-#define ExchangeRects(a, b) \
-{ \
- BoxRec t; \
- t = rects[a]; \
- rects[a] = rects[b]; \
- rects[b] = t; \
-}
-
-static void
-QuickSortRects(
- BoxRec rects[],
- int numRects)
-{
- int y1;
- int x1;
- int i, j;
- BoxPtr r;
-
- /* Always called with numRects > 1 */
-
- do
- {
- if (numRects == 2)
- {
- if (rects[0].y1 > rects[1].y1 ||
- (rects[0].y1 == rects[1].y1 && rects[0].x1 > rects[1].x1))
- ExchangeRects(0, 1);
- return;
- }
-
- /* Choose partition element, stick in location 0 */
- ExchangeRects(0, numRects >> 1);
- y1 = rects[0].y1;
- x1 = rects[0].x1;
-
- /* Partition array */
- i = 0;
- j = numRects;
- do
- {
- r = &(rects[i]);
- do
- {
- r++;
- i++;
- } while (i != numRects &&
- (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1)));
- r = &(rects[j]);
- do
- {
- r--;
- j--;
- } while (y1 < r->y1 || (y1 == r->y1 && x1 < r->x1));
- if (i < j)
- ExchangeRects(i, j);
- } while (i < j);
-
- /* Move partition element back to middle */
- ExchangeRects(0, j);
-
- /* Recurse */
- if (numRects-j-1 > 1)
- QuickSortRects(&rects[j+1], numRects-j-1);
- numRects = j;
- } while (numRects > 1);
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miRegionValidate --
- *
- * Take a ``region'' which is a non-y-x-banded random collection of
- * rectangles, and compute a nice region which is the union of all the
- * rectangles.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * The passed-in ``region'' may be modified.
- * pOverlap set to TRUE if any retangles overlapped, else FALSE;
- *
- * Strategy:
- * Step 1. Sort the rectangles into ascending order with primary key y1
- * and secondary key x1.
- *
- * Step 2. Split the rectangles into the minimum number of proper y-x
- * banded regions. This may require horizontally merging
- * rectangles, and vertically coalescing bands. With any luck,
- * this step in an identity tranformation (ala the Box widget),
- * or a coalescing into 1 box (ala Menus).
- *
- * Step 3. Merge the separate regions down to a single region by calling
- * miUnion. Maximize the work each miUnion call does by using
- * a binary merge.
- *
- *-----------------------------------------------------------------------
- */
-
-Bool
-miRegionValidate(RegionPtr badreg, Bool *pOverlap)
-{
- /* Descriptor for regions under construction in Step 2. */
- typedef struct {
- RegionRec reg;
- int prevBand;
- int curBand;
- } RegionInfo;
-
- int numRects; /* Original numRects for badreg */
- RegionInfo *ri; /* Array of current regions */
- int numRI; /* Number of entries used in ri */
- int sizeRI; /* Number of entries available in ri */
- int i; /* Index into rects */
- int j; /* Index into ri */
- RegionInfo *rit; /* &ri[j] */
- RegionPtr reg; /* ri[j].reg */
- BoxPtr box; /* Current box in rects */
- BoxPtr riBox; /* Last box in ri[j].reg */
- RegionPtr hreg; /* ri[j_half].reg */
- Bool ret = TRUE;
-
- *pOverlap = FALSE;
- if (!badreg->data)
- {
- good(badreg);
- return TRUE;
- }
- numRects = badreg->data->numRects;
- if (!numRects)
- {
- if (REGION_NAR(badreg))
- return FALSE;
- good(badreg);
- return TRUE;
- }
- if (badreg->extents.x1 < badreg->extents.x2)
- {
- if ((numRects) == 1)
- {
- xfreeData(badreg);
- badreg->data = (RegDataPtr) NULL;
- }
- else
- {
- DOWNSIZE(badreg, numRects);
- }
- good(badreg);
- return TRUE;
- }
-
- /* Step 1: Sort the rects array into ascending (y1, x1) order */
- QuickSortRects(REGION_BOXPTR(badreg), numRects);
-
- /* Step 2: Scatter the sorted array into the minimum number of regions */
-
- /* Set up the first region to be the first rectangle in badreg */
- /* Note that step 2 code will never overflow the ri[0].reg rects array */
- ri = (RegionInfo *) malloc(4 * sizeof(RegionInfo));
- if (!ri)
- return miRegionBreak (badreg);
- sizeRI = 4;
- numRI = 1;
- ri[0].prevBand = 0;
- ri[0].curBand = 0;
- ri[0].reg = *badreg;
- box = REGION_BOXPTR(&ri[0].reg);
- ri[0].reg.extents = *box;
- ri[0].reg.data->numRects = 1;
-
- /* Now scatter rectangles into the minimum set of valid regions. If the
- next rectangle to be added to a region would force an existing rectangle
- in the region to be split up in order to maintain y-x banding, just
- forget it. Try the next region. If it doesn't fit cleanly into any
- region, make a new one. */
-
- for (i = numRects; --i > 0;)
- {
- box++;
- /* Look for a region to append box to */
- for (j = numRI, rit = ri; --j >= 0; rit++)
- {
- reg = &rit->reg;
- riBox = REGION_END(reg);
-
- if (box->y1 == riBox->y1 && box->y2 == riBox->y2)
- {
- /* box is in same band as riBox. Merge or append it */
- if (box->x1 <= riBox->x2)
- {
- /* Merge it with riBox */
- if (box->x1 < riBox->x2) *pOverlap = TRUE;
- if (box->x2 > riBox->x2) riBox->x2 = box->x2;
- }
- else
- {
- RECTALLOC_BAIL(reg, 1, bail);
- *REGION_TOP(reg) = *box;
- reg->data->numRects++;
- }
- goto NextRect; /* So sue me */
- }
- else if (box->y1 >= riBox->y2)
- {
- /* Put box into new band */
- if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2;
- if (reg->extents.x1 > box->x1) reg->extents.x1 = box->x1;
- Coalesce(reg, rit->prevBand, rit->curBand);
- rit->curBand = reg->data->numRects;
- RECTALLOC_BAIL(reg, 1, bail);
- *REGION_TOP(reg) = *box;
- reg->data->numRects++;
- goto NextRect;
- }
- /* Well, this region was inappropriate. Try the next one. */
- } /* for j */
-
- /* Uh-oh. No regions were appropriate. Create a new one. */
- if (sizeRI == numRI)
- {
- /* Oops, allocate space for new region information */
- sizeRI <<= 1;
- rit = (RegionInfo *) realloc(ri, sizeRI * sizeof(RegionInfo));
- if (!rit)
- goto bail;
- ri = rit;
- rit = &ri[numRI];
- }
- numRI++;
- rit->prevBand = 0;
- rit->curBand = 0;
- rit->reg.extents = *box;
- rit->reg.data = NULL;
- if (!miRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
- goto bail;
-NextRect: ;
- } /* for i */
-
- /* Make a final pass over each region in order to Coalesce and set
- extents.x2 and extents.y2 */
-
- for (j = numRI, rit = ri; --j >= 0; rit++)
- {
- reg = &rit->reg;
- riBox = REGION_END(reg);
- reg->extents.y2 = riBox->y2;
- if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2;
- Coalesce(reg, rit->prevBand, rit->curBand);
- if (reg->data->numRects == 1) /* keep unions happy below */
- {
- xfreeData(reg);
- reg->data = NULL;
- }
- }
-
- /* Step 3: Union all regions into a single region */
- while (numRI > 1)
- {
- int half = numRI/2;
- for (j = numRI & 1; j < (half + (numRI & 1)); j++)
- {
- reg = &ri[j].reg;
- hreg = &ri[j+half].reg;
- if (!miRegionOp(reg, reg, hreg, miUnionO, TRUE, TRUE, pOverlap))
- ret = FALSE;
- if (hreg->extents.x1 < reg->extents.x1)
- reg->extents.x1 = hreg->extents.x1;
- if (hreg->extents.y1 < reg->extents.y1)
- reg->extents.y1 = hreg->extents.y1;
- if (hreg->extents.x2 > reg->extents.x2)
- reg->extents.x2 = hreg->extents.x2;
- if (hreg->extents.y2 > reg->extents.y2)
- reg->extents.y2 = hreg->extents.y2;
- xfreeData(hreg);
- }
- numRI -= half;
- }
- *badreg = ri[0].reg;
- free(ri);
- good(badreg);
- return ret;
-bail:
- for (i = 0; i < numRI; i++)
- xfreeData(&ri[i].reg);
- free(ri);
- return miRegionBreak (badreg);
-}
-
-RegionPtr
-miRectsToRegion(int nrects, xRectangle *prect, int ctype)
-{
-
- RegionPtr pRgn;
- RegDataPtr pData;
- BoxPtr pBox;
- int i;
- int x1, y1, x2, y2;
-
- pRgn = miRegionCreate(NullBox, 0);
- if (REGION_NAR (pRgn))
- return pRgn;
- if (!nrects)
- return pRgn;
- if (nrects == 1)
- {
- x1 = prect->x;
- y1 = prect->y;
- if ((x2 = x1 + (int) prect->width) > MAXSHORT)
- x2 = MAXSHORT;
- if ((y2 = y1 + (int) prect->height) > MAXSHORT)
- y2 = MAXSHORT;
- if (x1 != x2 && y1 != y2)
- {
- pRgn->extents.x1 = x1;
- pRgn->extents.y1 = y1;
- pRgn->extents.x2 = x2;
- pRgn->extents.y2 = y2;
- pRgn->data = NULL;
- }
- return pRgn;
- }
- pData = xallocData(nrects);
- if (!pData)
- {
- miRegionBreak (pRgn);
- return pRgn;
- }
- pBox = (BoxPtr) (pData + 1);
- for (i = nrects; --i >= 0; prect++)
- {
- x1 = prect->x;
- y1 = prect->y;
- if ((x2 = x1 + (int) prect->width) > MAXSHORT)
- x2 = MAXSHORT;
- if ((y2 = y1 + (int) prect->height) > MAXSHORT)
- y2 = MAXSHORT;
- if (x1 != x2 && y1 != y2)
- {
- pBox->x1 = x1;
- pBox->y1 = y1;
- pBox->x2 = x2;
- pBox->y2 = y2;
- pBox++;
- }
- }
- if (pBox != (BoxPtr) (pData + 1))
- {
- pData->size = nrects;
- pData->numRects = pBox - (BoxPtr) (pData + 1);
- pRgn->data = pData;
- if (ctype != CT_YXBANDED)
- {
- Bool overlap; /* result ignored */
- pRgn->extents.x1 = pRgn->extents.x2 = 0;
- miRegionValidate(pRgn, &overlap);
- }
- else
- miSetExtents(pRgn);
- good(pRgn);
- }
- else
- {
- free(pData);
- }
- return pRgn;
-}
-
-/*======================================================================
- * Region Subtraction
- *====================================================================*/
-
-
-/*-
- *-----------------------------------------------------------------------
- * miSubtractO --
- * Overlapping band subtraction. x1 is the left-most point not yet
- * checked.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * pReg may have rectangles added to it.
- *
- *-----------------------------------------------------------------------
- */
-/*ARGSUSED*/
-
-/*-
- *-----------------------------------------------------------------------
- * miSubtract --
- * Subtract regS from regM and leave the result in regD.
- * S stands for subtrahend, M for minuend and D for difference.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * regD is overwritten.
- *
- *-----------------------------------------------------------------------
- */
-Bool
-miSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS)
-{
- return pixman_region_subtract (regD, regM, regS);
-}
-
-/*======================================================================
- * Region Inversion
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miInverse --
- * Take a region and a box and return a region that is everything
- * in the box but not in the region. The careful reader will note
- * that this is the same as subtracting the region from the box...
- *
- * Results:
- * TRUE.
- *
- * Side Effects:
- * newReg is overwritten.
- *
- *-----------------------------------------------------------------------
- */
-Bool
-miInverse(
- RegionPtr newReg, /* Destination region */
- RegionPtr reg1, /* Region to invert */
- BoxPtr invRect /* Bounding box for inversion */
- )
-{
- return pixman_region_inverse (newReg, reg1, invRect);
-}
-int
-miRectIn(RegionPtr region, BoxPtr prect)
-{
- return pixman_region_contains_rectangle (region, prect);
-}
-
-/* TranslateRegion(pReg, x, y)
- translates in place
-*/
-
-void
-miTranslateRegion(RegionPtr pReg, int x, int y)
-{
- pixman_region_translate (pReg, x, y);
-}
-
-void
-miRegionReset(RegionPtr pReg, BoxPtr pBox)
-{
- pixman_region_reset (pReg, pBox);
-}
-
-Bool
-miPointInRegion(
- RegionPtr pReg,
- int x,
- int y,
- BoxPtr box /* "return" value */
- )
-{
- return pixman_region_contains_point (pReg, x, y, box);
-}
-
-Bool
-miRegionNotEmpty(RegionPtr pReg)
-{
- return pixman_region_not_empty (pReg);
-}
-
-Bool
-miRegionBroken(RegionPtr pReg)
-{
- good(pReg);
- return (REGION_NAR(pReg));
-}
-
-void
-miRegionEmpty(RegionPtr pReg)
-{
- good(pReg);
- xfreeData(pReg);
- pReg->extents.x2 = pReg->extents.x1;
- pReg->extents.y2 = pReg->extents.y1;
- pReg->data = &miEmptyData;
-}
-
-BoxPtr
-miRegionExtents(RegionPtr pReg)
-{
- good(pReg);
- return(&pReg->extents);
-}
-
-#define ExchangeSpans(a, b) \
-{ \
- DDXPointRec tpt; \
- int tw; \
- \
- tpt = spans[a]; spans[a] = spans[b]; spans[b] = tpt; \
- tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \
-}
-
-/* ||| I should apply the merge sort code to rectangle sorting above, and see
- if mapping time can be improved. But right now I've been at work 12 hours,
- so forget it.
-*/
-
-static void QuickSortSpans(
- DDXPointRec spans[],
- int widths[],
- int numSpans)
-{
- int y;
- int i, j, m;
- DDXPointPtr r;
-
- /* Always called with numSpans > 1 */
- /* Sorts only by y, doesn't bother to sort by x */
-
- do
- {
- if (numSpans < 9)
- {
- /* Do insertion sort */
- int yprev;
-
- yprev = spans[0].y;
- i = 1;
- do
- { /* while i != numSpans */
- y = spans[i].y;
- if (yprev > y)
- {
- /* spans[i] is out of order. Move into proper location. */
- DDXPointRec tpt;
- int tw, k;
-
- for (j = 0; y >= spans[j].y; j++) {}
- tpt = spans[i];
- tw = widths[i];
- for (k = i; k != j; k--)
- {
- spans[k] = spans[k-1];
- widths[k] = widths[k-1];
- }
- spans[j] = tpt;
- widths[j] = tw;
- y = spans[i].y;
- } /* if out of order */
- yprev = y;
- i++;
- } while (i != numSpans);
- return;
- }
-
- /* Choose partition element, stick in location 0 */
- m = numSpans / 2;
- if (spans[m].y > spans[0].y) ExchangeSpans(m, 0);
- if (spans[m].y > spans[numSpans-1].y) ExchangeSpans(m, numSpans-1);
- if (spans[m].y > spans[0].y) ExchangeSpans(m, 0);
- y = spans[0].y;
-
- /* Partition array */
- i = 0;
- j = numSpans;
- do
- {
- r = &(spans[i]);
- do
- {
- r++;
- i++;
- } while (i != numSpans && r->y < y);
- r = &(spans[j]);
- do
- {
- r--;
- j--;
- } while (y < r->y);
- if (i < j)
- ExchangeSpans(i, j);
- } while (i < j);
-
- /* Move partition element back to middle */
- ExchangeSpans(0, j);
-
- /* Recurse */
- if (numSpans-j-1 > 1)
- QuickSortSpans(&spans[j+1], &widths[j+1], numSpans-j-1);
- numSpans = j;
- } while (numSpans > 1);
-}
-
-#define NextBand() \
-{ \
- clipy1 = pboxBandStart->y1; \
- clipy2 = pboxBandStart->y2; \
- pboxBandEnd = pboxBandStart + 1; \
- while (pboxBandEnd != pboxLast && pboxBandEnd->y1 == clipy1) { \
- pboxBandEnd++; \
- } \
- for (; ppt != pptLast && ppt->y < clipy1; ppt++, pwidth++) {} \
-}
-
-/*
- Clip a list of scanlines to a region. The caller has allocated the
- space. FSorted is non-zero if the scanline origins are in ascending
- order.
- returns the number of new, clipped scanlines.
-*/
-
-int
-miClipSpans(
- RegionPtr prgnDst,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- DDXPointPtr pptNew,
- int *pwidthNew,
- int fSorted)
-{
- DDXPointPtr pptLast;
- int *pwidthNewStart; /* the vengeance of Xerox! */
- int y, x1, x2;
- int numRects;
-
- good(prgnDst);
- pptLast = ppt + nspans;
- pwidthNewStart = pwidthNew;
-
- if (!prgnDst->data)
- {
- /* Do special fast code with clip boundaries in registers(?) */
- /* It doesn't pay much to make use of fSorted in this case,
- so we lump everything together. */
-
- int clipx1, clipx2, clipy1, clipy2;
-
- clipx1 = prgnDst->extents.x1;
- clipy1 = prgnDst->extents.y1;
- clipx2 = prgnDst->extents.x2;
- clipy2 = prgnDst->extents.y2;
-
- for (; ppt != pptLast; ppt++, pwidth++)
- {
- y = ppt->y;
- x1 = ppt->x;
- if (clipy1 <= y && y < clipy2)
- {
- x2 = x1 + *pwidth;
- if (x1 < clipx1) x1 = clipx1;
- if (x2 > clipx2) x2 = clipx2;
- if (x1 < x2)
- {
- /* part of span in clip rectangle */
- pptNew->x = x1;
- pptNew->y = y;
- *pwidthNew = x2 - x1;
- pptNew++;
- pwidthNew++;
- }
- }
- } /* end for */
-
- }
- else if ((numRects = prgnDst->data->numRects))
- {
- /* Have to clip against many boxes */
- BoxPtr pboxBandStart, pboxBandEnd;
- BoxPtr pbox;
- BoxPtr pboxLast;
- int clipy1, clipy2;
-
- /* In this case, taking advantage of sorted spans gains more than
- the sorting costs. */
- if ((! fSorted) && (nspans > 1))
- QuickSortSpans(ppt, pwidth, nspans);
-
- pboxBandStart = REGION_BOXPTR(prgnDst);
- pboxLast = pboxBandStart + numRects;
-
- NextBand();
-
- for (; ppt != pptLast; )
- {
- y = ppt->y;
- if (y < clipy2)
- {
- /* span is in the current band */
- pbox = pboxBandStart;
- x1 = ppt->x;
- x2 = x1 + *pwidth;
- do
- { /* For each box in band */
- int newx1, newx2;
-
- newx1 = x1;
- newx2 = x2;
- if (newx1 < pbox->x1) newx1 = pbox->x1;
- if (newx2 > pbox->x2) newx2 = pbox->x2;
- if (newx1 < newx2)
- {
- /* Part of span in clip rectangle */
- pptNew->x = newx1;
- pptNew->y = y;
- *pwidthNew = newx2 - newx1;
- pptNew++;
- pwidthNew++;
- }
- pbox++;
- } while (pbox != pboxBandEnd);
- ppt++;
- pwidth++;
- }
- else
- {
- /* Move to next band, adjust ppt as needed */
- pboxBandStart = pboxBandEnd;
- if (pboxBandStart == pboxLast)
- break; /* We're completely done */
- NextBand();
- }
- }
- }
- return (pwidthNew - pwidthNewStart);
-}
diff --git a/xorg-server/mi/miscrinit.c b/xorg-server/mi/miscrinit.c
index 2af17672b..60a983e65 100644
--- a/xorg-server/mi/miscrinit.c
+++ b/xorg-server/mi/miscrinit.c
@@ -292,21 +292,25 @@ miScreenInit(
return miScreenDevPrivateInit(pScreen, width, pbits);
}
-static int privateKeyIndex;
-static DevPrivateKey privateKey = &privateKeyIndex;
+static DevPrivateKeyRec privateKeyRec;
+#define privateKey (&privateKeyRec)
DevPrivateKey
miAllocateGCPrivateIndex(void)
{
+ if (!dixRegisterPrivateKey(&privateKeyRec, PRIVATE_GC, 0))
+ return NULL;
return privateKey;
}
-static int miZeroLineScreenKeyIndex;
-DevPrivateKey miZeroLineScreenKey = &miZeroLineScreenKeyIndex;
+DevPrivateKeyRec miZeroLineScreenKeyRec;
void
miSetZeroLineBias(ScreenPtr pScreen, unsigned int bias)
{
+ if (!dixRegisterPrivateKey(&miZeroLineScreenKeyRec, PRIVATE_SCREEN, 0))
+ return;
+
dixSetPrivate(&pScreen->devPrivates, miZeroLineScreenKey,
(unsigned long *)(unsigned long)bias);
}
diff --git a/xorg-server/mi/mispans.c b/xorg-server/mi/mispans.c
index 7b332ee34..ccf2a723e 100644
--- a/xorg-server/mi/mispans.c
+++ b/xorg-server/mi/mispans.c
@@ -410,10 +410,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
if (!yspans || !ysizes)
{
- if (yspans)
- free(yspans);
- if (ysizes)
- free(ysizes);
+ free(yspans);
+ free(ysizes);
miDisposeSpanGroup (spanGroup);
return;
}
@@ -492,10 +490,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
}
free(yspans);
free(ysizes);
- if (points)
- free(points);
- if (widths)
- free(widths);
+ free(points);
+ free(widths);
return;
}
count = 0;
diff --git a/xorg-server/mi/mispans.h b/xorg-server/mi/mispans.h
index 8151415cc..5a5f5d2b6 100644
--- a/xorg-server/mi/mispans.h
+++ b/xorg-server/mi/mispans.h
@@ -1,102 +1,92 @@
-/***********************************************************
-
-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.
-
-
-Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- 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 of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL 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.
-
-******************************************************************/
-
-#ifndef MISPANS_H
-#define MISPANS_H
-
-typedef struct {
- int count; /* number of spans */
- DDXPointPtr points; /* pointer to list of start points */
- int *widths; /* pointer to list of widths */
-} Spans;
-
-typedef struct {
- int size; /* Total number of *Spans allocated */
- int count; /* Number of *Spans actually in group */
- Spans *group; /* List of Spans */
- int ymin, ymax; /* Min, max y values encountered */
-} SpanGroup;
-
-/* Initialize SpanGroup. MUST BE DONE before use. */
-extern _X_EXPORT void miInitSpanGroup(
- SpanGroup * /*spanGroup*/
-);
-
-/* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */
-extern _X_EXPORT void miAppendSpans(
- SpanGroup * /*spanGroup*/,
- SpanGroup * /*otherGroup*/,
- Spans * /*spans*/
-);
-
-/* Paint a span group, insuring that each pixel is painted at most once */
-extern _X_EXPORT void miFillUniqueSpanGroup(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- SpanGroup * /*spanGroup*/
-);
-
-/* Free up data in a span group. MUST BE DONE or you'll suffer memory leaks */
-extern _X_EXPORT void miFreeSpanGroup(
- SpanGroup * /*spanGroup*/
-);
-
-extern _X_EXPORT int miClipSpans(
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*ppt*/,
- int * /*pwidth*/,
- int /*nspans*/,
- DDXPointPtr /*pptNew*/,
- int * /*pwidthNew*/,
- int /*fSorted*/
-);
-
-/* Rops which must use span groups */
-#define miSpansCarefulRop(rop) (((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2)
-#define miSpansEasyRop(rop) (!miSpansCarefulRop(rop))
-
-#endif /* MISPANS_H */
+/***********************************************************
+
+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.
+
+
+Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ 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 of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL 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.
+
+******************************************************************/
+
+#ifndef MISPANS_H
+#define MISPANS_H
+
+typedef struct {
+ int count; /* number of spans */
+ DDXPointPtr points; /* pointer to list of start points */
+ int *widths; /* pointer to list of widths */
+} Spans;
+
+typedef struct {
+ int size; /* Total number of *Spans allocated */
+ int count; /* Number of *Spans actually in group */
+ Spans *group; /* List of Spans */
+ int ymin, ymax; /* Min, max y values encountered */
+} SpanGroup;
+
+/* Initialize SpanGroup. MUST BE DONE before use. */
+extern _X_EXPORT void miInitSpanGroup(
+ SpanGroup * /*spanGroup*/
+);
+
+/* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */
+extern _X_EXPORT void miAppendSpans(
+ SpanGroup * /*spanGroup*/,
+ SpanGroup * /*otherGroup*/,
+ Spans * /*spans*/
+);
+
+/* Paint a span group, insuring that each pixel is painted at most once */
+extern _X_EXPORT void miFillUniqueSpanGroup(
+ DrawablePtr /*pDraw*/,
+ GCPtr /*pGC*/,
+ SpanGroup * /*spanGroup*/
+);
+
+/* Free up data in a span group. MUST BE DONE or you'll suffer memory leaks */
+extern _X_EXPORT void miFreeSpanGroup(
+ SpanGroup * /*spanGroup*/
+);
+
+/* Rops which must use span groups */
+#define miSpansCarefulRop(rop) (((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2)
+#define miSpansEasyRop(rop) (!miSpansCarefulRop(rop))
+
+#endif /* MISPANS_H */
diff --git a/xorg-server/mi/misprite.c b/xorg-server/mi/misprite.c
index 69494b9dc..9a4bf49c7 100644
--- a/xorg-server/mi/misprite.c
+++ b/xorg-server/mi/misprite.c
@@ -182,10 +182,10 @@ miSpriteIsDown(miCursorInfoPtr pDevCursor)
* screen wrappers
*/
-static int miSpriteScreenKeyIndex;
-static DevPrivateKey miSpriteScreenKey = &miSpriteScreenKeyIndex;
-static int miSpriteDevPrivatesKeyIndex;
-static DevPrivateKey miSpriteDevPrivatesKey = &miSpriteDevPrivatesKeyIndex;
+static DevPrivateKeyRec miSpriteScreenKeyRec;
+#define miSpriteScreenKey (&miSpriteScreenKeyRec)
+static DevPrivateKeyRec miSpriteDevPrivatesKeyRec;
+#define miSpriteDevPrivatesKey (&miSpriteDevPrivatesKeyRec)
static Bool miSpriteCloseScreen(int i, ScreenPtr pScreen);
static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy,
@@ -268,7 +268,7 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
if (pCursorInfo->isUp &&
pCursorInfo->pScreen == pScreen &&
- miRectIn(pRegion, &pCursorInfo->saved) != rgnOUT)
+ RegionContainsRect(pRegion, &pCursorInfo->saved) != rgnOUT)
{
SPRITE_DEBUG(("Damage remove\n"));
miSpriteRemoveCursor (pDev, pScreen);
@@ -293,6 +293,12 @@ miSpriteInitialize (ScreenPtr pScreen,
if (!DamageSetup (pScreen))
return FALSE;
+ if (!dixRegisterPrivateKey(&miSpriteScreenKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&miSpriteDevPrivatesKeyRec, PRIVATE_DEVICE, 0))
+ return FALSE;
+
pScreenPriv = malloc(sizeof (miSpriteScreenRec));
if (!pScreenPriv)
return FALSE;
@@ -523,7 +529,7 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
* Damage will take care of destination check
*/
if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
- miRectIn(prgnSrc, &pCursorInfo->saved) != rgnOUT)
+ RegionContainsRect(prgnSrc, &pCursorInfo->saved) != rgnOUT)
{
SPRITE_DEBUG (("CopyWindow remove\n"));
miSpriteRemoveCursor (pDev, pScreen);
@@ -798,73 +804,9 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
miSpriteFindColors (pPointer, pScreen);
}
if (pPointer->isUp) {
-#if 0
- /* FIXME: Disabled for MPX, should be rewritten */
- int sx, sy;
- /*
- * check to see if the old saved region
- * encloses the new sprite, in which case we use
- * the flicker-free MoveCursor primitive.
- */
- sx = pointer->x - (int)pCursor->bits->xhot;
- sy = pointer->y - (int)pCursor->bits->yhot;
- if (sx + (int) pCursor->bits->width >= pointer->saved.x1 &&
- sx < pointer->saved.x2 &&
- sy + (int) pCursor->bits->height >= pointer->saved.y1 &&
- sy < pointer->saved.y2 &&
- (int) pCursor->bits->width + (2 * SPRITE_PAD) ==
- pointer->saved.x2 - pointer->saved.x1 &&
- (int) pCursor->bits->height + (2 * SPRITE_PAD) ==
- pointer->saved.y2 - pointer->saved.y1
- )
- {
- DamageDrawInternal (pScreen, TRUE);
- miSpriteIsDown(pCursorInfo);
- if (!(sx >= pointer->saved.x1 &&
- sx + (int)pCursor->bits->width < pointer->saved.x2
- && sy >= pointer->saved.y1 &&
- sy + (int)pCursor->bits->height <
- pointer->saved.y2))
- {
- int oldx1, oldy1, dx, dy;
-
- oldx1 = pointer->saved.x1;
- oldy1 = pointer->saved.y1;
- dx = oldx1 - (sx - SPRITE_PAD);
- dy = oldy1 - (sy - SPRITE_PAD);
- pointer->saved.x1 -= dx;
- pointer->saved.y1 -= dy;
- pointer->saved.x2 -= dx;
- pointer->saved.y2 -= dy;
- (void) miDCChangeSave(pScreen,
- pointer->saved.x1,
- pointer->saved.y1,
- pointer->saved.x2 -
- pointer->saved.x1,
- pointer->saved.y2 -
- pointer->saved.y1,
- dx, dy);
- }
- (void) miDCMoveCursor(pScreen, pCursor,
- pointer->saved.x1,
- pointer->saved.y1,
- pointer->saved.x2 -
- pointer->saved.x1,
- pointer->saved.y2 -
- pointer->saved.y1,
- sx - pointer->saved.x1,
- sy - pointer->saved.y1,
- pointer->colors[SOURCE_COLOR].pixel,
- pointer->colors[MASK_COLOR].pixel);
- miSpriteIsUp(pCursorInfo);
- DamageDrawInternal (pScreen, FALSE);
- }
- else
-#endif
- {
- SPRITE_DEBUG (("SetCursor remove %d\n", pDev->id));
- miSpriteRemoveCursor (pDev, pScreen);
- }
+ /* TODO: reimplement flicker-free MoveCursor */
+ SPRITE_DEBUG (("SetCursor remove %d\n", pDev->id));
+ miSpriteRemoveCursor (pDev, pScreen);
}
if (!pPointer->isUp && pPointer->pCursor)
diff --git a/xorg-server/mi/misprite.h b/xorg-server/mi/misprite.h
index 6dbc48460..635a6fad7 100644
--- a/xorg-server/mi/misprite.h
+++ b/xorg-server/mi/misprite.h
@@ -46,12 +46,5 @@ extern Bool miDCSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
int x, int y, int w, int h);
extern Bool miDCRestoreUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
int x, int y, int w, int h);
-extern Bool miDCMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
- CursorPtr pCursor, int x, int y,
- int w, int h, int dx, int dy,
- unsigned long source, unsigned long mask);
-extern Bool miDCChangeSave(DeviceIntPtr pDev, ScreenPtr pScreen,
- int x, int y, int w, int h,
- int dx, int dy);
extern Bool miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
extern void miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
diff --git a/xorg-server/mi/mivaltree.c b/xorg-server/mi/mivaltree.c
index cfcdab756..36ec8e60a 100644
--- a/xorg-server/mi/mivaltree.c
+++ b/xorg-server/mi/mivaltree.c
@@ -1,815 +1,813 @@
-/*
- * mivaltree.c --
- * Functions for recalculating window clip lists. Main function
- * is miValidateTree.
- *
-
-Copyright 1987, 1988, 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.
-
- *
- * Copyright 1987, 1988, 1989 by
- * Digital Equipment Corporation, Maynard, Massachusetts,
- *
- * 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 of Digital not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * DIGITAL 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.
- *
- ******************************************************************/
-
-/* The panoramix components contained the following notice */
-/*****************************************************************
-
-Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-
-******************************************************************/
-
-
- /*
- * Aug '86: Susan Angebranndt -- original code
- * July '87: Adam de Boor -- substantially modified and commented
- * Summer '89: Joel McCormack -- so fast you wouldn't believe it possible.
- * In particular, much improved code for window mapping and
- * circulating.
- * Bob Scheifler -- avoid miComputeClips for unmapped windows,
- * valdata changes
- */
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "validate.h"
-#include "windowstr.h"
-#include "mi.h"
-#include "regionstr.h"
-#include "mivalidate.h"
-
-#include "globals.h"
-
-/*
- * Compute the visibility of a shaped window
- */
-int
-miShapedWindowIn (ScreenPtr pScreen, RegionPtr universe, RegionPtr bounding,
- BoxPtr rect, int x, int y)
-{
- BoxRec box;
- BoxPtr boundBox;
- int nbox;
- Bool someIn, someOut;
- int t, x1, y1, x2, y2;
-
- nbox = REGION_NUM_RECTS (bounding);
- boundBox = REGION_RECTS (bounding);
- someIn = someOut = FALSE;
- x1 = rect->x1;
- y1 = rect->y1;
- x2 = rect->x2;
- y2 = rect->y2;
- while (nbox--)
- {
- if ((t = boundBox->x1 + x) < x1)
- t = x1;
- box.x1 = t;
- if ((t = boundBox->y1 + y) < y1)
- t = y1;
- box.y1 = t;
- if ((t = boundBox->x2 + x) > x2)
- t = x2;
- box.x2 = t;
- if ((t = boundBox->y2 + y) > y2)
- t = y2;
- box.y2 = t;
- if (box.x1 > box.x2)
- box.x2 = box.x1;
- if (box.y1 > box.y2)
- box.y2 = box.y1;
- switch (RECT_IN_REGION(pScreen, universe, &box))
- {
- case rgnIN:
- if (someOut)
- return rgnPART;
- someIn = TRUE;
- break;
- case rgnOUT:
- if (someIn)
- return rgnPART;
- someOut = TRUE;
- break;
- default:
- return rgnPART;
- }
- boundBox++;
- }
- if (someIn)
- return rgnIN;
- return rgnOUT;
-}
-
-static GetRedirectBorderClipProcPtr miGetRedirectBorderClipProc;
-static SetRedirectBorderClipProcPtr miSetRedirectBorderClipProc;
-
-void
-miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip,
- GetRedirectBorderClipProcPtr getBorderClip)
-{
- miSetRedirectBorderClipProc = setBorderClip;
- miGetRedirectBorderClipProc = getBorderClip;
-}
-
-/*
- * Manual redirected windows are treated as transparent; they do not obscure
- * siblings or parent windows
- */
-
-#ifdef COMPOSITE
-#define TreatAsTransparent(w) ((w)->redirectDraw == RedirectDrawManual)
-#else
-#define TreatAsTransparent(w) FALSE
-#endif
-
-#define HasParentRelativeBorder(w) (!(w)->borderIsPixel && \
- HasBorder(w) && \
- (w)->backgroundState == ParentRelative)
-
-
-/*
- *-----------------------------------------------------------------------
- * miComputeClips --
- * Recompute the clipList, borderClip, exposed and borderExposed
- * regions for pParent and its children. Only viewable windows are
- * taken into account.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * clipList, borderClip, exposed and borderExposed are altered.
- * A VisibilityNotify event may be generated on the parent window.
- *
- *-----------------------------------------------------------------------
- */
-static void
-miComputeClips (
- WindowPtr pParent,
- ScreenPtr pScreen,
- RegionPtr universe,
- VTKind kind,
- RegionPtr exposed ) /* for intermediate calculations */
-{
- int dx,
- dy;
- RegionRec childUniverse;
- WindowPtr pChild;
- int oldVis, newVis;
- BoxRec borderSize;
- 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
- * the borderSize region. If the window is unobscured, this rectangle
- * will be completely inside the universe (the universe will cover it
- * completely). If the window is completely obscured, none of the
- * universe will cover the rectangle.
- */
- borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent);
- borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent);
- dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent);
- if (dx > 32767)
- dx = 32767;
- borderSize.x2 = dx;
- dy = (int) pParent->drawable.y + (int) pParent->drawable.height + wBorderWidth(pParent);
- if (dy > 32767)
- dy = 32767;
- borderSize.y2 = dy;
-
-#ifdef COMPOSITE
- /*
- * In redirected drawing case, reset universe to borderSize
- */
- if (pParent->redirectDraw != RedirectDrawNone)
- {
- if (miSetRedirectBorderClipProc)
- {
- if (TreatAsTransparent (pParent))
- REGION_EMPTY (pScreen, universe);
- (*miSetRedirectBorderClipProc) (pParent, universe);
- }
- REGION_COPY(pScreen, universe, &pParent->borderSize);
- }
-#endif
-
- oldVis = pParent->visibility;
- switch (RECT_IN_REGION( pScreen, universe, &borderSize))
- {
- case rgnIN:
- newVis = VisibilityUnobscured;
- break;
- case rgnPART:
- newVis = VisibilityPartiallyObscured;
- {
- RegionPtr pBounding;
-
- if ((pBounding = wBoundingShape (pParent)))
- {
- switch (miShapedWindowIn (pScreen, universe, pBounding,
- &borderSize,
- pParent->drawable.x,
- pParent->drawable.y))
- {
- case rgnIN:
- newVis = VisibilityUnobscured;
- break;
- case rgnOUT:
- newVis = VisibilityFullyObscured;
- break;
- }
- }
- }
- break;
- default:
- newVis = VisibilityFullyObscured;
- break;
- }
- pParent->visibility = newVis;
- if (oldVis != newVis &&
- ((pParent->eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask))
- SendVisibilityNotify(pParent);
-
- dx = pParent->drawable.x - pParent->valdata->before.oldAbsCorner.x;
- dy = pParent->drawable.y - pParent->valdata->before.oldAbsCorner.y;
-
- /*
- * avoid computations when dealing with simple operations
- */
-
- switch (kind) {
- case VTMap:
- case VTStack:
- case VTUnmap:
- break;
- case VTMove:
- if ((oldVis == newVis) &&
- ((oldVis == VisibilityFullyObscured) ||
- (oldVis == VisibilityUnobscured)))
- {
- pChild = pParent;
- while (1)
- {
- if (pChild->viewable)
- {
- if (pChild->visibility != VisibilityFullyObscured)
- {
- REGION_TRANSLATE( pScreen, &pChild->borderClip,
- dx, dy);
- REGION_TRANSLATE( pScreen, &pChild->clipList,
- dx, dy);
- pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (pChild, dx, dy);
-
- }
- if (pChild->valdata)
- {
- REGION_NULL(pScreen,
- &pChild->valdata->after.borderExposed);
- if (HasParentRelativeBorder(pChild))
- {
- REGION_SUBTRACT(pScreen,
- &pChild->valdata->after.borderExposed,
- &pChild->borderClip,
- &pChild->winSize);
- }
- REGION_NULL(pScreen, &pChild->valdata->after.exposed);
- }
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pParent))
- pChild = pChild->parent;
- if (pChild == pParent)
- break;
- pChild = pChild->nextSib;
- }
- return;
- }
- /* fall through */
- default:
- /*
- * To calculate exposures correctly, we have to translate the old
- * borderClip and clipList regions to the window's new location so there
- * is a correspondence between pieces of the new and old clipping regions.
- */
- if (dx || dy)
- {
- /*
- * We translate the old clipList because that will be exposed or copied
- * if gravity is right.
- */
- REGION_TRANSLATE( pScreen, &pParent->borderClip, dx, dy);
- REGION_TRANSLATE( pScreen, &pParent->clipList, dx, dy);
- }
- break;
- case VTBroken:
- REGION_EMPTY (pScreen, &pParent->borderClip);
- REGION_EMPTY (pScreen, &pParent->clipList);
- break;
- }
-
- borderVisible = pParent->valdata->before.borderVisible;
- resized = pParent->valdata->before.resized;
- REGION_NULL(pScreen, &pParent->valdata->after.borderExposed);
- REGION_NULL(pScreen, &pParent->valdata->after.exposed);
-
- /*
- * Since the borderClip must not be clipped by the children, we do
- * the border exposure first...
- *
- * 'universe' is the window's borderClip. To figure the exposures, remove
- * the area that used to be exposed from the new.
- * This leaves a region of pieces that weren't exposed before.
- */
-
- if (HasBorder (pParent))
- {
- if (borderVisible)
- {
- /*
- * when the border changes shape, the old visible portions
- * of the border will be saved by DIX in borderVisible --
- * use that region and destroy it
- */
- REGION_SUBTRACT( pScreen, exposed, universe, borderVisible);
- REGION_DESTROY( pScreen, borderVisible);
- }
- else
- {
- REGION_SUBTRACT( pScreen, exposed, universe, &pParent->borderClip);
- }
- if (HasParentRelativeBorder(pParent) && (dx || dy))
- REGION_SUBTRACT( pScreen, &pParent->valdata->after.borderExposed,
- universe,
- &pParent->winSize);
- else
- REGION_SUBTRACT( pScreen, &pParent->valdata->after.borderExposed,
- exposed, &pParent->winSize);
-
- REGION_COPY( pScreen, &pParent->borderClip, universe);
-
- /*
- * To get the right clipList for the parent, and to make doubly sure
- * that no child overlaps the parent's border, we remove the parent's
- * border from the universe before proceeding.
- */
-
- REGION_INTERSECT( pScreen, universe, universe, &pParent->winSize);
- }
- else
- REGION_COPY( pScreen, &pParent->borderClip, universe);
-
- if ((pChild = pParent->firstChild) && pParent->mapped)
- {
- REGION_NULL(pScreen, &childUniverse);
- REGION_NULL(pScreen, &childUnion);
- if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
- ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
- (pChild->drawable.x < pParent->lastChild->drawable.x)))
- {
- for (; pChild; pChild = pChild->nextSib)
- {
- if (pChild->viewable && !TreatAsTransparent(pChild))
- REGION_APPEND( pScreen, &childUnion, &pChild->borderSize);
- }
- }
- else
- {
- for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib)
- {
- if (pChild->viewable && !TreatAsTransparent(pChild))
- REGION_APPEND( pScreen, &childUnion, &pChild->borderSize);
- }
- }
- REGION_VALIDATE( pScreen, &childUnion, &overlap);
-
- for (pChild = pParent->firstChild;
- pChild;
- pChild = pChild->nextSib)
- {
- if (pChild->viewable) {
- /*
- * If the child is viewable, we want to remove its extents
- * from the current universe, but we only re-clip it if
- * it's been marked.
- */
- if (pChild->valdata) {
- /*
- * Figure out the new universe from the child's
- * perspective and recurse.
- */
- REGION_INTERSECT( pScreen, &childUniverse,
- universe,
- &pChild->borderSize);
- miComputeClips (pChild, pScreen, &childUniverse, kind,
- exposed);
- }
- /*
- * Once the child has been processed, we remove its extents
- * from the current universe, thus denying its space to any
- * other sibling.
- */
- if (overlap && !TreatAsTransparent (pChild))
- REGION_SUBTRACT( pScreen, universe, universe,
- &pChild->borderSize);
- }
- }
- if (!overlap)
- REGION_SUBTRACT( pScreen, universe, universe, &childUnion);
- REGION_UNINIT( pScreen, &childUnion);
- REGION_UNINIT( pScreen, &childUniverse);
- } /* if any children */
-
- /*
- * 'universe' now contains the new clipList for the parent window.
- *
- * To figure the exposure of the window we subtract the old clip from the
- * new, just as for the border.
- */
-
- if (oldVis == VisibilityFullyObscured ||
- oldVis == VisibilityNotViewable)
- {
- REGION_COPY( pScreen, &pParent->valdata->after.exposed, universe);
- }
- else if (newVis != VisibilityFullyObscured &&
- newVis != VisibilityNotViewable)
- {
- REGION_SUBTRACT( pScreen, &pParent->valdata->after.exposed,
- universe, &pParent->clipList);
- }
-
- /* HACK ALERT - copying contents of regions, instead of regions */
- {
- RegionRec tmp;
-
- tmp = pParent->clipList;
- pParent->clipList = *universe;
- *universe = tmp;
- }
-
-#ifdef NOTDEF
- REGION_COPY( pScreen, &pParent->clipList, universe);
-#endif
-
- pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
- if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (pParent, dx, dy);
-}
-
-static void
-miTreeObscured(
- WindowPtr pParent )
-{
- WindowPtr pChild;
- int oldVis;
-
- pChild = pParent;
- while (1)
- {
- if (pChild->viewable)
- {
- oldVis = pChild->visibility;
- if (oldVis != (pChild->visibility = VisibilityFullyObscured) &&
- ((pChild->eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask))
- SendVisibilityNotify(pChild);
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pParent))
- pChild = pChild->parent;
- if (pChild == pParent)
- break;
- pChild = pChild->nextSib;
- }
-}
-
-/*
- *-----------------------------------------------------------------------
- * miValidateTree --
- * Recomputes the clip list for pParent and all its inferiors.
- *
- * Results:
- * Always returns 1.
- *
- * Side Effects:
- * The clipList, borderClip, exposed, and borderExposed regions for
- * each marked window are altered.
- *
- * Notes:
- * This routine assumes that all affected windows have been marked
- * (valdata created) and their winSize and borderSize regions
- * adjusted to correspond to their new positions. The borderClip and
- * clipList regions should not have been touched.
- *
- * The top-most level is treated differently from all lower levels
- * because pParent is unchanged. For the top level, we merge the
- * regions taken up by the marked children back into the clipList
- * for pParent, thus forming a region from which the marked children
- * can claim their areas. For lower levels, where the old clipList
- * and borderClip are invalid, we can't do this and have to do the
- * extra operations done in miComputeClips, but this is much faster
- * e.g. when only one child has moved...
- *
- *-----------------------------------------------------------------------
- */
-/*ARGSUSED*/
-int
-miValidateTree (
- WindowPtr pParent, /* Parent to validate */
- WindowPtr pChild, /* First child of pParent that was
- * affected */
- VTKind kind /* What kind of configuration caused call */
- )
-{
- RegionRec totalClip; /* Total clipping region available to
- * the marked children. pParent's clipList
- * merged with the borderClips of all
- * the marked children. */
- RegionRec childClip; /* The new borderClip for the current
- * child */
- RegionRec childUnion; /* the space covered by borderSize for
- * all marked children */
- RegionRec exposed; /* For intermediate calculations */
- ScreenPtr pScreen;
- WindowPtr pWin;
- Bool overlap;
- int viewvals;
- Bool forward;
-
- pScreen = pParent->drawable.pScreen;
- if (pChild == NullWindow)
- pChild = pParent->firstChild;
-
- REGION_NULL(pScreen, &childClip);
- REGION_NULL(pScreen, &exposed);
-
- /*
- * compute the area of the parent window occupied
- * by the marked children + the parent itself. This
- * is the area which can be divied up among the marked
- * children in their new configuration.
- */
- REGION_NULL(pScreen, &totalClip);
- viewvals = 0;
- if (REGION_BROKEN (pScreen, &pParent->clipList) &&
- !REGION_BROKEN (pScreen, &pParent->borderClip))
- {
- kind = VTBroken;
- /*
- * When rebuilding clip lists after out of memory,
- * assume everything is busted.
- */
- forward = TRUE;
- REGION_COPY (pScreen, &totalClip, &pParent->borderClip);
- REGION_INTERSECT (pScreen, &totalClip, &totalClip, &pParent->winSize);
-
- for (pWin = pParent->firstChild; pWin != pChild; pWin = pWin->nextSib)
- {
- if (pWin->viewable && !TreatAsTransparent (pWin))
- REGION_SUBTRACT (pScreen, &totalClip, &totalClip, &pWin->borderSize);
- }
- for (pWin = pChild; pWin; pWin = pWin->nextSib)
- if (pWin->valdata && pWin->viewable)
- viewvals++;
-
- REGION_EMPTY (pScreen, &pParent->clipList);
- }
- else
- {
- if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
- ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
- (pChild->drawable.x < pParent->lastChild->drawable.x)))
- {
- forward = TRUE;
- for (pWin = pChild; pWin; pWin = pWin->nextSib)
- {
- if (pWin->valdata)
- {
- RegionPtr pBorderClip = &pWin->borderClip;
-#ifdef COMPOSITE
- if (pWin->redirectDraw != RedirectDrawNone && miGetRedirectBorderClipProc)
- pBorderClip = (*miGetRedirectBorderClipProc)(pWin);
-#endif
- REGION_APPEND( pScreen, &totalClip, pBorderClip );
- if (pWin->viewable)
- viewvals++;
- }
- }
- }
- else
- {
- forward = FALSE;
- pWin = pParent->lastChild;
- while (1)
- {
- if (pWin->valdata)
- {
- RegionPtr pBorderClip = &pWin->borderClip;
-#ifdef COMPOSITE
- if (pWin->redirectDraw != RedirectDrawNone && miGetRedirectBorderClipProc)
- pBorderClip = (*miGetRedirectBorderClipProc)(pWin);
-#endif
- REGION_APPEND( pScreen, &totalClip, pBorderClip );
- if (pWin->viewable)
- viewvals++;
- }
- if (pWin == pChild)
- break;
- pWin = pWin->prevSib;
- }
- }
- REGION_VALIDATE( pScreen, &totalClip, &overlap);
- }
-
- /*
- * Now go through the children of the root and figure their new
- * borderClips from the totalClip, passing that off to miComputeClips
- * to handle recursively. Once that's done, we remove the child
- * from the totalClip to clip any siblings below it.
- */
-
- overlap = TRUE;
- if (kind != VTStack)
- {
- REGION_UNION( pScreen, &totalClip, &totalClip, &pParent->clipList);
- if (viewvals > 1)
- {
- /*
- * precompute childUnion to discover whether any of them
- * overlap. This seems redundant, but performance studies
- * have demonstrated that the cost of this loop is
- * lower than the cost of multiple Subtracts in the
- * loop below.
- */
- REGION_NULL(pScreen, &childUnion);
- if (forward)
- {
- for (pWin = pChild; pWin; pWin = pWin->nextSib)
- if (pWin->valdata && pWin->viewable && !TreatAsTransparent (pWin))
- REGION_APPEND( pScreen, &childUnion,
- &pWin->borderSize);
- }
- else
- {
- pWin = pParent->lastChild;
- while (1)
- {
- if (pWin->valdata && pWin->viewable && !TreatAsTransparent (pWin))
- REGION_APPEND( pScreen, &childUnion,
- &pWin->borderSize);
- if (pWin == pChild)
- break;
- pWin = pWin->prevSib;
- }
- }
- REGION_VALIDATE(pScreen, &childUnion, &overlap);
- if (overlap)
- REGION_UNINIT(pScreen, &childUnion);
- }
- }
-
- for (pWin = pChild;
- pWin != NullWindow;
- pWin = pWin->nextSib)
- {
- if (pWin->viewable) {
- if (pWin->valdata) {
- REGION_INTERSECT( pScreen, &childClip,
- &totalClip,
- &pWin->borderSize);
- miComputeClips (pWin, pScreen, &childClip, kind, &exposed);
- if (overlap && !TreatAsTransparent (pWin))
- {
- REGION_SUBTRACT( pScreen, &totalClip,
- &totalClip,
- &pWin->borderSize);
- }
- } else if (pWin->visibility == VisibilityNotViewable) {
- miTreeObscured(pWin);
- }
- } else {
- if (pWin->valdata) {
- REGION_EMPTY( pScreen, &pWin->clipList);
- if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (pWin, 0, 0);
- REGION_EMPTY( pScreen, &pWin->borderClip);
- pWin->valdata = NULL;
- }
- }
- }
-
- REGION_UNINIT( pScreen, &childClip);
- if (!overlap)
- {
- REGION_SUBTRACT(pScreen, &totalClip, &totalClip, &childUnion);
- REGION_UNINIT(pScreen, &childUnion);
- }
-
- REGION_NULL(pScreen, &pParent->valdata->after.exposed);
- REGION_NULL(pScreen, &pParent->valdata->after.borderExposed);
-
- /*
- * each case below is responsible for updating the
- * clipList and serial number for the parent window
- */
-
- switch (kind) {
- case VTStack:
- break;
- default:
- /*
- * totalClip contains the new clipList for the parent. Figure out
- * exposures and obscures as per miComputeClips and reset the parent's
- * clipList.
- */
- REGION_SUBTRACT( pScreen, &pParent->valdata->after.exposed,
- &totalClip, &pParent->clipList);
- /* fall through */
- case VTMap:
- REGION_COPY( pScreen, &pParent->clipList, &totalClip);
- pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- break;
- }
-
- REGION_UNINIT( pScreen, &totalClip);
- REGION_UNINIT( pScreen, &exposed);
- if (pScreen->ClipNotify)
- (*pScreen->ClipNotify) (pParent, 0, 0);
- return (1);
-}
+/*
+ * mivaltree.c --
+ * Functions for recalculating window clip lists. Main function
+ * is miValidateTree.
+ *
+
+Copyright 1987, 1988, 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.
+
+ *
+ * Copyright 1987, 1988, 1989 by
+ * Digital Equipment Corporation, Maynard, Massachusetts,
+ *
+ * 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 of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL 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.
+ *
+ ******************************************************************/
+
+/* The panoramix components contained the following notice */
+/*****************************************************************
+
+Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+
+******************************************************************/
+
+
+ /*
+ * Aug '86: Susan Angebranndt -- original code
+ * July '87: Adam de Boor -- substantially modified and commented
+ * Summer '89: Joel McCormack -- so fast you wouldn't believe it possible.
+ * In particular, much improved code for window mapping and
+ * circulating.
+ * Bob Scheifler -- avoid miComputeClips for unmapped windows,
+ * valdata changes
+ */
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "validate.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "regionstr.h"
+#include "mivalidate.h"
+
+#include "globals.h"
+
+/*
+ * Compute the visibility of a shaped window
+ */
+int
+miShapedWindowIn (RegionPtr universe, RegionPtr bounding,
+ BoxPtr rect, int x, int y)
+{
+ BoxRec box;
+ BoxPtr boundBox;
+ int nbox;
+ Bool someIn, someOut;
+ int t, x1, y1, x2, y2;
+
+ nbox = RegionNumRects (bounding);
+ boundBox = RegionRects (bounding);
+ someIn = someOut = FALSE;
+ x1 = rect->x1;
+ y1 = rect->y1;
+ x2 = rect->x2;
+ y2 = rect->y2;
+ while (nbox--)
+ {
+ if ((t = boundBox->x1 + x) < x1)
+ t = x1;
+ box.x1 = t;
+ if ((t = boundBox->y1 + y) < y1)
+ t = y1;
+ box.y1 = t;
+ if ((t = boundBox->x2 + x) > x2)
+ t = x2;
+ box.x2 = t;
+ if ((t = boundBox->y2 + y) > y2)
+ t = y2;
+ box.y2 = t;
+ if (box.x1 > box.x2)
+ box.x2 = box.x1;
+ if (box.y1 > box.y2)
+ box.y2 = box.y1;
+ switch (RegionContainsRect(universe, &box))
+ {
+ case rgnIN:
+ if (someOut)
+ return rgnPART;
+ someIn = TRUE;
+ break;
+ case rgnOUT:
+ if (someIn)
+ return rgnPART;
+ someOut = TRUE;
+ break;
+ default:
+ return rgnPART;
+ }
+ boundBox++;
+ }
+ if (someIn)
+ return rgnIN;
+ return rgnOUT;
+}
+
+static GetRedirectBorderClipProcPtr miGetRedirectBorderClipProc;
+static SetRedirectBorderClipProcPtr miSetRedirectBorderClipProc;
+
+void
+miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip,
+ GetRedirectBorderClipProcPtr getBorderClip)
+{
+ miSetRedirectBorderClipProc = setBorderClip;
+ miGetRedirectBorderClipProc = getBorderClip;
+}
+
+/*
+ * Manual redirected windows are treated as transparent; they do not obscure
+ * siblings or parent windows
+ */
+
+#ifdef COMPOSITE
+#define TreatAsTransparent(w) ((w)->redirectDraw == RedirectDrawManual)
+#else
+#define TreatAsTransparent(w) FALSE
+#endif
+
+#define HasParentRelativeBorder(w) (!(w)->borderIsPixel && \
+ HasBorder(w) && \
+ (w)->backgroundState == ParentRelative)
+
+
+/*
+ *-----------------------------------------------------------------------
+ * miComputeClips --
+ * Recompute the clipList, borderClip, exposed and borderExposed
+ * regions for pParent and its children. Only viewable windows are
+ * taken into account.
+ *
+ * Results:
+ * None.
+ *
+ * Side Effects:
+ * clipList, borderClip, exposed and borderExposed are altered.
+ * A VisibilityNotify event may be generated on the parent window.
+ *
+ *-----------------------------------------------------------------------
+ */
+static void
+miComputeClips (
+ WindowPtr pParent,
+ ScreenPtr pScreen,
+ RegionPtr universe,
+ VTKind kind,
+ RegionPtr exposed ) /* for intermediate calculations */
+{
+ int dx,
+ dy;
+ RegionRec childUniverse;
+ WindowPtr pChild;
+ int oldVis, newVis;
+ BoxRec borderSize;
+ 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
+ * the borderSize region. If the window is unobscured, this rectangle
+ * will be completely inside the universe (the universe will cover it
+ * completely). If the window is completely obscured, none of the
+ * universe will cover the rectangle.
+ */
+ borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent);
+ borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent);
+ dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent);
+ if (dx > 32767)
+ dx = 32767;
+ borderSize.x2 = dx;
+ dy = (int) pParent->drawable.y + (int) pParent->drawable.height + wBorderWidth(pParent);
+ if (dy > 32767)
+ dy = 32767;
+ borderSize.y2 = dy;
+
+#ifdef COMPOSITE
+ /*
+ * In redirected drawing case, reset universe to borderSize
+ */
+ if (pParent->redirectDraw != RedirectDrawNone)
+ {
+ if (miSetRedirectBorderClipProc)
+ {
+ if (TreatAsTransparent (pParent))
+ RegionEmpty(universe);
+ (*miSetRedirectBorderClipProc) (pParent, universe);
+ }
+ RegionCopy(universe, &pParent->borderSize);
+ }
+#endif
+
+ oldVis = pParent->visibility;
+ switch (RegionContainsRect(universe, &borderSize))
+ {
+ case rgnIN:
+ newVis = VisibilityUnobscured;
+ break;
+ case rgnPART:
+ newVis = VisibilityPartiallyObscured;
+ {
+ RegionPtr pBounding;
+
+ if ((pBounding = wBoundingShape (pParent)))
+ {
+ switch (miShapedWindowIn (universe, pBounding,
+ &borderSize,
+ pParent->drawable.x,
+ pParent->drawable.y))
+ {
+ case rgnIN:
+ newVis = VisibilityUnobscured;
+ break;
+ case rgnOUT:
+ newVis = VisibilityFullyObscured;
+ break;
+ }
+ }
+ }
+ break;
+ default:
+ newVis = VisibilityFullyObscured;
+ break;
+ }
+ pParent->visibility = newVis;
+ if (oldVis != newVis &&
+ ((pParent->eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask))
+ SendVisibilityNotify(pParent);
+
+ dx = pParent->drawable.x - pParent->valdata->before.oldAbsCorner.x;
+ dy = pParent->drawable.y - pParent->valdata->before.oldAbsCorner.y;
+
+ /*
+ * avoid computations when dealing with simple operations
+ */
+
+ switch (kind) {
+ case VTMap:
+ case VTStack:
+ case VTUnmap:
+ break;
+ case VTMove:
+ if ((oldVis == newVis) &&
+ ((oldVis == VisibilityFullyObscured) ||
+ (oldVis == VisibilityUnobscured)))
+ {
+ pChild = pParent;
+ while (1)
+ {
+ if (pChild->viewable)
+ {
+ if (pChild->visibility != VisibilityFullyObscured)
+ {
+ RegionTranslate(&pChild->borderClip,
+ dx, dy);
+ RegionTranslate(&pChild->clipList,
+ dx, dy);
+ pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ if (pScreen->ClipNotify)
+ (* pScreen->ClipNotify) (pChild, dx, dy);
+
+ }
+ if (pChild->valdata)
+ {
+ RegionNull(&pChild->valdata->after.borderExposed);
+ if (HasParentRelativeBorder(pChild))
+ {
+ RegionSubtract(&pChild->valdata->after.borderExposed,
+ &pChild->borderClip,
+ &pChild->winSize);
+ }
+ RegionNull(&pChild->valdata->after.exposed);
+ }
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pParent))
+ pChild = pChild->parent;
+ if (pChild == pParent)
+ break;
+ pChild = pChild->nextSib;
+ }
+ return;
+ }
+ /* fall through */
+ default:
+ /*
+ * To calculate exposures correctly, we have to translate the old
+ * borderClip and clipList regions to the window's new location so there
+ * is a correspondence between pieces of the new and old clipping regions.
+ */
+ if (dx || dy)
+ {
+ /*
+ * We translate the old clipList because that will be exposed or copied
+ * if gravity is right.
+ */
+ RegionTranslate(&pParent->borderClip, dx, dy);
+ RegionTranslate(&pParent->clipList, dx, dy);
+ }
+ break;
+ case VTBroken:
+ RegionEmpty(&pParent->borderClip);
+ RegionEmpty(&pParent->clipList);
+ break;
+ }
+
+ borderVisible = pParent->valdata->before.borderVisible;
+ resized = pParent->valdata->before.resized;
+ RegionNull(&pParent->valdata->after.borderExposed);
+ RegionNull(&pParent->valdata->after.exposed);
+
+ /*
+ * Since the borderClip must not be clipped by the children, we do
+ * the border exposure first...
+ *
+ * 'universe' is the window's borderClip. To figure the exposures, remove
+ * the area that used to be exposed from the new.
+ * This leaves a region of pieces that weren't exposed before.
+ */
+
+ if (HasBorder (pParent))
+ {
+ if (borderVisible)
+ {
+ /*
+ * when the border changes shape, the old visible portions
+ * of the border will be saved by DIX in borderVisible --
+ * use that region and destroy it
+ */
+ RegionSubtract(exposed, universe, borderVisible);
+ RegionDestroy(borderVisible);
+ }
+ else
+ {
+ RegionSubtract(exposed, universe, &pParent->borderClip);
+ }
+ if (HasParentRelativeBorder(pParent) && (dx || dy))
+ RegionSubtract(&pParent->valdata->after.borderExposed,
+ universe,
+ &pParent->winSize);
+ else
+ RegionSubtract(&pParent->valdata->after.borderExposed,
+ exposed, &pParent->winSize);
+
+ RegionCopy(&pParent->borderClip, universe);
+
+ /*
+ * To get the right clipList for the parent, and to make doubly sure
+ * that no child overlaps the parent's border, we remove the parent's
+ * border from the universe before proceeding.
+ */
+
+ RegionIntersect(universe, universe, &pParent->winSize);
+ }
+ else
+ RegionCopy(&pParent->borderClip, universe);
+
+ if ((pChild = pParent->firstChild) && pParent->mapped)
+ {
+ RegionNull(&childUniverse);
+ RegionNull(&childUnion);
+ if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
+ ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
+ (pChild->drawable.x < pParent->lastChild->drawable.x)))
+ {
+ for (; pChild; pChild = pChild->nextSib)
+ {
+ if (pChild->viewable && !TreatAsTransparent(pChild))
+ RegionAppend(&childUnion, &pChild->borderSize);
+ }
+ }
+ else
+ {
+ for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib)
+ {
+ if (pChild->viewable && !TreatAsTransparent(pChild))
+ RegionAppend(&childUnion, &pChild->borderSize);
+ }
+ }
+ RegionValidate(&childUnion, &overlap);
+
+ for (pChild = pParent->firstChild;
+ pChild;
+ pChild = pChild->nextSib)
+ {
+ if (pChild->viewable) {
+ /*
+ * If the child is viewable, we want to remove its extents
+ * from the current universe, but we only re-clip it if
+ * it's been marked.
+ */
+ if (pChild->valdata) {
+ /*
+ * Figure out the new universe from the child's
+ * perspective and recurse.
+ */
+ RegionIntersect(&childUniverse,
+ universe,
+ &pChild->borderSize);
+ miComputeClips (pChild, pScreen, &childUniverse, kind,
+ exposed);
+ }
+ /*
+ * Once the child has been processed, we remove its extents
+ * from the current universe, thus denying its space to any
+ * other sibling.
+ */
+ if (overlap && !TreatAsTransparent (pChild))
+ RegionSubtract(universe, universe,
+ &pChild->borderSize);
+ }
+ }
+ if (!overlap)
+ RegionSubtract(universe, universe, &childUnion);
+ RegionUninit(&childUnion);
+ RegionUninit(&childUniverse);
+ } /* if any children */
+
+ /*
+ * 'universe' now contains the new clipList for the parent window.
+ *
+ * To figure the exposure of the window we subtract the old clip from the
+ * new, just as for the border.
+ */
+
+ if (oldVis == VisibilityFullyObscured ||
+ oldVis == VisibilityNotViewable)
+ {
+ RegionCopy(&pParent->valdata->after.exposed, universe);
+ }
+ else if (newVis != VisibilityFullyObscured &&
+ newVis != VisibilityNotViewable)
+ {
+ RegionSubtract(&pParent->valdata->after.exposed,
+ universe, &pParent->clipList);
+ }
+
+ /* HACK ALERT - copying contents of regions, instead of regions */
+ {
+ RegionRec tmp;
+
+ tmp = pParent->clipList;
+ pParent->clipList = *universe;
+ *universe = tmp;
+ }
+
+#ifdef NOTDEF
+ RegionCopy(&pParent->clipList, universe);
+#endif
+
+ pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ if (pScreen->ClipNotify)
+ (* pScreen->ClipNotify) (pParent, dx, dy);
+}
+
+static void
+miTreeObscured(
+ WindowPtr pParent )
+{
+ WindowPtr pChild;
+ int oldVis;
+
+ pChild = pParent;
+ while (1)
+ {
+ if (pChild->viewable)
+ {
+ oldVis = pChild->visibility;
+ if (oldVis != (pChild->visibility = VisibilityFullyObscured) &&
+ ((pChild->eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask))
+ SendVisibilityNotify(pChild);
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pParent))
+ pChild = pChild->parent;
+ if (pChild == pParent)
+ break;
+ pChild = pChild->nextSib;
+ }
+}
+
+/*
+ *-----------------------------------------------------------------------
+ * miValidateTree --
+ * Recomputes the clip list for pParent and all its inferiors.
+ *
+ * Results:
+ * Always returns 1.
+ *
+ * Side Effects:
+ * The clipList, borderClip, exposed, and borderExposed regions for
+ * each marked window are altered.
+ *
+ * Notes:
+ * This routine assumes that all affected windows have been marked
+ * (valdata created) and their winSize and borderSize regions
+ * adjusted to correspond to their new positions. The borderClip and
+ * clipList regions should not have been touched.
+ *
+ * The top-most level is treated differently from all lower levels
+ * because pParent is unchanged. For the top level, we merge the
+ * regions taken up by the marked children back into the clipList
+ * for pParent, thus forming a region from which the marked children
+ * can claim their areas. For lower levels, where the old clipList
+ * and borderClip are invalid, we can't do this and have to do the
+ * extra operations done in miComputeClips, but this is much faster
+ * e.g. when only one child has moved...
+ *
+ *-----------------------------------------------------------------------
+ */
+/*ARGSUSED*/
+int
+miValidateTree (
+ WindowPtr pParent, /* Parent to validate */
+ WindowPtr pChild, /* First child of pParent that was
+ * affected */
+ VTKind kind /* What kind of configuration caused call */
+ )
+{
+ RegionRec totalClip; /* Total clipping region available to
+ * the marked children. pParent's clipList
+ * merged with the borderClips of all
+ * the marked children. */
+ RegionRec childClip; /* The new borderClip for the current
+ * child */
+ RegionRec childUnion; /* the space covered by borderSize for
+ * all marked children */
+ RegionRec exposed; /* For intermediate calculations */
+ ScreenPtr pScreen;
+ WindowPtr pWin;
+ Bool overlap;
+ int viewvals;
+ Bool forward;
+
+ pScreen = pParent->drawable.pScreen;
+ if (pChild == NullWindow)
+ pChild = pParent->firstChild;
+
+ RegionNull(&childClip);
+ RegionNull(&exposed);
+
+ /*
+ * compute the area of the parent window occupied
+ * by the marked children + the parent itself. This
+ * is the area which can be divied up among the marked
+ * children in their new configuration.
+ */
+ RegionNull(&totalClip);
+ viewvals = 0;
+ if (RegionBroken(&pParent->clipList) &&
+ !RegionBroken(&pParent->borderClip))
+ {
+ kind = VTBroken;
+ /*
+ * When rebuilding clip lists after out of memory,
+ * assume everything is busted.
+ */
+ forward = TRUE;
+ RegionCopy(&totalClip, &pParent->borderClip);
+ RegionIntersect(&totalClip, &totalClip, &pParent->winSize);
+
+ for (pWin = pParent->firstChild; pWin != pChild; pWin = pWin->nextSib)
+ {
+ if (pWin->viewable && !TreatAsTransparent (pWin))
+ RegionSubtract(&totalClip, &totalClip, &pWin->borderSize);
+ }
+ for (pWin = pChild; pWin; pWin = pWin->nextSib)
+ if (pWin->valdata && pWin->viewable)
+ viewvals++;
+
+ RegionEmpty(&pParent->clipList);
+ }
+ else
+ {
+ if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
+ ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
+ (pChild->drawable.x < pParent->lastChild->drawable.x)))
+ {
+ forward = TRUE;
+ for (pWin = pChild; pWin; pWin = pWin->nextSib)
+ {
+ if (pWin->valdata)
+ {
+ RegionPtr pBorderClip = &pWin->borderClip;
+#ifdef COMPOSITE
+ if (pWin->redirectDraw != RedirectDrawNone && miGetRedirectBorderClipProc)
+ pBorderClip = (*miGetRedirectBorderClipProc)(pWin);
+#endif
+ RegionAppend(&totalClip, pBorderClip );
+ if (pWin->viewable)
+ viewvals++;
+ }
+ }
+ }
+ else
+ {
+ forward = FALSE;
+ pWin = pParent->lastChild;
+ while (1)
+ {
+ if (pWin->valdata)
+ {
+ RegionPtr pBorderClip = &pWin->borderClip;
+#ifdef COMPOSITE
+ if (pWin->redirectDraw != RedirectDrawNone && miGetRedirectBorderClipProc)
+ pBorderClip = (*miGetRedirectBorderClipProc)(pWin);
+#endif
+ RegionAppend(&totalClip, pBorderClip );
+ if (pWin->viewable)
+ viewvals++;
+ }
+ if (pWin == pChild)
+ break;
+ pWin = pWin->prevSib;
+ }
+ }
+ RegionValidate(&totalClip, &overlap);
+ }
+
+ /*
+ * Now go through the children of the root and figure their new
+ * borderClips from the totalClip, passing that off to miComputeClips
+ * to handle recursively. Once that's done, we remove the child
+ * from the totalClip to clip any siblings below it.
+ */
+
+ overlap = TRUE;
+ if (kind != VTStack)
+ {
+ RegionUnion(&totalClip, &totalClip, &pParent->clipList);
+ if (viewvals > 1)
+ {
+ /*
+ * precompute childUnion to discover whether any of them
+ * overlap. This seems redundant, but performance studies
+ * have demonstrated that the cost of this loop is
+ * lower than the cost of multiple Subtracts in the
+ * loop below.
+ */
+ RegionNull(&childUnion);
+ if (forward)
+ {
+ for (pWin = pChild; pWin; pWin = pWin->nextSib)
+ if (pWin->valdata && pWin->viewable && !TreatAsTransparent (pWin))
+ RegionAppend(&childUnion,
+ &pWin->borderSize);
+ }
+ else
+ {
+ pWin = pParent->lastChild;
+ while (1)
+ {
+ if (pWin->valdata && pWin->viewable && !TreatAsTransparent (pWin))
+ RegionAppend(&childUnion,
+ &pWin->borderSize);
+ if (pWin == pChild)
+ break;
+ pWin = pWin->prevSib;
+ }
+ }
+ RegionValidate(&childUnion, &overlap);
+ if (overlap)
+ RegionUninit(&childUnion);
+ }
+ }
+
+ for (pWin = pChild;
+ pWin != NullWindow;
+ pWin = pWin->nextSib)
+ {
+ if (pWin->viewable) {
+ if (pWin->valdata) {
+ RegionIntersect(&childClip,
+ &totalClip,
+ &pWin->borderSize);
+ miComputeClips (pWin, pScreen, &childClip, kind, &exposed);
+ if (overlap && !TreatAsTransparent (pWin))
+ {
+ RegionSubtract(&totalClip,
+ &totalClip,
+ &pWin->borderSize);
+ }
+ } else if (pWin->visibility == VisibilityNotViewable) {
+ miTreeObscured(pWin);
+ }
+ } else {
+ if (pWin->valdata) {
+ RegionEmpty(&pWin->clipList);
+ if (pScreen->ClipNotify)
+ (* pScreen->ClipNotify) (pWin, 0, 0);
+ RegionEmpty(&pWin->borderClip);
+ pWin->valdata = NULL;
+ }
+ }
+ }
+
+ RegionUninit(&childClip);
+ if (!overlap)
+ {
+ RegionSubtract(&totalClip, &totalClip, &childUnion);
+ RegionUninit(&childUnion);
+ }
+
+ RegionNull(&pParent->valdata->after.exposed);
+ RegionNull(&pParent->valdata->after.borderExposed);
+
+ /*
+ * each case below is responsible for updating the
+ * clipList and serial number for the parent window
+ */
+
+ switch (kind) {
+ case VTStack:
+ break;
+ default:
+ /*
+ * totalClip contains the new clipList for the parent. Figure out
+ * exposures and obscures as per miComputeClips and reset the parent's
+ * clipList.
+ */
+ RegionSubtract(&pParent->valdata->after.exposed,
+ &totalClip, &pParent->clipList);
+ /* fall through */
+ case VTMap:
+ RegionCopy(&pParent->clipList, &totalClip);
+ pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ break;
+ }
+
+ RegionUninit(&totalClip);
+ RegionUninit(&exposed);
+ if (pScreen->ClipNotify)
+ (*pScreen->ClipNotify) (pParent, 0, 0);
+ return 1;
+}
diff --git a/xorg-server/mi/miwideline.c b/xorg-server/mi/miwideline.c
index 9fb540c2b..d74cd1d43 100644
--- a/xorg-server/mi/miwideline.c
+++ b/xorg-server/mi/miwideline.c
@@ -717,7 +717,7 @@ miLineArcI (
*--bwids = slw;
}
}
- return (pGC->lineWidth);
+ return pGC->lineWidth;
}
#define CLIPSTEPEDGE(edgey,edge,edgeleft) \
@@ -911,7 +911,7 @@ miLineArcD (
*wids++ = xcr - xcl + 1;
}
}
- return (pts - points);
+ return pts - points;
}
static int
diff --git a/xorg-server/mi/miwindow.c b/xorg-server/mi/miwindow.c
index 479085787..6c1b59e23 100644
--- a/xorg-server/mi/miwindow.c
+++ b/xorg-server/mi/miwindow.c
@@ -50,6 +50,7 @@ SOFTWARE.
#endif
#include <X11/X.h>
+#include <X11/extensions/shape.h>
#include "regionstr.h"
#include "region.h"
#include "mi.h"
@@ -66,7 +67,6 @@ miClearToBackground(WindowPtr pWin,
BoxRec box;
RegionRec reg;
RegionPtr pBSReg = NullRegion;
- ScreenPtr pScreen;
BoxPtr extents;
int x1, y1, x2, y2;
@@ -110,17 +110,16 @@ miClearToBackground(WindowPtr pWin,
box.y1 = y1;
box.y2 = y2;
- pScreen = pWin->drawable.pScreen;
- REGION_INIT(pScreen, &reg, &box, 1);
+ RegionInit(&reg, &box, 1);
- REGION_INTERSECT(pScreen, &reg, &reg, &pWin->clipList);
+ RegionIntersect(&reg, &reg, &pWin->clipList);
if (generateExposures)
- (*pScreen->WindowExposures)(pWin, &reg, pBSReg);
+ (*pWin->drawable.pScreen->WindowExposures)(pWin, &reg, pBSReg);
else if (pWin->backgroundState != None)
miPaintWindow(pWin, &reg, PW_BACKGROUND);
- REGION_UNINIT(pScreen, &reg);
+ RegionUninit(&reg);
if (pBSReg)
- REGION_DESTROY(pScreen, pBSReg);
+ RegionDestroy(pBSReg);
}
void
@@ -145,9 +144,6 @@ miMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst, WindowPtr *ppLayerWin)
WindowPtr pChild, pLast;
Bool anyMarked = FALSE;
MarkWindowProcPtr MarkWindow = pWin->drawable.pScreen->MarkWindow;
- ScreenPtr pScreen;
-
- pScreen = pWin->drawable.pScreen;
/* single layered systems are easy */
if (ppLayerWin) *ppLayerWin = pWin;
@@ -163,9 +159,9 @@ miMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst, WindowPtr *ppLayerWin)
{
if (pChild->viewable)
{
- if (REGION_BROKEN (pScreen, &pChild->winSize))
+ if (RegionBroken(&pChild->winSize))
SetWinSize (pChild);
- if (REGION_BROKEN (pScreen, &pChild->borderSize))
+ if (RegionBroken(&pChild->borderSize))
SetBorderSize (pChild);
(* MarkWindow)(pChild);
if (pChild->firstChild)
@@ -185,17 +181,17 @@ miMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst, WindowPtr *ppLayerWin)
}
if ( (pChild = pFirst) )
{
- box = REGION_EXTENTS(pChild->drawable.pScreen, &pWin->borderSize);
+ box = RegionExtents(&pWin->borderSize);
pLast = pChild->parent->lastChild;
while (1)
{
if (pChild->viewable)
{
- if (REGION_BROKEN (pScreen, &pChild->winSize))
+ if (RegionBroken(&pChild->winSize))
SetWinSize (pChild);
- if (REGION_BROKEN (pScreen, &pChild->borderSize))
+ if (RegionBroken(&pChild->borderSize))
SetBorderSize (pChild);
- if (RECT_IN_REGION(pScreen, &pChild->borderSize, box))
+ if (RegionContainsRect(&pChild->borderSize, box))
{
(* MarkWindow)(pChild);
anyMarked = TRUE;
@@ -229,22 +225,19 @@ miHandleValidateExposures(WindowPtr pWin)
{
WindowPtr pChild;
ValidatePtr val;
- ScreenPtr pScreen;
WindowExposuresProcPtr WindowExposures;
- pScreen = pWin->drawable.pScreen;
-
pChild = pWin;
WindowExposures = pChild->drawable.pScreen->WindowExposures;
while (1)
{
if ( (val = pChild->valdata) )
{
- if (REGION_NOTEMPTY(pScreen, &val->after.borderExposed))
+ if (RegionNotEmpty(&val->after.borderExposed))
miPaintWindow(pChild, &val->after.borderExposed, PW_BORDER);
- REGION_UNINIT(pScreen, &val->after.borderExposed);
+ RegionUninit(&val->after.borderExposed);
(*WindowExposures)(pChild, &val->after.exposed, NullRegion);
- REGION_UNINIT(pScreen, &val->after.exposed);
+ RegionUninit(&val->after.exposed);
free(val);
pChild->valdata = NULL;
if (pChild->firstChild)
@@ -284,8 +277,8 @@ miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind)
oldpt.y = pWin->drawable.y;
if (WasViewable)
{
- oldRegion = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldRegion, &pWin->borderClip);
+ oldRegion = RegionCreate(NullBox, 1);
+ RegionCopy(oldRegion, &pWin->borderClip);
anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin);
}
pWin->origin.x = x + (int)bw;
@@ -316,7 +309,7 @@ miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind)
{
(*pScreen->ValidateTree)(pLayerWin->parent, NullWindow, kind);
(* pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, oldRegion);
- REGION_DESTROY(pScreen, oldRegion);
+ RegionDestroy(oldRegion);
/* XXX need to retile border if ParentRelative origin */
(*pScreen->HandleExposures)(pLayerWin->parent);
}
@@ -338,7 +331,6 @@ miRecomputeExposures (
WindowPtr pWin,
pointer value) /* must conform to VisitWindowProcPtr */
{
- ScreenPtr pScreen;
RegionPtr pValid = (RegionPtr)value;
if (pWin->valdata)
@@ -352,18 +344,17 @@ miRecomputeExposures (
if (pWin->redirectDraw != RedirectDrawNone)
return WT_DONTWALKCHILDREN;
#endif
- pScreen = pWin->drawable.pScreen;
/*
* compute exposed regions of this window
*/
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.exposed,
+ RegionSubtract(&pWin->valdata->after.exposed,
&pWin->clipList, pValid);
/*
* compute exposed regions of the border
*/
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.borderExposed,
+ RegionSubtract(&pWin->valdata->after.borderExposed,
&pWin->borderClip, &pWin->winSize);
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.borderExposed,
+ RegionSubtract(&pWin->valdata->after.borderExposed,
&pWin->valdata->after.borderExposed, pValid);
return WT_WALKCHILDREN;
}
@@ -415,8 +406,8 @@ miSlideAndSizeWindow(WindowPtr pWin,
/*
* save the visible region of the window
*/
- oldRegion = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldRegion, &pWin->winSize);
+ oldRegion = RegionCreate(NullBox, 1);
+ RegionCopy(oldRegion, &pWin->winSize);
/*
* categorize child windows into regions to be moved
@@ -429,8 +420,8 @@ miSlideAndSizeWindow(WindowPtr pWin,
if (g != UnmapGravity)
{
if (!gravitate[g])
- gravitate[g] = REGION_CREATE(pScreen, NullBox, 1);
- REGION_UNION(pScreen, gravitate[g],
+ gravitate[g] = RegionCreate(NullBox, 1);
+ RegionUnion(gravitate[g],
gravitate[g], &pChild->borderClip);
}
else
@@ -445,8 +436,8 @@ miSlideAndSizeWindow(WindowPtr pWin,
oldWinClip = NULL;
if (pWin->bitGravity != ForgetGravity)
{
- oldWinClip = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldWinClip, &pWin->clipList);
+ oldWinClip = RegionCreate(NullBox, 1);
+ RegionCopy(oldWinClip, &pWin->clipList);
}
/*
* if the window is changing size, borderExposed
@@ -461,16 +452,16 @@ miSlideAndSizeWindow(WindowPtr pWin,
if ((pWin->drawable.height != h || pWin->drawable.width != w) &&
HasBorder (pWin))
{
- borderVisible = REGION_CREATE(pScreen, NullBox, 1);
+ borderVisible = RegionCreate(NullBox, 1);
/* for tiled borders, we punt and draw the whole thing */
if (pWin->borderIsPixel || !moved)
{
if (shrunk || moved)
- REGION_SUBTRACT(pScreen, borderVisible,
+ RegionSubtract(borderVisible,
&pWin->borderClip,
&pWin->winSize);
else
- REGION_COPY(pScreen, borderVisible,
+ RegionCopy(borderVisible,
&pWin->borderClip);
}
}
@@ -497,7 +488,7 @@ miSlideAndSizeWindow(WindowPtr pWin,
if (WasViewable)
{
- pRegion = REGION_CREATE(pScreen, NullBox, 1);
+ pRegion = RegionCreate(NullBox, 1);
if (pLayerWin == pWin)
anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange,
@@ -519,7 +510,7 @@ miSlideAndSizeWindow(WindowPtr pWin,
* the entire window is trashed unless bitGravity
* recovers portions of it
*/
- REGION_COPY(pScreen, &pWin->valdata->after.exposed, &pWin->clipList);
+ RegionCopy(&pWin->valdata->after.exposed, &pWin->clipList);
}
GravityTranslate (x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny);
@@ -548,16 +539,16 @@ miSlideAndSizeWindow(WindowPtr pWin,
dy = (oldy - ny) - offy;
if (dx || dy)
{
- REGION_TRANSLATE(pScreen, &pWin->winSize, dx, dy);
+ RegionTranslate(&pWin->winSize, dx, dy);
offx += dx;
offy += dy;
}
- REGION_INTERSECT(pScreen, gravitate[g], gravitate[g],
+ RegionIntersect(gravitate[g], gravitate[g],
&pWin->winSize);
}
/* get winSize back where it belongs */
if (offx || offy)
- REGION_TRANSLATE(pScreen, &pWin->winSize, -offx, -offy);
+ RegionTranslate(&pWin->winSize, -offx, -offy);
}
/*
* add screen bits to the appropriate bucket
@@ -568,9 +559,9 @@ miSlideAndSizeWindow(WindowPtr pWin,
/*
* clip to new clipList
*/
- REGION_COPY(pScreen, pRegion, oldWinClip);
- REGION_TRANSLATE(pScreen, pRegion, nx - oldx, ny - oldy);
- REGION_INTERSECT(pScreen, oldWinClip, pRegion, &pWin->clipList);
+ RegionCopy(pRegion, oldWinClip);
+ RegionTranslate(pRegion, nx - oldx, ny - oldy);
+ RegionIntersect(oldWinClip, pRegion, &pWin->clipList);
/*
* don't step on any gravity bits which will be copied after this
* region. Note -- this assumes that the regions will be copied
@@ -579,17 +570,17 @@ miSlideAndSizeWindow(WindowPtr pWin,
for (g = pWin->bitGravity + 1; g <= StaticGravity; g++)
{
if (gravitate[g])
- REGION_SUBTRACT(pScreen, oldWinClip, oldWinClip,
+ RegionSubtract(oldWinClip, oldWinClip,
gravitate[g]);
}
- REGION_TRANSLATE(pScreen, oldWinClip, oldx - nx, oldy - ny);
+ RegionTranslate(oldWinClip, oldx - nx, oldy - ny);
g = pWin->bitGravity;
if (!gravitate[g])
gravitate[g] = oldWinClip;
else
{
- REGION_UNION(pScreen, gravitate[g], gravitate[g], oldWinClip);
- REGION_DESTROY(pScreen, oldWinClip);
+ RegionUnion(gravitate[g], gravitate[g], oldWinClip);
+ RegionDestroy(oldWinClip);
}
}
@@ -613,14 +604,14 @@ miSlideAndSizeWindow(WindowPtr pWin,
/* only copy the remaining useful bits */
- REGION_INTERSECT(pScreen, gravitate[g], gravitate[g], oldRegion);
+ RegionIntersect(gravitate[g], gravitate[g], oldRegion);
/* clip to not overwrite already copied areas */
if (destClip) {
- REGION_TRANSLATE(pScreen, destClip, oldpt.x - x, oldpt.y - y);
- REGION_SUBTRACT(pScreen, gravitate[g], gravitate[g], destClip);
- REGION_TRANSLATE(pScreen, destClip, x - oldpt.x, y - oldpt.y);
+ RegionTranslate(destClip, oldpt.x - x, oldpt.y - y);
+ RegionSubtract(gravitate[g], gravitate[g], destClip);
+ RegionTranslate(destClip, x - oldpt.x, y - oldpt.y);
}
/* and move those bits */
@@ -636,7 +627,7 @@ miSlideAndSizeWindow(WindowPtr pWin,
/* remove any overwritten bits from the remaining useful bits */
- REGION_SUBTRACT(pScreen, oldRegion, oldRegion, gravitate[g]);
+ RegionSubtract(oldRegion, oldRegion, gravitate[g]);
/*
* recompute exposed regions of child windows
@@ -646,7 +637,7 @@ miSlideAndSizeWindow(WindowPtr pWin,
{
if (pChild->winGravity != g)
continue;
- REGION_INTERSECT(pScreen, pRegion,
+ RegionIntersect(pRegion,
&pChild->borderClip, gravitate[g]);
TraverseTree (pChild, miRecomputeExposures, (pointer)pRegion);
}
@@ -657,21 +648,21 @@ miSlideAndSizeWindow(WindowPtr pWin,
*/
if (g == pWin->bitGravity)
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.exposed,
+ RegionSubtract(&pWin->valdata->after.exposed,
&pWin->valdata->after.exposed, gravitate[g]);
if (!destClip)
destClip = gravitate[g];
else
{
- REGION_UNION(pScreen, destClip, destClip, gravitate[g]);
- REGION_DESTROY(pScreen, gravitate[g]);
+ RegionUnion(destClip, destClip, gravitate[g]);
+ RegionDestroy(gravitate[g]);
}
}
- REGION_DESTROY(pScreen, oldRegion);
- REGION_DESTROY(pScreen, pRegion);
+ RegionDestroy(oldRegion);
+ RegionDestroy(pRegion);
if (destClip)
- REGION_DESTROY(pScreen, destClip);
+ RegionDestroy(destClip);
if (anyMarked)
(*pScreen->HandleExposures)(pLayerWin->parent);
if (anyMarked && pScreen->PostValidateTree)
@@ -696,56 +687,59 @@ miGetLayerWindow(WindowPtr pWin)
*/
void
-miSetShape(WindowPtr pWin)
+miSetShape(WindowPtr pWin, int kind)
{
- Bool WasViewable = (Bool)(pWin->viewable);
- ScreenPtr pScreen = pWin->drawable.pScreen;
- Bool anyMarked = FALSE;
+ Bool WasViewable = (Bool)(pWin->viewable);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool anyMarked = FALSE;
WindowPtr pLayerWin;
- if (WasViewable)
- {
- anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin,
- &pLayerWin);
- if (pWin->valdata)
- {
- if (HasBorder (pWin))
- {
- RegionPtr borderVisible;
-
- borderVisible = REGION_CREATE(pScreen, NullBox, 1);
- REGION_SUBTRACT(pScreen, borderVisible,
- &pWin->borderClip, &pWin->winSize);
- pWin->valdata->before.borderVisible = borderVisible;
- }
- pWin->valdata->before.resized = TRUE;
- }
- }
-
- SetWinSize (pWin);
- SetBorderSize (pWin);
-
- ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
-
- if (WasViewable)
- {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin,
- NULL);
-
-
- if (anyMarked)
- (*pScreen->ValidateTree)(pLayerWin->parent, NullWindow, VTOther);
- }
-
- if (WasViewable)
- {
- if (anyMarked)
- (*pScreen->HandleExposures)(pLayerWin->parent);
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow, VTOther);
+ if (kind != ShapeInput) {
+ if (WasViewable)
+ {
+ anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin,
+ &pLayerWin);
+ if (pWin->valdata)
+ {
+ if (HasBorder (pWin))
+ {
+ RegionPtr borderVisible;
+
+ borderVisible = RegionCreate(NullBox, 1);
+ RegionSubtract(borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ }
+ pWin->valdata->before.resized = TRUE;
+ }
+ }
+
+ SetWinSize (pWin);
+ SetBorderSize (pWin);
+
+ ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
+
+ if (WasViewable)
+ {
+ anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin,
+ NULL);
+
+ if (anyMarked)
+ (*pScreen->ValidateTree)(pLayerWin->parent, NullWindow,
+ VTOther);
+ }
+
+ if (WasViewable)
+ {
+ if (anyMarked)
+ (*pScreen->HandleExposures)(pLayerWin->parent);
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow,
+ VTOther);
+ }
}
if (pWin->realized)
- WindowsRestructured ();
+ WindowsRestructured ();
CheckCursorConfinement(pWin);
}
@@ -785,8 +779,8 @@ miChangeBorderWidth(WindowPtr pWin, unsigned int width)
if (pWin->valdata && HadBorder)
{
RegionPtr borderVisible;
- borderVisible = REGION_CREATE(pScreen, NULL, 1);
- REGION_SUBTRACT(pScreen, borderVisible,
+ borderVisible = RegionCreate(NULL, 1);
+ RegionSubtract(borderVisible,
&pWin->borderClip, &pWin->winSize);
pWin->valdata->before.borderVisible = borderVisible;
}
@@ -810,25 +804,22 @@ miMarkUnrealizedWindow(WindowPtr pChild, WindowPtr pWin, Bool fromConfigure)
{
if ((pChild != pWin) || fromConfigure)
{
- REGION_EMPTY(pChild->drawable.pScreen, &pChild->clipList);
+ RegionEmpty(&pChild->clipList);
if (pChild->drawable.pScreen->ClipNotify)
(* pChild->drawable.pScreen->ClipNotify)(pChild, 0, 0);
- REGION_EMPTY(pChild->drawable.pScreen, &pChild->borderClip);
+ RegionEmpty(&pChild->borderClip);
}
}
void
miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth)
{
- ScreenPtr pScreen;
WindowPtr pChild;
- pScreen = pWin->drawable.pScreen;
-
for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
{
if (pChild->drawable.depth == depth)
- REGION_UNION(pScreen, pReg, pReg, &pChild->borderClip);
+ RegionUnion(pReg, pReg, &pChild->borderClip);
if (pChild->firstChild)
miSegregateChildren(pChild, pReg, depth);