#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)
{ }
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);
};
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) {
void removeWindow(XWindow *window);
XWindow *findWindow(Window window) const;
- list<Action> actions(void) { return _actions; }
+ ActionList actions(void) { return _actions; }
};
#endif // __epist_hh
}
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;
+ }
}
}
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]));
}
}
}
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);
-}
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;
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);
+}
#include <string>
class epist;
+class screen;
class XWindow;
class XAtom;
class XWindow {
private:
epist *_epist;
+ screen *_screen;
XAtom *_xatom;
Window _window;
void updateClass();
public:
- XWindow(epist *epist, Window window);
+ XWindow(epist *epist, screen *screen, Window window);
virtual ~XWindow();
inline Window window() const { return _window; }
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; }
};