From 8a3cfa2cf315cabd650bc02c61acf942d1eb68c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 2 Sep 2007 12:16:28 +0000 Subject: [PATCH] * Made menu windows behave differently than others: before, they were just always put between window screens and modal all windows (before floating all ones), so a BWindowScreen couldn't have menus at all. Now, they behave more like floating app windows, just that they float above all other application windows, such that all window feels (also BWindowScreen) can now have menus. * Reenabled keyboard redirection to the top most window in case it's a menu; bug #1152 no longer applies due to the above change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22149 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 5 +---- src/servers/app/WindowLayer.cpp | 14 +++++++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index c409f7b12c..df1d36464a 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1107,13 +1107,10 @@ Desktop::_UpdateFronts(bool updateFloating) EventTarget* Desktop::KeyboardEventTarget() { - // TODO: Not yet useful, and prevents a crashing application - // which has opened menu windows to be debugged (ticket #1152) -#if 0 WindowLayer* window = _CurrentWindows().LastWindow(); if (window != NULL && window->Feel() == kMenuWindowFeel) return &window->EventTarget(); -#endif + if (FocusWindow() != NULL) return &FocusWindow()->EventTarget(); diff --git a/src/servers/app/WindowLayer.cpp b/src/servers/app/WindowLayer.cpp index dd7d097f3a..19c847401e 100644 --- a/src/servers/app/WindowLayer.cpp +++ b/src/servers/app/WindowLayer.cpp @@ -1528,13 +1528,21 @@ WindowLayer::RemoveFromSubset(WindowLayer* window) bool WindowLayer::HasInSubset(const WindowLayer* window) const { - if (window == NULL || fFeel == window->Feel() || fFeel == B_NORMAL_WINDOW_FEEL) + if (window == NULL || fFeel == window->Feel() + || fFeel == B_NORMAL_WINDOW_FEEL) + return false; + + // Menus are a special case: they will always be on-top of every window + // of their application + if (fFeel == kMenuWindowFeel) + return window->ServerWindow()->App() == ServerWindow()->App(); + else if (window->Feel() == kMenuWindowFeel) return false; // we have a few special feels that have a fixed order - const int32 feel[] = {kWindowScreenFeel, kMenuWindowFeel, - B_MODAL_ALL_WINDOW_FEEL, B_FLOATING_ALL_WINDOW_FEEL, 0}; + const int32 feel[] = {kWindowScreenFeel, B_MODAL_ALL_WINDOW_FEEL, + B_FLOATING_ALL_WINDOW_FEEL, 0}; for (int32 order = 0; feel[order]; order++) { if (fFeel == feel[order])