diff options
author | Benjamin Otte <otte@redhat.com> | 2016-10-06 23:55:53 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-10-16 18:17:21 +0200 |
commit | eace2cf4219bbb1be376567f804ae2e0c3b5821a (patch) | |
tree | 1e74bd8c75c7105e217e0d639c5dc6e0742536c4 /gtk | |
parent | bae12e6a2fdb1ed58f159f0a9606364480efea99 (diff) | |
download | gtk+-eace2cf4219bbb1be376567f804ae2e0c3b5821a.tar.gz |
API: Remove gdk_window_set_background()
Backgrounds are always transparent black.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/deprecated/gtkmisc.c | 1 | ||||
-rw-r--r-- | gtk/gtkdrawingarea.c | 31 | ||||
-rw-r--r-- | gtk/gtkfixed.c | 29 | ||||
-rw-r--r-- | gtk/gtklayout.c | 31 | ||||
-rw-r--r-- | gtk/gtknotebook.c | 2 | ||||
-rw-r--r-- | gtk/gtkscrolledwindow.c | 3 | ||||
-rw-r--r-- | gtk/gtkstylecontext.c | 44 | ||||
-rw-r--r-- | gtk/gtkstylecontext.h | 4 |
8 files changed, 0 insertions, 145 deletions
diff --git a/gtk/deprecated/gtkmisc.c b/gtk/deprecated/gtkmisc.c index 2cab744fff..8035e68845 100644 --- a/gtk/deprecated/gtkmisc.c +++ b/gtk/deprecated/gtkmisc.c @@ -445,7 +445,6 @@ gtk_misc_realize (GtkWidget *widget) window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gtk_widget_set_window (widget, window); gtk_widget_register_window (widget, window); - gdk_window_set_background_pattern (window, NULL); } } diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c index 16f8f3befd..f39600171b 100644 --- a/gtk/gtkdrawingarea.c +++ b/gtk/gtkdrawingarea.c @@ -120,7 +120,6 @@ */ static void gtk_drawing_area_realize (GtkWidget *widget); -static void gtk_drawing_area_style_updated (GtkWidget *widget); static void gtk_drawing_area_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_drawing_area_send_configure (GtkDrawingArea *darea); @@ -134,7 +133,6 @@ gtk_drawing_area_class_init (GtkDrawingAreaClass *class) widget_class->realize = gtk_drawing_area_realize; widget_class->size_allocate = gtk_drawing_area_size_allocate; - widget_class->style_updated = gtk_drawing_area_style_updated; gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_DRAWING_AREA); } @@ -158,33 +156,6 @@ gtk_drawing_area_new (void) } static void -set_background (GtkWidget *widget) -{ - if (gtk_widget_get_realized (widget) && - gtk_widget_get_has_window (widget)) - { - /* We still need to call gtk_style_context_set_background() here for - * GtkDrawingArea, since clients expect backgrounds set on it (e.g. through - * gtk_widget_override_background_color) to be available even when they - * don't chain up from draw(). - * This should be revisited next time we have a major API break. - */ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS; - gtk_style_context_set_background (gtk_widget_get_style_context (widget), - gtk_widget_get_window (widget)); - G_GNUC_END_IGNORE_DEPRECATIONS; - } -} - -static void -gtk_drawing_area_style_updated (GtkWidget *widget) -{ - GTK_WIDGET_CLASS (gtk_drawing_area_parent_class)->style_updated (widget); - - set_background (widget); -} - -static void gtk_drawing_area_realize (GtkWidget *widget) { GtkAllocation allocation; @@ -216,8 +187,6 @@ gtk_drawing_area_realize (GtkWidget *widget) &attributes, attributes_mask); gtk_widget_register_window (widget, window); gtk_widget_set_window (widget, window); - - set_background (widget); } gtk_drawing_area_send_configure (GTK_DRAWING_AREA (widget)); diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c index 097676d14e..751e7b3478 100644 --- a/gtk/gtkfixed.c +++ b/gtk/gtkfixed.c @@ -94,7 +94,6 @@ static void gtk_fixed_get_preferred_height (GtkWidget *widget, gint *natural); static void gtk_fixed_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void gtk_fixed_style_updated (GtkWidget *widget); static gboolean gtk_fixed_draw (GtkWidget *widget, cairo_t *cr); static void gtk_fixed_add (GtkContainer *container, @@ -134,7 +133,6 @@ gtk_fixed_class_init (GtkFixedClass *class) widget_class->get_preferred_height = gtk_fixed_get_preferred_height; widget_class->size_allocate = gtk_fixed_size_allocate; widget_class->draw = gtk_fixed_draw; - widget_class->style_updated = gtk_fixed_style_updated; container_class->add = gtk_fixed_add; container_class->remove = gtk_fixed_remove; @@ -347,31 +345,6 @@ gtk_fixed_get_child_property (GtkContainer *container, } static void -set_background (GtkWidget *widget) -{ - if (gtk_widget_get_realized (widget)) - { - /* We still need to call gtk_style_context_set_background() here for - * GtkFixed, since subclasses like EmacsFixed depend on the X window - * background to be set. - * This should be revisited next time we have a major API break. - */ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS; - gtk_style_context_set_background (gtk_widget_get_style_context (widget), - gtk_widget_get_window (widget)); - G_GNUC_END_IGNORE_DEPRECATIONS; - } -} - -static void -gtk_fixed_style_updated (GtkWidget *widget) -{ - GTK_WIDGET_CLASS (gtk_fixed_parent_class)->style_updated (widget); - - set_background (widget); -} - -static void gtk_fixed_realize (GtkWidget *widget) { GtkAllocation allocation; @@ -402,8 +375,6 @@ gtk_fixed_realize (GtkWidget *widget) &attributes, attributes_mask); gtk_widget_set_window (widget, window); gtk_widget_register_window (widget, window); - - set_background (widget); } } diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c index 7402651b26..82ccf13b84 100644 --- a/gtk/gtklayout.c +++ b/gtk/gtklayout.c @@ -155,7 +155,6 @@ static void gtk_layout_allocate_child (GtkLayout *layout, GtkLayoutChild *child); static void gtk_layout_adjustment_changed (GtkAdjustment *adjustment, GtkLayout *layout); -static void gtk_layout_style_updated (GtkWidget *widget); static void gtk_layout_set_hadjustment_values (GtkLayout *layout); static void gtk_layout_set_vadjustment_values (GtkLayout *layout); @@ -692,7 +691,6 @@ gtk_layout_class_init (GtkLayoutClass *class) widget_class->get_preferred_height = gtk_layout_get_preferred_height; widget_class->size_allocate = gtk_layout_size_allocate; widget_class->draw = gtk_layout_draw; - widget_class->style_updated = gtk_layout_style_updated; container_class->add = gtk_layout_add; container_class->remove = gtk_layout_remove; @@ -858,26 +856,6 @@ gtk_layout_init (GtkLayout *layout) /* Widget methods */ -static void -set_background (GtkWidget *widget) -{ - GtkLayoutPrivate *priv; - - if (gtk_widget_get_realized (widget)) - { - priv = GTK_LAYOUT (widget)->priv; - - /* We still need to call gtk_style_context_set_background() here for - * GtkLayout, since subclasses like EelCanvas depend on a background to - * be set since the beginning of the draw() implementation. - * This should be revisited next time we have a major API break. - */ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS; - gtk_style_context_set_background (gtk_widget_get_style_context (widget), priv->bin_window); - G_GNUC_END_IGNORE_DEPRECATIONS; - } -} - static void gtk_layout_realize (GtkWidget *widget) { @@ -921,7 +899,6 @@ gtk_layout_realize (GtkWidget *widget) priv->bin_window = gdk_window_new (window, &attributes, attributes_mask); gtk_widget_register_window (widget, priv->bin_window); - set_background (widget); tmp_list = priv->children; while (tmp_list) @@ -934,14 +911,6 @@ gtk_layout_realize (GtkWidget *widget) } static void -gtk_layout_style_updated (GtkWidget *widget) -{ - GTK_WIDGET_CLASS (gtk_layout_parent_class)->style_updated (widget); - - set_background (widget); -} - -static void gtk_layout_map (GtkWidget *widget) { GtkLayout *layout = GTK_LAYOUT (widget); diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 64509438ac..2b0372bc07 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -2943,7 +2943,6 @@ show_drag_window (GtkNotebook *notebook, GdkWindowAttr attributes; GtkAllocation allocation; guint attributes_mask; - GdkRGBA transparent = {0, 0, 0, 0}; gtk_css_gadget_get_margin_allocation (page->gadget, &allocation, NULL); attributes.x = priv->drag_window_x; @@ -2959,7 +2958,6 @@ show_drag_window (GtkNotebook *notebook, &attributes, attributes_mask); gtk_widget_register_window (widget, priv->drag_window); - gdk_window_set_background_rgba (priv->drag_window, &transparent); } gtk_widget_set_child_visible (page->tab_label, FALSE); diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index a44d4fa091..72edc5b39b 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -4155,7 +4155,6 @@ create_indicator_window (GtkScrolledWindow *scrolled_window, GtkWidget *child) { GtkWidget *widget = GTK_WIDGET (scrolled_window); - GdkRGBA transparent = { 0, 0, 0, 0 }; GtkAllocation allocation; GdkWindow *window; GdkWindowAttr attributes; @@ -4177,8 +4176,6 @@ create_indicator_window (GtkScrolledWindow *scrolled_window, &attributes, attributes_mask); gtk_widget_register_window (widget, window); - gdk_window_set_background_rgba (window, &transparent); - if (scrolled_window->priv->use_indicators) gtk_widget_set_parent_window (child, window); diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index aa80b7312c..1989056cff 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -2449,50 +2449,6 @@ gtk_style_context_invalidate (GtkStyleContext *context) } /** - * gtk_style_context_set_background: - * @context: a #GtkStyleContext - * @window: a #GdkWindow - * - * Sets the background of @window to the background pattern or - * color specified in @context for its current state. - * - * Since: 3.0 - * - * Deprecated: 3.18: Use gtk_render_background() instead. - * Note that clients still using this function are now responsible - * for calling this function again whenever @context is invalidated. - **/ -void -gtk_style_context_set_background (GtkStyleContext *context, - GdkWindow *window) -{ - g_return_if_fail (GTK_IS_STYLE_CONTEXT (context)); - g_return_if_fail (GDK_IS_WINDOW (window)); - - /* This is a sophisticated optimization. - * If we know the GDK window's background will be opaque, we mark - * it as opaque. This is so GDK can do all the optimizations it does - * for opaque windows and be fast. - * This is mainly used when scrolling. - * - * We could indeed just set black instead of the color we have. - */ - if (gtk_css_style_render_background_is_opaque (gtk_style_context_lookup_style (context))) - { - const GdkRGBA *color; - - color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)); - - gdk_window_set_background_rgba (window, color); - } - else - { - GdkRGBA transparent = { 0.0, 0.0, 0.0, 0.0 }; - gdk_window_set_background_rgba (window, &transparent); - } -} - -/** * gtk_style_context_get_color: * @context: a #GtkStyleContext * @state: state to retrieve the color for diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h index 9f8551f7be..f6838bb3eb 100644 --- a/gtk/gtkstylecontext.h +++ b/gtk/gtkstylecontext.h @@ -1228,10 +1228,6 @@ void gtk_style_context_invalidate (GtkStyleContext *context); GDK_AVAILABLE_IN_ALL void gtk_style_context_reset_widgets (GdkScreen *screen); -GDK_DEPRECATED_IN_3_18_FOR(gtk_render_background) -void gtk_style_context_set_background (GtkStyleContext *context, - GdkWindow *window); - GDK_AVAILABLE_IN_3_4 void gtk_render_insertion_cursor (GtkStyleContext *context, |