]> Dogcows Code - chaz/openbox/commitdiff
support better resizing a delta value instead of an absolute value
authorDana Jansens <danakj@orodu.net>
Wed, 7 Aug 2002 16:24:13 +0000 (16:24 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 7 Aug 2002 16:24:13 +0000 (16:24 +0000)
util/epist/screen.cc
util/epist/window.cc

index 9068ed31a0290a5cef245809f43897b9af73995a..c4f0520be54e9e34f90f1ebb14f62ec6ca13441b 100644 (file)
@@ -274,11 +274,11 @@ void screen::handleKeypress(const XEvent &e) {
       return;
       
     case Action::resizeWindowWidth:
-      window->resize(window->width() + it->number(), window->height());
+      window->resize(it->number(), 0);
       return;
       
     case Action::resizeWindowHeight:
-      window->resize(window->width(), window->height() + it->number());
+      window->resize(0, it->number());
       return;
       
     case Action::toggleshade:
index ba952073942b23ae77e3c6ec48bd0f3b7e51e8dd..c8cdf012a4cca4d5e82b3c82302045a2571a4428 100644 (file)
@@ -336,6 +336,33 @@ void XWindow::move(int x, int y) const {
 }
 
 
+void XWindow::resize(int dwidth, int dheight) const {
+  // resize in increments if requested by the window
+
+  unsigned int wdest = _rect.width() + (dwidth * _inc_x) /
+                       _inc_x * _inc_x + _base_x;
+  unsigned int hdest = _rect.height() + (dheight * _inc_y) /
+                       _inc_y * _inc_y + _base_y;
+
+  if (width > wdest) {
+    while (width > wdest)
+      wdest += _inc_x;
+  } else {
+    while (width < wdest)
+      wdest -= _inc_x;
+  }
+  if (height > hdest) {
+    while (height > hdest)
+      hdest += _inc_y;
+  } else {
+    while (height < hdest)
+      hdest -= _inc_y;
+  }
+  
+  XResizeWindow(_epist->getXDisplay(), _window, wdest, hdest);
+}
+
+
 void XWindow::resize(unsigned int width, unsigned int height) const {
   // resize in increments if requested by the window
 
This page took 0.025014 seconds and 4 git commands to generate.