From c6234a4de0263828e89e3b8812cbb93e72d13ffc Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 20 Jul 2002 09:28:01 +0000 Subject: [PATCH] add iconifying --- util/epist/actions.hh | 2 +- util/epist/epist.cc | 4 ++++ util/epist/screen.cc | 4 ++++ util/epist/screen.hh | 1 + util/epist/window.cc | 6 ++++++ util/epist/window.hh | 1 + 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/util/epist/actions.hh b/util/epist/actions.hh index 710606ba..6506f0e7 100644 --- a/util/epist/actions.hh +++ b/util/epist/actions.hh @@ -35,7 +35,7 @@ public: enum ActionType { noaction = 0, execute, - iconify, + iconify, //done raise, //done lower, //done close, //done diff --git a/util/epist/epist.cc b/util/epist/epist.cc index 3654150d..7b2b432d 100644 --- a/util/epist/epist.cc +++ b/util/epist/epist.cc @@ -108,6 +108,10 @@ epist::epist(char **argv, char *dpy_name, char *rc_file) XKeysymToKeycode(getXDisplay(), XStringToKeysym("Down")), Mod1Mask)); + _actions.push_back(Action(Action::iconify, + XKeysymToKeycode(getXDisplay(), + XStringToKeysym("I")), + Mod1Mask | ControlMask)); activateGrabs(); } diff --git a/util/epist/screen.cc b/util/epist/screen.cc index db812878..d8d8edca 100644 --- a/util/epist/screen.cc +++ b/util/epist/screen.cc @@ -175,6 +175,10 @@ void screen::handleKeypress(const XEvent &e) { XWindow *window = *_active; switch (it->type()) { + case Action::iconify: + window->iconify(); + return; + case Action::close: window->close(); return; diff --git a/util/epist/screen.hh b/util/epist/screen.hh index 55b0babd..7b500d03 100644 --- a/util/epist/screen.hh +++ b/util/epist/screen.hh @@ -60,6 +60,7 @@ public: inline Window rootWindow() const { return _root; } inline bool managed() const { return _managed; } + inline int number() const { return _number; } void processEvent(const XEvent &e); diff --git a/util/epist/window.cc b/util/epist/window.cc index 592aa73e..c2dff72a 100644 --- a/util/epist/window.cc +++ b/util/epist/window.cc @@ -164,3 +164,9 @@ void XWindow::raise() const { void XWindow::lower() const { XLowerWindow(_epist->getXDisplay(), _window); } + + +void XWindow::iconify() const { + _xatom->sendClientMessage(_screen->rootWindow(), XAtom::wm_change_state, + _window, IconicState); +} diff --git a/util/epist/window.hh b/util/epist/window.hh index 3b118375..29e2d6ff 100644 --- a/util/epist/window.hh +++ b/util/epist/window.hh @@ -84,6 +84,7 @@ public: void close() const; void raise() const; void lower() const; + void iconify() const; bool operator == (const XWindow &w) const { return w._window == _window; } bool operator == (const Window &w) const { return w == _window; } -- 2.39.2