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.
This commit is contained in:
Campbell Barton 2023-10-25 11:17:23 +11:00
parent 60a8ae7830
commit 3638aa5b77
2 changed files with 4 additions and 2 deletions

View File

@ -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;

View File

@ -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 */