[gimp/gtk3-port: 122/235] libgimpwidgets: port GimpColorArea to GtkStyleContext
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 122/235] libgimpwidgets: port GimpColorArea to GtkStyleContext
- Date: Sun, 2 Oct 2011 14:54:59 +0000 (UTC)
commit af0f1f5e3b70138a58d232215853468e492ee43e
Author: Michael Natterer <mitch gimp org>
Date: Wed Dec 15 13:32:23 2010 +0100
libgimpwidgets: port GimpColorArea to GtkStyleContext
libgimpwidgets/gimpcolorarea.c | 37 +++++++++++++++++++++----------------
1 files changed, 21 insertions(+), 16 deletions(-)
---
diff --git a/libgimpwidgets/gimpcolorarea.c b/libgimpwidgets/gimpcolorarea.c
index 3cd8009..8f55d28 100644
--- a/libgimpwidgets/gimpcolorarea.c
+++ b/libgimpwidgets/gimpcolorarea.c
@@ -341,8 +341,8 @@ static gboolean
gimp_color_area_draw (GtkWidget *widget,
cairo_t *cr)
{
- GimpColorArea *area = GIMP_COLOR_AREA (widget);
- GtkStyle *style = gtk_widget_get_style (widget);
+ GimpColorArea *area = GIMP_COLOR_AREA (widget);
+ GtkStyleContext *context = gtk_widget_get_style_context (widget);
cairo_surface_t *buffer;
if (! area->buf || ! gtk_widget_is_drawable (widget))
@@ -363,9 +363,13 @@ gimp_color_area_draw (GtkWidget *widget,
if (area->draw_border)
{
+ GdkRGBA color;
+
cairo_set_line_width (cr, 1.0);
- gdk_cairo_set_source_color (cr,
- &style->fg[gtk_widget_get_state (widget)]);
+
+ gtk_style_context_get_color (context, gtk_widget_get_state_flags (widget),
+ &color);
+ gdk_cairo_set_source_rgba (cr, &color);
cairo_rectangle (cr, 0.5, 0.5, area->width - 1, area->height - 1);
@@ -524,15 +528,16 @@ gimp_color_area_render_buf (GtkWidget *widget,
guint rowstride,
GimpRGB *color)
{
- GtkStyle *style = gtk_widget_get_style (widget);
- guint x, y;
- guint check_size = 0;
- guchar light[3];
- guchar dark[3];
- guchar opaque[3];
- guchar insens[3];
- guchar *p;
- gdouble frac;
+ GtkStyleContext *context = gtk_widget_get_style_context (widget);
+ GdkRGBA bg;
+ guint x, y;
+ guint check_size = 0;
+ guchar light[3];
+ guchar dark[3];
+ guchar opaque[3];
+ guchar insens[3];
+ guchar *p;
+ gdouble frac;
switch (type)
{
@@ -551,9 +556,9 @@ gimp_color_area_render_buf (GtkWidget *widget,
gimp_rgb_get_uchar (color, opaque, opaque + 1, opaque + 2);
- insens[0] = style->bg[GTK_STATE_INSENSITIVE].red >> 8;
- insens[1] = style->bg[GTK_STATE_INSENSITIVE].green >> 8;
- insens[2] = style->bg[GTK_STATE_INSENSITIVE].blue >> 8;
+ gtk_style_context_get_background_color (context, GTK_STATE_FLAG_INSENSITIVE,
+ &bg);
+ gimp_rgb_get_uchar ((GimpRGB *) &bg, insens, insens + 1, insens + 2);
if (insensitive || check_size == 0 || color->a == 1.0)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]