all repos — fluxbox @ 4589ecdbbc719cc49f10cef4a9460d89b6a8fba7

custom fork of the fluxbox windowmanager

fix initialisation of state when a window is first mapped
rathnor rathnor
commit

4589ecdbbc719cc49f10cef4a9460d89b6a8fba7

parent

e68a7a4e72f0a0b3303d89e3b6a7d345997bf987

4 files changed, 38 insertions(+), 55 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,8 @@

(Format: Year/Month/Day) Changes for 0.9.10: +*04/06/20: + * Fix honouring of initial state on window open (Simon) + Window.hh/cc Screen.cc *04/06/18: * background xmessage in fbsetbg so it doesn't block anything also set the "okay" button to default so you can just press enter
M src/Screen.ccsrc/Screen.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.281 2004/06/14 12:25:31 fluxgen Exp $ +// $Id: Screen.cc,v 1.282 2004/06/19 15:04:27 rathnor Exp $ #include "Screen.hh"

@@ -1186,10 +1186,6 @@ if ((otherwin = findGroupRight(*winclient)) && otherwin != win) {

win->attachClient(otherwin->winClient()); } - if (!win->isIconic() && (win->workspaceNumber() == currentWorkspaceID() || win->isStuck())) { - win->show(); - } - m_clientlist_sig.notify(); FbTk::App::instance()->sync(false);

@@ -1229,9 +1225,6 @@ // don't add to focused_list, as it should already be in there (since the

// WinClient already exists). Fluxbox::instance()->attachSignals(*win); - // winclient actions should have been setup when the WinClient was created - if (win->workspaceNumber() == currentWorkspaceID() || win->isStuck()) - win->show(); m_clientlist_sig.notify();
M src/Window.ccsrc/Window.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.289 2004/06/07 21:48:14 fluxgen Exp $ +// $Id: Window.cc,v 1.290 2004/06/19 15:04:27 rathnor Exp $ #include "Window.hh"

@@ -557,8 +557,6 @@ stuck = false;

stick(); deiconify(); //we're omnipresent and visible } - - setState(m_current_state); sendConfigureNotify(); // no focus default

@@ -1285,7 +1283,7 @@ return;

iconic = true; - setState(IconicState); + setState(IconicState, false); hide(true);

@@ -1332,7 +1330,7 @@

bool was_iconic = iconic; iconic = false; - setState(NormalState); + setState(NormalState, false); ClientList::iterator client_it = clientList().begin(); ClientList::iterator client_it_end = clientList().end();

@@ -1522,13 +1520,13 @@ shaded = false;

m_blackbox_attrib.flags ^= ATTRIB_SHADED; m_blackbox_attrib.attrib ^= ATTRIB_SHADED; - setState(NormalState); + 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); + setState(IconicState, false); } }

@@ -1550,7 +1548,7 @@ m_blackbox_attrib.attrib |= ATTRIB_OMNIPRESENT;

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

@@ -1811,28 +1809,31 @@ }

/** Sets state on each client in our list + Use setting_up for setting startup state - it may not be committed yet + That'll happen when its mapped */ -void FluxboxWindow::setState(unsigned long new_state) { +void FluxboxWindow::setState(unsigned long new_state, bool setting_up) { if (numClients() == 0) return; m_current_state = new_state; - unsigned long state[2]; - state[0] = (unsigned long) m_current_state; - state[1] = (unsigned long) None; + if (!setting_up) { + unsigned long state[2]; + state[0] = (unsigned long) m_current_state; + state[1] = (unsigned long) None; - for_each(m_clientlist.begin(), m_clientlist.end(), - FbTk::ChangeProperty(display, FbAtoms::instance()->getWMStateAtom(), - PropModeReplace, - (unsigned char *)state, 2)); + for_each(m_clientlist.begin(), m_clientlist.end(), + FbTk::ChangeProperty(display, FbAtoms::instance()->getWMStateAtom(), + PropModeReplace, + (unsigned char *)state, 2)); - saveBlackboxAttribs(); - //notify state changed - m_statesig.notify(); + saveBlackboxAttribs(); + //notify state changed + m_statesig.notify(); + } } bool FluxboxWindow::getState() { - m_current_state = 0; Atom atom_return; bool ret = false;

@@ -1863,7 +1864,7 @@ * (so the caller can set defaults etc as well)

*/ void FluxboxWindow::restoreAttributes() { if (!getState()) - m_current_state = NormalState; + m_current_state = m_client->initial_state; Atom atom_return; int foo;

@@ -1894,29 +1895,16 @@ } else

return; if (m_blackbox_attrib.flags & ATTRIB_SHADED && - m_blackbox_attrib.attrib & ATTRIB_SHADED) { - int save_state = - ((m_current_state == IconicState) ? NormalState : m_current_state); - + m_blackbox_attrib.attrib & ATTRIB_SHADED) shaded = true; - - m_current_state = save_state; - } if (( m_blackbox_attrib.workspace != screen().currentWorkspaceID()) && - ( m_blackbox_attrib.workspace < screen().getCount())) { + ( m_blackbox_attrib.workspace < screen().getCount())) m_workspace_number = m_blackbox_attrib.workspace; - if (m_current_state == NormalState) m_current_state = WithdrawnState; - } else if (m_current_state == WithdrawnState) - m_current_state = NormalState; - if (m_blackbox_attrib.flags & ATTRIB_OMNIPRESENT && - m_blackbox_attrib.attrib & ATTRIB_OMNIPRESENT) { + m_blackbox_attrib.attrib & ATTRIB_OMNIPRESENT) stuck = true; - - m_current_state = NormalState; - } if (m_blackbox_attrib.flags & ATTRIB_STACK) { //!! TODO check value?

@@ -1942,7 +1930,6 @@ m_blackbox_attrib.premax_w = w;

m_blackbox_attrib.premax_h = h; } - setState(m_current_state); } /**

@@ -2062,14 +2049,14 @@ Fluxbox *fluxbox = Fluxbox::instance();

bool get_state_ret = getState(); if (! (get_state_ret && fluxbox->isStartup())) { - if ((m_client->wm_hint_flags & StateHint) && - (! (m_current_state == NormalState || m_current_state == IconicState))) { + if ((m_client->wm_hint_flags & StateHint) && m_current_state == 0) {// && m_current_state = m_client->initial_state; - } else - m_current_state = NormalState; + } } else if (iconic) m_current_state = NormalState; - + + setState(m_current_state, false); + switch (m_current_state) { case IconicState: iconify();

@@ -2091,7 +2078,7 @@ Workspace *wsp = screen().getWorkspace(m_workspace_number);

if (wsp != 0 && isGroupable()) destroyed = wsp->checkGrouping(*this); - // if we wasn't grouped with another window we deiconify ourself + // if we weren't grouped with another window we deiconify ourself if (!destroyed) deiconify(false);

@@ -2118,7 +2105,7 @@ fluxbox->grab();

if (! client->validateClient()) return; - setState(NormalState); + setState(NormalState, false); if (client->isTransient() || screen().doFocusNew()) setCurrentClient(*client, true);
M src/Window.hhsrc/Window.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.114 2004/05/13 01:48:18 rathnor Exp $ +// $Id: Window.hh,v 1.115 2004/06/19 15:04:28 rathnor Exp $ #ifndef WINDOW_HH #define WINDOW_HH

@@ -404,7 +404,7 @@ void associateClientWindow(bool use_attrs = false, int x = 0, int y = 0, unsigned int width = 1, unsigned int height = 1);

void restoreGravity(); void setGravityOffsets(); - void setState(unsigned long stateval); + void setState(unsigned long stateval, bool setting_up); void upsize(); void downsize();