From ebd5e1966ec7b6dc4978ea91de59ce81635d80a8 Mon Sep 17 00:00:00 2001 From: Gabriele Barbero Date: Wed, 7 May 2025 20:00:46 +0200 Subject: [PATCH] actions: hide windows-display-* actions from the Shortcuts dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit windows‑display* actions are used to switch open displays and are not meant to be remapped. They are implemented so they can be reassigned each time a display is opened, closed, or moved, in order to keep them aligned with the order of displays. This commit hides them from the Shortcuts dialog to prevent remapping and avoidinconsistent behavior. To avoid hiding these actions completely and making them harder to discover, this commit removes them only from the shortcuts dialog while still showing them in the action search. (see #11685) --- app/widgets/gimpaction-history.c | 2 +- app/widgets/gimpaction.c | 23 +++++++++++++++++++++++ app/widgets/gimpaction.h | 2 ++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/widgets/gimpaction-history.c b/app/widgets/gimpaction-history.c index f59e365c3b..7d9d247520 100644 --- a/app/widgets/gimpaction-history.c +++ b/app/widgets/gimpaction-history.c @@ -318,7 +318,7 @@ gimp_action_history_search (Gimp *gimp, gboolean gimp_action_history_is_blacklisted_action (const gchar *action_name) { - if (gimp_action_is_gui_blacklisted (action_name)) + if (gimp_action_is_action_search_blacklisted (action_name)) return TRUE; return (g_str_has_suffix (action_name, "-set") || diff --git a/app/widgets/gimpaction.c b/app/widgets/gimpaction.c index c0badd0975..3f015730f4 100644 --- a/app/widgets/gimpaction.c +++ b/app/widgets/gimpaction.c @@ -758,6 +758,29 @@ gimp_action_name_compare (GimpAction *action1, gboolean gimp_action_is_gui_blacklisted (const gchar *action_name) +{ + static const gchar *prefixes[] = + { + "windows-display-" + }; + + if (! (action_name && *action_name)) + return TRUE; + + for (guint i = 0; i < G_N_ELEMENTS (prefixes); i++) + { + if (g_str_has_prefix (action_name, prefixes[i])) + return TRUE; + } + + if (gimp_action_is_action_search_blacklisted (action_name)) + return TRUE; + + return FALSE; +} + +gboolean +gimp_action_is_action_search_blacklisted (const gchar *action_name) { static const gchar *prefixes[] = { diff --git a/app/widgets/gimpaction.h b/app/widgets/gimpaction.h index bcf119f54b..95b757b65c 100644 --- a/app/widgets/gimpaction.h +++ b/app/widgets/gimpaction.h @@ -126,6 +126,8 @@ gint gimp_action_name_compare (GimpAction *action1, GimpAction *action2); gboolean gimp_action_is_gui_blacklisted (const gchar *action_name); +gboolean gimp_action_is_action_search_blacklisted + (const gchar *action_name); GimpContext * gimp_action_get_context (GimpAction *action); GimpViewable * gimp_action_get_viewable (GimpAction *action);