Patch to fix Epist's buggy 2D workspace

Ava Arachne Jarvis ajar at katanalynx.dyndns.org
Wed Oct 30 05:12:17 EST 2002


The patch is attached.  This fixes three bugs:

  - nextWorkspaceRow went up instead of down, and prevWorkspaceRow went
    down instead of up. (simple change to parser.cc)

  - changeWorkspaceHorz had some issues with the "left-wards" case, 
    caused by calling changeWorkspace once in a special case, then 
    once more at the end of the function.  Oops.  (action.cc)

  - changeWorkspaceVert is conceptually a call to cycleWorkspace with 
    appropriate parameters.  cycleWorkspace seemed to take care of 
    wrapping as well, so I just changed changeWorkspaceVert to call 
    cycleWorkspace....  

Patched against the latest CVS.

-- 
| Women are wiser than men because they know less and understand more.
| 		-- Stephens
-------------- next part --------------
? epist-2dworkspace.patch
Index: util/epist/parser.cc
===================================================================
RCS file: /cvs/cvsroot/openbox/util/epist/parser.cc,v
retrieving revision 1.11
diff -p -u -r1.11 parser.cc
--- util/epist/parser.cc	2002/10/14 12:54:46	1.11
+++ util/epist/parser.cc	2002/10/30 10:02:56
@@ -115,8 +115,8 @@ void parser::setAction(string act)
     { "changeworkspace", Action::changeWorkspace },
     { "nextworkspace", Action::nextWorkspace },
     { "prevworkspace", Action::prevWorkspace },
-    { "nextworkspacerow", Action::upWorkspace },
-    { "prevworkspacerow", Action::downWorkspace },
+    { "nextworkspacerow", Action::downWorkspace },
+    { "prevworkspacerow", Action::upWorkspace },
     { "prevworkspacecolumn", Action::leftWorkspace },
     { "nextworkspacecolumn", Action::rightWorkspace },
     { "nextscreen", Action::nextScreen },
Index: util/epist/screen.cc
===================================================================
RCS file: /cvs/cvsroot/openbox/util/epist/screen.cc,v
retrieving revision 1.83
diff -p -u -r1.83 screen.cc
--- util/epist/screen.cc	2002/10/14 02:50:44	1.83
+++ util/epist/screen.cc	2002/10/30 10:02:56
@@ -706,8 +706,6 @@ void screen::changeWorkspaceVert(const i
   assert(_managed);
   int width = 0;
   int num_desktops = (signed)_num_desktops;
-  int active_desktop = (signed)_active_desktop;
-  int wnum = 0;
 
   _config->getValue(Config::workspaceColumns, width);
 
@@ -715,23 +713,7 @@ void screen::changeWorkspaceVert(const i
     return;
 
   // a cookie to the person that makes this pretty
-  if (num < 0) {
-    wnum = active_desktop - width;
-    if (wnum < 0) {
-      wnum = num_desktops/width * width + active_desktop;
-      if (wnum >= num_desktops)
-        wnum = num_desktops - 1;
-    }
-  }
-  else {
-    wnum = active_desktop + width;
-    if (wnum >= num_desktops) {
-      wnum = (active_desktop + width) % num_desktops - 1;
-      if (wnum < 0)
-        wnum = 0;
-    }
-  }
-  changeWorkspace(wnum);
+  cycleWorkspace(num > 0, width, true);
 }
 
 void screen::changeWorkspaceHorz(const int num) const {
@@ -748,7 +730,7 @@ void screen::changeWorkspaceHorz(const i
 
   if (num < 0) {
     if (active_desktop % width != 0)
-      changeWorkspace(active_desktop - 1);
+      wnum = active_desktop - 1;
     else {
       wnum = active_desktop + width - 1;
       if (wnum >= num_desktops)
@@ -764,6 +746,7 @@ void screen::changeWorkspaceHorz(const i
     else
       wnum = active_desktop - width + 1;
   }
+
   changeWorkspace(wnum);
 }
 


More information about the openbox mailing list