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.
This commit is contained in:
Benjamin Otte 2014-10-03 05:52:49 +02:00
parent 39453478ab
commit 91467a45fc
9 changed files with 24 additions and 2 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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),

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);