[gtk/style-context-redux: 163/164] drag icon: Stop using style context getters
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/style-context-redux: 163/164] drag icon: Stop using style context getters
- Date: Sat, 25 Jan 2020 19:21:00 +0000 (UTC)
commit f1ff69963e27646e6ea3f89765f977ffd05e2cf1
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jan 18 09:57:13 2020 -0500
drag icon: Stop using style context getters
Just go to the css node directly.
gtk/gtkdragicon.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkdragicon.c b/gtk/gtkdragicon.c
index ae36e1e1dc..c4bb48ea8c 100644
--- a/gtk/gtkdragicon.c
+++ b/gtk/gtkdragicon.c
@@ -22,9 +22,12 @@
#include "gtkprivate.h"
#include "gtkintl.h"
#include "gtkwidgetprivate.h"
+#include "gtkcssstyleprivate.h"
#include "gtkcssnodeprivate.h"
+#include "gtkcsstypesprivate.h"
#include "gtknativeprivate.h"
#include "gtkpicture.h"
+#include "gtkcssnumbervalueprivate.h"
/**
@@ -107,16 +110,15 @@ gtk_drag_icon_native_get_surface_transform (GtkNative *native,
int *x,
int *y)
{
- GtkStyleContext *context;
- GtkBorder margin, border, padding;
-
- context = gtk_widget_get_style_context (GTK_WIDGET (native));
- gtk_style_context_get_margin (context, &margin);
- gtk_style_context_get_border (context, &border);
- gtk_style_context_get_padding (context, &padding);
-
- *x = margin.left + border.left + padding.left;
- *y = margin.top + border.top + padding.top;
+ GtkCssStyle *style;
+
+ style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (native)));
+ *x = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MARGIN_LEFT), 100) +
+ _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100)
+
+ _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_PADDING_LEFT), 100);
+ *y = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MARGIN_TOP), 100) +
+ _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100) +
+ _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_PADDING_TOP), 100);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]