summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2016-02-12 16:36:59 +0000
committerAdam Jackson <ajax@redhat.com>2016-02-22 13:26:31 -0500
commite957a2e5dd288f515f3e93724823542c20333f6a (patch)
tree0f0e885f72fe0dcf9a13531adf6fcdd28a121a1f /dix
parentdbe8d03c42f01332b3dc41fe9290aed142f1436f (diff)
dix: Add hybrid full-size/empty-clip mode to SetRootClip
216bdbc735 removed the SetRootClip call in the XWayland output-hotplug handler when running rootless (e.g. as a part of Weston/Mutter), since the root window has no storage, so generating exposures will result in writes to invalid memory. Unfortunately, preventing the segfault also breaks sprite confinement. SetRootClip updates winSize and borderSize for the root window, which when combined with RRScreenSizeChanged calling ScreenRestructured, generates a new sprite-confinment area to update it to the whole screen. Removing this call results in the window geometry being reported correctly, but winSize/borderSize never changing from their values at startup, i.e. out of sync with the root window geometry / screen information in the connection info / XRandR. This patch introduces a hybrid mode, where we update winSize and borderSize for the root window, enabling sprite confinement to work correctly, but keep the clip emptied so exposures are never generated. Signed-off-by: Daniel Stone <daniels@collabora.com> Tested-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'dix')
-rw-r--r--dix/window.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/dix/window.c b/dix/window.c
index 25d29ecd4..ead4dc27f 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -3647,7 +3647,7 @@ WindowParentHasDeviceCursor(WindowPtr pWin,
* all of the windows
*/
void
-SetRootClip(ScreenPtr pScreen, Bool enable)
+SetRootClip(ScreenPtr pScreen, int enable)
{
WindowPtr pWin = pScreen->root;
WindowPtr pChild;
@@ -3655,6 +3655,7 @@ SetRootClip(ScreenPtr pScreen, Bool enable)
Bool anyMarked = FALSE;
WindowPtr pLayerWin;
BoxRec box;
+ enum RootClipMode mode = enable;
if (!pWin)
return;
@@ -3679,23 +3680,32 @@ SetRootClip(ScreenPtr pScreen, Bool enable)
}
}
- /*
- * Use REGION_BREAK to avoid optimizations in ValidateTree
- * that assume the root borderClip can't change well, normally
- * it doesn't...)
- */
- if (enable) {
+ if (mode != ROOT_CLIP_NONE) {
+ pWin->drawable.width = pScreen->width;
+ pWin->drawable.height = pScreen->height;
+
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;
+
+ /*
+ * Use REGION_BREAK to avoid optimizations in ValidateTree
+ * that assume the root borderClip can't change well, normally
+ * it doesn't...)
+ */
RegionBreak(&pWin->clipList);
+
+ /* For INPUT_ONLY, empty the borderClip so no rendering will ever
+ * be attempted to the screen pixmap (only redirected windows),
+ * but we keep borderSize as full regardless. */
+ if (WasViewable && mode == ROOT_CLIP_FULL)
+ RegionReset(&pWin->borderClip, &box);
+ else
+ RegionEmpty(&pWin->borderClip);
}
else {
RegionEmpty(&pWin->borderClip);