]> Dogcows Code - chaz/openbox/commitdiff
support the blackbox hints right and the blackbox attributes for decoration state
authorDana Jansens <danakj@orodu.net>
Sat, 10 Aug 2002 16:15:19 +0000 (16:15 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 10 Aug 2002 16:15:19 +0000 (16:15 +0000)
src/Window.cc
src/Window.hh

index 201bea66d7f28bc4c931788d92f0c3ef4a96f847..27c6f9454315dd309117fee1678f01fc563faddc 100644 (file)
@@ -126,8 +126,8 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
 
   blackbox_attrib.workspace = window_number = BSENTINEL;
 
-  blackbox_attrib.flags = blackbox_attrib.attrib = blackbox_attrib.stack
-    = blackbox_attrib.decoration = 0l;
+  blackbox_attrib.flags = blackbox_attrib.attrib = blackbox_attrib.stack = 0l;
+  blackbox_attrib.decoration = DecorNormal;
   blackbox_attrib.premax_x = blackbox_attrib.premax_y = 0;
   blackbox_attrib.premax_w = blackbox_attrib.premax_h = 0;
 
@@ -173,9 +173,8 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
   // get size, aspect, minimum/maximum size and other hints set by the
   // client
 
-  if (! getBlackboxHints()) {
+  if (! getBlackboxHints())
     getNetWMHints();
-  }
 
   getWMProtocols();
   getWMHints();
@@ -235,7 +234,7 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
   
   setAllowedActions();
 
-  enableDecor(True);
+  setupDecor();
   
   if (decorations & Decor_Titlebar)
     createTitlebar();
@@ -407,7 +406,26 @@ BlackboxWindow::~BlackboxWindow(void) {
 
 
 void BlackboxWindow::enableDecor(bool enable) {
-  if (enable) {
+  blackbox_attrib.flags |= AttribDecoration;
+  blackbox_attrib.decoration = enable ? DecorNormal : DecorNone;
+  setupDecor();
+    
+  // we can not be shaded if we lack a titlebar
+  if (! (decorations & Decor_Titlebar) && flags.shaded)
+    shade();
+    
+  if (flags.visible && frame.window) {
+    XMapSubwindows(blackbox->getXDisplay(), frame.window);
+    XMapWindow(blackbox->getXDisplay(), frame.window);
+  }
+
+  reconfigure();
+  setState(current_state);
+}
+
+
+void BlackboxWindow::setupDecor() {
+  if (blackbox_attrib.decoration != DecorNone) {
     // start with everything on
     decorations =
       (mwm_decorations & Decor_Titlebar ? Decor_Titlebar : 0) |
@@ -580,11 +598,6 @@ void BlackboxWindow::decorate(void) {
   if (decorations & Decor_Border) {
     frame.fborder_pixel = screen->getWindowStyle()->f_focus.pixel();
     frame.uborder_pixel = screen->getWindowStyle()->f_unfocus.pixel();
-    blackbox_attrib.flags |= AttribDecoration;
-    blackbox_attrib.decoration = DecorNormal;
-  } else {
-    blackbox_attrib.flags |= AttribDecoration;
-    blackbox_attrib.decoration = DecorNone;
   }
 
   if (decorations & Decor_Handle) {
@@ -1387,18 +1400,16 @@ bool BlackboxWindow::getBlackboxHints(void) {
   if (blackbox_hint->flags & AttribDecoration) {
     switch (blackbox_hint->decoration) {
     case DecorNone:
-      enableDecor(False);
+      blackbox_attrib.decoration = DecorNone;
       break;
 
     case DecorTiny:
     case DecorTool:
     case DecorNormal:
     default:
-      enableDecor(True);
+      // blackbox_attrib.decoration defaults to DecorNormal
       break;
     }
-
-    reconfigure();
   }
   
   delete [] blackbox_hint;
@@ -2320,18 +2331,6 @@ void BlackboxWindow::restoreAttributes(void) {
       enableDecor(True);
       break;
     }
-
-    // we can not be shaded if we lack a titlebar
-    if (! (decorations & Decor_Titlebar) && flags.shaded)
-      shade();
-
-    if (flags.visible && frame.window) {
-      XMapSubwindows(blackbox->getXDisplay(), frame.window);
-      XMapWindow(blackbox->getXDisplay(), frame.window);
-    }
-
-    reconfigure();
-    setState(current_state);
   }
 
   // with the state set it will then be the map event's job to read the
@@ -2718,7 +2717,7 @@ void BlackboxWindow::propertyNotifyEvent(const XPropertyEvent *pe) {
     if (isTransient()) {
       functions &= ~Func_Maximize;
       setAllowedActions();
-      enableDecor(True);
+      setupDecor();
     }
 
     reconfigure();
@@ -2762,7 +2761,7 @@ void BlackboxWindow::propertyNotifyEvent(const XPropertyEvent *pe) {
       }
       grabButtons();
       setAllowedActions();
-      enableDecor(True);
+      setupDecor();
     }
 
     Rect old_rect = frame.rect;
@@ -3808,18 +3807,6 @@ void BlackboxWindow::changeBlackboxHints(const BlackboxHints *net) {
       enableDecor(True);
       break;
     }
-
-    // we can not be shaded if we lack a titlebar
-    if (flags.shaded && ! (decorations & Decor_Titlebar))
-      shade();
-
-    if (flags.visible && frame.window) {
-      XMapSubwindows(blackbox->getXDisplay(), frame.window);
-      XMapWindow(blackbox->getXDisplay(), frame.window);
-    }
-
-    reconfigure();
-    setState(current_state);
   }
 }
 
index 17157ffc49508c34fa75b84ef83be08f9e4126b4..2372b5b114f19919d1d98b47551a2e3585d9b488 100644 (file)
@@ -190,7 +190,6 @@ private:
   /*
    * what decorations do we have?
    * this is based on the type of the client window as well as user input
-   * the menu is not really decor, but it goes hand in hand with the decor
    */
   DecorationFlags decorations;
   DecorationFlags mwm_decorations;
@@ -380,6 +379,7 @@ public:
   void beginMove(int x_root, int y_root);
   void beginResize(int x_root, int y_root, Corner dir);
   void enableDecor(bool enable);
+  void setupDecor();
   void setFocusFlag(bool focus);
   void iconify(void);
   void deiconify(bool reassoc = True, bool raise = True);
This page took 0.033231 seconds and 4 git commands to generate.