* SetFocusWindow() now makes sure no hidden window is taken as focus window...

* When switching workspaces, usually the focus switches to the front window.
  This no longer happens in case a floating window had focus and is still visible
  in the new workspace - in that case, focus is kept with the floating window.
* SetFocusWindow() now chooses the topmost window in case the specified window
  has either a modal or there is no front window.
Desktop::RemoveWindow() now makes sure the window is hidden before removing it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15447 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-12-09 14:23:51 +00:00
parent e695fe845d
commit e566030298

View File

@ -675,6 +675,9 @@ Desktop::SetWorkspace(int32 index)
_UpdateFronts(false);
_UpdateFloating(previousIndex, index);
// Set new focus to the front window, but keep focus to a floating
// window if still visible
if (!_Windows(index).HasWindow(FocusWindow()) || !FocusWindow()->IsFloating())
SetFocusWindow(FrontWindow());
MarkDirty(dirty);
@ -881,12 +884,20 @@ Desktop::SetFocusWindow(WindowLayer* focus)
return;
}
if (focus == NULL || hasModal)
if (focus == NULL || hasModal) {
focus = FrontWindow();
if (focus == NULL) {
// there might be no front window in case of only a single
// window with B_FLOATING_ALL_WINDOW_FEEL
focus = _CurrentWindows().LastWindow();
}
}
// make sure no window is chosen that doesn't want focus or cannot have it
while (focus != NULL
&& ((focus->Flags() & B_AVOID_FOCUS) != 0 || _WindowHasModal(focus))) {
&& ((focus->Flags() & B_AVOID_FOCUS) != 0
|| _WindowHasModal(focus)
|| focus->IsHidden())) {
focus = focus->PreviousWindow(fCurrentWorkspace);
}
@ -1366,6 +1377,9 @@ Desktop::RemoveWindow(WindowLayer *window)
{
BAutolock _(this);
if (!window->IsHidden())
HideWindow(window);
fAllWindows.RemoveWindow(window);
if (!window->IsNormal())
fSubsetWindows.RemoveWindow(window);