73b55c
From eff3bb9c6f0b71a57705885a3fe6e6469d252d2b Mon Sep 17 00:00:00 2001
73b55c
From: Fedora X Ninjas <x@fedoraproject.org>
73b55c
Date: Wed, 20 Jan 2010 14:46:12 +1300
04e6c0
Subject: [PATCH] Add nr for background=none root
04e6c0
04e6c0
---
b6d818
 dix/globals.c                |    1 +
520bba
 dix/window.c                 |   12 +++++++-----
b6d818
 hw/xfree86/common/xf86Init.c |   11 +++++++++++
b6d818
 hw/xfree86/common/xf86str.h  |    5 ++++-
b6d818
 include/opaque.h             |    1 +
b6d818
 os/utils.c                   |    3 +++
520bba
 6 files changed, 27 insertions(+), 6 deletions(-)
04e6c0
Kristian Høgsberg a7e275
diff --git a/dix/globals.c b/dix/globals.c
520bba
index c24a94f..907a5e8 100644
Kristian Høgsberg a7e275
--- a/dix/globals.c
Kristian Høgsberg a7e275
+++ b/dix/globals.c
520bba
@@ -124,6 +124,7 @@ FontPtr defaultFont;   /* not declared in dix.h to avoid including font.h in
Kristian Høgsberg a7e275
 CursorPtr rootCursor;
722283
 Bool party_like_its_1989 = FALSE;
722283
 Bool whiteRoot = FALSE;
722283
+Bool bgNoneRoot = FALSE;
722283
 
722283
 int cursorScreenDevPriv[MAXSCREENS];
722283
 
Kristian Høgsberg a7e275
diff --git a/dix/window.c b/dix/window.c
73b55c
index caff1cb..be1d1c4 100644
Kristian Høgsberg a7e275
--- a/dix/window.c
Kristian Høgsberg a7e275
+++ b/dix/window.c
520bba
@@ -466,22 +466,24 @@ InitRootWindow(WindowPtr pWin)
Kristian Høgsberg a7e275
     pWin->optional->cursor = rootCursor;
Kristian Høgsberg a7e275
     rootCursor->refcnt++;
520bba
 
b6d818
+    pWin->backingStore = defaultBackingStore;
b6d818
+    pWin->forcedBS = (defaultBackingStore != NotUseful);
Kristian Høgsberg a7e275
 
722283
     if (party_like_its_1989) {
722283
         MakeRootTile(pWin);
722283
         backFlag |= CWBackPixmap;
722283
+        pScreen->ChangeWindowAttributes(pWin, backFlag);
722283
+    } else if (bgNoneRoot) {
520bba
+       /* nothing, handled in xf86CreateRootWindow */
722283
     } else {
722283
 	if (whiteRoot)
Kristian Høgsberg a7e275
             pWin->background.pixel = pScreen->whitePixel;
722283
         else
722283
             pWin->background.pixel = pScreen->blackPixel;
Kristian Høgsberg a7e275
         backFlag |= CWBackPixel;
c5eb6a
-    } 
722283
 
b6d818
-    pWin->backingStore = defaultBackingStore;
b6d818
-    pWin->forcedBS = (defaultBackingStore != NotUseful);
b6d818
-    /* We SHOULD check for an error value here XXX */
b6d818
-    (*pScreen->ChangeWindowAttributes)(pWin, backFlag);
722283
+        pScreen->ChangeWindowAttributes(pWin, backFlag);
c5eb6a
+    }
Kristian Høgsberg a7e275
 
b6d818
     MapWindow(pWin, serverClient);
b6d818
 }
b6d818
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
73b55c
index 6707448..776b898 100644
b6d818
--- a/hw/xfree86/common/xf86Init.c
b6d818
+++ b/hw/xfree86/common/xf86Init.c
520bba
@@ -77,6 +77,7 @@
b6d818
 #ifdef RENDER
b6d818
 #include "picturestr.h"
b6d818
 #endif
b6d818
+#include "xace.h"
b6d818
 
cdde67
 #include "xf86VGAarbiter.h"
b6d818
 #include "globals.h"
73b55c
@@ -254,6 +255,7 @@ xf86CreateRootWindow(WindowPtr pWin)
b6d818
   int ret = TRUE;
b6d818
   int err = Success;
b6d818
   ScreenPtr pScreen = pWin->drawable.pScreen;
b6d818
+  ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
b6d818
   RootWinPropPtr pProp;
b6d818
   CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
b6d818
       dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);
73b55c
@@ -305,6 +307,15 @@ xf86CreateRootWindow(WindowPtr pWin)
b6d818
     }
b6d818
   }
b6d818
 
b6d818
+  if (bgNoneRoot && pScrn->canDoBGNoneRoot) {
b6d818
+      pWin->backgroundState = XaceBackgroundNoneState(pWin);
b6d818
+      pWin->background.pixel = pScreen->whitePixel;
b6d818
+      pScreen->ChangeWindowAttributes(pWin, CWBackPixmap | CWBorderPixel | CWCursor | CWBackingStore);
b6d818
+  } else {
b6d818
+      pWin->background.pixel = pScreen->blackPixel;
b6d818
+      pScreen->ChangeWindowAttributes(pWin, CWBackPixel | CWBorderPixel | CWCursor | CWBackingStore);
b6d818
+  }
b6d818
+
520bba
   DebugF("xf86CreateRootWindow() returns %d\n", ret);
520bba
   return (ret);
520bba
 }
b6d818
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
73b55c
index de1f1b6..5c3aa00 100644
b6d818
--- a/hw/xfree86/common/xf86str.h
b6d818
+++ b/hw/xfree86/common/xf86str.h
73b55c
@@ -503,7 +503,7 @@ typedef struct _confdrirec {
b6d818
 } confDRIRec, *confDRIPtr;
b6d818
 
b6d818
 /* These values should be adjusted when new fields are added to ScrnInfoRec */
b6d818
-#define NUM_RESERVED_INTS		16
b6d818
+#define NUM_RESERVED_INTS		15
cdde67
 #define NUM_RESERVED_POINTERS		14
b6d818
 #define NUM_RESERVED_FUNCS		11
b6d818
 
73b55c
@@ -775,6 +775,9 @@ typedef struct _ScrnInfoRec {
73b55c
     ClockRangePtr	clockRanges;
b6d818
     int			adjustFlags;
b6d818
 
b6d818
+    /* -nr support */
520bba
+    int                 canDoBGNoneRoot;
b6d818
+
b6d818
     /*
b6d818
      * These can be used when the minor ABI version is incremented.
b6d818
      * The NUM_* parameters must be reduced appropriately to keep the
Kristian Høgsberg a7e275
diff --git a/include/opaque.h b/include/opaque.h
520bba
index b3c7c70..fcc8c95 100644
Kristian Høgsberg a7e275
--- a/include/opaque.h
Kristian Høgsberg a7e275
+++ b/include/opaque.h
520bba
@@ -71,6 +71,7 @@ extern _X_EXPORT Bool defeatAccessControl;
520bba
 extern _X_EXPORT long maxBigRequestSize;
520bba
 extern _X_EXPORT Bool party_like_its_1989;
520bba
 extern _X_EXPORT Bool whiteRoot;
520bba
+extern _X_EXPORT Bool bgNoneRoot;
Kristian Høgsberg a7e275
 
520bba
 extern _X_EXPORT Bool CoreDump;
Kristian Høgsberg a7e275
 
Kristian Høgsberg a7e275
diff --git a/os/utils.c b/os/utils.c
73b55c
index d7c8388..40583d0 100644
Kristian Høgsberg a7e275
--- a/os/utils.c
Kristian Høgsberg a7e275
+++ b/os/utils.c
73b55c
@@ -513,6 +513,7 @@ void UseMsg(void)
Kristian Høgsberg a7e275
 #endif
Kristian Høgsberg a7e275
     ErrorF("-nolisten string       don't listen on protocol\n");
Kristian Høgsberg a7e275
     ErrorF("-noreset               don't reset after last client exists\n");
Kristian Høgsberg a7e275
+    ErrorF("-nr                    create root window with no background\n");
Kristian Høgsberg a7e275
     ErrorF("-reset                 reset after last client exists\n");
Kristian Høgsberg a7e275
     ErrorF("-p #                   screen-saver pattern duration (minutes)\n");
Kristian Høgsberg a7e275
     ErrorF("-pn                    accept failure to listen on all ports\n");
73b55c
@@ -856,6 +857,8 @@ ProcessCommandLine(int argc, char *argv[])
Kristian Høgsberg a7e275
 	    defaultBackingStore = WhenMapped;
Kristian Høgsberg a7e275
         else if ( strcmp( argv[i], "-wr") == 0)
Kristian Høgsberg a7e275
             whiteRoot = TRUE;
Kristian Høgsberg a7e275
+        else if ( strcmp( argv[i], "-nr") == 0)
Kristian Høgsberg a7e275
+            bgNoneRoot = TRUE;
Kristian Høgsberg a7e275
         else if ( strcmp( argv[i], "-maxbigreqsize") == 0) {
Kristian Høgsberg a7e275
              if(++i < argc) {
Kristian Høgsberg a7e275
                  long reqSizeArg = atol(argv[i]);
520bba
-- 
73b55c
1.6.6
520bba