diff options
-rw-r--r-- | libview/ev-view-presentation.c | 41 | ||||
-rw-r--r-- | shell/atril.css | 16 |
2 files changed, 32 insertions, 25 deletions
diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c index 72df922d..997a11b1 100644 --- a/libview/ev-view-presentation.c +++ b/libview/ev-view-presentation.c @@ -116,9 +116,6 @@ static void ev_view_presentation_set_cursor_for_location (EvViewPresentation *pv G_DEFINE_TYPE (EvViewPresentation, ev_view_presentation, GTK_TYPE_WIDGET) -static GdkRGBA black = { 0., 0., 0., 1. }; -static GdkRGBA white = { 1., 1., 1., 1. }; - static void ev_view_presentation_set_normal (EvViewPresentation *pview) { @@ -128,7 +125,8 @@ ev_view_presentation_set_normal (EvViewPresentation *pview) return; pview->state = EV_PRESENTATION_NORMAL; - gdk_window_set_background_rgba (gtk_widget_get_window (widget), &black); + gtk_style_context_remove_class (gtk_widget_get_style_context (widget), + "white-mode"); gtk_widget_queue_draw (widget); } @@ -141,7 +139,8 @@ ev_view_presentation_set_black (EvViewPresentation *pview) return; pview->state = EV_PRESENTATION_BLACK; - gdk_window_set_background_rgba (gtk_widget_get_window (widget), &black); + gtk_style_context_remove_class (gtk_widget_get_style_context (widget), + "white-mode"); gtk_widget_queue_draw (widget); } @@ -154,8 +153,8 @@ ev_view_presentation_set_white (EvViewPresentation *pview) return; pview->state = EV_PRESENTATION_WHITE; - gdk_window_set_background_rgba (gtk_widget_get_window (widget), &white); - gtk_widget_queue_draw (widget); + gtk_style_context_add_class (gtk_widget_get_style_context (widget), + "white-mode"); } static void @@ -1026,6 +1025,13 @@ ev_view_presentation_draw (GtkWidget *widget, cairo_surface_t *surface; cairo_rectangle_int_t clip_rect; GdkRectangle *area = &clip_rect; + GtkStyleContext *context; + + context = gtk_widget_get_style_context (GTK_WIDGET (pview)); + gtk_render_background (context, cr, + 0, 0, + gtk_widget_get_allocated_width (widget), + gtk_widget_get_allocated_height (widget)); if (!gdk_cairo_get_clip_rectangle (cr, &clip_rect)) return FALSE; @@ -1413,6 +1419,8 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass) widget_class->motion_notify_event = ev_view_presentation_motion_notify_event; widget_class->scroll_event = ev_view_presentation_scroll_event; + gtk_widget_class_set_css_name (widget_class, "evpresentationview"); + gobject_class->dispose = ev_view_presentation_dispose; gobject_class->constructor = ev_view_presentation_constructor; @@ -1514,25 +1522,8 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass) static void ev_view_presentation_init (EvViewPresentation *pview) { - static gsize initialization_value = 0; - gtk_widget_set_can_focus (GTK_WIDGET (pview), TRUE); - pview->is_constructing = TRUE; - - if (g_once_init_enter (&initialization_value)) { - GtkCssProvider *provider; - - provider = gtk_css_provider_new (); - gtk_css_provider_load_from_data (provider, - "EvViewPresentation {\n" - " background-color: black; }", - -1, NULL); - gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), - GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - g_object_unref (provider); - g_once_init_leave (&initialization_value, 1); - } + pview->is_constructing = TRUE; } GtkWidget * diff --git a/shell/atril.css b/shell/atril.css index e834616e..9cffc6be 100644 --- a/shell/atril.css +++ b/shell/atril.css @@ -1,3 +1,19 @@ #ev-fullscreen-toolbar { } + +#ev-loading-message { + background-color: @theme_selected_bg_color; + color: @theme_selected_fg_color; + border-radius: 3px; + padding: 8px; +} + +evpresentationview { + background-color: black; +} + +evpresentationview.white-mode { + background-color: white; +} + |