Commit 91467a45 authored by Benjamin Otte's avatar Benjamin Otte

stylecontext: Deprecate functions

- gtk_style_context_get_background_color()
- gtk_style_context_get_border_color()

Those functions shouldn't be used anymore, because they don't represent
anything from the CSS styling we support. The background color often
isn't used due to background images and there are actually 4 different
border colors (1 for each side) - if there isn't also a border image in
use.
parent 39453478
......@@ -206,8 +206,10 @@ swatch_draw (GtkWidget *widget,
}
else
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_background_color (context, state, &bg);
gtk_style_context_get_border_color (context, state, &border);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_style_context_get_border (context, state, &border_width);
cairo_new_sub_path (cr);
......
......@@ -6422,7 +6422,9 @@ draw_text_with_color (GtkEntry *entry,
state = gtk_widget_get_state_flags (widget);
state |= GTK_STATE_FLAG_SELECTED;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_background_color (context, state, &selection_color);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_style_context_get_color (context, state, &text_color);
for (i = 0; i < n_ranges; ++i)
......@@ -6594,7 +6596,9 @@ gtk_entry_draw_cursor (GtkEntry *entry,
GdkRGBA color;
state = gtk_widget_get_state_flags (widget);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_background_color (context, state, &color);
G_GNUC_END_IGNORE_DEPRECATIONS
gdk_cairo_rectangle (cr, &rect);
cairo_clip (cr);
......
......@@ -2614,7 +2614,9 @@ gtk_flow_box_draw (GtkWidget *widget,
cairo_path_destroy (path);
state = gtk_widget_get_state_flags (widget);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_border_color (context, state, &border_color);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_style_context_get_border (context, state, &border);
cairo_set_line_width (cr, border.left);
......
......@@ -898,7 +898,9 @@ gtk_popover_draw (GtkWidget *widget,
/* Render the border of the arrow tip */
if (border.bottom > 0)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_border_color (context, state, &border_color);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_popover_apply_tail_path (popover, cr);
gdk_cairo_set_source_rgba (cr, &border_color);
......
......@@ -3499,7 +3499,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
{
GdkRGBA bg;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg);
G_GNUC_END_IGNORE_DEPRECATIONS
color->red = (color->red + bg.red) * 0.5;
color->green = (color->green + bg.green) * 0.5;
......@@ -3890,7 +3892,9 @@ _gtk_style_context_get_attributes (AtkAttributeSet *attributes,
GdkRGBA color;
gchar *value;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_background_color (context, flags, &color);
G_GNUC_END_IGNORE_DEPRECATIONS
value = g_strdup_printf ("%u,%u,%u",
(guint) ceil (color.red * 65536 - color.red),
(guint) ceil (color.green * 65536 - color.green),
......
......@@ -1083,11 +1083,11 @@ GDK_AVAILABLE_IN_ALL
void gtk_style_context_get_color (GtkStyleContext *context,
GtkStateFlags state,
GdkRGBA *color);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_16_FOR(gtk_render_background)
void gtk_style_context_get_background_color (GtkStyleContext *context,
GtkStateFlags state,
GdkRGBA *color);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_16_FOR(gtk_render_frame)
void gtk_style_context_get_border_color (GtkStyleContext *context,
GtkStateFlags state,
GdkRGBA *color);
......
......@@ -591,7 +591,9 @@ render_para (GtkTextRenderer *text_renderer,
state |= GTK_STATE_FLAG_SELECTED;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_background_color (context, state, &selection);
G_GNUC_END_IGNORE_DEPRECATIONS
do
{
......@@ -783,7 +785,9 @@ render_para (GtkTextRenderer *text_renderer,
GdkRGBA color;
state = gtk_widget_get_state_flags (text_renderer->widget);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_background_color (context, state, &color);
G_GNUC_END_IGNORE_DEPRECATIONS
gdk_cairo_set_source_rgba (cr, &color);
......
......@@ -270,7 +270,9 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
state = gtk_widget_get_state_flags (GTK_WIDGET (text_view));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_background_color (context, state, &bg_color);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_style_context_get_color (context, state, &fg_color);
values->appearance.bg_color.red = CLAMP (bg_color.red * 65535. + 0.5, 0, 65535);
......
......@@ -7259,7 +7259,9 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_background_color (context, state, &bg_color);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_style_context_get_color (context, state, &fg_color);
values->appearance.bg_color.red = CLAMP (bg_color.red * 65535. + 0.5, 0, 65535);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment