aboutsummaryrefslogtreecommitdiff
path: root/src/Ewmh.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-10-13 21:51:37 (GMT)
committermarkt <markt>2007-10-13 21:51:37 (GMT)
commita59428d67a95a9df16554962f0a6257d6378328a (patch)
treef856ed9300c34f7a17d499f22d895610cfbc08e5 /src/Ewmh.cc
parent41b5c6dadb1f474675660cef18b812d4c2338ed2 (diff)
downloadfluxbox_pavel-a59428d67a95a9df16554962f0a6257d6378328a.zip
fluxbox_pavel-a59428d67a95a9df16554962f0a6257d6378328a.tar.bz2
merged changes from pre-devel
Diffstat (limited to 'src/Ewmh.cc')
-rw-r--r--src/Ewmh.cc73
1 files changed, 23 insertions, 50 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index de4377b..7266496 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -28,7 +28,6 @@
28#include "WinClient.hh" 28#include "WinClient.hh"
29#include "Workspace.hh" 29#include "Workspace.hh"
30#include "Layer.hh" 30#include "Layer.hh"
31#include "WinClientUtil.hh"
32#include "fluxbox.hh" 31#include "fluxbox.hh"
33#include "FbWinFrameTheme.hh" 32#include "FbWinFrameTheme.hh"
34#include "FocusControl.hh" 33#include "FocusControl.hh"
@@ -79,13 +78,6 @@ Ewmh::Ewmh() {
79 createAtoms(); 78 createAtoms();
80} 79}
81 80
82Ewmh::~Ewmh() {
83 while (!m_windows.empty()) {
84 XDestroyWindow(FbTk::App::instance()->display(), m_windows.back());
85 m_windows.pop_back();
86 }
87}
88
89void Ewmh::initForScreen(BScreen &screen) { 81void Ewmh::initForScreen(BScreen &screen) {
90 Display *disp = FbTk::App::instance()->display(); 82 Display *disp = FbTk::App::instance()->display();
91 83
@@ -108,14 +100,9 @@ void Ewmh::initForScreen(BScreen &screen) {
108 * Window Manager is present. 100 * Window Manager is present.
109 */ 101 */
110 102
111 Window wincheck = XCreateSimpleWindow(disp, 103 Window wincheck = screen.dummyWindow().window();
112 screen.rootWindow().window(),
113 -10, -10, 5, 5, 0, 0, 0);
114 104
115 if (wincheck != None) { 105 if (wincheck != None) {
116 // store the window so we can delete it later
117 m_windows.push_back(wincheck);
118
119 screen.rootWindow().changeProperty(m_net_supporting_wm_check, XA_WINDOW, 32, 106 screen.rootWindow().changeProperty(m_net_supporting_wm_check, XA_WINDOW, 32,
120 PropModeReplace, (unsigned char *) &wincheck, 1); 107 PropModeReplace, (unsigned char *) &wincheck, 1);
121 XChangeProperty(disp, wincheck, m_net_supporting_wm_check, XA_WINDOW, 32, 108 XChangeProperty(disp, wincheck, m_net_supporting_wm_check, XA_WINDOW, 32,
@@ -278,7 +265,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
278 // we also assume it shouldn't be visible in any toolbar 265 // we also assume it shouldn't be visible in any toolbar
279 win.setFocusHidden(true); 266 win.setFocusHidden(true);
280 win.setIconHidden(true); 267 win.setIconHidden(true);
281 win.setDecoration(FluxboxWindow::DECOR_NONE); 268 win.setDecorationMask(FluxboxWindow::DECOR_NONE);
282 win.moveToLayer(Layer::DOCK); 269 win.moveToLayer(Layer::DOCK);
283 } else if (atoms[l] == m_net_wm_window_type_desktop) { 270 } else if (atoms[l] == m_net_wm_window_type_desktop) {
284 /* 271 /*
@@ -291,7 +278,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
291 win.setFocusHidden(true); 278 win.setFocusHidden(true);
292 win.setIconHidden(true); 279 win.setIconHidden(true);
293 win.moveToLayer(Layer::DESKTOP); 280 win.moveToLayer(Layer::DESKTOP);
294 win.setDecorationMask(0); 281 win.setDecorationMask(FluxboxWindow::DECOR_NONE);
295 win.setTabable(false); 282 win.setTabable(false);
296 win.setMovable(false); 283 win.setMovable(false);
297 win.setResizable(false); 284 win.setResizable(false);
@@ -303,7 +290,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
303 * window is a splash screen displayed as an application 290 * window is a splash screen displayed as an application
304 * is starting up. 291 * is starting up.
305 */ 292 */
306 win.setDecoration(FluxboxWindow::DECOR_NONE); 293 win.setDecorationMask(FluxboxWindow::DECOR_NONE);
307 win.setFocusHidden(true); 294 win.setFocusHidden(true);
308 win.setIconHidden(true); 295 win.setIconHidden(true);
309 win.setMovable(false); 296 win.setMovable(false);
@@ -320,11 +307,11 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
320 * application). Windows of this type may set the 307 * application). Windows of this type may set the
321 * WM_TRANSIENT_FOR hint indicating the main application window. 308 * WM_TRANSIENT_FOR hint indicating the main application window.
322 */ 309 */
323 win.setDecoration(FluxboxWindow::DECOR_TOOL); 310 win.setDecorationMask(FluxboxWindow::DECOR_TOOL);
324 win.setIconHidden(true); 311 win.setIconHidden(true);
325 win.moveToLayer(Layer::ABOVE_DOCK); 312 win.moveToLayer(Layer::ABOVE_DOCK);
326 } else if (atoms[l] == m_net_wm_window_type_toolbar) { 313 } else if (atoms[l] == m_net_wm_window_type_toolbar) {
327 win.setDecoration(FluxboxWindow::DECOR_NONE); 314 win.setDecorationMask(FluxboxWindow::DECOR_NONE);
328 win.setIconHidden(true); 315 win.setIconHidden(true);
329 win.moveToLayer(Layer::ABOVE_DOCK); 316 win.moveToLayer(Layer::ABOVE_DOCK);
330 } 317 }
@@ -402,7 +389,10 @@ void Ewmh::updateClientClose(WinClient &winclient){
402 389
403void Ewmh::updateClientList(BScreen &screen) { 390void Ewmh::updateClientList(BScreen &screen) {
404 391
405 list<WinClient *> creation_order_list = screen.focusControl().creationOrderList(); 392 if (screen.isShuttingdown())
393 return;
394
395 list<Focusable *> creation_order_list = screen.focusControl().creationOrderList();
406 396
407 size_t num = creation_order_list.size(); 397 size_t num = creation_order_list.size();
408 Window *wl = FB_new_nothrow Window[num]; 398 Window *wl = FB_new_nothrow Window[num];
@@ -414,10 +404,13 @@ void Ewmh::updateClientList(BScreen &screen) {
414 } 404 }
415 405
416 int win=0; 406 int win=0;
417 list<WinClient *>::iterator client_it = creation_order_list.begin(); 407 list<Focusable *>::iterator client_it = creation_order_list.begin();
418 list<WinClient *>::iterator client_it_end = creation_order_list.end(); 408 list<Focusable *>::iterator client_it_end = creation_order_list.end();
419 for (; client_it != client_it_end; ++client_it) 409 for (; client_it != client_it_end; ++client_it) {
420 wl[win++] = (*client_it)->window(); 410 WinClient *client = dynamic_cast<WinClient *>(*client_it);
411 if (client)
412 wl[win++] = client->window();
413 }
421 414
422 /* From Extended Window Manager Hints, draft 1.3: 415 /* From Extended Window Manager Hints, draft 1.3:
423 * 416 *
@@ -800,32 +793,12 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce,
800 return true; 793 return true;
801 // ce.window = window to focus 794 // ce.window = window to focus
802 795
803 if (winclient->fbwindow()) { 796 // ce.data.l[0] == 2 means the request came from a pager
804 797 if (winclient->fbwindow() && (ce.data.l[0] == 2 ||
805 FluxboxWindow* fbwin = winclient->fbwindow(); 798 winclient->fbwindow()->allowsFocusFromClient())) {
806 799 winclient->focus();
807 // if the raised window is on a different workspace 800 winclient->fbwindow()->raise();
808 // we do what the user wish:
809 // either ignore|go to that workspace|get the window
810 if (fbwin->screen().currentWorkspaceID() != fbwin->workspaceNumber()
811 && !fbwin->isStuck()) {
812 BScreen::FollowModel model = (ce.data.l[0] == 2) ?
813 fbwin->screen().getUserFollowModel() :
814 fbwin->screen().getFollowModel();
815 if (model == BScreen::FOLLOW_ACTIVE_WINDOW) {
816 fbwin->screen().changeWorkspaceID(fbwin->workspaceNumber());
817 } else if (model == BScreen::FETCH_ACTIVE_WINDOW) {
818 fbwin->screen().sendToWorkspace(fbwin->screen().currentWorkspaceID(), fbwin);
819 } else if (model == BScreen::SEMIFOLLOW_ACTIVE_WINDOW) {
820 if (fbwin->isIconic())
821 fbwin->screen().sendToWorkspace(fbwin->screen().currentWorkspaceID(), fbwin);
822 else
823 fbwin->screen().changeWorkspaceID(fbwin->workspaceNumber());
824 } // else we ignore it. my favourite mode :)
825 }
826 fbwin->raise();
827 } 801 }
828 winclient->focus();
829 return true; 802 return true;
830 } else if (ce.message_type == m_net_close_window) { 803 } else if (ce.message_type == m_net_close_window) {
831 if (winclient == 0) 804 if (winclient == 0)
@@ -1203,7 +1176,7 @@ void Ewmh::updateActions(FluxboxWindow &win) {
1203 actions.push_back(m_net_wm_action_minimize); 1176 actions.push_back(m_net_wm_action_minimize);
1204 1177
1205 unsigned int max_width, max_height; 1178 unsigned int max_width, max_height;
1206 WinClientUtil::maxSize(win.clientList(), max_width, max_height); 1179 win.maxSize(max_width, max_height);
1207 1180
1208 // if unlimited max width we can maximize horizontal 1181 // if unlimited max width we can maximize horizontal
1209 if (max_width == 0) { 1182 if (max_width == 0) {