[gtk+] gail: Fix for new style code
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gail: Fix for new style code
- Date: Wed, 15 Dec 2010 13:52:42 +0000 (UTC)
commit 9e393020c41b4f1e8d69d5dd21c3f5a00f7dbad3
Author: Benjamin Otte <otte redhat com>
Date: Wed Dec 15 12:44:26 2010 +0100
gail: Fix for new style code
modules/other/gail/libgail-util/gailmisc.c | 42 +++++++++++++++------------
1 files changed, 23 insertions(+), 19 deletions(-)
---
diff --git a/modules/other/gail/libgail-util/gailmisc.c b/modules/other/gail/libgail-util/gailmisc.c
index a70a4f0..83910bb 100644
--- a/modules/other/gail/libgail-util/gailmisc.c
+++ b/modules/other/gail/libgail-util/gailmisc.c
@@ -19,6 +19,7 @@
#include "config.h"
+#include <math.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "gailmisc.h"
@@ -373,9 +374,11 @@ gail_misc_get_default_attributes (AtkAttributeSet *attrib_set,
GtkWidget *widget)
{
PangoContext *context;
- GtkStyle *style_value;
+ GtkStyleContext *style_context;
gint int_value;
PangoWrapMode mode;
+ GdkRGBA color;
+ gchar *value;
attrib_set = gail_misc_add_attribute (attrib_set,
ATK_TEXT_ATTR_DIRECTION,
@@ -453,25 +456,26 @@ gail_misc_get_default_attributes (AtkAttributeSet *attrib_set,
g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_WRAP_MODE,
int_value)));
- style_value = gtk_widget_get_style (widget);
- if (style_value)
- {
- GdkColor color;
- gchar *value;
+ style_context = gtk_widget_get_style_context (widget);
+
+ gtk_style_context_get_background_color (style_context, 0, &color);
+ value = g_strdup_printf ("%u,%u,%u",
+ (guint) ceil (color.red * 65536 - color.red),
+ (guint) ceil (color.green * 65536 - color.green),
+ (guint) ceil (color.blue * 65536 - color.blue));
+ attrib_set = gail_misc_add_attribute (attrib_set,
+ ATK_TEXT_ATTR_BG_COLOR,
+ value);
+
+ gtk_style_context_get_color (style_context, 0, &color);
+ value = g_strdup_printf ("%u,%u,%u",
+ (guint) ceil (color.red * 65536 - color.red),
+ (guint) ceil (color.green * 65536 - color.green),
+ (guint) ceil (color.blue * 65536 - color.blue));
+ attrib_set = gail_misc_add_attribute (attrib_set,
+ ATK_TEXT_ATTR_FG_COLOR,
+ value);
- color = style_value->base[GTK_STATE_NORMAL];
- value = g_strdup_printf ("%u,%u,%u",
- color.red, color.green, color.blue);
- attrib_set = gail_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_BG_COLOR,
- value);
- color = style_value->text[GTK_STATE_NORMAL];
- value = g_strdup_printf ("%u,%u,%u",
- color.red, color.green, color.blue);
- attrib_set = gail_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_FG_COLOR,
- value);
- }
attrib_set = gail_misc_add_attribute (attrib_set,
ATK_TEXT_ATTR_FG_STIPPLE,
g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_FG_STIPPLE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]