[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - 2 commits - vcl/inc vcl/unx

Caolán McNamara caolanm at redhat.com
Fri Jun 26 07:15:35 PDT 2015


 vcl/inc/unx/gtk/gtkframe.hxx       |    1 +
 vcl/unx/gtk/a11y/atkbridge.cxx     |    5 +++--
 vcl/unx/gtk/a11y/atkfactory.cxx    |    5 +++++
 vcl/unx/gtk/a11y/atkutil.cxx       |   12 ++++++++++--
 vcl/unx/gtk/a11y/atkutil.hxx       |    1 +
 vcl/unx/gtk/window/gtksalframe.cxx |   23 +++++++++++++++++++----
 6 files changed, 39 insertions(+), 8 deletions(-)

New commits:
commit dbba5f026cd94002fc76dc94a0d131d494bc4301
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 26 13:50:28 2015 +0100

    Related: tdf#92293 gtk3 a11y: I suspect that all of this is redundant
    
    in favor of hooking in via get_accessible
    
    Change-Id: I8c265e0d9a5f8bdf02b7ba4be71fc58194cf5aa4
    (cherry picked from commit aff0d4b29681ee8008ff438885c8cc2b461f4dd5)

diff --git a/vcl/unx/gtk/a11y/atkbridge.cxx b/vcl/unx/gtk/a11y/atkbridge.cxx
index 9a89a8f..c649c25 100644
--- a/vcl/unx/gtk/a11y/atkbridge.cxx
+++ b/vcl/unx/gtk/a11y/atkbridge.cxx
@@ -27,6 +27,9 @@
 
 bool InitAtkBridge()
 {
+#if GTK_CHECK_VERSION(3,0,0)
+    ooo_atk_util_ensure_event_listener();
+#else
     const char* pVersion = atk_get_toolkit_version();
     if( ! pVersion )
         return false;
@@ -56,13 +59,15 @@ bool InitAtkBridge()
     AtkRegistry * registry = atk_get_default_registry();
     if( registry )
         atk_registry_set_factory_type( registry, OOO_TYPE_FIXED, OOO_TYPE_WRAPPER_FACTORY );
-
+#endif
     return true;
 }
 
 void DeInitAtkBridge()
 {
+#if !GTK_CHECK_VERSION(3,0,0)
     restore_gail_window_vtable();
+#endif
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index 03f08e4..bb0a238 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -714,12 +714,20 @@ ooo_atk_util_class_init (AtkUtilClass *)
     atk_class->get_toolkit_name = ooo_atk_util_get_toolkit_name;
     atk_class->get_toolkit_version = ooo_atk_util_get_toolkit_version;
 
-    Application::AddEventListener( g_aEventListenerLink );
+    ooo_atk_util_ensure_event_listener();
 }
 
 } // extern "C"
 
-/*****************************************************************************/
+void ooo_atk_util_ensure_event_listener()
+{
+    static bool bInited;
+    if (!bInited)
+    {
+        Application::AddEventListener( g_aEventListenerLink );
+        bInited = true;
+    }
+}
 
 GType
 ooo_atk_util_get_type()
diff --git a/vcl/unx/gtk/a11y/atkutil.hxx b/vcl/unx/gtk/a11y/atkutil.hxx
index 89cb61a..9524188 100644
--- a/vcl/unx/gtk/a11y/atkutil.hxx
+++ b/vcl/unx/gtk/a11y/atkutil.hxx
@@ -25,6 +25,7 @@
 #define OOO_TYPE_ATK_UTIL ooo_atk_util_get_type()
 
 GType ooo_atk_util_get_type();
+void ooo_atk_util_ensure_event_listener();
 
 #endif
 
commit cfcae6481a9180d057a34e3a4a157dbc2f96918e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 26 13:24:19 2015 +0100

    Resolves: tdf#92293 gtk3: get a11y working
    
    (cherry picked from commit 093d7b8142d0cb224fcf23506f3b36f7a3a10d2c)
    
    Change-Id: I89cfde9b4c97852d36817b716ac08bd32096915b

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index e0547ed..0adeecd 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -471,6 +471,7 @@ public:
 extern "C" {
 
 GType ooo_fixed_get_type();
+AtkObject* ooo_fixed_get_accessible(GtkWidget *obj);
 
 } // extern "C"
 
diff --git a/vcl/unx/gtk/a11y/atkbridge.cxx b/vcl/unx/gtk/a11y/atkbridge.cxx
index e3ffdc6..9a89a8f 100644
--- a/vcl/unx/gtk/a11y/atkbridge.cxx
+++ b/vcl/unx/gtk/a11y/atkbridge.cxx
@@ -27,7 +27,6 @@
 
 bool InitAtkBridge()
 {
-#if !GTK_CHECK_VERSION(3,0,0)
     const char* pVersion = atk_get_toolkit_version();
     if( ! pVersion )
         return false;
@@ -57,16 +56,13 @@ bool InitAtkBridge()
     AtkRegistry * registry = atk_get_default_registry();
     if( registry )
         atk_registry_set_factory_type( registry, OOO_TYPE_FIXED, OOO_TYPE_WRAPPER_FACTORY );
-#endif
 
     return true;
 }
 
 void DeInitAtkBridge()
 {
-#if !GTK_CHECK_VERSION(3,0,0)
     restore_gail_window_vtable();
-#endif
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkfactory.cxx b/vcl/unx/gtk/a11y/atkfactory.cxx
index fb0cc77..99ed750 100644
--- a/vcl/unx/gtk/a11y/atkfactory.cxx
+++ b/vcl/unx/gtk/a11y/atkfactory.cxx
@@ -140,6 +140,11 @@ wrapper_factory_create_accessible( GObject *obj )
     return NULL;
 }
 
+AtkObject* ooo_fixed_get_accessible(GtkWidget *obj)
+{
+    return wrapper_factory_create_accessible(G_OBJECT(obj));
+}
+
 static void
 wrapper_factory_class_init( AtkObjectFactoryClass *klass )
 {
diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
index a7b9b88..55fce4d 100644
--- a/vcl/unx/gtk/window/gtksalframe.cxx
+++ b/vcl/unx/gtk/window/gtksalframe.cxx
@@ -971,6 +971,17 @@ void GtkSalFrame::resizeWindow( long nWidth, long nHeight )
         window_resize(nWidth, nHeight);
 }
 
+#if GTK_CHECK_VERSION(3,2,0)
+
+static void
+ooo_fixed_class_init(GtkFixedClass *klass)
+{
+    GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+    widget_class->get_accessible = ooo_fixed_get_accessible;
+}
+
+#endif
+
 /*
  * Always use a sub-class of GtkFixed we can tag for a11y. This allows us to
  * utilize GAIL for the toplevel window and toolkit implementation incl.
@@ -986,10 +997,14 @@ ooo_fixed_get_type()
         static const GTypeInfo tinfo =
         {
             sizeof (GtkFixedClass),
-            (GBaseInitFunc) NULL,      /* base init */
-            (GBaseFinalizeFunc) NULL,  /* base finalize */
-            (GClassInitFunc) NULL,     /* class init */
-            (GClassFinalizeFunc) NULL, /* class finalize */
+            nullptr,      /* base init */
+            nullptr,  /* base finalize */
+#if GTK_CHECK_VERSION(3,2,0)
+            reinterpret_cast<GClassInitFunc>(ooo_fixed_class_init), /* class init */
+#else
+            nullptr,     /* class init */
+#endif
+            nullptr, /* class finalize */
             NULL,                      /* class data */
             sizeof (GtkFixed),         /* instance size */
             0,                         /* nb preallocs */


More information about the Libreoffice-commits mailing list