TabManager: better delay detection for closing the menu.
As suggested by stippi, we can use system_time and the CurrentMessage when field to determine the relative time of the actual mouse clicks, rather than the time of message delivery.
This commit is contained in:
@@ -181,8 +181,9 @@ public:
|
|||||||
// Don't reopen the menu if it's already open or freshly closed.
|
// Don't reopen the menu if it's already open or freshly closed.
|
||||||
bigtime_t clickSpeed = 2000000;
|
bigtime_t clickSpeed = 2000000;
|
||||||
get_click_speed(&clickSpeed);
|
get_click_speed(&clickSpeed);
|
||||||
|
bigtime_t clickTime = Window()->CurrentMessage()->FindInt64("when");
|
||||||
if (!IsEnabled() || (Value() == B_CONTROL_ON)
|
if (!IsEnabled() || (Value() == B_CONTROL_ON)
|
||||||
|| real_time_clock_usecs() < fCloseTime + clickSpeed) {
|
|| clickTime < fCloseTime + clickSpeed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +200,7 @@ public:
|
|||||||
|
|
||||||
void MenuClosed()
|
void MenuClosed()
|
||||||
{
|
{
|
||||||
fCloseTime = real_time_clock_usecs();
|
fCloseTime = system_time();
|
||||||
SetValue(B_CONTROL_OFF);
|
SetValue(B_CONTROL_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user