[gtk/a11y/stackswitcher-tabs: 2/5] accessible: Avoid realizing the context prematurely




commit 342f7db5dbed3e8150f6363de4e2941d5010e75d
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Oct 14 00:16:23 2020 -0400

    accessible: Avoid realizing the context prematurely
    
    platform change is called from gtk_widget_set_focusable
    which is likely to be called early on in init(). We don't
    want to create an AT context that early if we can help
    it, e.g. since it makes it impossible to override the
    accessible-role with a construct property.

 gtk/gtkaccessible.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c
index 1f3e2a3209..582cdf08fd 100644
--- a/gtk/gtkaccessible.c
+++ b/gtk/gtkaccessible.c
@@ -656,14 +656,17 @@ void
 gtk_accessible_platform_changed (GtkAccessible               *self,
                                  GtkAccessiblePlatformChange  change)
 {
-  GtkATContext *context = gtk_accessible_get_at_context (self);
+  GtkATContext *context;
+
+  if (GTK_IS_WIDGET (self) &&
+      gtk_widget_get_root (GTK_WIDGET (self)) == NULL)
+    return;
+
+  context = gtk_accessible_get_at_context (self);
 
   /* propagate changes up from ignored widgets */
   if (gtk_accessible_get_accessible_role (self) == GTK_ACCESSIBLE_ROLE_NONE)
     {
-      if (gtk_widget_get_parent (GTK_WIDGET (self)) == NULL)
-        return;
-
       context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (gtk_widget_get_parent (GTK_WIDGET (self))));
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]