]> Dogcows Code - chaz/openbox/blobdiff - src/client.cc
rm a XXX.. comment it out :)
[chaz/openbox] / src / client.cc
index e0d68db406749b245a435439429a3e25e40ffd7d..3cd41d72fce2d4b89afe613d2bd43663cc9359d2 100644 (file)
@@ -495,7 +495,7 @@ void Client::updateNormalHints()
       // changing its gravity
       if (frame && _gravity != oldgravity) {
         // move our idea of the client's position based on its new gravity
-        int x, y;
+        int x = frame->rect().x(), y = frame->rect().y();
         frame->frameGravity(x, y);
         _area.setPos(x, y);
       }
@@ -1149,6 +1149,8 @@ void Client::internal_resize(Corner anchor, int w, int h, bool user,
 void Client::move(int x, int y)
 {
   if (!(_functions & Func_Move)) return;
+  frame->frameGravity(x, y); // get the client's position based on x,y for the
+                             // frame
   internal_move(x, y);
 }
 
@@ -1284,6 +1286,22 @@ void Client::changeAllowedActions(void)
 }
 
 
+void Client::remaximize()
+{
+  int dir;
+  if (_max_horz && _max_vert)
+    dir = 0;
+  else if (_max_horz)
+    dir = 1;
+  else if (_max_vert)
+    dir = 2;
+  else
+    return; // not maximized
+  _max_horz = _max_vert = false;
+  maximize(true, dir, false);
+}
+
+
 void Client::applyStartupState()
 {
   // these are in a carefully crafted order..
@@ -1360,18 +1378,11 @@ void Client::maximize(bool max, int dir, bool savearea)
     if (dir == 2 && !_max_vert) return;
   }
 
-  int g = _gravity;
-  
   const otk::Rect &a = openbox->screen(_screen)->area();
-  int x = _area.x(), y = _area.y(), w = _area.width(), h = _area.height();
+  int x = frame->rect().x(), y = frame->rect().y(),
+    w = _area.width(), h = _area.height();
   
   if (max) {
-    // when maximizing, put the client where we want, NOT the frame!
-    _gravity = StaticGravity;
-    // adjust our idea of position based on StaticGravity, so we stay put
-    // unless asked
-    frame->frameGravity(x, y);
-
     if (savearea) {
       long dimensions[4];
       long *readdim;
@@ -1409,7 +1420,7 @@ void Client::maximize(bool max, int dir, bool savearea)
       w = a.width();
     }
     if (dir == 0 || dir == 2) { // vert
-      y = a.y() + frame->size().top;
+      y = a.y();
       h = a.height() - frame->size().top - frame->size().bottom;
     }
   } else {
@@ -1441,24 +1452,20 @@ void Client::maximize(bool max, int dir, bool savearea)
         h = a.height() / 2;
       }
     }
-    otk::Property::erase(_window, otk::Property::atoms.openbox_premax);
   }
 
   if (dir == 0 || dir == 1) // horz
     _max_horz = max;
   if (dir == 0 || dir == 2) // vert
     _max_vert = max;
+
+  if (!_max_horz && !_max_vert)
+    otk::Property::erase(_window, otk::Property::atoms.openbox_premax);
+
   changeState(); // change the state hints on the client
 
+  frame->frameGravity(x, y); // figure out where the client should be going
   internal_resize(TopLeft, w, h, true, x, y);
-  _gravity = g;
-  if (max) {
-    // because of my little gravity trick in here, we have to set the position
-    // of the client to what it really is
-    int x, y;
-    frame->frameGravity(x, y);
-    _area.setPos(x, y);
-  }
 }
 
 
This page took 0.025594 seconds and 4 git commands to generate.