Merge pull request #95232 from bruvzg/popup_time_up

[PopupMenu] Increase mouse button release timeout and reset it from `post_popup`.
This commit is contained in:
Rémi Verschelde 2024-08-07 12:07:57 +02:00
commit 5e7592a342
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 2 additions and 1 deletions

View File

@ -608,7 +608,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
return; return;
} }
// Disable clicks under a time threshold to avoid selection right when opening the popup. // Disable clicks under a time threshold to avoid selection right when opening the popup.
if (was_during_grabbed_click && OS::get_singleton()->get_ticks_msec() - popup_time_msec < 150) { if (was_during_grabbed_click && OS::get_singleton()->get_ticks_msec() - popup_time_msec < 400) {
return; return;
} }
@ -1064,6 +1064,7 @@ void PopupMenu::_notification(int p_what) {
} break; } break;
case NOTIFICATION_POST_POPUP: { case NOTIFICATION_POST_POPUP: {
popup_time_msec = OS::get_singleton()->get_ticks_msec();
initial_button_mask = Input::get_singleton()->get_mouse_button_mask(); initial_button_mask = Input::get_singleton()->get_mouse_button_mask();
during_grabbed_click = (bool)initial_button_mask; during_grabbed_click = (bool)initial_button_mask;
} break; } break;