[gtk/wip/baedert/for-master: 15/29] window: Replace GtkStyleContext use to get surface transform



commit 0287e98eff268416ce933a1dd70a5c644862c9fc
Author: Timm Bäder <mail baedert org>
Date:   Fri Jan 24 07:55:17 2020 +0100

    window: Replace GtkStyleContext use to get surface transform
    
    We have GtkCssBoxes for this these days.

 gtk/gtkwindow.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index dbdff29526..e7dd97fc00 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -68,6 +68,7 @@
 #include "gtkwidgetprivate.h"
 #include "gtkwindowgroup.h"
 #include "gtkpopovermenubarprivate.h"
+#include "gtkcssboxesimplprivate.h"
 
 #include "a11y/gtkwindowaccessibleprivate.h"
 #include "a11y/gtkcontaineraccessibleprivate.h"
@@ -2354,17 +2355,14 @@ gtk_window_native_get_surface_transform (GtkNative *native,
                                          int       *x,
                                          int       *y)
 {
-  GtkWindow *self = GTK_WINDOW (native);
-  GtkStyleContext *context;
-  GtkBorder margin, border, padding;
+  const graphene_rect_t *margin_rect;
+  GtkCssBoxes boxes;
 
-  context = gtk_widget_get_style_context (GTK_WIDGET (self));
-  gtk_style_context_get_margin (context, &margin);
-  gtk_style_context_get_border (context, &border);
-  gtk_style_context_get_padding (context, &padding);
+  gtk_css_boxes_init (&boxes, GTK_WIDGET (native));
+  margin_rect = gtk_css_boxes_get_margin_rect (&boxes);
 
-  *x = margin.left + border.left + padding.left;
-  *y = margin.top + border.top + padding.top;
+  *x = - margin_rect->origin.x;
+  *y = - margin_rect->origin.y;
 }
 
 static void


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