From eb078ab8cf97634bff08979c43d9a238fca2b501 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sun, 18 Jan 2004 19:14:08 +0000 Subject: support for _NET_WM_STATE_HIDDEN and _NET_WM_STATE_SKIP_TASKBAR --- src/Ewmh.cc | 51 ++++++++++++++++++++++++++++++--------------------- src/Ewmh.hh | 5 ++++- src/Window.cc | 30 ++++++++++++++++-------------- src/Window.hh | 8 +++++--- 4 files changed, 55 insertions(+), 39 deletions(-) diff --git a/src/Ewmh.cc b/src/Ewmh.cc index f78432b..7b761d1 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Ewmh.cc,v 1.36 2003/12/19 00:36:53 fluxgen Exp $ +// $Id: Ewmh.cc,v 1.37 2004/01/18 19:12:11 fluxgen Exp $ #include "Ewmh.hh" @@ -78,6 +78,8 @@ void Ewmh::initForScreen(BScreen &screen) { m_net_wm_state_maximized_horz, m_net_wm_state_maximized_vert, m_net_wm_state_fullscreen, + m_net_wm_state_hidden, + m_net_wm_state_skip_taskbar, m_net_wm_desktop, @@ -102,24 +104,26 @@ void Ewmh::initForScreen(BScreen &screen) { void Ewmh::setupClient(WinClient &winclient) { updateStrut(winclient); + } void Ewmh::setupFrame(FluxboxWindow &win) { - Atom ret_type; int fmt; unsigned long nitems, bytes_after; - long *data = 0; -/* - if (XGetWindowProperty(disp, win.clientWindow(), - m_net_wm_state, 0, 1, False, XA_CARDINAL, - &ret_type, &fmt, &nitems, &bytes_after, - (unsigned char **) &data) == Success && data) { - flags = *data; - setState(win, flags); + unsigned char *data = 0; + + win.winClient().property(m_net_wm_state, 0, 0x7fffffff, False, XA_ATOM, + &ret_type, &fmt, &nitems, &bytes_after, + &data); + if (data) { + // we must convert to long + unsigned long *real = (unsigned long *)data; + for (int i=0; iwindowList().end(); for (; it != it_end; ++it) { - if ((*it)->numClients() == 1) + if ((*it)->numClients() == 1) { wl[win++] = (*it)->clientWindow(); - else { + } else { // add every client in fluxboxwindow to list window list std::list::iterator client_it = (*it)->clientList().begin(); @@ -201,11 +205,10 @@ void Ewmh::updateClientList(BScreen &screen) { for (; client_it != client_it_end; ++client_it) wl[win++] = (*client_it)->window(); } - //number of windows to show in client list num = win; screen.rootWindow().changeProperty(m_net_client_list, - XA_CARDINAL, 32, + XA_WINDOW, 32, PropModeReplace, (unsigned char *)wl, num); delete [] wl; @@ -274,7 +277,6 @@ void Ewmh::updateWorkspace(FluxboxWindow &win) { // return true if we did handle the atom here bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, WinClient * const winclient) { - if (ce.message_type == m_net_wm_desktop) { if (screen == 0) return true; @@ -367,7 +369,7 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, W // ce.data.l[4] = height // TODO: gravity and flags winclient->fbwindow()->moveResize(ce.data.l[1], ce.data.l[2], - ce.data.l[3], ce.data.l[4]); + ce.data.l[3], ce.data.l[4]); return true; } @@ -420,7 +422,9 @@ void Ewmh::createAtoms() { m_net_wm_state_maximized_horz = XInternAtom(disp, "_NET_WM_STATE_MAXIMIZED_HORZ", False); m_net_wm_state_maximized_vert = XInternAtom(disp, "_NET_WM_STATE_MAXIMIZED_VERT", False); m_net_wm_state_fullscreen = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); - + m_net_wm_state_hidden = XInternAtom(disp, "_NET_WM_STATE_HIDDEN", False); + m_net_wm_state_skip_taskbar = XInternAtom(disp, "_NET_WM_STATE_SKIP_TASKBAR", False); + m_net_wm_strut = XInternAtom(disp, "_NET_WM_STRUT", False); m_net_wm_icon_geometry = XInternAtom(disp, "_NET_WM_ICON_GEOMETRY", False); m_net_wm_icon = XInternAtom(disp, "_NET_WM_ICON", False); @@ -487,7 +491,9 @@ void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) { win.maximizeVertical(); } else if (state == m_net_wm_state_fullscreen) { // fullscreen setFullscreen(win, value); - } + } else if (state == m_net_wm_state_hidden || + state == m_net_wm_state_skip_taskbar) + win.setHidden(value); } // toggle window state @@ -502,6 +508,9 @@ void Ewmh::toggleState(FluxboxWindow &win, Atom state) { win.maximizeVertical(); } else if (state == m_net_wm_state_fullscreen) { // fullscreen setFullscreen(win, getState(win) == 0); // toggle current state + } else if (state == m_net_wm_state_hidden || + state == m_net_wm_state_skip_taskbar) { + win.setHidden(!win.isHidden()); } } diff --git a/src/Ewmh.hh b/src/Ewmh.hh index c4419ba..6de9073 100644 --- a/src/Ewmh.hh +++ b/src/Ewmh.hh @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Ewmh.hh,v 1.12 2003/09/23 13:52:05 rathnor Exp $ +// $Id: Ewmh.hh,v 1.13 2004/01/18 19:12:11 fluxgen Exp $ #include "AtomHandler.hh" @@ -87,6 +87,9 @@ private: m_net_wm_state, m_net_wm_state_sticky, m_net_wm_state_shaded, m_net_wm_state_maximized_horz, m_net_wm_state_maximized_vert, m_net_wm_state_fullscreen, + m_net_wm_state_hidden, + m_net_wm_state_skip_taskbar, + m_net_wm_strut, m_net_wm_icon_geometry, m_net_wm_icon, m_net_wm_pid, m_net_wm_handled_icons; diff --git a/src/Window.cc b/src/Window.cc index 8a3bb31..9575e2a 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.262 2004/01/17 00:49:20 fluxgen Exp $ +// $Id: Window.cc,v 1.263 2004/01/18 19:14:08 fluxgen Exp $ #include "Window.hh" @@ -1684,6 +1684,12 @@ void FluxboxWindow::moveToLayer(int layernum) { } } +void FluxboxWindow::setHidden(bool value) { + if(value) + m_blackbox_attrib.flags |= ATTRIB_HIDDEN; + else + m_blackbox_attrib.flags ^= ATTRIB_HIDDEN; +} // window has actually RECEIVED focus (got a FocusIn event) // so now we make it a focused frame etc @@ -2911,19 +2917,15 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) { ///////////////////////////////////// // begin by checking the screen (or Xinerama head) edges - if (screen().hasXinerama()) { - // head "0" == whole screen width + height, which we skip since the - // sum of all the heads covers those edges - for (int h = 1; h <= screen().numHeads(); h++) { - snapToWindow(dx, dy, left, right, top, bottom, - screen().maxLeft(h), - screen().maxRight(h), - screen().maxTop(h), - screen().maxBottom(h)); - } - } else - snapToWindow(dx, dy, left, right, top, bottom, 0, screen().width(), 0, screen().height()); - + // head "0" == whole screen width + height, which we skip since the + // sum of all the heads covers those edges + for (int h = 1; h <= screen().numHeads(); h++) { + snapToWindow(dx, dy, left, right, top, bottom, + screen().maxLeft(h), + screen().maxRight(h), + screen().maxTop(h), + screen().maxBottom(h)); + } ///////////////////////////////////// // now check window edges diff --git a/src/Window.hh b/src/Window.hh index d61703a..71c0b71 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.105 2003/12/30 20:56:40 fluxgen Exp $ +// $Id: Window.hh,v 1.106 2004/01/18 19:14:08 fluxgen Exp $ #ifndef WINDOW_HH #define WINDOW_HH @@ -100,7 +100,8 @@ public: ATTRIB_OMNIPRESENT = 0x08, ATTRIB_WORKSPACE = 0x10, ATTRIB_STACK = 0x20, - ATTRIB_DECORATION = 0x40 + ATTRIB_DECORATION = 0x40, + ATTRIB_HIDDEN = 0x80, }; /** @@ -206,7 +207,7 @@ public: void raiseLayer(); void lowerLayer(); void moveToLayer(int layernum); - + void setHidden(bool value); void reconfigure(); @@ -261,6 +262,7 @@ public: @name accessors */ //@{ + inline bool isHidden() const { return (m_blackbox_attrib.flags & ATTRIB_HIDDEN); } inline bool isManaged() const { return m_managed; } inline bool isFocused() const { return focused; } bool isVisible() const; -- cgit v0.11.2