summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-10-15 21:29:37 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-10-15 21:32:11 -0400
commitab61b7b9aee2e9f794dea1e6861f0fbc2d196164 (patch)
tree402eab9b0456140aa42fe9756336fee4a7b74790
parent3eae91255d2ed9a856ac8ddfa82e68b737b7f1f9 (diff)
downloadgtk+-ab61b7b9aee2e9f794dea1e6861f0fbc2d196164.tar.gz
atspi: Properly filter out parent actions
We only want to show relevant, local actions for widgets, but _gtk_widget_get_action_muxer() will return the muxer of a parent widget (all the way up to the toplevel), if the widget does not have any actions of its own. To detect this situation, compare what _gtk_widget_get_action_muxer() returns for the parent widget, and act accordingly.
-rw-r--r--gtk/a11y/gtkatspiaction.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gtk/a11y/gtkatspiaction.c b/gtk/a11y/gtkatspiaction.c
index bcb74d594a..2c28c0fbbd 100644
--- a/gtk/a11y/gtkatspiaction.c
+++ b/gtk/a11y/gtkatspiaction.c
@@ -678,12 +678,18 @@ widget_handle_method (GDBusConnection *connection,
GtkAtSpiContext *self = user_data;
GtkAccessible *accessible = gtk_at_context_get_accessible (GTK_AT_CONTEXT (self));
GtkWidget *widget = GTK_WIDGET (accessible);
+ GtkWidget *parent = gtk_widget_get_parent (widget);
GtkActionMuxer *muxer = _gtk_widget_get_action_muxer (widget, FALSE);
+ GtkActionMuxer *parent_muxer = parent ? _gtk_widget_get_action_muxer (parent, FALSE) : NULL;
if (muxer == NULL)
return;
- char **actions = gtk_action_muxer_list_actions (muxer, TRUE);
+ char **actions = NULL;
+
+ if (muxer != parent_muxer)
+ actions = gtk_action_muxer_list_actions (muxer, TRUE);
+
int n_actions = actions != NULL ? g_strv_length (actions) : 0;
/* XXX: We need more fields in the action API */
@@ -771,13 +777,19 @@ widget_handle_get_property (GDBusConnection *connection,
GtkAtSpiContext *self = user_data;
GtkAccessible *accessible = gtk_at_context_get_accessible (GTK_AT_CONTEXT (self));
GtkWidget *widget = GTK_WIDGET (accessible);
+ GtkWidget *parent = gtk_widget_get_parent (widget);
GtkActionMuxer *muxer = _gtk_widget_get_action_muxer (widget, FALSE);
+ GtkActionMuxer *parent_muxer = parent ? _gtk_widget_get_action_muxer (parent, FALSE) : NULL;
GVariant *res = NULL;
if (muxer == NULL)
return res;
- char **actions = gtk_action_muxer_list_actions (muxer, TRUE);
+ char **actions = NULL;
+
+ if (muxer != parent_muxer)
+ actions = gtk_action_muxer_list_actions (muxer, TRUE);
+
int n_actions = actions != NULL ? g_strv_length (actions) : 0;
if (g_strcmp0 (property_name, "NActions") == 0)