]> Dogcows Code - chaz/openbox/blobdiff - util/epist/screen.cc
toggledecor almost done
[chaz/openbox] / util / epist / screen.cc
index 4a35635740f95e717b04431a5f6b3f7933b07265..1bd7ad5da9b872db8de5f4a19b1ba5bf88db4178 100644 (file)
@@ -279,19 +279,23 @@ void screen::handleKeypress(const XEvent &e) {
       return;
 
     case Action::moveWindowUp:
-      window->move(window->x(), window->y() - it->number());
+      window->move(window->x(), window->y() -
+                   (it->number() != 0 ? it->number(): 1));
       return;
       
     case Action::moveWindowDown:
-      window->move(window->x(), window->y() + it->number());
+      window->move(window->x(), window->y() +
+                   (it->number() != 0 ? it->number(): 1));
       return;
       
     case Action::moveWindowLeft:
-      window->move(window->x() - it->number(), window->y());
+      window->move(window->x() - (it->number() != 0 ? it->number(): 1),
+                   window->y());
       return;
       
     case Action::moveWindowRight:
-      window->move(window->x() + it->number(), window->y());
+      window->move(window->x() + (it->number() != 0 ? it->number(): 1),
+                   window->y());
       return;
       
     case Action::resizeWindowWidth:
@@ -317,6 +321,10 @@ void screen::handleKeypress(const XEvent &e) {
     case Action::toggleMaximizeFull:
       window->toggleMaximize(XWindow::Max_Full);
       return;
+
+    case Action::toggleDecorations:
+      window->decorate(! window->decorated());
+      return;
       
     default:
       assert(false);  // unhandled action type!
@@ -588,52 +596,56 @@ 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);
-    else {
+    wnum = _active_desktop - width;
+    if (wnum < 0) {
       wnum = _num_desktops/width * width + _active_desktop;
       if (wnum >= _num_desktops)
         wnum = _num_desktops - 1;
-      changeWorkspace(wnum);
     }
   }
   else {
-    int wnum = _active_desktop + width;
-    if (wnum < _num_desktops)
-      changeWorkspace(wnum);
-    else {
+    wnum = _active_desktop + width;
+    if (wnum >= _num_desktops) {
       wnum = (_active_desktop + width) % _num_desktops - 1;
       if (wnum < 0)
         wnum = 0;
-      changeWorkspace(wnum);
     }
-     
   }
+  changeWorkspace(wnum);
 }
 
 void screen::changeWorkspaceHorz(const int num) const {
   assert(_managed);
   const Config *conf = _epist->getConfig();
   int width = conf->getNumberValue(Config::workspaceColumns);
-
+  int wnum;
+  
   if (width > _num_desktops || width <= 0)
     return;
 
   if (num < 0) {
     if (_active_desktop % width != 0)
       changeWorkspace(_active_desktop - 1);
-    else
-      changeWorkspace(_active_desktop + width - 1);
+    else {
+      wnum = _active_desktop + width - 1;
+      if (wnum >= _num_desktops)
+        wnum = _num_desktops - 1;
+    }
   }
   else {
-    if (_active_desktop % width != width - 1)
-      changeWorkspace(_active_desktop + 1);
+    if (_active_desktop % width != width - 1) {
+      wnum = _active_desktop + 1;
+      if (wnum >= _num_desktops)
+        wnum = _num_desktops / width * width;
+    }
     else
-      changeWorkspace(_active_desktop - width + 1);
+      wnum = _active_desktop - width + 1;
   }
+  changeWorkspace(wnum);
 }
 
 void screen::grabKey(const KeyCode keyCode, const int modifierMask) const {
This page took 0.026157 seconds and 4 git commands to generate.