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:
@@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include "utf8_functions.h"
|
#include "utf8_functions.h"
|
||||||
|
|
||||||
|
#define USE_CACHED_MENUWINDOW 0
|
||||||
|
|
||||||
using std::nothrow;
|
using std::nothrow;
|
||||||
using BPrivate::BMenuWindow;
|
using BPrivate::BMenuWindow;
|
||||||
@@ -1367,12 +1368,14 @@ BMenu::_Hide()
|
|||||||
window->DetachMenu();
|
window->DetachMenu();
|
||||||
// we don't want to be deleted when the window is removed
|
// we don't want to be deleted when the window is removed
|
||||||
|
|
||||||
|
#if USE_CACHED_MENUWINDOW
|
||||||
if (fSuper != NULL)
|
if (fSuper != NULL)
|
||||||
window->Unlock();
|
window->Unlock();
|
||||||
else {
|
else
|
||||||
// it's our window, quit it
|
#endif
|
||||||
window->Quit();
|
window->Quit();
|
||||||
}
|
// it's our window, quit it
|
||||||
|
|
||||||
|
|
||||||
// Delete the menu window used by our submenus
|
// Delete the menu window used by our submenus
|
||||||
_DeleteMenuWindow();
|
_DeleteMenuWindow();
|
||||||
@@ -2022,12 +2025,13 @@ BMenu::_OverSubmenu(BMenuItem *item, BPoint loc)
|
|||||||
BMenuWindow *
|
BMenuWindow *
|
||||||
BMenu::_MenuWindow()
|
BMenu::_MenuWindow()
|
||||||
{
|
{
|
||||||
|
#if USE_CACHED_MENUWINDOW
|
||||||
if (fCachedMenuWindow == NULL) {
|
if (fCachedMenuWindow == NULL) {
|
||||||
char windowName[64];
|
char windowName[64];
|
||||||
snprintf(windowName, 64, "%s cached menu", Name());
|
snprintf(windowName, 64, "%s cached menu", Name());
|
||||||
fCachedMenuWindow = new (nothrow) BMenuWindow(windowName);
|
fCachedMenuWindow = new (nothrow) BMenuWindow(windowName);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return fCachedMenuWindow;
|
return fCachedMenuWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2385,6 +2389,7 @@ BMenu::QuitTracking()
|
|||||||
menuBar->_RestoreFocus();
|
menuBar->_RestoreFocus();
|
||||||
|
|
||||||
fChosenItem = NULL;
|
fChosenItem = NULL;
|
||||||
|
|
||||||
fState = MENU_STATE_CLOSED;
|
fState = MENU_STATE_CLOSED;
|
||||||
_Hide();
|
_Hide();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <ServerProtocol.h>
|
#include <ServerProtocol.h>
|
||||||
#include <TokenSpace.h>
|
#include <TokenSpace.h>
|
||||||
#include <tracker_private.h>
|
#include <tracker_private.h>
|
||||||
|
#include <WindowPrivate.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -1912,7 +1913,8 @@ BWindow::IsModal() const
|
|||||||
{
|
{
|
||||||
return fFeel == B_MODAL_SUBSET_WINDOW_FEEL
|
return fFeel == B_MODAL_SUBSET_WINDOW_FEEL
|
||||||
|| fFeel == B_MODAL_APP_WINDOW_FEEL
|
|| fFeel == B_MODAL_APP_WINDOW_FEEL
|
||||||
|| fFeel == B_MODAL_ALL_WINDOW_FEEL;
|
|| fFeel == B_MODAL_ALL_WINDOW_FEEL
|
||||||
|
|| fFeel == kMenuWindowFeel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user