[metacity] don't use deprecated gtk_style_context_get_background_color
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] don't use deprecated gtk_style_context_get_background_color
- Date: Fri, 5 Dec 2014 11:03:45 +0000 (UTC)
commit f201335eb64568bc12d46e0294529032747a93f2
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Fri Dec 5 12:58:28 2014 +0200
don't use deprecated gtk_style_context_get_background_color
Replace gtk_style_context_get_background_color with local static
function get_background_color that does exactly same thing.
Thanks to Lucian Langa for reporting bug.
src/ui/draw-workspace.c | 21 ++++++++++++++++++++-
src/ui/theme.c | 25 ++++++++++++++++++++++---
2 files changed, 42 insertions(+), 4 deletions(-)
---
diff --git a/src/ui/draw-workspace.c b/src/ui/draw-workspace.c
index 3a0b65a..d8778ad 100644
--- a/src/ui/draw-workspace.c
+++ b/src/ui/draw-workspace.c
@@ -64,6 +64,25 @@ get_window_rect (const WnckWindowDisplayInfo *win,
}
static void
+get_background_color (GtkStyleContext *context,
+ GtkStateFlags state,
+ GdkRGBA *color)
+{
+ GdkRGBA *c;
+
+ g_return_if_fail (color != NULL);
+ g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+
+ gtk_style_context_get (context,
+ state,
+ "background-color", &c,
+ NULL);
+
+ *color = *c;
+ gdk_rgba_free (c);
+}
+
+static void
draw_window (GtkWidget *widget,
cairo_t *cr,
const WnckWindowDisplayInfo *win,
@@ -87,7 +106,7 @@ draw_window (GtkWidget *widget,
if (is_active)
meta_gtk_style_get_light_color (style, state, &color);
else
- gtk_style_context_get_background_color (style, state, &color);
+ get_background_color (style, state, &color);
gdk_cairo_set_source_rgba (cr, &color);
cairo_rectangle (cr,
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 5763851..61dee8d 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -1507,6 +1507,25 @@ meta_color_spec_new_gtk (MetaGtkColorComponent component,
return spec;
}
+static void
+get_background_color (GtkStyleContext *context,
+ GtkStateFlags state,
+ GdkRGBA *color)
+{
+ GdkRGBA *c;
+
+ g_return_if_fail (color != NULL);
+ g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+
+ gtk_style_context_get (context,
+ state,
+ "background-color", &c,
+ NULL);
+
+ *color = *c;
+ gdk_rgba_free (c);
+}
+
/* Based on set_color() in gtkstyle.c */
#define LIGHTNESS_MULT 1.3
#define DARKNESS_MULT 0.7
@@ -1515,7 +1534,7 @@ meta_gtk_style_get_light_color (GtkStyleContext *style,
GtkStateFlags state,
GdkRGBA *color)
{
- gtk_style_context_get_background_color (style, state, color);
+ get_background_color (style, state, color);
gtk_style_shade (color, color, LIGHTNESS_MULT);
}
@@ -1524,7 +1543,7 @@ meta_gtk_style_get_dark_color (GtkStyleContext *style,
GtkStateFlags state,
GdkRGBA *color)
{
- gtk_style_context_get_background_color (style, state, color);
+ get_background_color (style, state, color);
gtk_style_shade (color, color, DARKNESS_MULT);
}
@@ -1540,7 +1559,7 @@ meta_set_color_from_style (GdkRGBA *color,
{
case META_GTK_COLOR_BG:
case META_GTK_COLOR_BASE:
- gtk_style_context_get_background_color (context, state, color);
+ get_background_color (context, state, color);
break;
case META_GTK_COLOR_FG:
case META_GTK_COLOR_TEXT:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]