patch for epist resize

Fabian Sturm f at rtfs.org
Thu Sep 12 23:07:14 EDT 2002


Hello!

I didnt manage to get the resize of windows with epist working
so I changed the code a little bit to what I think is correct.
But I am no X programmer so it is just a guess.

The Patch was against the testing version but the code
seems to be the same in the cvs too so it should apply to both.

Maybe its usefull.

Sincerly Fabian Sturm


--- openbox-2.0.0/util/epist/window.cc	Thu Aug 15 12:21:32 2002
+++ myopenbox-2.0.0/util/epist/window.cc	Thu Sep 12 19:27:04 2002
@@ -339,9 +339,21 @@ void XWindow::move(int x, int y) const {
 void XWindow::resizeRel(int dwidth, int dheight) const {
   // resize in increments if requested by the window
   unsigned int width = _rect.width(), height = _rect.height();
-  
-  unsigned int wdest = width + (dwidth * _inc_x) / _inc_x * _inc_x + _base_x;
-  unsigned int hdest = height + (dheight * _inc_y) / _inc_y * _inc_y + _base_y;
+  unsigned int wdest = width, hdest = height;
+
+  if (dwidth != 0) {
+    if (dwidth > 0) 
+      wdest = width + (dwidth < _inc_x ? _inc_x : (dwidth / _inc_x) * _inc_x);
+    else
+      wdest = width + (dwidth > -_inc_x ? -_inc_x : (dwidth / _inc_x) * _inc_x);
+  }
+
+  if (dheight != 0) {
+    if (dheight > 0) 
+      hdest = height + (dheight < _inc_y ? _inc_y : (dheight / _inc_y) * _inc_y);
+    else
+      hdest = height + (dheight > -_inc_y ? -_inc_y : (dheight / _inc_y) * _inc_y);
+  }
 
   XResizeWindow(_epist->getXDisplay(), _window, wdest, hdest);
 }




More information about the openbox mailing list