]> Dogcows Code - chaz/openbox/commitdiff
configure request optimizations
authorDana Jansens <danakj@orodu.net>
Sat, 4 Jan 2003 07:24:40 +0000 (07:24 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 4 Jan 2003 07:24:40 +0000 (07:24 +0000)
src/client.cc
src/client.hh
src/openbox_wrap.cc

index 289fcf165112e66e1163f15fbc96894c3a65596a..80869e1529da394f06baa71feb7adb5b737eb97f 100644 (file)
@@ -802,7 +802,7 @@ void OBClient::shapeHandler(const XShapeEvent &e)
 #endif
 
 
-void OBClient::resize(Corner anchor, int w, int h)
+void OBClient::resize(Corner anchor, int w, int h, int x, int y)
 {
   w -= _base_size.x(); 
   h -= _base_size.y();
@@ -835,23 +835,27 @@ void OBClient::resize(Corner anchor, int w, int h)
   w += _base_size.x();
   h += _base_size.y();
 
-  int x = _area.x(), y = _area.y();  
-  switch (anchor) {
-  case TopLeft:
-    break;
-  case TopRight:
-    x -= w - _area.width();
-    break;
-  case BottomLeft:
-    y -= h - _area.height();
-    break;
-  case BottomRight:
-    x -= w - _area.width();
-    y -= h - _area.height();
-    break;
+  if (x == INT_MIN || y == INT_MIN) {
+    x = _area.x();
+    y = _area.y();
+    switch (anchor) {
+    case TopLeft:
+      break;
+    case TopRight:
+      x -= w - _area.width();
+      break;
+    case BottomLeft:
+      y -= h - _area.height();
+      break;
+    case BottomRight:
+      x -= w - _area.width();
+      y -= h - _area.height();
+      break;
+    }
   }
 
   _area.setSize(w, h);
+
   XResizeWindow(otk::OBDisplay::display, _window, w, h);
 
   // resize the frame to match the request
@@ -863,6 +867,7 @@ void OBClient::resize(Corner anchor, int w, int h)
 void OBClient::move(int x, int y)
 {
   _area.setPos(x, y);
+
   // move the frame to be in the requested position
   frame->adjustPosition();
 }
@@ -1048,10 +1053,14 @@ void OBClient::configureRequestHandler(const XConfigureRequestEvent &e)
       corner = TopLeft;
     }
 
-    resize(corner, w, h);
-  }
-
-  if (e.value_mask & (CWX | CWY)) {
+    // if moving AND resizing ...
+    if (e.value_mask & (CWX | CWY)) {
+      int x = (e.value_mask & CWX) ? e.x : _area.x();
+      int y = (e.value_mask & CWY) ? e.y : _area.y();
+      resize(corner, w, h, x, y);
+    } else // if JUST resizing...
+      resize(corner, w, h);
+  } else if (e.value_mask & (CWX | CWY)) { // if JUST moving...
     int x = (e.value_mask & CWX) ? e.x : _area.x();
     int y = (e.value_mask & CWY) ? e.y : _area.y();
     move(x, y);
index 927fc2f1878141ad4fdc12157fa8a67229101c7b..80c6e4ee159530a5bbd7ade87663491f16ad6156 100644 (file)
@@ -431,11 +431,17 @@ public:
   //! Resizes the client window, anchoring it in a given corner
   /*!
     This also maintains things like the client's minsize, and size increments.
-    @param anchor The corner to keep in the same position when resizing
-    @param x The X component of the new size for the client
-    @param y The Y component of the new size for the client
+    @param anchor The corner to keep in the same position when resizing.
+    @param w The width component of the new size for the client.
+    @param h The height component of the new size for the client.
+    @param x An optional X coordinate to which the window will be moved
+             after resizing.
+    @param y An optional Y coordinate to which the window will be moved
+             after resizing.
+    The x and y coordinates must both be sepcified together, or they will have
+    no effect. When they are specified, the anchor is ignored.
   */
-  void resize(Corner anchor, int x, int y);
+  void resize(Corner anchor, int w, int h, int x = INT_MIN, int y = INT_MIN);
 
   //! Request the client to close its window.
   void close();
index 3a81b9fde691fa5cfed57ff9bf161172662e33bd..f4212c82d30b9f7a5a42acc9f9a96182b1ba9aa9 100644 (file)
@@ -2282,11 +2282,13 @@ static PyObject *_wrap_OBClient_resize(PyObject *self, PyObject *args) {
     int arg2 ;
     int arg3 ;
     int arg4 ;
+    int arg5 = (int) INT_MIN ;
+    int arg6 = (int) INT_MIN ;
     PyObject * obj0  = 0 ;
     
-    if(!PyArg_ParseTuple(args,(char *)"Oiii:OBClient_resize",&obj0,&arg2,&arg3,&arg4)) goto fail;
+    if(!PyArg_ParseTuple(args,(char *)"Oiii|ii:OBClient_resize",&obj0,&arg2,&arg3,&arg4,&arg5,&arg6)) goto fail;
     if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
-    (arg1)->resize((ob::OBClient::Corner )arg2,arg3,arg4);
+    (arg1)->resize((ob::OBClient::Corner )arg2,arg3,arg4,arg5,arg6);
     
     Py_INCREF(Py_None); resultobj = Py_None;
     return resultobj;
This page took 0.035782 seconds and 4 git commands to generate.