aboutsummaryrefslogtreecommitdiff
path: root/src/Ewmh.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-01-18 19:14:08 (GMT)
committerfluxgen <fluxgen>2004-01-18 19:14:08 (GMT)
commiteb078ab8cf97634bff08979c43d9a238fca2b501 (patch)
tree192481847e4f3ebc0ab803bfc4522636e0122227 /src/Ewmh.cc
parentdba6249a1c66a8ef78266d9bbbf83c5ae8048813 (diff)
downloadfluxbox-eb078ab8cf97634bff08979c43d9a238fca2b501.zip
fluxbox-eb078ab8cf97634bff08979c43d9a238fca2b501.tar.bz2
support for _NET_WM_STATE_HIDDEN and _NET_WM_STATE_SKIP_TASKBAR
Diffstat (limited to 'src/Ewmh.cc')
-rw-r--r--src/Ewmh.cc51
1 files changed, 30 insertions, 21 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 @@
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.36 2003/12/19 00:36:53 fluxgen Exp $ 22// $Id: Ewmh.cc,v 1.37 2004/01/18 19:12:11 fluxgen Exp $
23 23
24#include "Ewmh.hh" 24#include "Ewmh.hh"
25 25
@@ -78,6 +78,8 @@ void Ewmh::initForScreen(BScreen &screen) {
78 m_net_wm_state_maximized_horz, 78 m_net_wm_state_maximized_horz,
79 m_net_wm_state_maximized_vert, 79 m_net_wm_state_maximized_vert,
80 m_net_wm_state_fullscreen, 80 m_net_wm_state_fullscreen,
81 m_net_wm_state_hidden,
82 m_net_wm_state_skip_taskbar,
81 83
82 m_net_wm_desktop, 84 m_net_wm_desktop,
83 85
@@ -102,24 +104,26 @@ void Ewmh::initForScreen(BScreen &screen) {
102 104
103void Ewmh::setupClient(WinClient &winclient) { 105void Ewmh::setupClient(WinClient &winclient) {
104 updateStrut(winclient); 106 updateStrut(winclient);
107
105} 108}
106 109
107void Ewmh::setupFrame(FluxboxWindow &win) { 110void Ewmh::setupFrame(FluxboxWindow &win) {
108
109 Atom ret_type; 111 Atom ret_type;
110 int fmt; 112 int fmt;
111 unsigned long nitems, bytes_after; 113 unsigned long nitems, bytes_after;
112 long *data = 0; 114 unsigned char *data = 0;
113/* 115
114 if (XGetWindowProperty(disp, win.clientWindow(), 116 win.winClient().property(m_net_wm_state, 0, 0x7fffffff, False, XA_ATOM,
115 m_net_wm_state, 0, 1, False, XA_CARDINAL, 117 &ret_type, &fmt, &nitems, &bytes_after,
116 &ret_type, &fmt, &nitems, &bytes_after, 118 &data);
117 (unsigned char **) &data) == Success && data) { 119 if (data) {
118 flags = *data; 120 // we must convert to long
119 setState(win, flags); 121 unsigned long *real = (unsigned long *)data;
122 for (int i=0; i<nitems; ++i)
123 setState(win, real[i], true);
120 XFree(data); 124 XFree(data);
121 } 125 }
122*/ 126
123 if (win.winClient().property(m_net_wm_desktop, 0, 1, False, XA_CARDINAL, 127 if (win.winClient().property(m_net_wm_desktop, 0, 1, False, XA_CARDINAL,
124 &ret_type, &fmt, &nitems, &bytes_after, 128 &ret_type, &fmt, &nitems, &bytes_after,
125 (unsigned char **) &data) && data) { 129 (unsigned char **) &data) && data) {
@@ -143,7 +147,7 @@ void Ewmh::updateClientList(BScreen &screen) {
143 147
144 BScreen::Workspaces::const_iterator workspace_it = 148 BScreen::Workspaces::const_iterator workspace_it =
145 screen.getWorkspacesList().begin(); 149 screen.getWorkspacesList().begin();
146 BScreen::Workspaces::const_iterator workspace_it_end = 150 const BScreen::Workspaces::const_iterator workspace_it_end =
147 screen.getWorkspacesList().end(); 151 screen.getWorkspacesList().end();
148 for (; workspace_it != workspace_it_end; ++workspace_it) { 152 for (; workspace_it != workspace_it_end; ++workspace_it) {
149 Workspace::Windows::iterator win_it = 153 Workspace::Windows::iterator win_it =
@@ -179,9 +183,9 @@ void Ewmh::updateClientList(BScreen &screen) {
179 Workspace::Windows::const_iterator it_end = 183 Workspace::Windows::const_iterator it_end =
180 (*workspace_it)->windowList().end(); 184 (*workspace_it)->windowList().end();
181 for (; it != it_end; ++it) { 185 for (; it != it_end; ++it) {
182 if ((*it)->numClients() == 1) 186 if ((*it)->numClients() == 1) {
183 wl[win++] = (*it)->clientWindow(); 187 wl[win++] = (*it)->clientWindow();
184 else { 188 } else {
185 // add every client in fluxboxwindow to list window list 189 // add every client in fluxboxwindow to list window list
186 std::list<WinClient *>::iterator client_it = 190 std::list<WinClient *>::iterator client_it =
187 (*it)->clientList().begin(); 191 (*it)->clientList().begin();
@@ -201,11 +205,10 @@ void Ewmh::updateClientList(BScreen &screen) {
201 for (; client_it != client_it_end; ++client_it) 205 for (; client_it != client_it_end; ++client_it)
202 wl[win++] = (*client_it)->window(); 206 wl[win++] = (*client_it)->window();
203 } 207 }
204
205 //number of windows to show in client list 208 //number of windows to show in client list
206 num = win; 209 num = win;
207 screen.rootWindow().changeProperty(m_net_client_list, 210 screen.rootWindow().changeProperty(m_net_client_list,
208 XA_CARDINAL, 32, 211 XA_WINDOW, 32,
209 PropModeReplace, (unsigned char *)wl, num); 212 PropModeReplace, (unsigned char *)wl, num);
210 213
211 delete [] wl; 214 delete [] wl;
@@ -274,7 +277,6 @@ void Ewmh::updateWorkspace(FluxboxWindow &win) {
274 277
275// return true if we did handle the atom here 278// return true if we did handle the atom here
276bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, WinClient * const winclient) { 279bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, WinClient * const winclient) {
277
278 if (ce.message_type == m_net_wm_desktop) { 280 if (ce.message_type == m_net_wm_desktop) {
279 if (screen == 0) 281 if (screen == 0)
280 return true; 282 return true;
@@ -367,7 +369,7 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, W
367 // ce.data.l[4] = height 369 // ce.data.l[4] = height
368 // TODO: gravity and flags 370 // TODO: gravity and flags
369 winclient->fbwindow()->moveResize(ce.data.l[1], ce.data.l[2], 371 winclient->fbwindow()->moveResize(ce.data.l[1], ce.data.l[2],
370 ce.data.l[3], ce.data.l[4]); 372 ce.data.l[3], ce.data.l[4]);
371 return true; 373 return true;
372 } 374 }
373 375
@@ -420,7 +422,9 @@ void Ewmh::createAtoms() {
420 m_net_wm_state_maximized_horz = XInternAtom(disp, "_NET_WM_STATE_MAXIMIZED_HORZ", False); 422 m_net_wm_state_maximized_horz = XInternAtom(disp, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
421 m_net_wm_state_maximized_vert = XInternAtom(disp, "_NET_WM_STATE_MAXIMIZED_VERT", False); 423 m_net_wm_state_maximized_vert = XInternAtom(disp, "_NET_WM_STATE_MAXIMIZED_VERT", False);
422 m_net_wm_state_fullscreen = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); 424 m_net_wm_state_fullscreen = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False);
423 425 m_net_wm_state_hidden = XInternAtom(disp, "_NET_WM_STATE_HIDDEN", False);
426 m_net_wm_state_skip_taskbar = XInternAtom(disp, "_NET_WM_STATE_SKIP_TASKBAR", False);
427
424 m_net_wm_strut = XInternAtom(disp, "_NET_WM_STRUT", False); 428 m_net_wm_strut = XInternAtom(disp, "_NET_WM_STRUT", False);
425 m_net_wm_icon_geometry = XInternAtom(disp, "_NET_WM_ICON_GEOMETRY", False); 429 m_net_wm_icon_geometry = XInternAtom(disp, "_NET_WM_ICON_GEOMETRY", False);
426 m_net_wm_icon = XInternAtom(disp, "_NET_WM_ICON", False); 430 m_net_wm_icon = XInternAtom(disp, "_NET_WM_ICON", False);
@@ -487,7 +491,9 @@ void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) {
487 win.maximizeVertical(); 491 win.maximizeVertical();
488 } else if (state == m_net_wm_state_fullscreen) { // fullscreen 492 } else if (state == m_net_wm_state_fullscreen) { // fullscreen
489 setFullscreen(win, value); 493 setFullscreen(win, value);
490 } 494 } else if (state == m_net_wm_state_hidden ||
495 state == m_net_wm_state_skip_taskbar)
496 win.setHidden(value);
491} 497}
492 498
493// toggle window state 499// toggle window state
@@ -502,6 +508,9 @@ void Ewmh::toggleState(FluxboxWindow &win, Atom state) {
502 win.maximizeVertical(); 508 win.maximizeVertical();
503 } else if (state == m_net_wm_state_fullscreen) { // fullscreen 509 } else if (state == m_net_wm_state_fullscreen) { // fullscreen
504 setFullscreen(win, getState(win) == 0); // toggle current state 510 setFullscreen(win, getState(win) == 0); // toggle current state
511 } else if (state == m_net_wm_state_hidden ||
512 state == m_net_wm_state_skip_taskbar) {
513 win.setHidden(!win.isHidden());
505 } 514 }
506} 515}
507 516