IsModal() now includes also the kMenuWindowLook. Fixes bug #1269. Please

review.
Added a compile time option to switch off the use of the cached menu 
windows. Looks like there is a problem with the focus system, if I keep 
the cached menu window around, it "steals" keyboard events from the main 
app window after the menu has been opened and closed once.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23343 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2008-01-10 16:04:57 +00:00
parent c99755c092
commit 0625889c61
2 changed files with 12 additions and 5 deletions
+9 -4
View File
@@ -34,6 +34,7 @@
#include "utf8_functions.h"
#define USE_CACHED_MENUWINDOW 0
using std::nothrow;
using BPrivate::BMenuWindow;
@@ -1367,12 +1368,14 @@ BMenu::_Hide()
window->DetachMenu();
// we don't want to be deleted when the window is removed
#if USE_CACHED_MENUWINDOW
if (fSuper != NULL)
window->Unlock();
else {
// it's our window, quit it
else
#endif
window->Quit();
}
// it's our window, quit it
// Delete the menu window used by our submenus
_DeleteMenuWindow();
@@ -2022,12 +2025,13 @@ BMenu::_OverSubmenu(BMenuItem *item, BPoint loc)
BMenuWindow *
BMenu::_MenuWindow()
{
#if USE_CACHED_MENUWINDOW
if (fCachedMenuWindow == NULL) {
char windowName[64];
snprintf(windowName, 64, "%s cached menu", Name());
fCachedMenuWindow = new (nothrow) BMenuWindow(windowName);
}
#endif
return fCachedMenuWindow;
}
@@ -2385,6 +2389,7 @@ BMenu::QuitTracking()
menuBar->_RestoreFocus();
fChosenItem = NULL;
fState = MENU_STATE_CLOSED;
_Hide();
}
+3 -1
View File
@@ -34,6 +34,7 @@
#include <ServerProtocol.h>
#include <TokenSpace.h>
#include <tracker_private.h>
#include <WindowPrivate.h>
#include <ctype.h>
#include <stdio.h>
@@ -1912,7 +1913,8 @@ BWindow::IsModal() const
{
return fFeel == B_MODAL_SUBSET_WINDOW_FEEL
|| fFeel == B_MODAL_APP_WINDOW_FEEL
|| fFeel == B_MODAL_ALL_WINDOW_FEEL;
|| fFeel == B_MODAL_ALL_WINDOW_FEEL
|| fFeel == kMenuWindowFeel;
}