[gtk+] stylecontext: Deprecate functions



commit 91467a45fc57d429b6d3eb91b6f8c2f3fa6c9654
Author: Benjamin Otte <otte redhat com>
Date:   Fri Oct 3 05:52:49 2014 +0200

    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.

 gtk/gtkcolorswatch.c  |    2 ++
 gtk/gtkentry.c        |    4 ++++
 gtk/gtkflowbox.c      |    2 ++
 gtk/gtkpopover.c      |    2 ++
 gtk/gtkstylecontext.c |    4 ++++
 gtk/gtkstylecontext.h |    4 ++--
 gtk/gtktextdisplay.c  |    4 ++++
 gtk/gtktextutil.c     |    2 ++
 gtk/gtktextview.c     |    2 ++
 9 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index 05b6c81..9218a2c 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -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);
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 0c10e74..48a38b8 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -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);
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index e8374e9..9e9e840 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -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);
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 65e1b05..0106c65 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -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);
 
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index f0a0c8e..e62a185 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -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),
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 653a52c..6184d84 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -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);
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index 9e8fcea..420db81 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -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);
 
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
index 32b41ae..2ccd48c 100644
--- a/gtk/gtktextutil.c
+++ b/gtk/gtktextutil.c
@@ -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);
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 59dcf76..1543336 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]