all repos — fluxbox @ 83224b7f55c9fd1febb89171d311da95f323eae4

custom fork of the fluxbox windowmanager

fix up window initialisation ordering
simonb simonb
commit

83224b7f55c9fd1febb89171d311da95f323eae4

parent

a6c1529a97585aea2392e6cc2ddcbd3b909aeff7

4 files changed, 58 insertions(+), 21 deletions(-)

jump to
M ChangeLogChangeLog

@@ -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 <Current> and
M src/Ewmh.ccsrc/Ewmh.cc

@@ -238,7 +238,7 @@ unsigned int desktop = static_cast<unsigned int>(*data);

if (desktop == 0xFFFFFFFF && !win.isStuck()) win.stick(); else - win.setWorkspace(desktop, false); + win.setWorkspace(desktop); XFree(data); }
M src/Window.ccsrc/Window.cc

@@ -280,7 +280,7 @@ m_titlesig(*this),

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,10 +490,15 @@ if (m_client->initial_state == WithdrawnState) {

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 @@ cerr<<"FluxboxWindow::init("<<title()<<") transientFor->title(): "<<

m_client->transientFor()->fbwindow()->title()<<endl; } #endif // DEBUG + if (!place_window) moveResize(frame().x(), frame().y(), frame().width(), frame().height()); - screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window); - setWorkspace(m_workspace_number, true); + setWorkspace(m_workspace_number); if (shaded) { // start shaded shaded = false;

@@ -602,6 +607,7 @@

setupWindow(); FbTk::App::instance()->sync(false); + } /// apply shape to this window

@@ -1748,7 +1754,7 @@ maximize(MAX_FULL);

} -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 @@ m_blackbox_attrib.flags |= ATTRIB_WORKSPACE;

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<<this<<" notify workspace signal"<<endl; #endif // DEBUG

@@ -1770,13 +1776,16 @@ m_layernum = layernum;

m_blackbox_attrib.flags |= ATTRIB_STACK; m_blackbox_attrib.stack = layernum; - saveBlackboxAttribs(); + + if (isInitialized()) { + saveBlackboxAttribs(); #ifdef DEBUG - cerr<<this<<" notify layer signal"<<endl; + cerr<<this<<" notify layer signal"<<endl; #endif // DEBUG - m_layersig.notify(); + m_layersig.notify(); + } } void FluxboxWindow::shade() {

@@ -1791,13 +1800,15 @@ shaded = false;

m_blackbox_attrib.flags ^= ATTRIB_SHADED; m_blackbox_attrib.attrib ^= ATTRIB_SHADED; - setState(NormalState, false); + if (isInitialized()) + setState(NormalState, false); } else { shaded = true; m_blackbox_attrib.flags |= ATTRIB_SHADED; m_blackbox_attrib.attrib |= ATTRIB_SHADED; // shading is the same as iconic - setState(IconicState, false); + if (isInitialized()) + setState(IconicState, false); } }

@@ -1819,9 +1830,11 @@ m_blackbox_attrib.attrib |= ATTRIB_OMNIPRESENT;

} - setState(m_current_state, false); - // notify since some things consider "stuck" to be a pseudo-workspace - m_workspacesig.notify(); + if (isInitialized()) { + setState(m_current_state, false); + // notify since some things consider "stuck" to be a pseudo-workspace + m_workspacesig.notify(); + } }

@@ -1882,6 +1895,11 @@ // don't let it up to menu layer

if (layerNum() == (Fluxbox::instance()->getMenuLayer()+1)) return; + if (!isInitialized()) { + m_layernum++; + return; + } + // get root window WinClient *client = getRootTransientFor(m_client);

@@ -1914,6 +1932,12 @@ }

} void FluxboxWindow::lowerLayer() { + if (!isInitialized()) { + if (m_layernum > 0) + m_layernum--; + return; + } + // get root window WinClient *client = getRootTransientFor(m_client);

@@ -1955,6 +1979,11 @@

// don't let it set its layer into menu area if (layernum <= fluxbox->getMenuLayer()) { layernum = fluxbox->getMenuLayer() + 1; + } + + if (!isInitialized()) { + m_layernum = layernum; + return; } // get root window

@@ -1993,12 +2022,14 @@ m_blackbox_attrib.flags |= ATTRIB_HIDDEN;

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(); }
M src/Window.hhsrc/Window.hh

@@ -234,7 +234,7 @@ void resize(unsigned int width, unsigned int height);

/// 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 @@ inline void setResizable(bool resizable) { functions.resize = resizable; }

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 @@ ThemeListener m_themelistener;

// Window states bool moving, resizing, shaded, iconic, - focused, stuck, m_managed, fullscreen; + focused, stuck, m_initialized, fullscreen; int maximized;