Commit: 1f5e1b59a3ee1baa30a268710f32d26f9b92ad66 Author: Campbell Barton Date: Wed Nov 16 11:38:04 2022 +1100 Branches: blender-v3.4-release https://developer.blender.org/rB1f5e1b59a3ee1baa30a268710f32d26f9b92ad66
GHOST/Wayland: quiet key modifier warning under gnome-shell This was already suppressed in `getModifierKeys`, but `keyboard_depressed_state_key_event` was still warning. =================================================================== M intern/ghost/intern/GHOST_SystemWayland.cpp =================================================================== diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index f8f0302c282..2ca526e34f2 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -805,6 +805,21 @@ static GWL_SeatStatePointer *gwl_seat_state_pointer_from_cursor_surface( return nullptr; } +static bool gwl_seat_key_depressed_suppress_warning(const GWL_Seat *seat) +{ + bool suppress_warning = false; + +#ifdef USE_GNOME_KEYBOARD_SUPPRESS_WARNING + if ((seat->key_depressed_suppress_warning.any_mod_held == true) && + (seat->key_depressed_suppress_warning.any_keys_held_on_enter == false)) { + /* The compositor gave us invalid information, don't show a warning. */ + suppress_warning = true; + } +#endif + + return suppress_warning; +} + /** \} */ /* -------------------------------------------------------------------- */ @@ -1751,13 +1766,17 @@ static void keyboard_depressed_state_key_event(GWL_Seat *seat, const GHOST_TKey gkey, const GHOST_TEventType etype) { + const bool show_warning = !gwl_seat_key_depressed_suppress_warning(seat); + if (GHOST_KEY_MODIFIER_CHECK(gkey)) { const int index = GHOST_KEY_MODIFIER_TO_INDEX(gkey); int16_t &value = seat->key_depressed.mods[index]; if (etype == GHOST_kEventKeyUp) { value -= 1; if (UNLIKELY(value < 0)) { - CLOG_WARN(LOG, "modifier (%d) has negative keys held (%d)!", index, value); + if (show_warning) { + CLOG_WARN(LOG, "modifier (%d) has negative keys held (%d)!", index, value); + } value = 0; } } @@ -5514,14 +5533,7 @@ GHOST_TSuccess GHOST_SystemWayland::getModifierKeys(GHOST_ModifierKeys &keys) co const xkb_mod_mask_t state = xkb_state_serialize_mods(seat->xkb_state, XKB_STATE_MODS_DEPRESSED); - bool show_warning = true; -#ifdef USE_GNOME_KEYBOARD_SUPPRESS_WARNING - if ((seat->key_depressed_suppress_warning.any_mod_held == true) && - (seat->key_depressed_suppress_warning.any_keys_held_on_enter == false)) { - /* The compositor gave us invalid information, don't show a warning. */ - show_warning = false; - } -#endif + const bool show_warning = !gwl_seat_key_depressed_suppress_warning(seat); /* Use local #GWL_KeyboardDepressedState to check which key is pressed. * Use XKB as the source of truth, if there is any discrepancy. */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs