DeskBar raise-to-front: reintroduce fLastClickTime
This was removed in hrev33708 when enabling the "double click to raise" feature. It results in all clicks after the first one just raising the team again. Fixes #8471
This commit is contained in:
@@ -96,7 +96,8 @@ TExpandoMenuBar::TExpandoMenuBar(menu_layout layout, TBarView* barView)
|
|||||||
fFirstBuild(true),
|
fFirstBuild(true),
|
||||||
fPreviousDragTargetItem(NULL),
|
fPreviousDragTargetItem(NULL),
|
||||||
fLastMousedOverItem(NULL),
|
fLastMousedOverItem(NULL),
|
||||||
fLastClickedItem(NULL)
|
fLastClickedItem(NULL),
|
||||||
|
fLastClickTime(0)
|
||||||
{
|
{
|
||||||
SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
|
SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
SetFont(be_plain_font);
|
SetFont(be_plain_font);
|
||||||
@@ -333,14 +334,23 @@ TExpandoMenuBar::MouseDown(BPoint where)
|
|||||||
|
|
||||||
// double-click on an item brings the team to front
|
// double-click on an item brings the team to front
|
||||||
int32 clicks;
|
int32 clicks;
|
||||||
|
bigtime_t clickSpeed = 0;
|
||||||
|
get_click_speed(&clickSpeed);
|
||||||
|
bigtime_t delta = system_time() - fLastClickTime;
|
||||||
if (message->FindInt32("clicks", &clicks) == B_OK && clicks > 1
|
if (message->FindInt32("clicks", &clicks) == B_OK && clicks > 1
|
||||||
&& item == menuItem && item == fLastClickedItem) {
|
&& item == menuItem && item == fLastClickedItem
|
||||||
|
&& delta <= clickSpeed) {
|
||||||
be_roster->ActivateApp((addr_t)item->Teams()->ItemAt(0));
|
be_roster->ActivateApp((addr_t)item->Teams()->ItemAt(0));
|
||||||
// activate this team
|
// activate this team
|
||||||
return;
|
return;
|
||||||
// absorb the message
|
// absorb the message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update fLastClickTime only if we are not already triggering the
|
||||||
|
// double-click action. Otherwise the delay is renewed at every subsequent
|
||||||
|
// click and they keep triggering the double click action
|
||||||
|
fLastClickTime = system_time();
|
||||||
|
|
||||||
BMenuBar::MouseDown(where);
|
BMenuBar::MouseDown(where);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ private:
|
|||||||
TTeamMenuItem* fPreviousDragTargetItem;
|
TTeamMenuItem* fPreviousDragTargetItem;
|
||||||
BMenuItem* fLastMousedOverItem;
|
BMenuItem* fLastMousedOverItem;
|
||||||
BMenuItem* fLastClickedItem;
|
BMenuItem* fLastClickedItem;
|
||||||
|
bigtime_t fLastClickTime;
|
||||||
BList fTeamList;
|
BList fTeamList;
|
||||||
|
|
||||||
static bool sDoMonitor;
|
static bool sDoMonitor;
|
||||||
|
|||||||
Reference in New Issue
Block a user