From 4f3abf48d38ec971a481c37a7b5d91ccbc8c5f89 Mon Sep 17 00:00:00 2001 From: Poommetee Ketson Date: Wed, 2 Aug 2017 00:43:25 +0700 Subject: [PATCH] MenuButton: defer grab_click_focus until button_up (cherry picked from commit 49ec6c4380644da460af65e210d555d4b739517f) --- scene/gui/menu_button.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 12413ba6ef8..193683ae9ff 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -56,7 +56,6 @@ void MenuButton::pressed() { popup->set_size(Size2(size.width, 0)); popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_pos()), get_size())); popup->popup(); - popup->call_deferred("grab_click_focus"); popup->set_invalidate_click_until_motion(); } @@ -113,6 +112,7 @@ MenuButton::MenuButton() { popup->hide(); add_child(popup); popup->set_as_toplevel(true); + connect("button_up", popup, "call_deferred", make_binds("grab_click_focus")); set_process_unhandled_key_input(true); set_click_on_press(true); }