From 3638aa5b7776e0a5a675e90bc135ceccddfa43b9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 25 Oct 2023 11:17:23 +1100 Subject: [PATCH] Fix Wayland/LIBDECOR assuming a normal window state on startup As the window state will have been initialized, read the current window state instead of assuming normal so changes are properly detected. Also note that the cause of #107314 has been fixed up-stream. --- intern/ghost/intern/GHOST_SystemWayland.cc | 4 +++- intern/ghost/intern/GHOST_WindowWayland.cc | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemWayland.cc b/intern/ghost/intern/GHOST_SystemWayland.cc index 8f115009d6f..57460d86942 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cc +++ b/intern/ghost/intern/GHOST_SystemWayland.cc @@ -5998,7 +5998,9 @@ GHOST_TSuccess GHOST_SystemWayland::getModifierKeys(GHOST_ModifierKeys &keys) co /* NOTE(@ideasman42): it's important to write the XKB state back to #GWL_KeyboardDepressedState * otherwise changes to modifiers in the future wont generate events. * This can cause modifiers to be stuck when switching between windows in GNOME because - * window activation is handled before the keyboard enter callback runs, see: #107314. */ + * window activation is handled before the keyboard enter callback runs, see: #107314. + * Now resolved upstream, keep this for GNOME 45 and older releases & misbehaving compositors + * as the workaround doesn't have significant down-sides. */ int16_t &depressed_l = seat->key_depressed.mods[GHOST_KEY_MODIFIER_TO_INDEX(mod_info.key_l)]; int16_t &depressed_r = seat->key_depressed.mods[GHOST_KEY_MODIFIER_TO_INDEX(mod_info.key_r)]; bool val_l = depressed_l > 0; diff --git a/intern/ghost/intern/GHOST_WindowWayland.cc b/intern/ghost/intern/GHOST_WindowWayland.cc index c63831c8a5b..2f62249c8d5 100644 --- a/intern/ghost/intern/GHOST_WindowWayland.cc +++ b/intern/ghost/intern/GHOST_WindowWayland.cc @@ -1572,7 +1572,7 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system, } xdg_toplevel *toplevel = libdecor_frame_get_xdg_toplevel(decor.frame); - gwl_window_state_set_for_xdg(toplevel, state, GHOST_kWindowStateNormal); + gwl_window_state_set_for_xdg(toplevel, state, gwl_window_state_get(window_)); } else #endif /* WITH_GHOST_WAYLAND_LIBDECOR */