window: Don't set invalid csd input shape

This might happen if the CSS values of the decoration node are broken,
e.g. if people *accidentally* type large negative values for the
margins.

Fixes #2268
This commit is contained in:
Timm Bäder 2019-11-29 10:02:14 +01:00
parent 05e9a9b572
commit 83ec7d562a

View File

@ -5361,7 +5361,6 @@ update_csd_shape (GtkWindow *window)
{
GtkWidget *widget = (GtkWidget *)window;
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
cairo_region_t *region;
cairo_rectangle_int_t rect;
GtkBorder border, tmp;
GtkBorder window_border;
@ -5392,9 +5391,13 @@ update_csd_shape (GtkWindow *window)
rect.y = window_border.top;
rect.width = gtk_widget_get_allocated_width (widget) - window_border.left - window_border.right;
rect.height = gtk_widget_get_allocated_height (widget) - window_border.top - window_border.bottom;
region = cairo_region_create_rectangle (&rect);
gtk_widget_set_csd_input_shape (widget, region);
cairo_region_destroy (region);
if (rect.width > 0 && rect.height > 0)
{
cairo_region_t *region = cairo_region_create_rectangle (&rect);
gtk_widget_set_csd_input_shape (widget, region);
cairo_region_destroy (region);
}
}
static void