[gtk/wip/baedert/for-master: 4/9] window: Inline update_csd_shape() into only caller



commit fa64416b277465238671091e0387493edc4af55a
Author: Timm Bäder <mail baedert org>
Date:   Wed Feb 5 15:31:10 2020 +0100

    window: Inline update_csd_shape() into only caller

 gtk/gtkwindow.c | 82 ++++++++++++++++++++++++++-------------------------------
 1 file changed, 38 insertions(+), 44 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 336993c6c3..6c81362e0d 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5314,49 +5314,6 @@ get_shadow_width (GtkWindow *window,
   gtk_style_context_restore (context);
 }
 
-static void
-update_csd_shape (GtkWindow *window)
-{
-  GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
-  GtkWidget *widget = (GtkWidget *)window;
-  GtkCssBoxes css_boxes;
-  graphene_rect_t border_box;
-  GtkBorder handle_size;
-
-  if (!priv->client_decorated)
-    return;
-
-  gtk_css_boxes_init (&css_boxes, priv->decoration_widget);
-  border_box = *gtk_css_boxes_get_border_rect (&css_boxes);
-
-  /* Move into window coords */
-  if (!gtk_widget_compute_point (priv->decoration_widget, widget,
-                                 &border_box.origin, &border_box.origin))
-    return;
-
-  get_resize_handle_size (window, &handle_size);
-
-  if (priv->type != GTK_WINDOW_POPUP)
-    {
-      border_box.origin.x -= handle_size.left;
-      border_box.origin.y -= handle_size.top;
-      border_box.size.width += handle_size.left + handle_size.right;
-      border_box.size.height += handle_size.top + handle_size.bottom;
-    }
-
-  if (border_box.size.width > 0 && border_box.size.height > 0)
-    {
-      cairo_region_t *region = cairo_region_create_rectangle (&(cairo_rectangle_int_t) {
-                                                                border_box.origin.x,
-                                                                border_box.origin.y,
-                                                                border_box.size.width,
-                                                                border_box.size.height
-                                                              });
-      gtk_widget_set_csd_input_shape (widget, region);
-      cairo_region_destroy (region);
-    }
-}
-
 static void
 update_opaque_region (GtkWindow           *window,
                       const GtkBorder     *border,
@@ -5445,6 +5402,10 @@ update_realized_window_properties (GtkWindow     *window,
                                    GtkBorder     *window_border)
 {
   GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
+  GtkWidget *widget = (GtkWidget *)window;
+  GtkCssBoxes css_boxes;
+  graphene_rect_t border_box;
+  GtkBorder handle_size;
 
   if (priv->surface && priv->client_decorated && priv->use_client_shadow)
     gdk_surface_set_shadow_width (priv->surface,
@@ -5454,7 +5415,40 @@ update_realized_window_properties (GtkWindow     *window,
                                   window_border->bottom);
 
   update_opaque_region (window, window_border, child_allocation);
-  update_csd_shape (window);
+
+  /* Update input shape */
+  if (!priv->client_decorated)
+    return;
+
+  gtk_css_boxes_init (&css_boxes, priv->decoration_widget);
+  border_box = *gtk_css_boxes_get_border_rect (&css_boxes);
+
+  /* Move into window coords */
+  if (!gtk_widget_compute_point (priv->decoration_widget, widget,
+                                 &border_box.origin, &border_box.origin))
+    return;
+
+  get_resize_handle_size (window, &handle_size);
+
+  if (priv->type != GTK_WINDOW_POPUP)
+    {
+      border_box.origin.x -= handle_size.left;
+      border_box.origin.y -= handle_size.top;
+      border_box.size.width += handle_size.left + handle_size.right;
+      border_box.size.height += handle_size.top + handle_size.bottom;
+    }
+
+  if (border_box.size.width > 0 && border_box.size.height > 0)
+    {
+      cairo_region_t *region = cairo_region_create_rectangle (&(cairo_rectangle_int_t) {
+                                                                border_box.origin.x,
+                                                                border_box.origin.y,
+                                                                border_box.size.width,
+                                                                border_box.size.height
+                                                              });
+      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]