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
+4 -1
View File
@@ -114,7 +114,10 @@ protected:
void InitObject2(); void InitObject2();
void DrawLabel(BRect bounds, BRect update); void DrawLabel(BRect bounds, BRect update);
static void InitMenu(BMenu* menu); static void InitMenu(BMenu* menu);
static long MenuTask(void* arg);
int32 _MenuTask();
static int32 _thread_entry(void *arg);
void _UpdateFrame(); void _UpdateFrame();
void _InitMenuBar(BMenu* menu, void _InitMenuBar(BMenu* menu,
BRect frame, bool fixedSize); BRect frame, bool fixedSize);
+24 -18
View File
@@ -303,8 +303,8 @@ BMenuField::MouseDown(BPoint where)
fMenuBar->StartMenuBar(0, false, true, &bounds); fMenuBar->StartMenuBar(0, false, true, &bounds);
fMenuTaskID = spawn_thread((thread_func)MenuTask, "_m_task_", B_NORMAL_PRIORITY, this); fMenuTaskID = spawn_thread((thread_func)_thread_entry, "_m_task_", B_NORMAL_PRIORITY, this);
if (fMenuTaskID) if (fMenuTaskID >= 0)
resume_thread(fMenuTaskID); resume_thread(fMenuTaskID);
} }
@@ -827,35 +827,41 @@ BMenuField::InitMenu(BMenu *menu)
} }
long /* static */
BMenuField::MenuTask(void *arg) 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; return 0;
menuField->fSelected = true; fSelected = true;
menuField->fTransition = true; fTransition = true;
menuField->Invalidate(); Invalidate();
menuField->UnlockLooper(); UnlockLooper();
bool tracking; bool tracking;
do { do {
snooze(20000); snooze(20000);
if (!menuField->LockLooper()) if (!LockLooper())
return 0; return 0;
tracking = menuField->fMenuBar->fTracking; tracking = fMenuBar->fTracking;
menuField->UnlockLooper(); UnlockLooper();
} while (tracking); } while (tracking);
if (menuField->LockLooper()) { if (LockLooper()) {
menuField->fSelected = false; fSelected = false;
menuField->fTransition = true; fTransition = true;
menuField->Invalidate(); Invalidate();
menuField->UnlockLooper(); UnlockLooper();
} }
return 0; return 0;