summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-03-27 20:06:29 -0700
committerKeith Packard <keithp@keithp.com>2011-03-27 20:06:29 -0700
commita095a6d4e8f5090907e8d3d66018636216300846 (patch)
tree8a7f76cbf682ed190ed6ee3aea779d5947ee35ed
parenta22486f848014000dc13dda470f77d4d8ea9e9f6 (diff)
parentef9d04f8ad4239ac30984769c9c8c101bb8e78bf (diff)
Merge remote-tracking branch 'airlied/pwin-cleanup'
-rw-r--r--dix/window.c103
-rw-r--r--hw/kdrive/src/kdrive.c93
-rw-r--r--hw/kdrive/src/kdrive.h3
-rw-r--r--hw/xfree86/common/xf86Helper.c104
-rw-r--r--hw/xfree86/dri/dri.c4
-rw-r--r--hw/xquartz/darwin.c110
-rw-r--r--hw/xquartz/darwin.h1
-rw-r--r--hw/xquartz/quartz.c2
-rw-r--r--hw/xwin/winrandr.c104
-rw-r--r--include/window.h1
10 files changed, 111 insertions, 414 deletions
diff --git a/dix/window.c b/dix/window.c
index 3668370b3..cd28d054a 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -116,6 +116,7 @@ Equipment Corporation.
#include "dixstruct.h"
#include "gcstruct.h"
#include "servermd.h"
+#include "mivalidate.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
@@ -3684,3 +3685,105 @@ WindowParentHasDeviceCursor(WindowPtr pWin,
}
return FALSE;
}
+
+/*
+ * SetRootClip --
+ * Enable or disable rendering to the screen by
+ * setting the root clip list and revalidating
+ * all of the windows
+ */
+void
+SetRootClip(ScreenPtr pScreen, Bool enable)
+{
+ WindowPtr pWin = pScreen->root;
+ WindowPtr pChild;
+ Bool WasViewable;
+ Bool anyMarked = FALSE;
+ WindowPtr pLayerWin;
+ BoxRec box;
+
+ if (!pWin)
+ return;
+ WasViewable = (Bool)(pWin->viewable);
+ if (WasViewable)
+ {
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
+ {
+ (void) (*pScreen->MarkOverlappedWindows)(pChild,
+ pChild,
+ &pLayerWin);
+ }
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ 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;
+ }
+ }
+
+ /*
+ * Use REGION_BREAK to avoid optimizations in ValidateTree
+ * that assume the root borderClip can't change well, normally
+ * it doesn't...)
+ */
+ if (enable)
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+ RegionInit(&pWin->winSize, &box, 1);
+ RegionInit(&pWin->borderSize, &box, 1);
+ if (WasViewable)
+ RegionReset(&pWin->borderClip, &box);
+ pWin->drawable.width = pScreen->width;
+ pWin->drawable.height = pScreen->height;
+ RegionBreak(&pWin->clipList);
+ }
+ else
+ {
+ RegionEmpty(&pWin->borderClip);
+ RegionBreak(&pWin->clipList);
+ }
+
+ ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
+
+ if (WasViewable)
+ {
+ if (pWin->firstChild)
+ {
+ anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
+ pWin->firstChild,
+ (WindowPtr *)NULL);
+ }
+ else
+ {
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ }
+
+
+ if (anyMarked)
+ (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
+ }
+
+ if (WasViewable)
+ {
+ if (anyMarked)
+ (*pScreen->HandleExposures)(pWin);
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
+ }
+ if (pWin->realized)
+ WindowsRestructured ();
+ FlushAllOutput();
+}
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index c688eb038..f034ce463 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -92,95 +92,6 @@ static Bool kdCaughtSignal = FALSE;
KdOsFuncs *kdOsFuncs;
void
-KdSetRootClip (ScreenPtr pScreen, BOOL enable)
-{
- WindowPtr pWin = pScreen->root;
- WindowPtr pChild;
- Bool WasViewable;
- Bool anyMarked = FALSE;
- WindowPtr pLayerWin;
- BoxRec box;
-
- if (!pWin)
- return;
- WasViewable = (Bool)(pWin->viewable);
- if (WasViewable)
- {
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- (void) (*pScreen->MarkOverlappedWindows)(pChild,
- pChild,
- &pLayerWin);
- }
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- 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;
- }
- }
-
- if (enable)
- {
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
- pWin->drawable.width = pScreen->width;
- pWin->drawable.height = pScreen->height;
- RegionInit(&pWin->winSize, &box, 1);
- RegionInit(&pWin->borderSize, &box, 1);
- RegionReset(&pWin->borderClip, &box);
- RegionBreak(&pWin->clipList);
- }
- else
- {
- RegionEmpty(&pWin->borderClip);
- RegionBreak(&pWin->clipList);
- }
-
- ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
-
- if (WasViewable)
- {
- if (pWin->firstChild)
- {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
- pWin->firstChild,
- (WindowPtr *)NULL);
- }
- else
- {
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- }
-
-
- if (anyMarked)
- (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
- }
-
- if (WasViewable)
- {
- if (anyMarked)
- (*pScreen->HandleExposures)(pWin);
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
- }
- if (pWin->realized)
- WindowsRestructured ();
-}
-
-void
KdDisableScreen (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
@@ -188,7 +99,7 @@ KdDisableScreen (ScreenPtr pScreen)
if (!pScreenPriv->enabled)
return;
if (!pScreenPriv->closed)
- KdSetRootClip (pScreen, FALSE);
+ SetRootClip (pScreen, FALSE);
KdDisableColormap (pScreen);
if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->disableAccel)
(*pScreenPriv->card->cfuncs->disableAccel) (pScreen);
@@ -271,7 +182,7 @@ KdEnableScreen (ScreenPtr pScreen)
if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->enableAccel)
(*pScreenPriv->card->cfuncs->enableAccel) (pScreen);
KdEnableColormap (pScreen);
- KdSetRootClip (pScreen, TRUE);
+ SetRootClip (pScreen, TRUE);
if (pScreenPriv->card->cfuncs->dpms)
(*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState);
return TRUE;
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 3ca98146b..2ab535aef 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -387,9 +387,6 @@ KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs);
extern miPointerScreenFuncRec kdPointerScreenFuncs;
void
-KdSetRootClip (ScreenPtr pScreen, BOOL enable);
-
-void
KdDisableScreen (ScreenPtr pScreen);
void
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 1a5bf8a1c..399883886 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -983,106 +983,6 @@ xf86SetBlackWhitePixels(ScreenPtr pScreen)
}
/*
- * xf86SetRootClip --
- * Enable or disable rendering to the screen by
- * setting the root clip list and revalidating
- * all of the windows
- */
-
-static void
-xf86SetRootClip (ScreenPtr pScreen, Bool enable)
-{
- WindowPtr pWin = pScreen->root;
- WindowPtr pChild;
- Bool WasViewable = (Bool)(pWin->viewable);
- Bool anyMarked = FALSE;
- WindowPtr pLayerWin;
- BoxRec box;
-
- if (WasViewable)
- {
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- (void) (*pScreen->MarkOverlappedWindows)(pChild,
- pChild,
- &pLayerWin);
- }
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- 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;
- }
- }
-
- /*
- * Use REGION_BREAK to avoid optimizations in ValidateTree
- * that assume the root borderClip can't change well, normally
- * it doesn't...)
- */
- if (enable)
- {
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
- RegionInit(&pWin->winSize, &box, 1);
- RegionInit(&pWin->borderSize, &box, 1);
- if (WasViewable)
- RegionReset(&pWin->borderClip, &box);
- pWin->drawable.width = pScreen->width;
- pWin->drawable.height = pScreen->height;
- RegionBreak(&pWin->clipList);
- }
- else
- {
- RegionEmpty(&pWin->borderClip);
- RegionBreak(&pWin->clipList);
- }
-
- ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
-
- if (WasViewable)
- {
- if (pWin->firstChild)
- {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
- pWin->firstChild,
- (WindowPtr *)NULL);
- }
- else
- {
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- }
-
-
- if (anyMarked)
- (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
- }
-
- if (WasViewable)
- {
- if (anyMarked)
- (*pScreen->HandleExposures)(pWin);
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
- }
- if (pWin->realized)
- WindowsRestructured ();
- FlushAllOutput ();
-}
-
-/*
* Function to enable/disable access to the frame buffer
*
* This is used when VT switching and when entering/leaving DGA direct mode.
@@ -1115,7 +1015,7 @@ xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
* Restore all of the clip lists on the screen
*/
if (!xf86Resetting)
- xf86SetRootClip (pScreen, TRUE);
+ SetRootClip (pScreen, TRUE);
}
else
@@ -1123,7 +1023,7 @@ xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
/*
* Empty all of the clip lists on the screen
*/
- xf86SetRootClip (pScreen, FALSE);
+ SetRootClip (pScreen, FALSE);
}
}
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 3c64ae443..bb5482a0b 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -1497,10 +1497,6 @@ DRIGetDrawableInfo(ScreenPtr pScreen,
*stamp = pDRIPriv->pSAREA->drawableTable[*index].stamp;
*X = (int)(pWin->drawable.x);
*Y = (int)(pWin->drawable.y);
-#if 0
- *W = (int)(pWin->winSize.extents.x2 - pWin->winSize.extents.x1);
- *H = (int)(pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
-#endif
*W = (int)(pWin->drawable.width);
*H = (int)(pWin->drawable.height);
*numClipRects = RegionNumRects(&pWin->clipList);
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 33276c389..3b6f0a29e 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -767,113 +767,3 @@ void AbortDDX( void )
OsAbort();
}
-#include "mivalidate.h" // for union _Validate used by windowstr.h
-#include "windowstr.h" // for struct _Window
-#include "scrnintstr.h" // for struct _Screen
-
-// This is copied from Xserver/hw/xfree86/common/xf86Helper.c.
-// Quartz mode uses this when switching in and out of Quartz.
-// Quartz or IOKit can use this when waking from sleep.
-// Copyright (c) 1997-1998 by The XFree86 Project, Inc.
-
-/*
- * xf86SetRootClip --
- * Enable or disable rendering to the screen by
- * setting the root clip list and revalidating
- * all of the windows
- */
-
-void
-xf86SetRootClip (ScreenPtr pScreen, int enable)
-{
- WindowPtr pWin = pScreen->root;
- WindowPtr pChild;
- Bool WasViewable = (Bool)(pWin->viewable);
- Bool anyMarked = TRUE;
- RegionPtr pOldClip = NULL;
- WindowPtr pLayerWin;
- BoxRec box;
-
- if (WasViewable)
- {
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- (void) (*pScreen->MarkOverlappedWindows)(pChild,
- pChild,
- &pLayerWin);
- }
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- 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;
- }
- }
-
- /*
- * Use REGION_BREAK to avoid optimizations in ValidateTree
- * that assume the root borderClip can't change well, normally
- * it doesn't...)
- */
- if (enable)
- {
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
- RegionReset(&pWin->borderClip, &box);
- RegionBreak(&pWin->clipList);
- }
- else
- {
- RegionEmpty(&pWin->borderClip);
- RegionBreak(&pWin->clipList);
- }
-
- ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
-
- if (WasViewable)
- {
- if (pWin->backStorage)
- {
- pOldClip = RegionCreate(NullBox, 1);
- RegionCopy(pOldClip, &pWin->clipList);
- }
-
- if (pWin->firstChild)
- {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
- pWin->firstChild,
- (WindowPtr *)NULL);
- }
- else
- {
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- }
-
-
- if (anyMarked)
- (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
- }
-
- if (WasViewable)
- {
- if (anyMarked)
- (*pScreen->HandleExposures)(pWin);
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
- }
- if (pWin->realized)
- WindowsRestructured ();
- FlushAllOutput ();
-}
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index 350eadeb6..e874af24c 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -42,7 +42,6 @@
void DarwinPrintBanner(void);
int DarwinParseModifierList(const char *constmodifiers, int separatelr);
void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
-void xf86SetRootClip (ScreenPtr pScreen, int enable);
#define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \
dixLookupPrivate(&pScreen->devPrivates, darwinScreenKey))
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 11e5a74d7..4b72a89d3 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -442,7 +442,7 @@ void QuartzSetRootClip(
for (i = 0; i < screenInfo.numScreens; i++) {
if (screenInfo.screens[i]) {
- xf86SetRootClip(screenInfo.screens[i], enable);
+ SetRootClip(screenInfo.screens[i], enable);
}
}
}
diff --git a/hw/xwin/winrandr.c b/hw/xwin/winrandr.c
index 248404800..c58119360 100644
--- a/hw/xwin/winrandr.c
+++ b/hw/xwin/winrandr.c
@@ -63,106 +63,6 @@ winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations)
return TRUE;
}
-
-/*
- Copied from the xfree86 DDX
-
- Why can't this be in DIX?
- Does union _Validate vary depending on DDX??
- */
-static void
-xf86SetRootClip (ScreenPtr pScreen, Bool enable)
-{
- WindowPtr pWin = pScreen->root;
- WindowPtr pChild;
- Bool WasViewable = (Bool)(pWin->viewable);
- Bool anyMarked = FALSE;
- WindowPtr pLayerWin;
- BoxRec box;
-
- if (WasViewable)
- {
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- (void) (*pScreen->MarkOverlappedWindows)(pChild,
- pChild,
- &pLayerWin);
- }
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- 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;
- }
- }
-
- /*
- * Use REGION_BREAK to avoid optimizations in ValidateTree
- * that assume the root borderClip can't change well, normally
- * it doesn't...)
- */
- if (enable)
- {
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
- REGION_INIT (pScreen, &pWin->winSize, &box, 1);
- REGION_INIT (pScreen, &pWin->borderSize, &box, 1);
- if (WasViewable)
- REGION_RESET(pScreen, &pWin->borderClip, &box);
- pWin->drawable.width = pScreen->width;
- pWin->drawable.height = pScreen->height;
- REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
- }
- else
- {
- REGION_EMPTY(pScreen, &pWin->borderClip);
- REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
- }
-
- ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
-
- if (WasViewable)
- {
- if (pWin->firstChild)
- {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
- pWin->firstChild,
- (WindowPtr *)NULL);
- }
- else
- {
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- }
-
-
- if (anyMarked)
- (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
- }
-
- if (WasViewable)
- {
- if (anyMarked)
- (*pScreen->HandleExposures)(pWin);
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
- }
- if (pWin->realized)
- WindowsRestructured ();
- FlushAllOutput ();
-}
-
/*
*/
@@ -178,7 +78,7 @@ winDoRandRScreenSetSize (ScreenPtr pScreen,
WindowPtr pRoot = pScreen->root;
// Prevent screen updates while we change things around
- xf86SetRootClip(pScreen, FALSE);
+ SetRootClip(pScreen, FALSE);
/* Update the screen size as requested */
pScreenInfo->dwWidth = width;
@@ -205,7 +105,7 @@ winDoRandRScreenSetSize (ScreenPtr pScreen,
// does this emit a ConfigureNotify??
// Restore the ability to update screen, now with new dimensions
- xf86SetRootClip(pScreen, TRUE);
+ SetRootClip(pScreen, TRUE);
// and arrange for it to be repainted
miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
diff --git a/include/window.h b/include/window.h
index 6fb2f8c18..1e4e9bfa4 100644
--- a/include/window.h
+++ b/include/window.h
@@ -266,4 +266,5 @@ extern _X_EXPORT void DisableMapUnmapEvents(
extern _X_EXPORT void EnableMapUnmapEvents(
WindowPtr /* pWin */ );
+extern _X_EXPORT void SetRootClip(ScreenPtr pScreen, Bool enable);
#endif /* WINDOW_H */