git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22965 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2007-11-20 12:59:59 +00:00
parent 15b9bc4f1b
commit ee70f30ea0
2 changed files with 28 additions and 19 deletions

View File

@ -114,7 +114,10 @@ protected:
void InitObject2();
void DrawLabel(BRect bounds, BRect update);
static void InitMenu(BMenu* menu);
static long MenuTask(void* arg);
int32 _MenuTask();
static int32 _thread_entry(void *arg);
void _UpdateFrame();
void _InitMenuBar(BMenu* menu,
BRect frame, bool fixedSize);

View File

@ -303,8 +303,8 @@ BMenuField::MouseDown(BPoint where)
fMenuBar->StartMenuBar(0, false, true, &bounds);
fMenuTaskID = spawn_thread((thread_func)MenuTask, "_m_task_", B_NORMAL_PRIORITY, this);
if (fMenuTaskID)
fMenuTaskID = spawn_thread((thread_func)_thread_entry, "_m_task_", B_NORMAL_PRIORITY, this);
if (fMenuTaskID >= 0)
resume_thread(fMenuTaskID);
}
@ -827,35 +827,41 @@ BMenuField::InitMenu(BMenu *menu)
}
long
BMenuField::MenuTask(void *arg)
/* static */
int32
BMenuField::_thread_entry(void *arg)
{
BMenuField *menuField = static_cast<BMenuField *>(arg);
return static_cast<BMenuField *>(arg)->_MenuTask();
}
if (!menuField->LockLooper())
int32
BMenuField::_MenuTask()
{
if (!LockLooper())
return 0;
menuField->fSelected = true;
menuField->fTransition = true;
menuField->Invalidate();
menuField->UnlockLooper();
fSelected = true;
fTransition = true;
Invalidate();
UnlockLooper();
bool tracking;
do {
snooze(20000);
if (!menuField->LockLooper())
if (!LockLooper())
return 0;
tracking = menuField->fMenuBar->fTracking;
tracking = fMenuBar->fTracking;
menuField->UnlockLooper();
UnlockLooper();
} while (tracking);
if (menuField->LockLooper()) {
menuField->fSelected = false;
menuField->fTransition = true;
menuField->Invalidate();
menuField->UnlockLooper();
if (LockLooper()) {
fSelected = false;
fTransition = true;
Invalidate();
UnlockLooper();
}
return 0;