From ccf137b886131b78172201ee7e04f4d011634a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 6 Jan 2007 17:08:19 +0000 Subject: [PATCH] BWindow::IsFront() was implemented incorrectly - we actually need to query the app_server for this; added a new AS_IS_FRONT_WINDOW command for this. For example, clicking on the menu bar to bring windows to front in FFM mode does work now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19725 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/app/ServerProtocol.h | 3 ++- src/kits/interface/Window.cpp | 14 ++++++++++++-- src/servers/app/ServerWindow.cpp | 7 ++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/headers/private/app/ServerProtocol.h b/headers/private/app/ServerProtocol.h index 55a153c2d7..8295d220b5 100644 --- a/headers/private/app/ServerProtocol.h +++ b/headers/private/app/ServerProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -92,6 +92,7 @@ enum { AS_WINDOW_MOVE, AS_SET_SIZE_LIMITS, AS_ACTIVATE_WINDOW, + AS_IS_FRONT_WINDOW, AS_UPDATE_IF_NEEDED, // BPicture definitions diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 5bdbccd89b..0b9257c2f5 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -647,7 +647,17 @@ BWindow::EndViewTransaction() bool BWindow::IsFront() const { - return (IsActive() || IsModal()); + BAutolock locker(const_cast(this)); + if (!locker.IsLocked()) + return false; + + fLink->StartMessage(AS_IS_FRONT_WINDOW); + + status_t status; + if (fLink->FlushWithReply(status) == B_OK) + return status >= B_OK; + + return false; } diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index b9bd8f8f85..0984564c84 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -813,6 +813,11 @@ fDesktop->LockSingleWindow(); break; } #endif + case AS_IS_FRONT_WINDOW: + fLink.StartMessage(fDesktop->FrontWindow() == fWindowLayer ? B_OK : B_ERROR); + fLink.Flush(); + break; + case AS_GET_WORKSPACES: { STRACE(("ServerWindow %s: Message AS_GET_WORKSPACES\n", Title()));