summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2011-11-20 00:42:20 -0800
committerJamey Sharp <jamey@minilop.net>2011-11-20 01:00:16 -0800
commit87a70acc81c9a8d8ad09b4de7f17ab40ea619f68 (patch)
tree1c2a1e19dc647036d8e0d67e58c79a960a056c73
parentf0d50cc6651dce3a8a3cd3fb84210aa92b139763 (diff)
InitRootWindow: Use ChangeWindowAttributes instead of duplicating it.
The protocol requires ChangeWindowAttributes to be able to set the root window's background and cursor to their defaults. So let's just use that when InitRootWindow needs to set up the defaults in the first place. This guarantees that using ChangeWindowAttributes to reset the root window really does restore the startup state, which wasn't quite true before: - If both party_like_its_1989 and bgNoneRoot were set, then the root background was initially the root weave, but ChangeWindowAttributes would reset it to background None. - InitRootWindow checked whether the screen supported background None, while ChangeWindowAttributes unconditionally trusted bgNoneRoot. Signed-off-by: Jamey Sharp <jamey@minilop.net>
-rw-r--r--dix/window.c44
1 files changed, 9 insertions, 35 deletions
diff --git a/dix/window.c b/dix/window.c
index 1953f025b..44bfa182a 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -551,38 +551,13 @@ void
InitRootWindow(WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- int backFlag = CWBorderPixel | CWCursor | CWBackingStore;
+ int mask = CWBackPixmap | CWBackingStore | CWCursor;
+ XID attrs[] = { None, defaultBackingStore, None };
if (!(*pScreen->CreateWindow)(pWin))
return; /* XXX */
(*pScreen->PositionWindow)(pWin, 0, 0);
-
- pWin->cursorIsNone = FALSE;
- pWin->optional->cursor = rootCursor;
- rootCursor->refcnt++;
-
-
- if (party_like_its_1989) {
- MakeRootTile(pWin);
- backFlag |= CWBackPixmap;
- } else if (pScreen->canDoBGNoneRoot && bgNoneRoot) {
- pWin->backgroundState = XaceBackgroundNoneState(pWin);
- pWin->background.pixel = pScreen->whitePixel;
- backFlag |= CWBackPixmap;
- } else {
- pWin->backgroundState = BackgroundPixel;
- if (whiteRoot)
- pWin->background.pixel = pScreen->whitePixel;
- else
- pWin->background.pixel = pScreen->blackPixel;
- backFlag |= CWBackPixel;
- }
-
- pWin->backingStore = defaultBackingStore;
- pWin->forcedBS = (defaultBackingStore != NotUseful);
- /* We SHOULD check for an error value here XXX */
- (*pScreen->ChangeWindowAttributes)(pWin, backFlag);
-
+ ChangeWindowAttributes(pWin, mask, attrs, serverClient);
MapWindow(pWin, serverClient);
}
@@ -1062,14 +1037,13 @@ 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) {
+ if (party_like_its_1989)
+ MakeRootTile(pWin);
+ else if (pScreen->canDoBGNoneRoot && bgNoneRoot) {
pWin->backgroundState = XaceBackgroundNoneState(pWin);
pWin->background.pixel = pScreen->whitePixel;
- }
- else if (party_like_its_1989)
- MakeRootTile(pWin);
- else {
- pWin->backgroundState = BackgroundPixel;
+ } else {
+ pWin->backgroundState = BackgroundPixel;
if (whiteRoot)
pWin->background.pixel = pScreen->whitePixel;
else
@@ -1278,7 +1252,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
goto PatchUp;
}
pWin->backingStore = val;
- pWin->forcedBS = FALSE;
+ pWin->forcedBS = (client == serverClient && pWin->backingStore != NotUseful);
break;
case CWBackingPlanes:
if (pWin->optional || ((CARD32)*pVlist != (CARD32)~0L)) {