Added implementation of _set_menu_sem_() to Window.cpp (should it go to a different place ?), thus fixing the build (at least here, I hope I didn't forget anything else).
Thanks to Bill Hayden for reporting and sorry again for the trouble. Changed a comment in PopUpMenu.cpp git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8394 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
//
|
//
|
||||||
// File Name: PopUpMenu.cpp
|
// File Name: PopUpMenu.cpp
|
||||||
// Author: Marc Flerackers ([email protected])
|
// Author: Marc Flerackers ([email protected])
|
||||||
|
// Stefano Ceccherini ([email protected])
|
||||||
// Description: BPopUpMenu represents a menu that pops up when you
|
// Description: BPopUpMenu represents a menu that pops up when you
|
||||||
// activate it.
|
// activate it.
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -297,9 +298,8 @@ BPopUpMenu::_go(BPoint where, bool autoInvoke, bool startOpened,
|
|||||||
popup_menu_data *data = new popup_menu_data;
|
popup_menu_data *data = new popup_menu_data;
|
||||||
sem_id sem = create_sem(0, "window close lock");
|
sem_id sem = create_sem(0, "window close lock");
|
||||||
|
|
||||||
// Asynchronous menu: we set the BWindow semaphore
|
// Asynchronous menu: we set the BWindow menu's semaphore
|
||||||
// and let BWindow do the job for us (??? this is what
|
// and let BWindow block when needed
|
||||||
// it's probably happening, _set_menu_sem_() is undocumented)
|
|
||||||
if (async) {
|
if (async) {
|
||||||
data->window = window;
|
data->window = window;
|
||||||
_set_menu_sem_(window, sem);
|
_set_menu_sem_(window, sem);
|
||||||
@@ -330,10 +330,14 @@ BPopUpMenu::_go(BPoint where, bool autoInvoke, bool startOpened,
|
|||||||
delete data;
|
delete data;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Synchronous menu: we block on the sem till
|
// Synchronous menu: we block on the sem till
|
||||||
// the other thread deletes it.
|
// the other thread deletes it.
|
||||||
if (!async) {
|
if (!async) {
|
||||||
if (window) {
|
if (window) {
|
||||||
|
// TODO: usually it's not a good idea to check for a particular error
|
||||||
|
// code. Though here we just want to wait till the semaphore is deleted
|
||||||
|
// (it will return B_BAD_SEM_ID in that case), not provide locking or whatever.
|
||||||
while (acquire_sem_etc(sem, 1, B_TIMEOUT, 50000) != B_BAD_SEM_ID)
|
while (acquire_sem_etc(sem, 1, B_TIMEOUT, 50000) != B_BAD_SEM_ID)
|
||||||
window->UpdateIfNeeded();
|
window->UpdateIfNeeded();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,6 +127,15 @@ static property_info windowPropInfo[] =
|
|||||||
};
|
};
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Move this to a better place ?
|
||||||
|
void
|
||||||
|
_set_menu_sem_(BWindow *window, sem_id sem)
|
||||||
|
{
|
||||||
|
window->fMenuSem = sem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
BWindow::BWindow(BRect frame,
|
BWindow::BWindow(BRect frame,
|
||||||
|
|||||||
Reference in New Issue
Block a user