aboutsummaryrefslogtreecommitdiff
path: root/src/Ewmh.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ewmh.cc')
-rw-r--r--src/Ewmh.cc44
1 files changed, 32 insertions, 12 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 46bb94e..7996828 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -526,7 +526,9 @@ void Ewmh::updateState(FluxboxWindow &win) {
526 // TODO: should we update the _NET_WM_ALLOWED_ACTIONS 526 // TODO: should we update the _NET_WM_ALLOWED_ACTIONS
527 // here too? 527 // here too?
528 528
529 std::vector<unsigned int> state; 529 typedef std::vector<unsigned int> StateVec;
530
531 StateVec state;
530 532
531 if (win.isStuck()) 533 if (win.isStuck())
532 state.push_back(m_net_wm_state_sticky); 534 state.push_back(m_net_wm_state_sticky);
@@ -536,10 +538,10 @@ void Ewmh::updateState(FluxboxWindow &win) {
536 state.push_back(m_net_wm_state_below); 538 state.push_back(m_net_wm_state_below);
537 if (win.layerNum() == Fluxbox::instance()->getAboveDockLayer()) 539 if (win.layerNum() == Fluxbox::instance()->getAboveDockLayer())
538 state.push_back(m_net_wm_state_above); 540 state.push_back(m_net_wm_state_above);
539 if (win.isFocusHidden()) { 541 if (win.isIconic())
540 state.push_back(m_net_wm_state_hidden); 542 state.push_back(m_net_wm_state_hidden);
543 if (win.isIconHidden())
541 state.push_back(m_net_wm_state_skip_taskbar); 544 state.push_back(m_net_wm_state_skip_taskbar);
542 }
543 if (win.isFullscreen()) { 545 if (win.isFullscreen()) {
544 state.push_back(m_net_wm_state_fullscreen); 546 state.push_back(m_net_wm_state_fullscreen);
545 } 547 }
@@ -549,9 +551,31 @@ void Ewmh::updateState(FluxboxWindow &win) {
549 551
550 it = win.clientList().begin(); 552 it = win.clientList().begin();
551 for (; it != it_end; ++it) { 553 for (; it != it_end; ++it) {
552 if (!state.empty()) 554
555 // search the old states for _NET_WM_STATE_SKIP_PAGER and append it
556 // to the current state, so it wont get deleted by us.
557 StateVec client_state(state);
558 Atom ret_type;
559 int fmt;
560 unsigned long nitems, bytes_after;
561 unsigned char *data = 0;
562
563 (*it)->property(m_net_wm_state, 0, 0x7fffffff, False, XA_ATOM,
564 &ret_type, &fmt, &nitems, &bytes_after,
565 &data);
566 if (data) {
567 Atom *old_states = (Atom *)data;
568 for (unsigned long i=0; i < nitems; ++i)
569 if (old_states[i] == m_net_wm_state_skip_pager) {
570 client_state.push_back(m_net_wm_state_skip_pager);
571 }
572 XFree(data);
573 }
574
575 if (!client_state.empty())
553 (*it)->changeProperty(m_net_wm_state, XA_ATOM, 32, PropModeReplace, 576 (*it)->changeProperty(m_net_wm_state, XA_ATOM, 32, PropModeReplace,
554 reinterpret_cast<unsigned char*>(&state.front()), state.size()); 577 reinterpret_cast<unsigned char*>(&client_state.front()),
578 client_state.size());
555 else 579 else
556 (*it)->deleteProperty(m_net_wm_state); 580 (*it)->deleteProperty(m_net_wm_state);
557 } 581 }
@@ -777,6 +801,7 @@ void Ewmh::createAtoms() {
777 m_net_wm_state_fullscreen = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); 801 m_net_wm_state_fullscreen = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False);
778 m_net_wm_state_hidden = XInternAtom(disp, "_NET_WM_STATE_HIDDEN", False); 802 m_net_wm_state_hidden = XInternAtom(disp, "_NET_WM_STATE_HIDDEN", False);
779 m_net_wm_state_skip_taskbar = XInternAtom(disp, "_NET_WM_STATE_SKIP_TASKBAR", False); 803 m_net_wm_state_skip_taskbar = XInternAtom(disp, "_NET_WM_STATE_SKIP_TASKBAR", False);
804 m_net_wm_state_skip_pager = XInternAtom(disp, "_NET_WM_STATE_SKIP_PAGER", False);
780 m_net_wm_state_above = XInternAtom(disp, "_NET_WM_STATE_ABOVE", False); 805 m_net_wm_state_above = XInternAtom(disp, "_NET_WM_STATE_ABOVE", False);
781 m_net_wm_state_below = XInternAtom(disp, "_NET_WM_STATE_BELOW", False); 806 m_net_wm_state_below = XInternAtom(disp, "_NET_WM_STATE_BELOW", False);
782 807
@@ -860,9 +885,7 @@ void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) {
860 if ((value && !win.isFullscreen()) || 885 if ((value && !win.isFullscreen()) ||
861 (!value && win.isFullscreen())) 886 (!value && win.isFullscreen()))
862 setFullscreen(win, value); 887 setFullscreen(win, value);
863 } else if (state == m_net_wm_state_hidden || 888 } else if (state == m_net_wm_state_skip_taskbar) {
864 state == m_net_wm_state_skip_taskbar) {
865 win.setFocusHidden(value);
866 win.setIconHidden(value); 889 win.setIconHidden(value);
867 } else if (state == m_net_wm_state_below) { // bottom layer 890 } else if (state == m_net_wm_state_below) { // bottom layer
868 if (value) 891 if (value)
@@ -875,7 +898,6 @@ void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) {
875 win.moveToLayer(Fluxbox::instance()->getAboveDockLayer()); 898 win.moveToLayer(Fluxbox::instance()->getAboveDockLayer());
876 else 899 else
877 win.moveToLayer(Fluxbox::instance()->getNormalLayer()); 900 win.moveToLayer(Fluxbox::instance()->getNormalLayer());
878
879 } 901 }
880} 902}
881 903
@@ -891,9 +913,7 @@ void Ewmh::toggleState(FluxboxWindow &win, Atom state) {
891 win.maximizeVertical(); 913 win.maximizeVertical();
892 } else if (state == m_net_wm_state_fullscreen) { // fullscreen 914 } else if (state == m_net_wm_state_fullscreen) { // fullscreen
893 setFullscreen(win, getState(win) == 0); // toggle current state 915 setFullscreen(win, getState(win) == 0); // toggle current state
894 } else if (state == m_net_wm_state_hidden || 916 } else if (state == m_net_wm_state_skip_taskbar) {
895 state == m_net_wm_state_skip_taskbar) {
896 win.setFocusHidden(!win.isFocusHidden());
897 win.setIconHidden(!win.isIconHidden()); 917 win.setIconHidden(!win.isIconHidden());
898 } else if (state == m_net_wm_state_below) { // bottom layer 918 } else if (state == m_net_wm_state_below) { // bottom layer
899 if (win.layerNum() == Fluxbox::instance()->getBottomLayer()) 919 if (win.layerNum() == Fluxbox::instance()->getBottomLayer())