all repos — openbox @ c517f511000c8ec775f7413527b9e276b7995806

openbox fork - make it a bit more like ryudo

some cleanups and such.
Dana Jansens danakj@orodu.net
commit

c517f511000c8ec775f7413527b9e276b7995806

parent

b4411cb1ef1c25a287181b570e974545e1010530

M util/epist/actions.ccutil/epist/actions.cc

@@ -22,7 +22,7 @@ // DEALINGS IN THE SOFTWARE.

#include "actions.hh" -Action::Action(enum ActionType type, KeyCode keycode, int modifierMask, +Action::Action(enum ActionType type, KeyCode keycode, unsigned int modifierMask, int num): _type(type), _keycode(keycode), _modifierMask(modifierMask), _numberParam(num) { }
M util/epist/actions.hhutil/epist/actions.hh

@@ -73,16 +73,16 @@

private: enum ActionType _type; const KeyCode _keycode; - const int _modifierMask; + const unsigned 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 unsigned 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, unsigned int modifierMask, int number = 0); };
M util/epist/epist.ccutil/epist/epist.cc

@@ -138,6 +138,7 @@ root = e->xkey.root;

else root = e->xany.window; + cout << "event\n"; ScreenList::const_iterator it, end = _screens.end(); for (it = _screens.begin(); it != end; ++it) { if ((*it)->rootWindow() == root) {
M util/epist/epist.hhutil/epist/epist.hh

@@ -67,7 +67,7 @@ void addWindow(XWindow *window);

void removeWindow(XWindow *window); XWindow *findWindow(Window window) const; - list<Action> actions(void) { return _actions; } + ActionList actions(void) { return _actions; } }; #endif // __epist_hh
M util/epist/screen.ccutil/epist/screen.cc

@@ -143,28 +143,32 @@ }

} void screen::handleKeypress(const XEvent &e) { - list<Action>::const_iterator it = _epist->actions().begin(); - list<Action>::const_iterator end = _epist->actions().end(); + ActionList::const_iterator it = _epist->actions().begin(); + ActionList::const_iterator end = _epist->actions().end(); + cout << "key press\n"; for (; it != end; ++it) { if (e.xkey.keycode == it->keycode() && - e.xkey.state == it->modifierMask() ) - { - switch (it->type()) { - case Action::nextWorkspace: - cycleWorkspace(true); - break; - case Action::prevWorkspace: - cycleWorkspace(false); - break; - case Action::changeWorkspace: - changeWorkspace(it->number()); - break; - case Action::shade: - toggleShaded((*_active)->window()); - break; - } + e.xkey.state == it->modifierMask()) { + switch (it->type()) { + case Action::nextWorkspace: + cycleWorkspace(true); + break; + + case Action::prevWorkspace: + cycleWorkspace(false); + break; + + case Action::changeWorkspace: + changeWorkspace(it->number()); + break; + + case Action::shade: + (*_active)->shade(! (*_active)->shaded()); break; } + + break; + } } }

@@ -216,7 +220,8 @@ break;

if (it == end) { // didn't already exist if (doAddWindow(rootclients[i])) { cout << "Added window: 0x" << hex << rootclients[i] << dec << endl; - _clients.insert(insert_point, new XWindow(_epist, rootclients[i])); + _clients.insert(insert_point, new XWindow(_epist, this, + rootclients[i])); } } }

@@ -291,8 +296,3 @@

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); -}
M util/epist/window.ccutil/epist/window.cc

@@ -31,12 +31,13 @@ using std::endl;

using std::hex; using std::dec; -#include "window.hh" #include "epist.hh" +#include "screen.hh" +#include "window.hh" #include "../../src/XAtom.hh" -XWindow::XWindow(epist *epist, Window window) - : _epist(epist), _xatom(epist->xatom()), _window(window) { +XWindow::XWindow(epist *epist, screen *screen, Window window) + : _epist(epist), _screen(screen), _xatom(epist->xatom()), _window(window) { _unmapped = false;

@@ -140,3 +141,9 @@ _unmapped = true;

break; } } + + +void XWindow::shade(const bool sh) const { + _xatom->sendClientMessage(_screen->rootWindow(), XAtom::net_wm_state, + _window, (sh ? 1 : 0), XAtom::net_wm_state_shaded); +}
M util/epist/window.hhutil/epist/window.hh

@@ -31,6 +31,7 @@ #include <list>

#include <string> class epist; +class screen; class XWindow; class XAtom;

@@ -39,6 +40,7 @@

class XWindow { private: epist *_epist; + screen *_screen; XAtom *_xatom; Window _window;

@@ -61,7 +63,7 @@ void updateTitle();

void updateClass(); public: - XWindow(epist *epist, Window window); + XWindow(epist *epist, screen *screen, Window window); virtual ~XWindow(); inline Window window() const { return _window; }

@@ -77,6 +79,8 @@ inline bool maxVert() const { return _max_vert; }

inline bool maxHorz() const { return _max_horz; } void processEvent(const XEvent &e); + + void shade(const bool sh) const; bool operator == (const XWindow &w) const { return w._window == _window; } bool operator == (const Window &w) const { return w == _window; }