cdde67c
From b4e4b980663692a3af5787eeaf2d48eb6c0188ed Mon Sep 17 00:00:00 2001
cdde67c
From: Fedora X Ninjas <airlied@redhat.com>
cdde67c
Date: Tue, 4 Aug 2009 14:45:58 +1000
04e6c06
Subject: [PATCH] Add nr for background=none root
04e6c06
04e6c06
---
b6d8183
 dix/globals.c                |    1 +
520bba9
 dix/window.c                 |   12 +++++++-----
b6d8183
 hw/xfree86/common/xf86Init.c |   11 +++++++++++
b6d8183
 hw/xfree86/common/xf86str.h  |    5 ++++-
b6d8183
 include/opaque.h             |    1 +
b6d8183
 os/utils.c                   |    3 +++
520bba9
 6 files changed, 27 insertions(+), 6 deletions(-)
04e6c06
Kristian Høgsberg a7e275b
diff --git a/dix/globals.c b/dix/globals.c
520bba9
index c24a94f..907a5e8 100644
Kristian Høgsberg a7e275b
--- a/dix/globals.c
Kristian Høgsberg a7e275b
+++ b/dix/globals.c
520bba9
@@ -124,6 +124,7 @@ FontPtr defaultFont;   /* not declared in dix.h to avoid including font.h in
Kristian Høgsberg a7e275b
 CursorPtr rootCursor;
7222836
 Bool party_like_its_1989 = FALSE;
7222836
 Bool whiteRoot = FALSE;
7222836
+Bool bgNoneRoot = FALSE;
7222836
 
7222836
 int cursorScreenDevPriv[MAXSCREENS];
7222836
 
Kristian Høgsberg a7e275b
diff --git a/dix/window.c b/dix/window.c
cdde67c
index 32e26d9..0bf1d52 100644
Kristian Høgsberg a7e275b
--- a/dix/window.c
Kristian Høgsberg a7e275b
+++ b/dix/window.c
520bba9
@@ -466,22 +466,24 @@ InitRootWindow(WindowPtr pWin)
Kristian Høgsberg a7e275b
     pWin->optional->cursor = rootCursor;
Kristian Høgsberg a7e275b
     rootCursor->refcnt++;
520bba9
 
b6d8183
+    pWin->backingStore = defaultBackingStore;
b6d8183
+    pWin->forcedBS = (defaultBackingStore != NotUseful);
Kristian Høgsberg a7e275b
 
7222836
     if (party_like_its_1989) {
7222836
         MakeRootTile(pWin);
7222836
         backFlag |= CWBackPixmap;
7222836
+        pScreen->ChangeWindowAttributes(pWin, backFlag);
7222836
+    } else if (bgNoneRoot) {
520bba9
+       /* nothing, handled in xf86CreateRootWindow */
7222836
     } else {
7222836
 	if (whiteRoot)
Kristian Høgsberg a7e275b
             pWin->background.pixel = pScreen->whitePixel;
7222836
         else
7222836
             pWin->background.pixel = pScreen->blackPixel;
Kristian Høgsberg a7e275b
         backFlag |= CWBackPixel;
c5eb6a7
-    } 
7222836
 
b6d8183
-    pWin->backingStore = defaultBackingStore;
b6d8183
-    pWin->forcedBS = (defaultBackingStore != NotUseful);
b6d8183
-    /* We SHOULD check for an error value here XXX */
b6d8183
-    (*pScreen->ChangeWindowAttributes)(pWin, backFlag);
7222836
+        pScreen->ChangeWindowAttributes(pWin, backFlag);
c5eb6a7
+    }
Kristian Høgsberg a7e275b
 
b6d8183
     MapWindow(pWin, serverClient);
b6d8183
 }
b6d8183
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
cdde67c
index e84da4e..2a0f47a 100644
b6d8183
--- a/hw/xfree86/common/xf86Init.c
b6d8183
+++ b/hw/xfree86/common/xf86Init.c
520bba9
@@ -77,6 +77,7 @@
b6d8183
 #ifdef RENDER
b6d8183
 #include "picturestr.h"
b6d8183
 #endif
b6d8183
+#include "xace.h"
b6d8183
 
cdde67c
 #include "xf86VGAarbiter.h"
b6d8183
 #include "globals.h"
cdde67c
@@ -234,6 +235,7 @@ xf86CreateRootWindow(WindowPtr pWin)
b6d8183
   int ret = TRUE;
b6d8183
   int err = Success;
b6d8183
   ScreenPtr pScreen = pWin->drawable.pScreen;
b6d8183
+  ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
b6d8183
   RootWinPropPtr pProp;
b6d8183
   CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
b6d8183
       dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);
cdde67c
@@ -285,6 +287,15 @@ xf86CreateRootWindow(WindowPtr pWin)
b6d8183
     }
b6d8183
   }
b6d8183
 
b6d8183
+  if (bgNoneRoot && pScrn->canDoBGNoneRoot) {
b6d8183
+      pWin->backgroundState = XaceBackgroundNoneState(pWin);
b6d8183
+      pWin->background.pixel = pScreen->whitePixel;
b6d8183
+      pScreen->ChangeWindowAttributes(pWin, CWBackPixmap | CWBorderPixel | CWCursor | CWBackingStore);
b6d8183
+  } else {
b6d8183
+      pWin->background.pixel = pScreen->blackPixel;
b6d8183
+      pScreen->ChangeWindowAttributes(pWin, CWBackPixel | CWBorderPixel | CWCursor | CWBackingStore);
b6d8183
+  }
b6d8183
+
520bba9
   DebugF("xf86CreateRootWindow() returns %d\n", ret);
520bba9
   return (ret);
520bba9
 }
b6d8183
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
cdde67c
index 5c3ee44..e3c7841 100644
b6d8183
--- a/hw/xfree86/common/xf86str.h
b6d8183
+++ b/hw/xfree86/common/xf86str.h
520bba9
@@ -516,7 +516,7 @@ typedef struct _confdrirec {
b6d8183
 } confDRIRec, *confDRIPtr;
b6d8183
 
b6d8183
 /* These values should be adjusted when new fields are added to ScrnInfoRec */
b6d8183
-#define NUM_RESERVED_INTS		16
b6d8183
+#define NUM_RESERVED_INTS		15
cdde67c
 #define NUM_RESERVED_POINTERS		14
b6d8183
 #define NUM_RESERVED_FUNCS		11
b6d8183
 
cdde67c
@@ -800,6 +800,9 @@ typedef struct _ScrnInfoRec {
b6d8183
     ClockRangesPtr	clockRanges;
b6d8183
     int			adjustFlags;
b6d8183
 
b6d8183
+    /* -nr support */
520bba9
+    int                 canDoBGNoneRoot;
b6d8183
+
b6d8183
     /*
b6d8183
      * These can be used when the minor ABI version is incremented.
b6d8183
      * The NUM_* parameters must be reduced appropriately to keep the
Kristian Høgsberg a7e275b
diff --git a/include/opaque.h b/include/opaque.h
520bba9
index b3c7c70..fcc8c95 100644
Kristian Høgsberg a7e275b
--- a/include/opaque.h
Kristian Høgsberg a7e275b
+++ b/include/opaque.h
520bba9
@@ -71,6 +71,7 @@ extern _X_EXPORT Bool defeatAccessControl;
520bba9
 extern _X_EXPORT long maxBigRequestSize;
520bba9
 extern _X_EXPORT Bool party_like_its_1989;
520bba9
 extern _X_EXPORT Bool whiteRoot;
520bba9
+extern _X_EXPORT Bool bgNoneRoot;
Kristian Høgsberg a7e275b
 
520bba9
 extern _X_EXPORT Bool CoreDump;
Kristian Høgsberg a7e275b
 
Kristian Høgsberg a7e275b
diff --git a/os/utils.c b/os/utils.c
520bba9
index 00abd63..7bfdf8b 100644
Kristian Høgsberg a7e275b
--- a/os/utils.c
Kristian Høgsberg a7e275b
+++ b/os/utils.c
520bba9
@@ -514,6 +514,7 @@ void UseMsg(void)
Kristian Høgsberg a7e275b
 #endif
Kristian Høgsberg a7e275b
     ErrorF("-nolisten string       don't listen on protocol\n");
Kristian Høgsberg a7e275b
     ErrorF("-noreset               don't reset after last client exists\n");
Kristian Høgsberg a7e275b
+    ErrorF("-nr                    create root window with no background\n");
Kristian Høgsberg a7e275b
     ErrorF("-reset                 reset after last client exists\n");
Kristian Høgsberg a7e275b
     ErrorF("-p #                   screen-saver pattern duration (minutes)\n");
Kristian Høgsberg a7e275b
     ErrorF("-pn                    accept failure to listen on all ports\n");
520bba9
@@ -861,6 +862,8 @@ ProcessCommandLine(int argc, char *argv[])
Kristian Høgsberg a7e275b
 	    defaultBackingStore = WhenMapped;
Kristian Høgsberg a7e275b
         else if ( strcmp( argv[i], "-wr") == 0)
Kristian Høgsberg a7e275b
             whiteRoot = TRUE;
Kristian Høgsberg a7e275b
+        else if ( strcmp( argv[i], "-nr") == 0)
Kristian Høgsberg a7e275b
+            bgNoneRoot = TRUE;
Kristian Høgsberg a7e275b
         else if ( strcmp( argv[i], "-maxbigreqsize") == 0) {
Kristian Høgsberg a7e275b
              if(++i < argc) {
Kristian Høgsberg a7e275b
                  long reqSizeArg = atol(argv[i]);
520bba9
-- 
cdde67c
1.6.0.6
520bba9