diff options
author | raveit65 <[email protected]> | 2017-03-05 16:06:08 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-03-07 13:34:19 +0100 |
commit | b461ca43a65f51dfd89bcb837ac6953a60a82d21 (patch) | |
tree | 92161ea6844600f18c125e7fb9dcdfb1168d2eed /libview/ev-view.c | |
parent | 3f14ab3b26ea683f02089d14795ac0b5b8d9d076 (diff) | |
download | atril-b461ca43a65f51dfd89bcb837ac6953a60a82d21.tar.bz2 atril-b461ca43a65f51dfd89bcb837ac6953a60a82d21.tar.xz |
a11y: Do not use AtkFactory to create the EvViewAccessible
https://bugzilla.gnome.org/show_bug.cgi?id=685828
taken from:
https://git.gnome.org/browse/evince/commit/?id=37c58de
Diffstat (limited to 'libview/ev-view.c')
-rw-r--r-- | libview/ev-view.c | 58 |
1 files changed, 11 insertions, 47 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c index b360b22d..5195299f 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -4629,6 +4629,8 @@ ev_view_dispose (GObject *object) view->loading_timeout = 0; } + g_clear_object(&view->accessible); + G_OBJECT_CLASS (ev_view_parent_class)->dispose (object); } @@ -4691,50 +4693,14 @@ ev_view_set_property (GObject *object, } /* Accessibility */ -static void -ev_view_init_accessibility (EvView *view) -{ - static gboolean first_time = TRUE; - - if (first_time) { - AtkObjectFactory *factory; - AtkRegistry *registry; - GType derived_type; - GType derived_atk_type; - - /* - * Figure out whether accessibility is enabled by looking at the - * type of the accessible object which would be created for - * the parent type of EvView. - */ - derived_type = g_type_parent (EV_TYPE_VIEW); - - registry = atk_get_default_registry (); - factory = atk_registry_get_factory (registry, - derived_type); - derived_atk_type = atk_object_factory_get_accessible_type (factory); - if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE)) { - atk_registry_set_factory_type (registry, - EV_TYPE_VIEW, - ev_view_accessible_factory_get_type ()); - view->a11y_enabled = TRUE; - } - first_time = FALSE; - } -} - static AtkObject * ev_view_get_accessible (GtkWidget *widget) { - ev_view_init_accessibility (EV_VIEW (widget)); - return GTK_WIDGET_CLASS (ev_view_parent_class)->get_accessible (widget); -} + EvView *view = EV_VIEW (widget); -static gboolean -ev_view_is_a11y_enabled (EvView *view) -{ - ev_view_init_accessibility (view); - return view->a11y_enabled; + if (!view->accessible) + view->accessible = ev_view_accessible_new (widget); + return view->accessible; } /* GtkContainer */ @@ -5091,14 +5057,12 @@ setup_caches (EvView *view) view->height_to_page_cache = ev_view_get_height_to_page_cache (view); view->pixbuf_cache = ev_pixbuf_cache_new (GTK_WIDGET (view), view->model, view->pixbuf_cache_size); view->page_cache = ev_page_cache_new (view->document); - if (ev_view_is_a11y_enabled (view)) { - EvJobPageDataFlags flags = ev_page_cache_get_flags (view->page_cache); - ev_page_cache_set_flags (view->page_cache, - flags | - EV_PAGE_DATA_INCLUDE_TEXT_LAYOUT | - EV_PAGE_DATA_INCLUDE_TEXT); - } + ev_page_cache_set_flags (view->page_cache, + ev_page_cache_get_flags (view->page_cache) | + EV_PAGE_DATA_INCLUDE_TEXT_LAYOUT | + EV_PAGE_DATA_INCLUDE_TEXT); + inverted_colors = ev_document_model_get_inverted_colors (view->model); ev_pixbuf_cache_set_inverted_colors (view->pixbuf_cache, inverted_colors); g_signal_connect (view->pixbuf_cache, "job-finished", G_CALLBACK (job_finished_cb), view); |