Blob Blame History Raw
From 8a00e31151649ea43f2160f3ea8e72a2ceccf149 Mon Sep 17 00:00:00 2001
From: Kristian <krh@redhat.com>
Date: Fri, 15 Aug 2008 15:15:14 +1000
Subject: [PATCH] Add nr for background=none root

---
 dix/globals.c    |    1 +
 dix/window.c     |   15 ++++++++++-----
 include/opaque.h |    1 +
 os/utils.c       |    3 +++
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/dix/globals.c b/dix/globals.c
index 7f95eab..db34786 100644
--- a/dix/globals.c
+++ b/dix/globals.c
@@ -143,6 +143,7 @@ Bool loadableFonts = FALSE;
 CursorPtr rootCursor;
 Bool blackRoot=FALSE;
 Bool whiteRoot=FALSE;
+Bool bgNoneRoot=FALSE;
 #ifdef XPRINT
 ClientPtr requestingClient;	/* XXX this should be obsolete now, remove? */
 #endif
diff --git a/dix/window.c b/dix/window.c
index 834c26b..0a1d163 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -472,17 +472,22 @@ InitRootWindow(WindowPtr pWin)
     pWin->optional->cursor = rootCursor;
     rootCursor->refcnt++;
 
-    if (!blackRoot && !whiteRoot) {
-        MakeRootTile(pWin);
-        backFlag |= CWBackPixmap;
+    if (bgNoneRoot) {
+      pWin->backgroundState = XaceBackgroundNoneState(pWin);
+      pWin->background.pixel = pScreen->whitePixel;
+      backFlag |= CWBackPixmap;
     }
-    else {
+    else if (blackRoot || whiteRoot) {
         if (blackRoot)
             pWin->background.pixel = pScreen->blackPixel;
         else
             pWin->background.pixel = pScreen->whitePixel;
         backFlag |= CWBackPixel;
-    } 
+    }
+    else {
+        MakeRootTile(pWin);
+        backFlag |= CWBackPixmap;
+    }
 
     pWin->backingStore = defaultBackingStore;
     pWin->forcedBS = (defaultBackingStore != NotUseful);
diff --git a/include/opaque.h b/include/opaque.h
index 3d19d27..cf5d135 100644
--- a/include/opaque.h
+++ b/include/opaque.h
@@ -74,6 +74,7 @@ extern Bool defeatAccessControl;
 extern long maxBigRequestSize;
 extern Bool blackRoot;
 extern Bool whiteRoot;
+extern Bool bgNoneRoot;
 
 extern Bool CoreDump;
 
diff --git a/os/utils.c b/os/utils.c
index d785d46..08337d8 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -615,6 +615,7 @@ void UseMsg(void)
 #endif
     ErrorF("-nolisten string       don't listen on protocol\n");
     ErrorF("-noreset               don't reset after last client exists\n");
+    ErrorF("-nr                    create root window with no background\n");
     ErrorF("-reset                 reset after last client exists\n");
     ErrorF("-p #                   screen-saver pattern duration (minutes)\n");
     ErrorF("-pn                    accept failure to listen on all ports\n");
@@ -986,6 +987,8 @@ ProcessCommandLine(int argc, char *argv[])
 	    defaultBackingStore = WhenMapped;
         else if ( strcmp( argv[i], "-wr") == 0)
             whiteRoot = TRUE;
+        else if ( strcmp( argv[i], "-nr") == 0)
+            bgNoneRoot = TRUE;
         else if ( strcmp( argv[i], "-maxbigreqsize") == 0) {
              if(++i < argc) {
                  long reqSizeArg = atol(argv[i]);
-- 
1.5.5.1