Cleanup internal GUI state, if event is accepted in _input.
This commit is contained in:
parent
fdaf0de3f0
commit
62fa80afd7
2 changed files with 14 additions and 0 deletions
|
@ -2496,6 +2496,17 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
|||
}
|
||||
}
|
||||
|
||||
void Viewport::_gui_cleanup_internal_state(Ref<InputEvent> p_event) {
|
||||
ERR_FAIL_COND(p_event.is_null());
|
||||
|
||||
Ref<InputEventMouseButton> mb = p_event;
|
||||
if (mb.is_valid()) {
|
||||
if (!mb->is_pressed()) {
|
||||
gui.mouse_focus_mask &= ~(1 << (mb->get_button_index() - 1)); // Remove from mask.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Control *>::Element *Viewport::_gui_add_root_control(Control *p_control) {
|
||||
gui.roots_order_dirty = true;
|
||||
return gui.roots.push_back(p_control);
|
||||
|
@ -2851,6 +2862,8 @@ void Viewport::input(const Ref<InputEvent> &p_event) {
|
|||
|
||||
if (!is_input_handled()) {
|
||||
_gui_input_event(p_event);
|
||||
} else {
|
||||
_gui_cleanup_internal_state(p_event);
|
||||
}
|
||||
//get_tree()->call_group(SceneTree::GROUP_CALL_REVERSE|SceneTree::GROUP_CALL_REALTIME|SceneTree::GROUP_CALL_MULIILEVEL,gui_input_group,"_gui_input",p_event); //special one for GUI, as controls use their own process check
|
||||
}
|
||||
|
|
|
@ -340,6 +340,7 @@ private:
|
|||
Control *_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_global, const Transform2D &p_xform, Transform2D &r_inv_xform);
|
||||
|
||||
void _gui_input_event(Ref<InputEvent> p_event);
|
||||
void _gui_cleanup_internal_state(Ref<InputEvent> p_event);
|
||||
|
||||
void update_worlds();
|
||||
|
||||
|
|
Loading…
Reference in a new issue