]> Dogcows Code - chaz/openbox/commitdiff
better support for relative resizing
authorDana Jansens <danakj@orodu.net>
Wed, 7 Aug 2002 16:27:27 +0000 (16:27 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 7 Aug 2002 16:27:27 +0000 (16:27 +0000)
util/epist/screen.cc
util/epist/window.cc
util/epist/window.hh

index c4f0520be54e9e34f90f1ebb14f62ec6ca13441b..a98e0ad14c24b1e3e4b269e90ed8c3f71aa9afcd 100644 (file)
@@ -274,11 +274,11 @@ void screen::handleKeypress(const XEvent &e) {
       return;
       
     case Action::resizeWindowWidth:
-      window->resize(it->number(), 0);
+      window->resizeRel(it->number(), 0);
       return;
       
     case Action::resizeWindowHeight:
-      window->resize(0, it->number());
+      window->resizeRel(0, it->number());
       return;
       
     case Action::toggleshade:
index c8cdf012a4cca4d5e82b3c82302045a2571a4428..31787e6dcf6dbc52ea91c44b77976321533f808f 100644 (file)
@@ -336,34 +336,18 @@ void XWindow::move(int x, int y) const {
 }
 
 
-void XWindow::resize(int dwidth, int dheight) const {
+void XWindow::resizeRel(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;
-  }
+  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;
+
   XResizeWindow(_epist->getXDisplay(), _window, wdest, hdest);
 }
 
 
-void XWindow::resize(unsigned int width, unsigned int height) const {
+void XWindow::resizeAbs(unsigned int width, unsigned int height) const {
   // resize in increments if requested by the window
 
   unsigned int wdest = width / _inc_x * _inc_x + _base_x;
index 65ceda7bebf2302ff5c9c9b80c6110229ac46d03..c245299346f3802b7ea347addf426a9e8afcca73 100644 (file)
@@ -111,7 +111,8 @@ public:
   void focus() const;
   void sendTo(unsigned int dest) const;
   void move(int x, int y) const;
-  void resize(unsigned int width, unsigned int height) const;
+  void resizeRel(int dwidth, int dheight) const;
+  void resizeAbs(unsigned int width, unsigned int height) const;
   void toggleMaximize(Max max) const; // i hate toggle functions
   void maximize(Max max) const;
 
This page took 0.029974 seconds and 4 git commands to generate.