Minor improvements
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16916 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
|
#include <MenuBar.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <PropertyInfo.h>
|
#include <PropertyInfo.h>
|
||||||
@@ -264,8 +265,6 @@ BMenu::AttachedToWindow()
|
|||||||
free(chars);
|
free(chars);
|
||||||
free(keys);
|
free(keys);
|
||||||
|
|
||||||
fAttachAborted = false;
|
|
||||||
|
|
||||||
BMenuItem *superItem = Superitem();
|
BMenuItem *superItem = Superitem();
|
||||||
BMenu *superMenu = Supermenu();
|
BMenu *superMenu = Supermenu();
|
||||||
if (AddDynamicItem(B_INITIAL_ADD)) {
|
if (AddDynamicItem(B_INITIAL_ADD)) {
|
||||||
@@ -1056,7 +1055,7 @@ BMenu::_show(bool selectFirstItem)
|
|||||||
// See if the supermenu has a cached menuwindow,
|
// See if the supermenu has a cached menuwindow,
|
||||||
// and use that one if possible.
|
// and use that one if possible.
|
||||||
BMenuWindow *window = NULL;
|
BMenuWindow *window = NULL;
|
||||||
|
bool ourWindow = false;
|
||||||
if (fSuper != NULL) {
|
if (fSuper != NULL) {
|
||||||
fSuperbounds = fSuper->ConvertToScreen(fSuper->Bounds());
|
fSuperbounds = fSuper->ConvertToScreen(fSuper->Bounds());
|
||||||
window = fSuper->MenuWindow();
|
window = fSuper->MenuWindow();
|
||||||
@@ -1068,16 +1067,30 @@ BMenu::_show(bool selectFirstItem)
|
|||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
// Menu windows get the BMenu's handler name
|
// Menu windows get the BMenu's handler name
|
||||||
window = new BMenuWindow(Name());
|
window = new BMenuWindow(Name());
|
||||||
|
ourWindow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window == NULL)
|
if (window == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (window->Lock()) {
|
if (window->Lock()) {
|
||||||
|
fAttachAborted = false;
|
||||||
window->AttachMenu(this);
|
window->AttachMenu(this);
|
||||||
|
|
||||||
|
// Menu didn't have the time to add its items: aborting...
|
||||||
|
if (fAttachAborted) {
|
||||||
|
window->DetachMenu();
|
||||||
|
// TODO: Probably not needed, we can just let _hide() quit the window
|
||||||
|
if (ourWindow)
|
||||||
|
window->Quit();
|
||||||
|
else
|
||||||
|
window->Unlock();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: for some reason, Window() can already be NULL at this point,
|
// TODO: for some reason, Window() can already be NULL at this point,
|
||||||
// which causes a crash in one of the following functions...
|
// which causes a crash in one of the following functions...
|
||||||
|
// Does this still happens ?
|
||||||
UpdateWindowViewSize();
|
UpdateWindowViewSize();
|
||||||
window->Show();
|
window->Show();
|
||||||
|
|
||||||
@@ -1134,7 +1147,7 @@ BMenu::_track(int *action, long start)
|
|||||||
|
|
||||||
bigtime_t snoozeAmount = 50000;
|
bigtime_t snoozeAmount = 50000;
|
||||||
BPoint location;
|
BPoint location;
|
||||||
GetMouse(&location, &buttons, true);
|
GetMouse(&location, &buttons, false);
|
||||||
BPoint screenLocation = ConvertToScreen(location);
|
BPoint screenLocation = ConvertToScreen(location);
|
||||||
item = HitTestItems(location, B_ORIGIN);
|
item = HitTestItems(location, B_ORIGIN);
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user