summaryrefslogtreecommitdiff
path: root/libview
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-07-03 11:57:20 +0200
committerraveit65 <[email protected]>2016-07-03 11:57:20 +0200
commit1a32d3949a77658c048e07842d7a0361d5e0b4a8 (patch)
tree620404536b6aaddd7e9a1c4053ed936f4e52c358 /libview
parente77cdcee8a93fffba34fa752e977ee3f2b6dac3e (diff)
downloadatril-1a32d3949a77658c048e07842d7a0361d5e0b4a8.tar.bz2
atril-1a32d3949a77658c048e07842d7a0361d5e0b4a8.tar.xz
Gtk+-3 ev-view: Set a style class on the view so it can be more easily styled
And share the style we use for other content views. https://bugzilla.gnome.org/show_bug.cgi?id=653294 taken from: https://git.gnome.org/browse/evince/commit/?id=a56186e call gtk_style_context_set_background() Even if we now render a background in _draw() with gtk_render_background, using gtk_style_context_set_background() in realize makes the backing GdkWindow not being completely transparent, which enables GTK to apply optimizations during the paint cycle. The result is, especially in clutter-gtk applications such as Documents, scrolling in a document page is much smoother. taken from: https://git.gnome.org/browse/evince/commit/?id=1785924
Diffstat (limited to 'libview')
-rw-r--r--libview/ev-view.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c
index d00e7f62..4db3f7e1 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3603,6 +3603,13 @@ ev_view_expose_event (GtkWidget *widget,
ev_view_loading_window_move (view);
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_render_background (gtk_widget_get_style_context (widget),
+ cr,
+ 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
+#endif
if (view->document == NULL)
return FALSE;
@@ -5206,12 +5213,20 @@ ev_view_class_init (EvViewClass *class)
static void
ev_view_init (EvView *view)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkStyleContext *context;
+#endif
+
gtk_widget_set_can_focus (GTK_WIDGET (view), TRUE);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_has_window (GTK_WIDGET (view), TRUE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (view), FALSE);
gtk_container_set_resize_mode (GTK_CONTAINER (view), GTK_RESIZE_QUEUE);
+ context = gtk_widget_get_style_context (GTK_WIDGET (view));
+ gtk_style_context_add_class (context, "content-view");
+ gtk_style_context_add_class (context, "view");
+
gtk_widget_set_events (GTK_WIDGET (view),
GDK_EXPOSURE_MASK |
GDK_BUTTON_PRESS_MASK |