summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosephMcc <[email protected]>2017-03-18 13:19:16 -0700
committerraveit65 <[email protected]>2017-08-14 20:02:44 +0200
commit1707819fbed55e83e2ecf069b4de6281e66d4d22 (patch)
tree15a55259035374741ce04f0399e861f2a22cf4f0
parent74c480343a89e8fcabc3b1e8d71d77db8c039c75 (diff)
downloadatril-1707819fbed55e83e2ecf069b4de6281e66d4d22.tar.bz2
atril-1707819fbed55e83e2ecf069b4de6281e66d4d22.tar.xz
ev-annotation-window: Fix setting the color of the window border
We need to actually connect to a change in the correct property to update this. In this case "rgba", not "color". We also need to prevent the system theme from affecting the color of the annotation window. taken from: https://github.com/linuxmint/xreader/commit/1236d4b
-rw-r--r--libview/ev-annotation-window.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/libview/ev-annotation-window.c b/libview/ev-annotation-window.c
index 776187f2..15bdce5a 100644
--- a/libview/ev-annotation-window.c
+++ b/libview/ev-annotation-window.c
@@ -121,20 +121,14 @@ ev_annotation_window_sync_contents (EvAnnotationWindow *window)
static void
ev_annotation_window_set_color (EvAnnotationWindow *window,
- GdkColor *color)
+ GdkRGBA *color)
{
GtkStyleProperties *properties;
GtkStyleProvider *provider;
- GdkRGBA rgba;
-
- rgba.red = color->red / 65535.;
- rgba.green = color->green / 65535.;
- rgba.blue = color->blue / 65535.;
- rgba.alpha = 1;
properties = gtk_style_properties_new ();
gtk_style_properties_set (properties, 0,
- "background-color", &rgba,
+ "background-color", color,
NULL);
provider = GTK_STYLE_PROVIDER (properties);
@@ -165,10 +159,10 @@ ev_annotation_window_color_changed (EvAnnotation *annot,
GParamSpec *pspec,
EvAnnotationWindow *window)
{
- GdkColor color;
+ GdkRGBA rgba;
- ev_annotation_get_color (annot, &color);
- ev_annotation_window_set_color (window, &color);
+ ev_annotation_get_rgba (annot, &rgba);
+ ev_annotation_window_set_color (window, &rgba);
}
static void
@@ -365,13 +359,11 @@ ev_annotation_window_init (EvAnnotationWindow *window)
gtk_widget_show (hbox);
gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_container_set_border_width (GTK_CONTAINER (window), 0);
gtk_widget_show (vbox);
gtk_widget_add_events (GTK_WIDGET (window),
GDK_BUTTON_PRESS_MASK |
GDK_KEY_PRESS_MASK);
- gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
gtk_container_set_border_width (GTK_CONTAINER (window), 2);
@@ -392,7 +384,7 @@ ev_annotation_window_constructor (GType type,
EvAnnotationMarkup *markup;
const gchar *contents;
const gchar *label;
- GdkColor color;
+ GdkRGBA color;
EvRectangle *rect;
gdouble scale;
@@ -418,7 +410,7 @@ ev_annotation_window_constructor (GType type,
(gint)((rect->x2 - rect->x1) * scale),
(gint)((rect->y2 - rect->y1) * scale));
- ev_annotation_get_color (annot, &color);
+ ev_annotation_get_rgba (annot, &color);
ev_annotation_window_set_color (window, &color);
gtk_widget_set_name (GTK_WIDGET (window), ev_annotation_get_name (annot));
gtk_window_set_title (GTK_WINDOW (window), label);
@@ -435,7 +427,7 @@ ev_annotation_window_constructor (GType type,
g_signal_connect (annot, "notify::label",
G_CALLBACK (ev_annotation_window_label_changed),
window);
- g_signal_connect (annot, "notify::color",
+ g_signal_connect (annot, "notify::rgba",
G_CALLBACK (ev_annotation_window_color_changed),
window);