]> Dogcows Code - chaz/openbox/blobdiff - util/epist/screen.cc
cleaned up changeWorkspaceVert() a bit
[chaz/openbox] / util / epist / screen.cc
index 0ec57decab51bd2eaf35c399082139a45065ae4a..3b619e17056d057c275abd717c1bd143a24202e5 100644 (file)
@@ -588,16 +588,26 @@ void screen::changeWorkspaceVert(const int num) const {
   if (width > _num_desktops || width <= 0)
     return;
 
+  int wnum;
+  
+  // a cookie to the person that makes this pretty
   if (num < 0) {
-    int wnum = _active_desktop - width;
-    if (wnum >= 0)
-      changeWorkspace(wnum);
+    wnum = _active_desktop - width;
+    if (wnum < 0) {
+      wnum = _num_desktops/width * width + _active_desktop;
+      if (wnum >= _num_desktops)
+        wnum = _num_desktops - 1;
+    }
   }
   else {
-    int wnum = _active_desktop + width;
-    if (wnum < _num_desktops)
-      changeWorkspace(wnum);
+    wnum = _active_desktop + width;
+    if (wnum >= _num_desktops) {
+      wnum = (_active_desktop + width) % _num_desktops - 1;
+      if (wnum < 0)
+        wnum = 0;
+    }
   }
+  changeWorkspace(wnum);
 }
 
 void screen::changeWorkspaceHorz(const int num) const {
This page took 0.024645 seconds and 4 git commands to generate.