From 83224b7f55c9fd1febb89171d311da95f323eae4 Mon Sep 17 00:00:00 2001 From: simonb Date: Wed, 5 Jan 2005 05:37:06 +0000 Subject: fix up window initialisation ordering --- ChangeLog | 5 +++++ src/Ewmh.cc | 2 +- src/Window.cc | 65 +++++++++++++++++++++++++++++++++++++++++++---------------- src/Window.hh | 7 ++++--- 4 files changed, 58 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 887a3de..45c0a47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ (Format: Year/Month/Day) Changes for 0.9.12 *05/01/05: + * Tidy up initialisation a bit better. Handlers can still use "action" + functions (e.g. stick()), but those functions should now check if + isInitialised and only set the state variables (not send signals + etc) if not. + Window.hh/cc Ewmh.cc * Fix for BScreen::reassociateWindow (Mathias) Simon's last changes made fluxbox crash when "Sticky" or "Workspace" options in the apps-file where used. This fix also solves and diff --git a/src/Ewmh.cc b/src/Ewmh.cc index 2d744f7..548633c 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -238,7 +238,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) { if (desktop == 0xFFFFFFFF && !win.isStuck()) win.stick(); else - win.setWorkspace(desktop, false); + win.setWorkspace(desktop); XFree(data); } diff --git a/src/Window.cc b/src/Window.cc index fdb636d..4498428 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -280,7 +280,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm, m_themelistener(*this), moving(false), resizing(false), shaded(false), iconic(false), focused(false), - stuck(false), m_managed(false), fullscreen(false), + stuck(false), m_initialized(false), fullscreen(false), maximized(MAX_NONE), m_attaching_tab(0), m_screen(client.screen()), @@ -490,11 +490,16 @@ void FluxboxWindow::init() { return; } - m_managed = true; //this window is managed - Fluxbox::instance()->saveWindowSearchGroup(frame().window().window(), this); Fluxbox::instance()->attachSignals(*this); + /**************************************************/ + /* Read state above here, apply state below here. */ + /**************************************************/ + + // this window is managed, we are now allowed to modify actual state + m_initialized = true; + // update transient infomation m_client->updateTransientInfo(); @@ -566,12 +571,12 @@ void FluxboxWindow::init() { m_client->transientFor()->fbwindow()->title()<addWindow(*this, place_window); - setWorkspace(m_workspace_number, true); + setWorkspace(m_workspace_number); if (shaded) { // start shaded shaded = false; @@ -602,6 +607,7 @@ void FluxboxWindow::init() { setupWindow(); FbTk::App::instance()->sync(false); + } /// apply shape to this window @@ -1748,7 +1754,7 @@ void FluxboxWindow::maximizeFull() { } -void FluxboxWindow::setWorkspace(int n, bool notify) { +void FluxboxWindow::setWorkspace(int n) { unsigned int old_wkspc = m_workspace_number; m_workspace_number = n; @@ -1757,7 +1763,7 @@ void FluxboxWindow::setWorkspace(int n, bool notify) { m_blackbox_attrib.workspace = m_workspace_number; // notify workspace change - if (notify && !stuck && old_wkspc != m_workspace_number) { + if (isInitialized() && !stuck && old_wkspc != m_workspace_number) { #ifdef DEBUG cerr<getMenuLayer()+1)) return; + if (!isInitialized()) { + m_layernum++; + return; + } + // get root window WinClient *client = getRootTransientFor(m_client); @@ -1914,6 +1932,12 @@ void FluxboxWindow::raiseLayer() { } void FluxboxWindow::lowerLayer() { + if (!isInitialized()) { + if (m_layernum > 0) + m_layernum--; + return; + } + // get root window WinClient *client = getRootTransientFor(m_client); @@ -1957,6 +1981,11 @@ void FluxboxWindow::moveToLayer(int layernum) { layernum = fluxbox->getMenuLayer() + 1; } + if (!isInitialized()) { + m_layernum = layernum; + return; + } + // get root window WinClient *client = getRootTransientFor(m_client); @@ -1993,12 +2022,14 @@ void FluxboxWindow::setFocusHidden(bool value) { else m_blackbox_attrib.flags ^= ATTRIB_HIDDEN; - m_statesig.notify(); + if (isInitialized()) + m_statesig.notify(); } void FluxboxWindow::setIconHidden(bool value) { m_icon_hidden= value; - m_statesig.notify(); + if (isInitialized()) + m_statesig.notify(); } diff --git a/src/Window.hh b/src/Window.hh index 020fd88..5f1468b 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -234,7 +234,7 @@ public: /// move and resize frame to pox x,y and size width, height void moveResize(int x, int y, unsigned int width, unsigned int height, int gravity = ForgetGravity); - void setWorkspace(int n, bool notify = true); + void setWorkspace(int n); void changeBlackboxHints(const BlackboxHints &bh); void updateFunctions(); void restoreAttributes(); @@ -286,7 +286,8 @@ public: inline bool isFocusHidden() const { return (m_blackbox_attrib.flags & ATTRIB_HIDDEN); } inline bool isIconHidden() const { return m_icon_hidden; } - inline bool isManaged() const { return m_managed; } + inline bool isManaged() const { return m_initialized; } + inline bool isInitialized() const { return m_initialized; } inline bool isFocused() const { return focused; } bool isVisible() const; inline bool isIconic() const { return iconic; } @@ -459,7 +460,7 @@ private: // Window states bool moving, resizing, shaded, iconic, - focused, stuck, m_managed, fullscreen; + focused, stuck, m_initialized, fullscreen; int maximized; -- cgit v0.11.2