[gtk/wip/muktupavels/opaque-region] window: fix opaque region



commit 44c994e4690dfb770977a11e6f0022f2aba904f7
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Nov 30 19:53:40 2019 +0200

    window: fix opaque region
    
    Decoration node for drawing is used only for client side decorated
    windows, but corners from opaque region is subtracted also for
    normal windows.
    
    Rename function to better reflect what it does and do not subtract
    corners if decoration node was not used for drawing.

 gtk/gtkwindow.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 6c5f136043..7229518900 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7236,13 +7236,20 @@ corner_rect (cairo_rectangle_int_t *rect,
 }
 
 static void
-subtract_corners_from_region (cairo_region_t        *region,
-                              cairo_rectangle_int_t *extents,
-                              GtkStyleContext       *context,
-                              GtkWindow             *window)
+subtract_decoration_corners_from_region (cairo_region_t        *region,
+                                         cairo_rectangle_int_t *extents,
+                                         GtkStyleContext       *context,
+                                         GtkWindow             *window)
 {
+  GtkWindowPrivate *priv = window->priv;
   cairo_rectangle_int_t rect;
 
+  if (!priv->client_decorated ||
+      !priv->decorated ||
+      priv->fullscreen ||
+      priv->maximized)
+    return;
+
   gtk_style_context_save_to_node (context, window->priv->decoration_node);
 
   corner_rect (&rect, _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS));
@@ -7304,7 +7311,7 @@ update_opaque_region (GtkWindow           *window,
 
       opaque_region = cairo_region_create_rectangle (&rect);
 
-      subtract_corners_from_region (opaque_region, &rect, context, window);
+      subtract_decoration_corners_from_region (opaque_region, &rect, context, window);
     }
   else
     {


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