[PATCH 2/2 v3] dix: fix root window background behaviour for protocol calls
Tiago Vignatti
tiago.vignatti at nokia.com
Wed Nov 10 11:48:04 PST 2010
Instead always paint root tiled (-retro like), protocol calls
(XSetWindowBackgroundPixmap and related) should behave accordingly when None
and ParentRelative is set as background pixmap.
It follow what the protocol states: "changing the background of a root window
to None or ParentRelative restores the default background pixmap".
Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
---
One would want to create another patch cleaning-up and use
SetRootWindowBackground() on InitRootWindow()
changes made on v2:
- remove canDoBGNoneRoot check (kudos to Ville)
- restores always the default background pixmap (kudos to Rami)
changes made on v3:
- ParentRelative should follow None (kudos to Ville)
- BlackPixel and WhitePixel should also be caught (kudos to Ville)
- now using SetRootWindowBackground for that code
dix/window.c | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/dix/window.c b/dix/window.c
index bfaa6f5..cba583d 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -956,6 +956,26 @@ DestroySubwindows(WindowPtr pWin, ClientPtr client)
return Success;
}
+static void
+SetRootWindowBackground(WindowPtr pWin, ScreenPtr pScreen, Mask *index2)
+{
+ /* following the protocol: "Changing the background of a root window to
+ * None or ParentRelative restores the default background pixmap" */
+ if (bgNoneRoot) {
+ pWin->backgroundState = XaceBackgroundNoneState(pWin);
+ pWin->background.pixel = pScreen->whitePixel;
+ }
+ else if (party_like_its_1989)
+ MakeRootTile(pWin);
+ else {
+ if (whiteRoot)
+ pWin->background.pixel = pScreen->whitePixel;
+ else
+ pWin->background.pixel = pScreen->blackPixel;
+ *index2 = CWBackPixel;
+ }
+}
+
/*****
* ChangeWindowAttributes
*
@@ -1005,7 +1025,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
if (pWin->backgroundState == BackgroundPixmap)
(*pScreen->DestroyPixmap)(pWin->background.pixmap);
if (!pWin->parent)
- MakeRootTile(pWin);
+ SetRootWindowBackground(pWin, pScreen, &index2);
else {
pWin->backgroundState = XaceBackgroundNoneState(pWin);
pWin->background.pixel = pScreen->whitePixel;
@@ -1022,7 +1042,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
if (pWin->backgroundState == BackgroundPixmap)
(*pScreen->DestroyPixmap)(pWin->background.pixmap);
if (!pWin->parent)
- MakeRootTile(pWin);
+ SetRootWindowBackground(pWin, pScreen, &index2);
else
pWin->backgroundState = ParentRelative;
borderRelative = TRUE;
--
1.7.0.4
More information about the xorg-devel
mailing list