changeset 35753:9c74edcbbc96

Cosmetic: Adjust indent.
author ib
date Thu, 24 Jan 2013 15:27:26 +0000
parents d302b71c644e
children 5b5a3108e59f
files gui/wm/ws.c
diffstat 1 files changed, 20 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/gui/wm/ws.c	Thu Jan 24 15:27:00 2013 +0000
+++ b/gui/wm/ws.c	Thu Jan 24 15:27:26 2013 +0000
@@ -953,10 +953,10 @@
     wsImageDestroy(win);
     XDestroyWindow(wsDisplay, win->WindowID);
 #if 0
-    win->Visible      = wsNo;
-    win->Focused      = wsNo;
-    win->Mapped       = wsNo;
-    win->Rolled       = wsNo;
+    win->Visible = wsNo;
+    win->Focused = wsNo;
+    win->Mapped  = wsNo;
+    win->Rolled  = wsNo;
 #endif
 }
 
@@ -1019,9 +1019,6 @@
     }
 }
 
-// ----------------------------------------------------------------------------------------------
-//    Set window background to 'color'.
-// ----------------------------------------------------------------------------------------------
 /**
  * @brief Pack color components @a r, @a g and @a b into 15 bits.
  *
@@ -1066,6 +1063,16 @@
     return pixel;
 }
 
+/**
+ * @brief Set and fill, or unset a window background.
+ *
+ * @param win pointer to a ws window structure
+ * @param r red (0 - 255, or -1)
+ * @param g green (0 - 255, or -1)
+ * @param b blue (0 - 255, or -1)
+ *
+ * @note Passing -1 for @a r, @a g and @a b unsets the background.
+ */
 void wsWindowBackground(wsWindow *win, int r, int g, int b)
 {
     int color = 0;
@@ -1101,8 +1108,12 @@
         ;
     }
 
-    XSetWindowBackground(wsDisplay, win->WindowID, color);
-    XClearWindow(wsDisplay, win->WindowID);
+    if (r == -1 && g == -1 && b == -1)
+        XSetWindowBackgroundPixmap(wsDisplay, win->WindowID, None);
+    else {
+        XSetWindowBackground(wsDisplay, win->WindowID, color);
+        XClearWindow(wsDisplay, win->WindowID);
+    }
 }
 
 // ----------------------------------------------------------------------------------------------