summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-06-01 19:50:43 +0200
committerraveit65 <[email protected]>2016-06-05 11:02:36 +0200
commitea8248f5cdbb8cb67f515cda14d57dd84c6ea07f (patch)
tree694c93607eef74bc4717054fa0b1b1f2628e8fd5
parentb5093f7c7e8de0a8c921a4da6832b09809cbc23e (diff)
downloadmate-settings-daemon-ea8248f5cdbb8cb67f515cda14d57dd84c6ea07f.tar.bz2
mate-settings-daemon-ea8248f5cdbb8cb67f515cda14d57dd84c6ea07f.tar.xz
GTK+3 msd-locate-pointer: port to GtkStyleContext
taken from: https://git.gnome.org/browse/gnome-settings-daemon/commit/?id=81cfd0e
-rw-r--r--plugins/mouse/msd-locate-pointer.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/mouse/msd-locate-pointer.c b/plugins/mouse/msd-locate-pointer.c
index a9cb341..8be68fe 100644
--- a/plugins/mouse/msd-locate-pointer.c
+++ b/plugins/mouse/msd-locate-pointer.c
@@ -55,18 +55,30 @@ locate_pointer_paint (MsdLocatePointerData *data,
cairo_t *cr,
gboolean composite)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkRGBA color;
+ gdouble progress, circle_progress;
+ gint width, height, i;
+ GtkStyleContext *context;
+#else
GdkColor color;
gdouble progress, circle_progress;
gint width, height, i;
GtkStyle *style;
+#endif
progress = data->progress;
width = gdk_window_get_width (data->window);
height = gdk_window_get_height (data->window);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ context = gtk_widget_get_style_context (data->widget);
+ gtk_style_context_get_background_color (context, GTK_STATE_FLAG_SELECTED, &color);
+#else
style = gtk_widget_get_style (data->widget);
color = style->bg[GTK_STATE_SELECTED];
+#endif
cairo_set_source_rgba (cr, 1., 1., 1., 0.);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
@@ -86,9 +98,15 @@ locate_pointer_paint (MsdLocatePointerData *data,
if (composite)
{
cairo_set_source_rgba (cr,
+#if GTK_CHECK_VERSION (3, 0, 0)
+ color.red,
+ color.green,
+ color.blue,
+#else
color.red / 65535.,
color.green / 65535.,
color.blue / 65535.,
+#endif
1 - circle_progress);
cairo_arc (cr,
width / 2,