moveWindowLeft, //done
moveWindowRight, //done
- toggleMaximizeFull,
- toggleMaximizeVertical,
- toggleMaximizeHorizontal,
+ toggleMaximizeFull, //done
+ toggleMaximizeVertical, //done
+ toggleMaximizeHorizontal, //done
sendToWorkspace, //done
XKeysymToKeycode(getXDisplay(),
XStringToKeysym("O")),
Mod1Mask | ControlMask));
+ _actions.push_back(Action(Action::toggleMaximizeHorizontal,
+ XKeysymToKeycode(getXDisplay(),
+ XStringToKeysym("X")),
+ ShiftMask | Mod1Mask));
+ _actions.push_back(Action(Action::toggleMaximizeVertical,
+ XKeysymToKeycode(getXDisplay(),
+ XStringToKeysym("X")),
+ ShiftMask | ControlMask));
+ _actions.push_back(Action(Action::toggleMaximizeFull,
+ XKeysymToKeycode(getXDisplay(),
+ XStringToKeysym("X")),
+ Mod1Mask | ControlMask));
_actions.push_back(Action(Action::changeWorkspace,
XKeysymToKeycode(getXDisplay(),
XStringToKeysym("1")),
window->shade(! window->shaded());
return;
+ case Action::toggleMaximizeHorizontal:
+ window->toggleMaximize(XWindow::Max_Horz);
+ return;
+
+ case Action::toggleMaximizeVertical:
+ window->toggleMaximize(XWindow::Max_Vert);
+ return;
+
+ case Action::toggleMaximizeFull:
+ window->toggleMaximize(XWindow::Max_Full);
+ return;
+
default:
assert(false); // unhandled action type!
break;
findFramePosition(fx, fy);
XMoveWindow(_epist->getXDisplay(), _window, fx + x, fy + y);
}
+
+
+void XWindow::toggleMaximize(Max max) const {
+ switch (max) {
+ case Max_Full:
+ _xatom->
+ sendClientMessage(_screen->rootWindow(), XAtom::net_wm_state,
+ _window, (_max_vert == _max_horz ? 2 : 1),
+ _xatom->getAtom(XAtom::net_wm_state_maximized_horz),
+ _xatom->getAtom(XAtom::net_wm_state_maximized_vert));
+ break;
+
+ case Max_Horz:
+ _xatom->
+ sendClientMessage(_screen->rootWindow(), XAtom::net_wm_state,
+ _window, 2,
+ _xatom->getAtom(XAtom::net_wm_state_maximized_horz));
+ break;
+
+ case Max_Vert:
+ _xatom->
+ sendClientMessage(_screen->rootWindow(), XAtom::net_wm_state,
+ _window, 2,
+ _xatom->getAtom(XAtom::net_wm_state_maximized_vert));
+ break;
+
+ case Max_None:
+ assert(false); // you should not do this. it is pointless and probly a bug
+ break;
+ }
+}
+
+
+void XWindow::maximize(Max max) const {
+ switch (max) {
+ case Max_None:
+ _xatom->
+ sendClientMessage(_screen->rootWindow(), XAtom::net_wm_state,
+ _window, 0,
+ _xatom->getAtom(XAtom::net_wm_state_maximized_horz),
+ _xatom->getAtom(XAtom::net_wm_state_maximized_vert));
+ break;
+
+ case Max_Full:
+ _xatom->
+ sendClientMessage(_screen->rootWindow(), XAtom::net_wm_state,
+ _window, 1,
+ _xatom->getAtom(XAtom::net_wm_state_maximized_horz),
+ _xatom->getAtom(XAtom::net_wm_state_maximized_vert));
+ break;
+
+ case Max_Horz:
+ _xatom->
+ sendClientMessage(_screen->rootWindow(), XAtom::net_wm_state,
+ _window, 1,
+ _xatom->getAtom(XAtom::net_wm_state_maximized_horz));
+ break;
+
+ case Max_Vert:
+ _xatom->
+ sendClientMessage(_screen->rootWindow(), XAtom::net_wm_state,
+ _window, 1,
+ _xatom->getAtom(XAtom::net_wm_state_maximized_vert));
+ break;
+ }
+}
typedef std::list<XWindow *> WindowList;
class XWindow {
+public:
+ enum Max {
+ Max_None,
+ Max_Horz,
+ Max_Vert,
+ Max_Full
+ };
+
private:
epist *_epist;
screen *_screen;
void focus() const;
void sendTo(unsigned int dest) const;
void move(int x, int y) const;
+ void toggleMaximize(Max max) const; // i hate toggle functions
+ void maximize(Max max) const;
bool operator == (const XWindow &w) const { return w._window == _window; }
bool operator == (const Window &w) const { return w == _window; }