]> Dogcows Code - chaz/openbox/blobdiff - src/client.cc
supply the same interface with optional arguments as before. increment callback funct...
[chaz/openbox] / src / client.cc
index 43c35ca8de784d69e0e36c8bd41568128c9b2396..83fd110721ce13350ef8241859f07a5b35ba93d7 100644 (file)
@@ -47,21 +47,19 @@ Client::Client(int screen, Window window)
   _urgent = false;
   _positioned = false;
   _disabled_decorations = 0;
-  _modal = false;
   _modal_child = 0;
   _group = None;
   _desktop = 0;
   
   getArea();
   getDesktop();
+  getState();  // do this before updateTransientFor! (for _modal)
+  getShaped();
 
   updateTransientFor();
   getMwmHints();
   getType(); // this can change the mwmhints for special cases
 
-  getState();
-  getShaped();
-
   updateProtocols();
 
   getGravity();        // get the attribute gravity
@@ -266,11 +264,8 @@ void Client::setupDecorAndFunctions()
         _decorations &= ~Decor_Border;
       if (! (_mwmhints.decorations & MwmDecor_Handle))
         _decorations &= ~Decor_Handle;
-      if (! (_mwmhints.decorations & MwmDecor_Title)) {
+      if (! (_mwmhints.decorations & MwmDecor_Title))
         _decorations &= ~Decor_Titlebar;
-        // if we don't have a titlebar, then we cannot shade!
-        _functions &= ~Func_Shade;
-      }
       if (! (_mwmhints.decorations & MwmDecor_Iconify))
         _decorations &= ~Decor_Iconify;
       if (! (_mwmhints.decorations & MwmDecor_Maximize))
@@ -315,16 +310,17 @@ void Client::setupDecorAndFunctions()
   if (_disabled_decorations & Decor_Close)
     _decorations &= ~Decor_Close;
 
-  // You can't shade without a titlebar
+  // if we don't have a titlebar, then we cannot shade!
   if (!(_decorations & Decor_Titlebar))
     _functions &= ~Func_Shade;
-  
+
   changeAllowedActions();
 
   if (frame) {
     frame->adjustSize(); // change the decors on the frame
     frame->adjustPosition(); // with more/less decorations, we may need to be
                              // moved
+    remaximize(); // with new decor, the window's maximized size may change
   }
 }
 
@@ -1094,9 +1090,16 @@ void Client::clientMessageHandler(const XClientMessageEvent &e)
       setDesktop(openbox->screen(_screen)->desktop());
     if (_shaded)
       shade(false);
-    // XXX: deiconify
     focus();
     openbox->screen(_screen)->raiseWindow(this);
+  } else if (e.message_type == otk::Property::atoms.openbox_active_window) {
+    if (_iconic)
+      setDesktop(openbox->screen(_screen)->desktop());
+    if (e.data.l[0] && _shaded)
+      shade(false);
+    focus();
+    if (e.data.l[1])
+      openbox->screen(_screen)->raiseWindow(this);
   }
 }
 
@@ -1339,6 +1342,21 @@ void Client::changeAllowedActions(void)
 
   otk::Property::set(_window, otk::Property::atoms.net_wm_allowed_actions,
                      otk::Property::atoms.atom, actions, num);
+
+  // make sure the window isn't breaking any rules now
+  
+  if (!(_functions & Func_Shade) && _shaded)
+    if (frame) shade(false);
+    else _shaded = false;
+  if (!(_functions & Func_Iconify) && _iconic)
+    if (frame) setDesktop(openbox->screen(_screen)->desktop());
+    else _iconic = false;
+  if (!(_functions & Func_Fullscreen) && _fullscreen)
+    if (frame) fullscreen(false);
+    else _fullscreen = false;
+  if (!(_functions & Func_Maximize) && (_max_horz || _max_vert))
+    if (frame) maximize(false, 0);
+    else _max_vert = _max_horz = false;
 }
 
 
@@ -1616,7 +1634,6 @@ void Client::installColormap(bool install) const
 {
   XWindowAttributes wa;
   if (XGetWindowAttributes(**otk::display, _window, &wa)) {
-    printf("%snstalling Window Colormap 0x%lx!\n", install ? "I" : "Uni", _window);
     if (install)
       XInstallColormap(**otk::display, wa.colormap);
     else
This page took 0.027628 seconds and 4 git commands to generate.