X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FScreen.cc;h=5f69d82af15025eaf2d54d5e8265c501a9c78c82;hb=1766453ca2ce30adf84798cb504e8b4d258bd08f;hp=6d20451303bb0826322756f3704f48fe4e6a95a4;hpb=8941da8e41d15ae6729c04b2933d74869c25e857;p=chaz%2Fopenbox diff --git a/src/Screen.cc b/src/Screen.cc index 6d204513..5f69d82a 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -245,6 +245,8 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) { workspacemenu->setItemSelected(2, True); + removeWorkspaceNames(); // do not need them any longer + toolbar = new Toolbar(this); slit = new Slit(this); @@ -593,7 +595,6 @@ void BScreen::load_rc(void) { else resource.col_direction = TopBottom; - removeWorkspaceNames(); if (config->getValue(screenstr + "workspaceNames", s)) { string::const_iterator it = s.begin(), end = s.end(); while(1) { @@ -1060,10 +1061,6 @@ void BScreen::changeWorkspaceID(unsigned int id) { if (! current_workspace) return; if (id != current_workspace->getID()) { - current_workspace->hideAll(); - - workspacemenu->setItemSelected(current_workspace->getID() + 2, False); - BlackboxWindow *focused = blackbox->getFocusedWindow(); if (focused && focused->getScreen() == this && ! focused->isStuck()) { if (focused->getWorkspaceNumber() != current_workspace->getID()) { @@ -1072,8 +1069,15 @@ void BScreen::changeWorkspaceID(unsigned int id) { abort(); } current_workspace->setLastFocusedWindow(focused); - blackbox->setFocusedWindow((BlackboxWindow *) 0); + } else { + // if no window had focus, no need to store a last focus + current_workspace->setLastFocusedWindow((BlackboxWindow *) 0); } + // when we switch workspaces, unfocus whatever was focused + blackbox->setFocusedWindow((BlackboxWindow *) 0); + + current_workspace->hideAll(); + workspacemenu->setItemSelected(current_workspace->getID() + 2, False); current_workspace = getWorkspace(id); @@ -1229,7 +1233,7 @@ void BScreen::updateNetizenConfigNotify(XEvent *e) { void BScreen::raiseWindows(Window *workspace_stack, unsigned int num) { - // XXX: why 13?? + // the 13 represents the number of blackbox windows such as menus Window *session_stack = new Window[(num + workspacesList.size() + rootmenuList.size() + 13)]; unsigned int i = 0, k = num;