fixed check on valid win and screen pointer in setFocusedWindow
This commit is contained in:
parent
1c7a33c64c
commit
b831814482
1 changed files with 21 additions and 14 deletions
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
//Use GNU extensions
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
|
@ -2437,14 +2437,14 @@ void Fluxbox::timeout(void) {
|
||||||
reconfigure_wait = reread_menu_wait = false;
|
reconfigure_wait = reread_menu_wait = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set focused window
|
||||||
void Fluxbox::setFocusedWindow(FluxboxWindow *win) {
|
void Fluxbox::setFocusedWindow(FluxboxWindow *win) {
|
||||||
BScreen *old_screen = 0, *screen = 0;
|
BScreen *old_screen = 0, *screen = 0;
|
||||||
FluxboxWindow *old_win = 0;
|
FluxboxWindow *old_win = 0;
|
||||||
Toolbar *old_tbar = 0, *tbar = 0;
|
Toolbar *old_tbar = 0, *tbar = 0;
|
||||||
Workspace *old_wkspc = 0, *wkspc = 0;
|
Workspace *old_wkspc = 0, *wkspc = 0;
|
||||||
|
|
||||||
if (focused_window!=0) {
|
if (focused_window != 0) {
|
||||||
old_win = focused_window;
|
old_win = focused_window;
|
||||||
old_screen = old_win->getScreen();
|
old_screen = old_win->getScreen();
|
||||||
|
|
||||||
|
@ -2457,20 +2457,27 @@ void Fluxbox::setFocusedWindow(FluxboxWindow *win) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (win && ! win->isIconic()) {
|
if (win && ! win->isIconic()) {
|
||||||
|
// make sure we have a valid win pointer with a valid screen
|
||||||
screen = win->getScreen();
|
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();
|
tbar = screen->getToolbar();
|
||||||
wkspc = screen->getWorkspace(win->getWorkspaceNumber());
|
wkspc = screen->getWorkspace(win->getWorkspaceNumber());
|
||||||
focused_window = win;
|
focused_window = win; // update focused window
|
||||||
win->setFocusFlag(True);
|
win->setFocusFlag(True); // set focus flag
|
||||||
|
// select this window in workspace menu
|
||||||
wkspc->menu()->setItemSelected(win->getWindowNumber(), true);
|
wkspc->menu()->setItemSelected(win->getWindowNumber(), true);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
focused_window = (FluxboxWindow *) 0;
|
focused_window = (FluxboxWindow *) 0;
|
||||||
|
|
||||||
if (tbar!=0)
|
if (tbar != 0)
|
||||||
tbar->redrawWindowLabel(True);
|
tbar->redrawWindowLabel(True);
|
||||||
if (screen!=0)
|
if (screen != 0)
|
||||||
screen->updateNetizenWindowFocus();
|
screen->updateNetizenWindowFocus();
|
||||||
|
|
||||||
if (old_tbar && old_tbar != tbar)
|
if (old_tbar && old_tbar != tbar)
|
||||||
|
|
Loading…
Reference in a new issue