summaryrefslogtreecommitdiffstats
path: root/platform/linuxbsd/display_server_x11.cpp
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2021-08-13 00:31:16 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2021-08-13 11:19:19 +0200
commit7c864d41c9aa8c6b1c585175fc997af8070f6b30 (patch)
tree03ee430a5d2787190969291619bfa7af1063fd52 /platform/linuxbsd/display_server_x11.cpp
parent39efccf3b8298e30aa67a726ffd8752b3dff4c66 (diff)
downloadredot-engine-7c864d41c9aa8c6b1c585175fc997af8070f6b30.tar.gz
Improve input event accumulation
- API has been simplified: all events now go through `parse_input_event()`. Whether they are accumulated or not depends on the `use_accumulated_input` flag. - Event accumulation is now thread-safe (it was not needed so far, but it prepares the ground for the following changes). - Touch drag events now support accumulation.
Diffstat (limited to 'platform/linuxbsd/display_server_x11.cpp')
-rw-r--r--platform/linuxbsd/display_server_x11.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index 5b26b23806..9a368860e7 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -2247,7 +2247,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
k->set_shift_pressed(true);
}
- Input::get_singleton()->accumulate_input_event(k);
+ Input::get_singleton()->parse_input_event(k);
}
memfree(utf8string);
return;
@@ -2396,7 +2396,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
}
}
- Input::get_singleton()->accumulate_input_event(k);
+ Input::get_singleton()->parse_input_event(k);
}
Atom DisplayServerX11::_process_selection_request_target(Atom p_target, Window p_requestor, Atom p_property) const {
@@ -2883,13 +2883,13 @@ void DisplayServerX11::process_events() {
// in a spurious mouse motion event being sent to Godot; remember it to be able to filter it out
xi.mouse_pos_to_filter = pos;
}
- Input::get_singleton()->accumulate_input_event(st);
+ Input::get_singleton()->parse_input_event(st);
} else {
if (!xi.state.has(index)) { // Defensive
break;
}
xi.state.erase(index);
- Input::get_singleton()->accumulate_input_event(st);
+ Input::get_singleton()->parse_input_event(st);
}
} break;
@@ -2906,7 +2906,7 @@ void DisplayServerX11::process_events() {
sd->set_index(index);
sd->set_position(pos);
sd->set_relative(pos - curr_pos_elem->value());
- Input::get_singleton()->accumulate_input_event(sd);
+ Input::get_singleton()->parse_input_event(sd);
curr_pos_elem->value() = pos;
}
@@ -3058,7 +3058,7 @@ void DisplayServerX11::process_events() {
st->set_index(E->key());
st->set_window_id(window_id);
st->set_position(E->get());
- Input::get_singleton()->accumulate_input_event(st);
+ Input::get_singleton()->parse_input_event(st);
}
xi.state.clear();
#endif
@@ -3156,7 +3156,7 @@ void DisplayServerX11::process_events() {
mb->set_window_id(window_id_other);
mb->set_position(Vector2(x, y));
mb->set_global_position(mb->get_position());
- Input::get_singleton()->accumulate_input_event(mb);
+ Input::get_singleton()->parse_input_event(mb);
}
break;
}
@@ -3164,7 +3164,7 @@ void DisplayServerX11::process_events() {
}
}
- Input::get_singleton()->accumulate_input_event(mb);
+ Input::get_singleton()->parse_input_event(mb);
} break;
case MotionNotify: {
@@ -3280,7 +3280,7 @@ void DisplayServerX11::process_events() {
// this is so that the relative motion doesn't get messed up
// after we regain focus.
if (focused) {
- Input::get_singleton()->accumulate_input_event(mm);
+ Input::get_singleton()->parse_input_event(mm);
} else {
// Propagate the event to the focused window,
// because it's received only on the topmost window.
@@ -3300,7 +3300,7 @@ void DisplayServerX11::process_events() {
mm->set_position(pos_focused);
mm->set_global_position(pos_focused);
mm->set_speed(Input::get_singleton()->get_last_mouse_speed());
- Input::get_singleton()->accumulate_input_event(mm);
+ Input::get_singleton()->parse_input_event(mm);
break;
}