]> Dogcows Code - chaz/openbox/commitdiff
added window cycling
authorDana Jansens <danakj@orodu.net>
Sat, 20 Jul 2002 09:02:45 +0000 (09:02 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 20 Jul 2002 09:02:45 +0000 (09:02 +0000)
util/epist/actions.hh
util/epist/epist.cc
util/epist/screen.cc
util/epist/screen.hh

index b211bf9d5599b3c29064b18b85e9cf189327f20d..11c262e0adc84b5ef5ef8555a380899710306d2e 100644 (file)
@@ -39,7 +39,7 @@ public:
     raiseWindow,
     lowerWindow,
     closeWindow,
-    shade,
+    toggleshade,
     moveWindowUp,
     moveWindowDown,
     moveWindowLeft,
index 3eac87839fde4e8591a791ba4ef09e5436227545..3fb064631d3ade4bd04f78e33577fff548a8ab3a 100644 (file)
@@ -79,15 +79,23 @@ epist::epist(char **argv, char *dpy_name, char *rc_file)
   _actions.push_back(Action(Action::nextWorkspace,
                             XKeysymToKeycode(getXDisplay(),
                                              XStringToKeysym("Tab")),
-                            Mod1Mask));
+                            ControlMask));
   _actions.push_back(Action(Action::prevWorkspace,
                            XKeysymToKeycode(getXDisplay(),
                                              XStringToKeysym("Tab")),
-                           ControlMask));
-  _actions.push_back(Action(Action::shade,
+                           ControlMask | ShiftMask));
+  _actions.push_back(Action(Action::toggleshade,
                             XKeysymToKeycode(getXDisplay(),
                                              XStringToKeysym("F5")),
                             Mod1Mask));
+  _actions.push_back(Action(Action::nextWindow,
+                            XKeysymToKeycode(getXDisplay(),
+                                             XStringToKeysym("Tab")),
+                            Mod1Mask));
+  _actions.push_back(Action(Action::prevWindow,
+                           XKeysymToKeycode(getXDisplay(),
+                                             XStringToKeysym("Tab")),
+                           Mod1Mask | ShiftMask));
   activateGrabs();
 }
 
index 475a96e20f95581b766e4aec3f44ece9e3580ccf..0d97b6143a301c661370c96a6ba4bb65e3c44cd4 100644 (file)
@@ -157,6 +157,14 @@ void screen::handleKeypress(const XEvent &e) {
         cycleWorkspace(false);
         return;
 
+      case Action::nextWindow:
+        cycleWindow(true);
+        return;
+
+      case Action::prevWindow:
+        cycleWindow(false);
+        return;
+
       case Action::changeWorkspace:
         changeWorkspace(it->number());
         return;
@@ -167,7 +175,7 @@ void screen::handleKeypress(const XEvent &e) {
         XWindow *window = *_active;
 
         switch (it->type()) {
-        case Action::shade:
+        case Action::toggleshade:
           window->shade(! window->shaded());
           return;
         }
@@ -274,6 +282,37 @@ void screen::updateActiveWindow() {
       }
  */
 
+
+void screen::cycleWindow(const bool forward) const {
+  if (_clients.empty()) return;
+    
+  WindowList::const_iterator target = _active;
+
+  if (target == _clients.end())
+    target = _clients.begin();
+  do {
+    if (forward) {
+      ++target;
+      if (target == _clients.end())
+        target = _clients.begin();
+    } else {
+      if (target == _clients.begin())
+        target = _clients.end();
+      --target;
+    }
+  } while (target == _clients.end() || (*target)->iconic());
+  
+  if (target != _clients.end()) {
+    // we dont send an ACTIVE_WINDOW client message because that would also
+    // unshade the window if it was shaded
+    XSetInputFocus(_epist->getXDisplay(), (*target)->window(), RevertToNone,
+                   CurrentTime);
+    XRaiseWindow(_epist->getXDisplay(), (*target)->window());
+  }
+}
+
+
 void screen::cycleWorkspace(const bool forward) const {
   unsigned long currentDesktop = 0;
   unsigned long numDesktops = 0;
@@ -297,6 +336,7 @@ void screen::cycleWorkspace(const bool forward) const {
   }
 }
 
+
 void screen::changeWorkspace(const int num) const {
   _xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root, num);
 }
index 42e685de87a7a81dddcce4d5b6ce191cee51a254..55b0babd04f4147cb0d09dce19f30fbf6243c435 100644 (file)
@@ -65,8 +65,9 @@ public:
 
   void handleKeypress(const XEvent &e);
 
-  void cycleWorkspace(const bool forward)const;
-  void changeWorkspace(const int num)const;
+  void cycleWindow(const bool forward) const;
+  void cycleWorkspace(const bool forward) const;
+  void changeWorkspace(const int num) const;
   void toggleShaded(const Window win) const;
 };
 
This page took 0.027211 seconds and 4 git commands to generate.