From da0f53d8e4dee43e53b85e5224506b1f81e1228e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 27 Feb 2006 14:05:04 +0000 Subject: [PATCH] B_AVOID_FRONT window were ignored when activating a window, and thus, menus could steal the focus of the focus window. This fixes bug #181. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16532 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 022c65bb30..6ca95b1cd2 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1117,10 +1117,20 @@ Desktop::ActivateWindow(WindowLayer* window) return; if (window == FrontWindow()) { - SetFocusWindow(window); + // see if there is a normal B_AVOID_FRONT window still in front of us + WindowLayer* avoidsFront = window->NextWindow(fCurrentWorkspace); + while (avoidsFront && avoidsFront->IsNormal() + && (avoidsFront->Flags() & B_AVOID_FRONT) == 0) { + avoidsFront = avoidsFront->NextWindow(fCurrentWorkspace); + } - UnlockAllWindows(); - return; + if (avoidsFront == NULL) { + // we're already the frontmost window, we might just not have focus yet + SetFocusWindow(window); + + UnlockAllWindows(); + return; + } } // we don't need to redraw what is currently