* When the current focus window was closed or invisible, we used to
chose the front window as our next focus window - but this proved to be problematic with B_AVOID_FRONT windows. Therefore, we now simply chose the top-most window as the next focus window. This fixes bug #281, and potentially also fixes bug #181. * This also revealed another bug in SetFocusWindow(): when the window to have focus already had focus, but were hidden before, the focus did not change; if that window was subsequently removed, the app_server would have crashed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16811 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -897,7 +897,7 @@ Desktop::_UpdateFloating(int32 previousWorkspace, int32 nextWorkspace)
|
||||
|
||||
/*!
|
||||
Search the visible windows for a valid back window
|
||||
(only normal windows can be back windows)
|
||||
(only desktop windows can't be back windows)
|
||||
*/
|
||||
void
|
||||
Desktop::_UpdateBack()
|
||||
@@ -906,7 +906,7 @@ Desktop::_UpdateBack()
|
||||
|
||||
for (WindowLayer* window = _CurrentWindows().FirstWindow();
|
||||
window != NULL; window = window->NextWindow(fCurrentWorkspace)) {
|
||||
if (window->IsHidden() || !window->SupportsFront())
|
||||
if (window->IsHidden() || window->Feel() == kDesktopWindowFeel)
|
||||
continue;
|
||||
|
||||
fBack = window;
|
||||
@@ -990,8 +990,8 @@ Desktop::SetFocusWindow(WindowLayer* focus)
|
||||
|
||||
// TODO: test for FFM and B_LOCK_WINDOW_FOCUS
|
||||
|
||||
if (focus == fFocus && focus != NULL && (focus->Flags() & B_AVOID_FOCUS) == 0
|
||||
&& !hasModal) {
|
||||
if (focus == fFocus && focus != NULL && !focus->IsHidden()
|
||||
&& (focus->Flags() & B_AVOID_FOCUS) == 0 && !hasModal) {
|
||||
// the window that is supposed to get focus already has focus
|
||||
UnlockAllWindows();
|
||||
return;
|
||||
@@ -1209,7 +1209,7 @@ Desktop::SendWindowBehind(WindowLayer* window, WindowLayer* behindOf)
|
||||
MarkDirty(dirty);
|
||||
|
||||
_UpdateFronts();
|
||||
SetFocusWindow(FrontWindow());
|
||||
SetFocusWindow(_CurrentWindows().LastWindow());
|
||||
_WindowChanged(window);
|
||||
|
||||
UnlockAllWindows();
|
||||
@@ -1284,7 +1284,7 @@ Desktop::HideWindow(WindowLayer* window)
|
||||
_UpdateFronts();
|
||||
|
||||
if (FocusWindow() == window)
|
||||
SetFocusWindow(FrontWindow());
|
||||
SetFocusWindow(_CurrentWindows().LastWindow());
|
||||
}
|
||||
|
||||
if (fWorkspacesLayer != NULL)
|
||||
@@ -1707,7 +1707,7 @@ Desktop::SetWindowFeel(WindowLayer *window, window_feel newFeel)
|
||||
_UpdateFronts();
|
||||
|
||||
if (window == FocusWindow() && !window->IsVisible())
|
||||
SetFocusWindow(FrontWindow());
|
||||
SetFocusWindow(_CurrentWindows().LastWindow());
|
||||
|
||||
UnlockAllWindows();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Haiku, Inc.
|
||||
* Copyright (c) 2005-2006, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*
|
||||
* Authors:
|
||||
@@ -47,6 +47,10 @@ WindowList::SetIndex(int32 index)
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Adds the \a window to the end of the list. If \a before is
|
||||
given, it will be inserted right before that window.
|
||||
*/
|
||||
void
|
||||
WindowList::AddWindow(WindowLayer* window, WindowLayer* before)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user