mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Wayland: Unify key handling logic
Previously we had different logic for direct key presses and client-side key repetition, as one queued up input events and the other dispatched them directly (client-side key repetition is run from the main thread). I kinda figured out that this difference doesn't really matter, as we can queue them up before the thread message dispatching logic. That's exactly what we do now, which allows us to make a single method for both of them, making the code much clearer and simplifying future maintenance. This patch also includes a tiny fixup in the compose logic, which checks for the validity of the generated key event before actually working with it. The cases in which we can end up with an invalid reference are very few, so it's not the end of the world, but it's still absolutely a good idea to check, to avoid nasty surprises down the line.
This commit is contained in:
parent
3a97723ff2
commit
9a814b4444
3 changed files with 73 additions and 91 deletions
|
|
@ -1695,6 +1695,8 @@ void DisplayServerWayland::try_suspend() {
|
|||
void DisplayServerWayland::process_events() {
|
||||
wayland_thread.mutex.lock();
|
||||
|
||||
wayland_thread.keyboard_echo_keys();
|
||||
|
||||
while (wayland_thread.has_message()) {
|
||||
Ref<WaylandThread::Message> msg = wayland_thread.pop_message();
|
||||
|
||||
|
|
@ -1837,8 +1839,6 @@ void DisplayServerWayland::process_events() {
|
|||
}
|
||||
}
|
||||
|
||||
wayland_thread.keyboard_echo_keys();
|
||||
|
||||
switch (suspend_state) {
|
||||
case SuspendState::NONE: {
|
||||
bool emulate_vsync = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue