summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2010-12-17 15:25:15 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2010-12-17 15:25:15 +0900
commit71e7cd0ec407f489549ed045b7e9bfdff8c70c58 (patch)
treeaab2e74e2a73dcd875eaf2c55509186ac362461c /modules
parent735fa8b1976e3bbe045e5365d42f0d67007e5293 (diff)
parente9a77a153501dd5f1ecf1726f23afac0229eed61 (diff)
downloadgtk+-71e7cd0ec407f489549ed045b7e9bfdff8c70c58.tar.gz
Merge branch 'master' into treeview-refactor
Conflicts: tests/testtreeedit.c
Diffstat (limited to 'modules')
-rw-r--r--modules/input/gtkimcontextxim.c35
-rw-r--r--modules/other/gail/libgail-util/gailmisc.c42
2 files changed, 32 insertions, 45 deletions
diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c
index 035edc3a00..a6adf9f280 100644
--- a/modules/input/gtkimcontextxim.c
+++ b/modules/input/gtkimcontextxim.c
@@ -1755,14 +1755,19 @@ static gboolean
on_status_window_draw (GtkWidget *widget,
cairo_t *cr)
{
- GtkStyle *style;
+ GtkStyleContext *style;
+ GdkRGBA color;
- style = gtk_widget_get_style (widget);
+ style = gtk_widget_get_style_context (widget);
- gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]);
+ gtk_style_context_get_background_color (style, 0, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
+ cairo_paint (cr);
+
+ gtk_style_context_get_color (style, 0, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
cairo_paint (cr);
- gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
cairo_rectangle (cr,
0, 0,
gtk_widget_get_allocated_width (widget) - 1,
@@ -1772,26 +1777,6 @@ on_status_window_draw (GtkWidget *widget,
return FALSE;
}
-/* We watch the ::style-set signal for our label widget
- * and use that to change it's foreground color to match
- * the 'text' color of the toplevel window. The text/base
- * pair of colors might be reversed from the fg/bg pair
- * that are normally used for labels.
- */
-static void
-on_status_window_style_set (GtkWidget *toplevel,
- GtkStyle *previous_style,
- GtkWidget *label)
-{
- GtkStyle *style;
- gint i;
-
- style = gtk_widget_get_style (toplevel);
-
- for (i = 0; i < 5; i++)
- gtk_widget_modify_fg (label, i, &style->text[i]);
-}
-
/* Creates the widgets for the status window; called when we
* first need to show text for the status window.
*/
@@ -1811,8 +1796,6 @@ status_window_make_window (StatusWindow *status_window)
gtk_misc_set_padding (GTK_MISC (status_label), 1, 1);
gtk_widget_show (status_label);
- g_signal_connect (window, "style-set",
- G_CALLBACK (on_status_window_style_set), status_label);
gtk_container_add (GTK_CONTAINER (window), status_label);
g_signal_connect (window, "draw",
diff --git a/modules/other/gail/libgail-util/gailmisc.c b/modules/other/gail/libgail-util/gailmisc.c
index a70a4f0109..83910bb562 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,