[gtk/wip/baedert/for-master: 10/12] window: Don't set invalid csd input shape



commit 1c10f99ef50883130dece6c5d8299e4e567048ab
Author: Timm Bäder <mail baedert org>
Date:   Fri Nov 29 10:02:14 2019 +0100

    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

 gtk/gtkwindow.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 24ced0c171..eed0de6cc6 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5392,9 +5392,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)
+    {
+      region = cairo_region_create_rectangle (&rect);
+      gtk_widget_set_csd_input_shape (widget, region);
+      cairo_region_destroy (region);
+    }
 }
 
 static void


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