all repos — fluxbox @ b8318144826e443a544def93929f8b0e036eab1b

custom fork of the fluxbox windowmanager

fixed check on valid win and screen pointer in setFocusedWindow
fluxgen fluxgen
commit

b8318144826e443a544def93929f8b0e036eab1b

parent

1c7a33c64c2a2a556fd8b27b201274e8b3a5fb01

1 files changed, 21 insertions(+), 14 deletions(-)

jump to
M src/fluxbox.ccsrc/fluxbox.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: fluxbox.cc,v 1.60 2002/05/29 06:22:31 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.61 2002/07/13 14:04:46 fluxgen Exp $ //Use GNU extensions #ifndef _GNU_SOURCE

@@ -2437,14 +2437,14 @@

reconfigure_wait = reread_menu_wait = false; } - +// set focused window void Fluxbox::setFocusedWindow(FluxboxWindow *win) { BScreen *old_screen = 0, *screen = 0; FluxboxWindow *old_win = 0; Toolbar *old_tbar = 0, *tbar = 0; Workspace *old_wkspc = 0, *wkspc = 0; - if (focused_window!=0) { + if (focused_window != 0) { old_win = focused_window; old_screen = old_win->getScreen();

@@ -2455,22 +2455,29 @@ old_win->setFocusFlag(False);

old_wkspc->menu()->setItemSelected(old_win->getWindowNumber(), false); } - + if (win && ! win->isIconic()) { - - screen = win->getScreen(); - tbar = screen->getToolbar(); - wkspc = screen->getWorkspace(win->getWorkspaceNumber()); - focused_window = win; - win->setFocusFlag(True); - wkspc->menu()->setItemSelected(win->getWindowNumber(), true); - + // make sure we have a valid win pointer with a valid screen + ScreenList::iterator winscreen = + std::find(screenList.begin(), screenList.end(), + win->getScreen()); + if (winscreen == screenList.end()) + focused_window = 0; // the window pointer wasn't valid, mark no window focused + else { + screen = *winscreen; + tbar = screen->getToolbar(); + wkspc = screen->getWorkspace(win->getWorkspaceNumber()); + focused_window = win; // update focused window + win->setFocusFlag(True); // set focus flag + // select this window in workspace menu + wkspc->menu()->setItemSelected(win->getWindowNumber(), true); + } } else focused_window = (FluxboxWindow *) 0; - if (tbar!=0) + if (tbar != 0) tbar->redrawWindowLabel(True); - if (screen!=0) + if (screen != 0) screen->updateNetizenWindowFocus(); if (old_tbar && old_tbar != tbar)