diff options
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/viewport.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index c156b0df31..8f431389d8 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1808,15 +1808,18 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { pos = gui.focus_inv_xform.xform(pos); mb->set_position(pos); - if (gui.mouse_focus->can_process()) { - _gui_call_input(gui.mouse_focus, mb); - } + Control *mouse_focus = gui.mouse_focus; + //disable mouse focus if needed before calling input, this makes popups on mouse press event work better, as the release will never be received otherwise if (mb->get_button_index() == gui.mouse_focus_button) { gui.mouse_focus = NULL; gui.mouse_focus_button = -1; } + if (mouse_focus->can_process()) { + _gui_call_input(mouse_focus, mb); + } + /*if (gui.drag_data.get_type()!=Variant::NIL && mb->get_button_index()==BUTTON_LEFT) { _propagate_viewport_notification(this,NOTIFICATION_DRAG_END); gui.drag_data=Variant(); //always clear |