diff options
author | Benjamin Otte <otte@redhat.com> | 2018-07-13 14:52:43 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2018-07-13 14:56:04 +0200 |
commit | 4456b068535c98c9edda7ce218787d2409f67697 (patch) | |
tree | 5e8f91c04eddfb145aeaab3018de5aa91dbe43a6 | |
parent | 2f72353e0e1951f52c076a021ec882e0fe4f620c (diff) | |
download | gtk+-4456b068535c98c9edda7ce218787d2409f67697.tar.gz |
window: Update opaque region if background-color changes
The opaque region is only set when the background color is opaque. So
we need to do something about it when the background color changes.
However, in the case where a size allocation is going to happen, we
already do this update in size_allocate(), so in that case avoid doing
it twice.
-rw-r--r-- | gtk/gtkwindow.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 012f4efa58..9f495c12ab 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -6735,7 +6735,7 @@ subtract_corners_from_region (cairo_region_t *region, static void update_opaque_region (GtkWindow *window, - GtkBorder *border, + const GtkBorder *border, const GtkAllocation *allocation) { GtkWidget *widget = GTK_WIDGET (window); @@ -7825,11 +7825,24 @@ static void gtk_window_style_updated (GtkWidget *widget) { GtkCssStyleChange *change = gtk_style_context_get_change (gtk_widget_get_style_context (widget)); + GtkWindow *window = GTK_WINDOW (widget); GTK_WIDGET_CLASS (gtk_window_parent_class)->style_updated (widget); + if (!_gtk_widget_get_alloc_needed (widget) && + (change == NULL || gtk_css_style_change_changes_property (change, GTK_CSS_PROPERTY_BACKGROUND_COLOR))) + { + GtkAllocation allocation; + GtkBorder window_border; + + _gtk_widget_get_allocation (widget, &allocation); + get_shadow_width (window, &window_border); + + update_opaque_region (window, &window_border, &allocation); + } + if (change == NULL || gtk_css_style_change_changes_property (change, GTK_CSS_PROPERTY_ICON_THEME)) - update_themed_icon (GTK_WINDOW (widget)); + update_themed_icon (window); } /** |