summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Ewmh.cc96
1 files changed, 61 insertions, 35 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 190850b..f09b365 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Ewmh.cc,v 1.40 2004/01/21 09:37:10 fluxgen Exp $ 22// $Id: Ewmh.cc,v 1.41 2004/01/21 15:42:14 fluxgen Exp $
23 23
24#include "Ewmh.hh" 24#include "Ewmh.hh"
25 25
@@ -144,31 +144,6 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
144 unsigned long nitems, bytes_after; 144 unsigned long nitems, bytes_after;
145 unsigned char *data = 0; 145 unsigned char *data = 0;
146 146
147 win.winClient().property(m_net_wm_state, 0, 0x7fffffff, False, XA_ATOM,
148 &ret_type, &fmt, &nitems, &bytes_after,
149 &data);
150 if (data) {
151 // we must convert to long
152 unsigned long *real = (unsigned long *)data;
153 for (unsigned long i=0; i<nitems; ++i)
154 setState(win, real[i], true);
155 XFree(data);
156 }
157
158 if (win.winClient().property(m_net_wm_desktop, 0, 1, False, XA_CARDINAL,
159 &ret_type, &fmt, &nitems, &bytes_after,
160 (unsigned char **) &data) && data) {
161 unsigned int desktop = static_cast<unsigned int>(*data);
162 if (desktop == 0xFFFFFFFF && !win.isStuck())
163 win.stick();
164 else
165 win.screen().sendToWorkspace(desktop, &win, false);
166
167 XFree(data);
168 }
169
170 updateWorkspace(win);
171
172 /* From Extended Window Manager Hints, draft 1.3: 147 /* From Extended Window Manager Hints, draft 1.3:
173 * 148 *
174 * _NET_WM_WINDOW_TYPE, ATOM[]/32 149 * _NET_WM_WINDOW_TYPE, ATOM[]/32
@@ -199,6 +174,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
199 */ 174 */
200 if (atoms[l] == m_net_wm_window_type_dock) { 175 if (atoms[l] == m_net_wm_window_type_dock) {
201 win.moveToLayer(Fluxbox::instance()->getDockLayer()); 176 win.moveToLayer(Fluxbox::instance()->getDockLayer());
177 cerr<<"Dock app: moveToLayer Dock layer"<<endl;
202 // we also assume it shouldn't be visible in any toolbar 178 // we also assume it shouldn't be visible in any toolbar
203 win.setHidden(true); 179 win.setHidden(true);
204 break; 180 break;
@@ -206,6 +182,24 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
206 182
207 } 183 }
208 } 184 }
185
186 setupState(win);
187
188 if (win.winClient().property(m_net_wm_desktop, 0, 1, False, XA_CARDINAL,
189 &ret_type, &fmt, &nitems, &bytes_after,
190 (unsigned char **) &data) && data) {
191 unsigned int desktop = static_cast<unsigned int>(*data);
192 if (desktop == 0xFFFFFFFF && !win.isStuck())
193 win.stick();
194 else
195 win.screen().sendToWorkspace(desktop, &win, false);
196
197 XFree(data);
198 }
199
200 updateWorkspace(win);
201
202
209} 203}
210 204
211void Ewmh::updateFrameClose(FluxboxWindow &win) { 205void Ewmh::updateFrameClose(FluxboxWindow &win) {
@@ -730,14 +724,12 @@ void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) {
730 state == m_net_wm_state_skip_taskbar) { 724 state == m_net_wm_state_skip_taskbar) {
731 win.setHidden(value); 725 win.setHidden(value);
732 } else if (state == m_net_wm_state_below) { 726 } else if (state == m_net_wm_state_below) {
733
734 if (value) 727 if (value)
735 win.moveToLayer(Fluxbox::instance()->getBottomLayer()); 728 win.moveToLayer(Fluxbox::instance()->getBottomLayer());
736 else 729 else
737 win.moveToLayer(Fluxbox::instance()->getNormalLayer()); 730 win.moveToLayer(Fluxbox::instance()->getNormalLayer());
738 731
739 } else if (state == m_net_wm_state_above) { 732 } else if (state == m_net_wm_state_above) {
740
741 if (value) 733 if (value)
742 win.moveToLayer(Fluxbox::instance()->getAboveDockLayer()); 734 win.moveToLayer(Fluxbox::instance()->getAboveDockLayer());
743 else 735 else
@@ -766,11 +758,12 @@ void Ewmh::toggleState(FluxboxWindow &win, Atom state) {
766 win.moveToLayer(Fluxbox::instance()->getNormalLayer()); 758 win.moveToLayer(Fluxbox::instance()->getNormalLayer());
767 else 759 else
768 win.moveToLayer(Fluxbox::instance()->getBottomLayer()); 760 win.moveToLayer(Fluxbox::instance()->getBottomLayer());
761
769 } else if (state == m_net_wm_state_above) { 762 } else if (state == m_net_wm_state_above) {
770 if (win.layerNum() == Fluxbox::instance()->getAboveDockLayer()) 763 if (win.layerNum() == Fluxbox::instance()->getAboveDockLayer())
771 win.moveToLayer(Fluxbox::instance()->getNormalLayer()); 764 win.moveToLayer(Fluxbox::instance()->getNormalLayer());
772 else 765 else
773 win.moveToLayer(Fluxbox::instance()->getNormalLayer()); 766 win.moveToLayer(Fluxbox::instance()->getAboveDockLayer());
774 } 767 }
775 768
776} 769}
@@ -784,16 +777,49 @@ void Ewmh::updateStrut(WinClient &winclient) {
784 if (winclient.property(m_net_wm_strut, 0, 4, False, XA_CARDINAL, 777 if (winclient.property(m_net_wm_strut, 0, 4, False, XA_CARDINAL,
785 &ret_type, &fmt, &nitems, &bytes_after, 778 &ret_type, &fmt, &nitems, &bytes_after,
786 (unsigned char **) &data) && data) { 779 (unsigned char **) &data) && data) {
787#ifdef DEBUG 780
788 cerr<<__FILE__<<"("<<__FUNCTION__<<"): Strut: "<<data[0]<<", "<<data[1]<<", "<< 781 winclient.setStrut(winclient.screen().requestStrut(data[0], data[1],
789 data[2]<<", "<<data[3]<<endl; 782 data[2], data[3]));
790#endif // DEBUG
791 winclient.setStrut(
792 winclient.screen().requestStrut(data[0], data[1], data[2], data[3]));
793 winclient.screen().updateAvailableWorkspaceArea(); 783 winclient.screen().updateAvailableWorkspaceArea();
794 } 784 }
795} 785}
796 786
787void Ewmh::setupState(FluxboxWindow &win) {
788 /* From Extended Window Manager Hints, draft 1.3:
789 *
790 * _NET_WM_STATE, ATOM[]
791 *
792 * A list of hints describing the window state. Atoms present in
793 * the list MUST be considered set, atoms not present in the list
794 * MUST be considered not set. The Window Manager SHOULD honor
795 * _NET_WM_STATE whenever a withdrawn window requests to be mapped.
796 * A Client wishing to change the state of a window MUST send a
797 * _NET_WM_STATE client message to the root window (see below).
798 * The Window Manager MUST keep this property updated to reflect
799 * the current state of the window.
800 *
801 * The Window Manager should remove the property whenever a window
802 * is withdrawn, but it should leave the property in place when it
803 * is shutting down, e.g. in response to losing ownership of the
804 * WM_Sn manager selection.
805 */
806 Atom ret_type;
807 int fmt;
808 unsigned long nitems, bytes_after;
809 unsigned char *data = 0;
810
811 win.winClient().property(m_net_wm_state, 0, 0x7fffffff, False, XA_ATOM,
812 &ret_type, &fmt, &nitems, &bytes_after,
813 &data);
814 if (data) {
815 Atom *states = (Atom *)data;
816 for (unsigned long i=0; i < nitems; ++i)
817 setState(win, states[i], true);
818
819 XFree(data);
820 }
821}
822
797Ewmh::WindowState::WindowState(int t_x, int t_y, 823Ewmh::WindowState::WindowState(int t_x, int t_y,
798 unsigned int t_width, 824 unsigned int t_width,
799 unsigned int t_height, 825 unsigned int t_height,