Reviewed-by: Rami Ylimäki <rami.ylim...@vincit.fi>

On 11/10/2010 09:48 PM, Tiago Vignatti wrote:
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.vigna...@nokia.com>
Signed-off-by: Ville Syrjälä<ville.syrj...@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;

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to