all repos — fluxbox @ 03fc8ed5ec1a6f70ee5fb205c4bf9d4f15cd9f01

custom fork of the fluxbox windowmanager

state shaded and sticky fixed
fluxgen fluxgen
commit

03fc8ed5ec1a6f70ee5fb205c4bf9d4f15cd9f01

parent

1ce20af09b4196672ce443fac9b49c3775f96e08

2 files changed, 46 insertions(+), 6 deletions(-)

jump to
M src/Ewmh.ccsrc/Ewmh.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Ewmh.cc,v 1.1 2002/10/02 16:26:05 fluxgen Exp $ +// $Id: Ewmh.cc,v 1.2 2002/10/11 10:20:33 fluxgen Exp $ #include "Ewmh.hh"

@@ -63,7 +63,8 @@

//set supported atoms Atom atomsupported[] = { m_net_wm_state, - m_net_wm_state_sticky, + // states that we support: + m_net_wm_state_sticky, m_net_wm_state_shaded, m_net_client_list,

@@ -186,7 +187,21 @@

} bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen *screen, FluxboxWindow *win) { - + if (win != 0) { + if (ce.message_type == m_net_wm_state) { + if (ce.data.l[0] == STATE_REMOVE) { + setState(*win, ce.data.l[1], false); + setState(*win, ce.data.l[2], false); + } else if (ce.data.l[0] == STATE_ADD) { + setState(*win, ce.data.l[1], true); + setState(*win, ce.data.l[2], true); + } else if (ce.data.l[0] == STATE_TOGGLE) { + toggleState(*win, ce.data.l[1]); + toggleState(*win, ce.data.l[2]); + } + } + } + return false; }

@@ -212,7 +227,8 @@ m_net_properties = XInternAtom(disp, "_NET_PROPERTIES", False);

m_net_wm_name = XInternAtom(disp, "_NET_WM_NAME", False); m_net_wm_desktop = XInternAtom(disp, "_NET_WM_DESKTOP", False); m_net_wm_window_type = XInternAtom(disp, "_NET_WM_WINDOW_TYPE", False); - + + // state atom and the supported state atoms m_net_wm_state = XInternAtom(disp, "_NET_WM_STATE", False); m_net_wm_state_sticky = XInternAtom(disp, "_NET_WM_STATE_STICKY", False); m_net_wm_state_shaded = XInternAtom(disp, "_NET_WM_STATE_SHADED", False);

@@ -226,3 +242,26 @@

m_net_wm_ping = XInternAtom(disp, "_NET_WM_PING", False); } +// set window state +void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) const { + + if (state == m_net_wm_state_sticky) { // STICKY + if (value && !win.isStuck() || + (!value && win.isStuck())) + win.stick(); + } else if (state == m_net_wm_state_shaded) { // SHADED + if ((value && !win.isShaded()) || + (!value && win.isShaded())) + win.shade(); + } + +} + +// toggle window state +void Ewmh::toggleState(FluxboxWindow &win, Atom state) const { + if (state == m_net_wm_state_sticky) { + win.stick(); + } else if (state == m_net_wm_state_shaded) + win.shade(); +} +
M src/Ewmh.hhsrc/Ewmh.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Ewmh.hh,v 1.1 2002/10/02 16:26:05 fluxgen Exp $ +// $Id: Ewmh.hh,v 1.2 2002/10/11 10:20:33 fluxgen Exp $ #include "AtomHandler.hh"

@@ -50,7 +50,8 @@ private:

enum { STATE_REMOVE = 0, STATE_ADD = 1, STATE_TOGGLE = 2}; - void setState(FluxboxWindow &win, Atom flags) const; + void setState(FluxboxWindow &win, Atom state, bool value) const; + void toggleState(FluxboxWindow &win, Atom state) const; void createAtoms(); // root window properties