]> Dogcows Code - chaz/openbox/commitdiff
Added changeWorkspace() and a broken toggleShaded()
authorScott Moynes <smoynes@nexus.carleton.ca>
Sat, 20 Jul 2002 01:44:01 +0000 (01:44 +0000)
committerScott Moynes <smoynes@nexus.carleton.ca>
Sat, 20 Jul 2002 01:44:01 +0000 (01:44 +0000)
util/epist/actions.cc
util/epist/actions.hh
util/epist/epist.cc
util/epist/screen.cc
util/epist/screen.hh

index d4beaacb7df62aa9d53ca866ae8a2330c0093e94..ac4fc4ab0c842372b80680bf1d7a81531a6061e2 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "actions.hh"
 
-Action::Action(enum ActionType type, KeyCode keycode, int modifierMask):
-  _type(type), _keycode(keycode), _modifierMask(modifierMask)
+Action::Action(enum ActionType type, KeyCode keycode, int modifierMask,
+               int num): _type(type), _keycode(keycode),
+                         _modifierMask(modifierMask), _numberParam(num)
 { }
index 9a7a60435340dc36b951e5b54f8228b2ffe19ebf..09ee523f2ed8ca26ce60dfe8b3ff9482f984cf8c 100644 (file)
@@ -47,15 +47,15 @@ public:
 
     nextWindow,
     prevWindow,
-    nextWindowOnAllDesktops,
-    prevWindowOnAllDesktops,
+    nextWindowOnAllWorkspaces,
+    prevWindowOnAllWorkspaces,
 
     nextWindowOfClass,
     prevWindowOfClass,
 
-    changeDesktop,
-    nextDesktop,
-    prevDesktop,
+    changeWorkspace, //done
+    nextWorkspace, //done
+    prevWorkspace, //done
 
     // these are openbox extensions
     showRootMenu,
@@ -74,13 +74,16 @@ private:
   enum ActionType _type;
   const KeyCode _keycode;
   const int _modifierMask;
-  
+
+  const int _numberParam;
 public:
   inline enum ActionType type() const { return _type;}
   inline const KeyCode keycode() const { return _keycode; }
   inline const int modifierMask() const { return _modifierMask; }
+  inline const int number() const { return _numberParam; }
 
-  Action(enum ActionType type, KeyCode keycode, int modifierMask);
+  Action(enum ActionType type, KeyCode keycode, int modifierMask,
+         int number = 0);
 };
   
 typedef std::list<Action> ActionList;
index a9d017928c5148d5e5cdf077d6f222e29e4714cd..6296fe03fd51b5f5d88006ee8079afa073116733 100644 (file)
@@ -76,14 +76,18 @@ epist::epist(char **argv, char *dpy_name, char *rc_file)
     ::exit(1);
   }
 
-  _actions.push_back(Action(Action::nextDesktop,
+  _actions.push_back(Action(Action::nextWorkspace,
                             XKeysymToKeycode(getXDisplay(),
                                              XStringToKeysym("Tab")),
                             Mod1Mask));
-  _actions.push_back(Action(Action::prevDesktop,
+  _actions.push_back(Action(Action::prevWorkspace,
                            XKeysymToKeycode(getXDisplay(),
                                              XStringToKeysym("Tab")),
                            ControlMask));
+  _actions.push_back(Action(Action::shade,
+                            XKeysymToKeycode(getXDisplay(),
+                                             XStringToKeysym("F5")),
+                            Mod1Mask));
   activateGrabs();
 }
 
@@ -92,11 +96,6 @@ epist::~epist() {
   delete _xatom;
 }
 
-
-//   XGrabKey(_epist->getXDisplay(), XKeysymToKeycode(_epist->getXDisplay(),
-//                                            XStringToKeysym("F5")),
-//            Mod1Mask, _root, True, GrabModeAsync, GrabModeAsync);
-                  
 void epist::activateGrabs() {
 
   ScreenList::const_iterator scrit, scrend = _screens.end();
index d8f055401645cd7b39e4e55a5705eb7a74d60cbb..afe5b8d1e6b53e00f952dbceb45f7ca149ad1919 100644 (file)
@@ -150,12 +150,18 @@ void screen::handleKeypress(const XEvent &e) {
         e.xkey.state == it->modifierMask() )
       {
         switch (it->type()) {
-        case Action::nextDesktop:
+        case Action::nextWorkspace:
           cycleWorkspace(true);
           break;
-        case Action::prevDesktop:
+        case Action::prevWorkspace:
           cycleWorkspace(false);
           break;
+        case Action::changeWorkspace:
+          changeWorkspace(it->number());
+          break;
+        case Action::shade:
+          toggleShaded((*_active)->window());
+          break;
         }
         break;
       }
@@ -259,9 +265,7 @@ void screen::updateActiveWindow() {
       }
  */
 
-void screen::cycleWorkspace(const bool forward) {
-  cout << "blef" << endl;
-
+void screen::cycleWorkspace(const bool forward) const {
   unsigned long currentDesktop = 0;
   unsigned long numDesktops = 0;
   
@@ -272,9 +276,6 @@ void screen::cycleWorkspace(const bool forward) {
     else
       --currentDesktop;
 
-    cout << currentDesktop << endl;
-
-    
     _xatom->getValue(_root, XAtom::net_number_of_desktops, XAtom::cardinal,
                      numDesktops);
     
@@ -283,10 +284,15 @@ void screen::cycleWorkspace(const bool forward) {
     else if (currentDesktop >= numDesktops)
       currentDesktop = 0;
 
-    
-    _xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root,
-                              currentDesktop);
-    
+    changeWorkspace(currentDesktop);
   }
 }
-                                               
+
+void screen::changeWorkspace(const int num) const {
+  _xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root, num);
+}
+
+void screen::toggleShaded(const Window win) const {
+  _xatom->sendClientMessage(_root, XAtom::net_wm_state, win, 2,
+                            XAtom::net_wm_state_shaded);
+}
index 06b2cb0936d398b81333f82719bf45f08f5da1a5..42e685de87a7a81dddcce4d5b6ce191cee51a254 100644 (file)
@@ -65,7 +65,9 @@ public:
 
   void handleKeypress(const XEvent &e);
 
-  void cycleWorkspace(const bool forward);
+  void cycleWorkspace(const bool forward)const;
+  void changeWorkspace(const int num)const;
+  void toggleShaded(const Window win) const;
 };
 
 #endif // __screen_hh
This page took 0.029845 seconds and 4 git commands to generate.