diff options
author | Juan Linietsky <reduzio@gmail.com> | 2020-03-14 13:06:39 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-03-26 15:49:43 +0100 |
commit | c7b4dcae2f3b75ad7146e36f196893731f403144 (patch) | |
tree | d6223521b246aa36d0e0b78d6ed626fa2a0e3769 /scene/gui/menu_button.cpp | |
parent | 441f1a5fe9a3bf0e4e5dab578f793500b1ff6e3d (diff) |
Open sub-windows as embedded if the OS does not support them
Diffstat (limited to 'scene/gui/menu_button.cpp')
-rw-r--r-- | scene/gui/menu_button.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 4cae7b8f40..61441ff958 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -43,20 +43,24 @@ void MenuButton::_unhandled_key_input(Ref<InputEvent> p_event) { if (!get_parent() || !is_visible_in_tree() || is_disabled()) return; - bool global_only = (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this)); - - if (popup->activate_item_by_event(p_event, global_only)) + //bool global_only = (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this)); + //if (popup->activate_item_by_event(p_event, global_only)) + // accept_event(); + if (popup->activate_item_by_event(p_event, false)) accept_event(); } } void MenuButton::pressed() { - emit_signal("about_to_popup"); Size2 size = get_size(); Point2 gp = get_screen_position(); - popup->set_position(gp + Size2(0, size.height * get_global_transform().get_scale().y)); + + gp.y += get_size().y; + + popup->set_position(gp); + popup->set_size(Size2(size.width, 0)); popup->set_parent_rect(Rect2(Point2(gp - popup->get_position()), get_size())); popup->popup(); |