summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-10-11 10:20:33 (GMT)
committerfluxgen <fluxgen>2002-10-11 10:20:33 (GMT)
commit03fc8ed5ec1a6f70ee5fb205c4bf9d4f15cd9f01 (patch)
treec6097d988ac7d2a1ba3863364cdf5c31852924e8
parent1ce20af09b4196672ce443fac9b49c3775f96e08 (diff)
downloadfluxbox_lack-03fc8ed5ec1a6f70ee5fb205c4bf9d4f15cd9f01.zip
fluxbox_lack-03fc8ed5ec1a6f70ee5fb205c4bf9d4f15cd9f01.tar.bz2
state shaded and sticky fixed
-rw-r--r--src/Ewmh.cc47
-rw-r--r--src/Ewmh.hh5
2 files changed, 46 insertions, 6 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 0d5885b..f715ccc 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.1 2002/10/02 16:26:05 fluxgen Exp $ 22// $Id: Ewmh.cc,v 1.2 2002/10/11 10:20:33 fluxgen Exp $
23 23
24#include "Ewmh.hh" 24#include "Ewmh.hh"
25 25
@@ -63,7 +63,8 @@ void Ewmh::initForScreen(const BScreen &screen) {
63 //set supported atoms 63 //set supported atoms
64 Atom atomsupported[] = { 64 Atom atomsupported[] = {
65 m_net_wm_state, 65 m_net_wm_state,
66 m_net_wm_state_sticky, 66 // states that we support:
67 m_net_wm_state_sticky,
67 m_net_wm_state_shaded, 68 m_net_wm_state_shaded,
68 69
69 m_net_client_list, 70 m_net_client_list,
@@ -186,7 +187,21 @@ void Ewmh::updateWorkspace(FluxboxWindow &win) {
186} 187}
187 188
188bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen *screen, FluxboxWindow *win) { 189bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen *screen, FluxboxWindow *win) {
189 190 if (win != 0) {
191 if (ce.message_type == m_net_wm_state) {
192 if (ce.data.l[0] == STATE_REMOVE) {
193 setState(*win, ce.data.l[1], false);
194 setState(*win, ce.data.l[2], false);
195 } else if (ce.data.l[0] == STATE_ADD) {
196 setState(*win, ce.data.l[1], true);
197 setState(*win, ce.data.l[2], true);
198 } else if (ce.data.l[0] == STATE_TOGGLE) {
199 toggleState(*win, ce.data.l[1]);
200 toggleState(*win, ce.data.l[2]);
201 }
202 }
203 }
204 return false;
190} 205}
191 206
192 207
@@ -212,7 +227,8 @@ void Ewmh::createAtoms() {
212 m_net_wm_name = XInternAtom(disp, "_NET_WM_NAME", False); 227 m_net_wm_name = XInternAtom(disp, "_NET_WM_NAME", False);
213 m_net_wm_desktop = XInternAtom(disp, "_NET_WM_DESKTOP", False); 228 m_net_wm_desktop = XInternAtom(disp, "_NET_WM_DESKTOP", False);
214 m_net_wm_window_type = XInternAtom(disp, "_NET_WM_WINDOW_TYPE", False); 229 m_net_wm_window_type = XInternAtom(disp, "_NET_WM_WINDOW_TYPE", False);
215 230
231 // state atom and the supported state atoms
216 m_net_wm_state = XInternAtom(disp, "_NET_WM_STATE", False); 232 m_net_wm_state = XInternAtom(disp, "_NET_WM_STATE", False);
217 m_net_wm_state_sticky = XInternAtom(disp, "_NET_WM_STATE_STICKY", False); 233 m_net_wm_state_sticky = XInternAtom(disp, "_NET_WM_STATE_STICKY", False);
218 m_net_wm_state_shaded = XInternAtom(disp, "_NET_WM_STATE_SHADED", False); 234 m_net_wm_state_shaded = XInternAtom(disp, "_NET_WM_STATE_SHADED", False);
@@ -226,3 +242,26 @@ void Ewmh::createAtoms() {
226 m_net_wm_ping = XInternAtom(disp, "_NET_WM_PING", False); 242 m_net_wm_ping = XInternAtom(disp, "_NET_WM_PING", False);
227} 243}
228 244
245// set window state
246void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) const {
247
248 if (state == m_net_wm_state_sticky) { // STICKY
249 if (value && !win.isStuck() ||
250 (!value && win.isStuck()))
251 win.stick();
252 } else if (state == m_net_wm_state_shaded) { // SHADED
253 if ((value && !win.isShaded()) ||
254 (!value && win.isShaded()))
255 win.shade();
256 }
257
258}
259
260// toggle window state
261void Ewmh::toggleState(FluxboxWindow &win, Atom state) const {
262 if (state == m_net_wm_state_sticky) {
263 win.stick();
264 } else if (state == m_net_wm_state_shaded)
265 win.shade();
266}
267
diff --git a/src/Ewmh.hh b/src/Ewmh.hh
index 2344045..672665a 100644
--- a/src/Ewmh.hh
+++ b/src/Ewmh.hh
@@ -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.hh,v 1.1 2002/10/02 16:26:05 fluxgen Exp $ 22// $Id: Ewmh.hh,v 1.2 2002/10/11 10:20:33 fluxgen Exp $
23 23
24#include "AtomHandler.hh" 24#include "AtomHandler.hh"
25 25
@@ -50,7 +50,8 @@ private:
50 50
51 enum { STATE_REMOVE = 0, STATE_ADD = 1, STATE_TOGGLE = 2}; 51 enum { STATE_REMOVE = 0, STATE_ADD = 1, STATE_TOGGLE = 2};
52 52
53 void setState(FluxboxWindow &win, Atom flags) const; 53 void setState(FluxboxWindow &win, Atom state, bool value) const;
54 void toggleState(FluxboxWindow &win, Atom state) const;
54 void createAtoms(); 55 void createAtoms();
55 56
56 // root window properties 57 // root window properties