aboutsummaryrefslogtreecommitdiff
path: root/src/Ewmh.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-07-28 15:06:36 (GMT)
committerrathnor <rathnor>2003-07-28 15:06:36 (GMT)
commitd353b688dec41daddeec9696586a4519f58cce45 (patch)
tree322a29e0e31cb15a7725047c10144c4ab3d5e130 /src/Ewmh.cc
parentf9bb208da8e8926281c91f3e386ec1de48f700a2 (diff)
downloadfluxbox-d353b688dec41daddeec9696586a4519f58cce45.zip
fluxbox-d353b688dec41daddeec9696586a4519f58cce45.tar.bz2
update many things to use WinClient instead of FluxboxWindow
Diffstat (limited to 'src/Ewmh.cc')
-rw-r--r--src/Ewmh.cc56
1 files changed, 30 insertions, 26 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 10fa722..e6a0994 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.29 2003/07/04 01:03:40 rathnor Exp $ 22// $Id: Ewmh.cc,v 1.30 2003/07/28 15:06:33 rathnor Exp $
23 23
24#include "Ewmh.hh" 24#include "Ewmh.hh"
25 25
@@ -95,6 +95,10 @@ void Ewmh::initForScreen(BScreen &screen) {
95 95
96} 96}
97 97
98void Ewmh::setupClient(WinClient &winclient) {
99 updateStrut(winclient);
100}
101
98void Ewmh::setupFrame(FluxboxWindow &win) { 102void Ewmh::setupFrame(FluxboxWindow &win) {
99 103
100 Atom ret_type; 104 Atom ret_type;
@@ -123,8 +127,6 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
123 XFree(data); 127 XFree(data);
124 } 128 }
125 129
126 updateStrut(win);
127
128} 130}
129 131
130void Ewmh::updateClientList(BScreen &screen) { 132void Ewmh::updateClientList(BScreen &screen) {
@@ -260,34 +262,36 @@ void Ewmh::updateWorkspace(FluxboxWindow &win) {
260} 262}
261 263
262// return true if we did handle the atom here 264// return true if we did handle the atom here
263bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, FluxboxWindow * const win) { 265bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, WinClient * const winclient) {
264 266
265 if (ce.message_type == m_net_wm_desktop) { 267 if (ce.message_type == m_net_wm_desktop) {
266 if (screen == 0) 268 if (screen == 0)
267 return true; 269 return true;
268 // ce.data.l[0] = workspace number 270 // ce.data.l[0] = workspace number
269 // valid window and workspace number? 271 // valid window and workspace number?
270 if (win == 0 || 272 if (winclient == 0 || winclient->fbwindow() == 0 ||
271 static_cast<unsigned int>(ce.data.l[0]) >= screen->getCount()) 273 static_cast<unsigned int>(ce.data.l[0]) >= screen->getCount())
272 return true; 274 return true;
273 275
274 screen->sendToWorkspace(ce.data.l[0], win, false); 276 screen->sendToWorkspace(ce.data.l[0], winclient->fbwindow(), false);
275 return true; 277 return true;
276 } else if (ce.message_type == m_net_wm_state) { 278 } else if (ce.message_type == m_net_wm_state) {
277 if (win == 0) 279 if (winclient == 0 || winclient->fbwindow() == 0)
278 return true; 280 return true;
281
282 FluxboxWindow &win = *winclient->fbwindow();
279 // ce.data.l[0] = the action (remove, add or toggle) 283 // ce.data.l[0] = the action (remove, add or toggle)
280 // ce.data.l[1] = the first property to alter 284 // ce.data.l[1] = the first property to alter
281 // ce.data.l[2] = second property to alter (can be zero) 285 // ce.data.l[2] = second property to alter (can be zero)
282 if (ce.data.l[0] == STATE_REMOVE) { 286 if (ce.data.l[0] == STATE_REMOVE) {
283 setState(*win, ce.data.l[1], false); 287 setState(win, ce.data.l[1], false);
284 setState(*win, ce.data.l[2], false); 288 setState(win, ce.data.l[2], false);
285 } else if (ce.data.l[0] == STATE_ADD) { 289 } else if (ce.data.l[0] == STATE_ADD) {
286 setState(*win, ce.data.l[1], true); 290 setState(win, ce.data.l[1], true);
287 setState(*win, ce.data.l[2], true); 291 setState(win, ce.data.l[2], true);
288 } else if (ce.data.l[0] == STATE_TOGGLE) { 292 } else if (ce.data.l[0] == STATE_TOGGLE) {
289 toggleState(*win, ce.data.l[1]); 293 toggleState(win, ce.data.l[1]);
290 toggleState(*win, ce.data.l[2]); 294 toggleState(win, ce.data.l[2]);
291 } 295 }
292 296
293 return true; 297 return true;
@@ -330,20 +334,20 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, F
330 } else if (ce.message_type == m_net_active_window) { 334 } else if (ce.message_type == m_net_active_window) {
331 335
332 // make sure we have a valid window 336 // make sure we have a valid window
333 if (win == 0) 337 if (winclient == 0)
334 return true; 338 return true;
335 // ce.window = window to focus 339 // ce.window = window to focus
336 340
337 win->setInputFocus(); 341 winclient->focus();
338 return true; 342 return true;
339 } else if (ce.message_type == m_net_close_window) { 343 } else if (ce.message_type == m_net_close_window) {
340 if (win == 0) 344 if (winclient == 0)
341 return true; 345 return true;
342 // ce.window = window to close (which in this case is the win argument) 346 // ce.window = window to close (which in this case is the win argument)
343 win->close(); 347 winclient->sendClose();
344 return true; 348 return true;
345 } else if (ce.message_type == m_net_moveresize_window) { 349 } else if (ce.message_type == m_net_moveresize_window) {
346 if (win == 0) 350 if (winclient == 0 && winclient->fbwindow())
347 return true; 351 return true;
348 // ce.data.l[0] = gravity and flags 352 // ce.data.l[0] = gravity and flags
349 // ce.data.l[1] = x 353 // ce.data.l[1] = x
@@ -351,7 +355,7 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, F
351 // ce.data.l[3] = width 355 // ce.data.l[3] = width
352 // ce.data.l[4] = height 356 // ce.data.l[4] = height
353 // TODO: gravity and flags 357 // TODO: gravity and flags
354 win->moveResize(ce.data.l[1], ce.data.l[2], 358 winclient->fbwindow()->moveResize(ce.data.l[1], ce.data.l[2],
355 ce.data.l[3], ce.data.l[4]); 359 ce.data.l[3], ce.data.l[4]);
356 return true; 360 return true;
357 } 361 }
@@ -361,9 +365,9 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, F
361} 365}
362 366
363 367
364bool Ewmh::propertyNotify(FluxboxWindow &win, Atom the_property) { 368bool Ewmh::propertyNotify(WinClient &winclient, Atom the_property) {
365 if (the_property == m_net_wm_strut) { 369 if (the_property == m_net_wm_strut) {
366 updateStrut(win); 370 updateStrut(winclient);
367 return true; 371 return true;
368 } 372 }
369 373
@@ -434,20 +438,20 @@ void Ewmh::toggleState(FluxboxWindow &win, Atom state) const {
434} 438}
435 439
436 440
437void Ewmh::updateStrut(FluxboxWindow &win) { 441void Ewmh::updateStrut(WinClient &winclient) {
438 Atom ret_type = 0; 442 Atom ret_type = 0;
439 int fmt = 0; 443 int fmt = 0;
440 unsigned long nitems = 0, bytes_after = 0; 444 unsigned long nitems = 0, bytes_after = 0;
441 long *data = 0; 445 long *data = 0;
442 if (win.winClient().property(m_net_wm_strut, 0, 4, False, XA_CARDINAL, 446 if (winclient.property(m_net_wm_strut, 0, 4, False, XA_CARDINAL,
443 &ret_type, &fmt, &nitems, &bytes_after, 447 &ret_type, &fmt, &nitems, &bytes_after,
444 (unsigned char **) &data) && data) { 448 (unsigned char **) &data) && data) {
445#ifdef DEBUG 449#ifdef DEBUG
446 cerr<<__FILE__<<"("<<__FUNCTION__<<"): Strut: "<<data[0]<<", "<<data[1]<<", "<< 450 cerr<<__FILE__<<"("<<__FUNCTION__<<"): Strut: "<<data[0]<<", "<<data[1]<<", "<<
447 data[2]<<", "<<data[3]<<endl; 451 data[2]<<", "<<data[3]<<endl;
448#endif // DEBUG 452#endif // DEBUG
449 win.setStrut(win.screen().requestStrut(data[0], data[1], data[2], data[3])); 453 winclient.setStrut(
450 win.screen().updateAvailableWorkspaceArea(); 454 winclient.screen().requestStrut(data[0], data[1], data[2], data[3]));
455 winclient.screen().updateAvailableWorkspaceArea();
451 } 456 }
452
453} 457}