[gtk/style-context-redux: 3/4] 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: 3/4] drag icon: Stop using style context getters
- Date: Sat, 25 Jan 2020 15:56:50 +0000 (UTC)
commit 0cebeb322ece3905a1e41f70d6aad90e0e0b01cf
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 | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkdragicon.c b/gtk/gtkdragicon.c
index ae36e1e1dc..30a462f089 100644
--- a/gtk/gtkdragicon.c
+++ b/gtk/gtkdragicon.c
@@ -107,16 +107,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;
+ GtkCssNode *node;
+
+ node = gtk_widget_get_css_node (GTK_WIDGET (native));
+ *y = _gtk_css_number_value_get (gtk_css_node_get_value (node, GTK_CSS_PROPERTY_MARGIN_LEFT), 100) +
+ _gtk_css_number_value_get (gtk_css_node_get_value (node, GTK_CSS_PROPERTY_BORDER_LEFT), 100) +
+ _gtk_css_number_value_get (gtk_css_node_get_value (node, GTK_CSS_PROPERTY_PADDING_LEFT), 100);
+ *y = _gtk_css_number_value_get (gtk_css_node_get_value (node, GTK_CSS_PROPERTY_MARGIN_TOP), 100) +
+ _gtk_css_number_value_get (gtk_css_node_get_value (node, GTK_CSS_PROPERTY_BORDER_TOP), 100) +
+ _gtk_css_number_value_get (gtk_css_node_get_value (node, GTK_CSS_PROPERTY_PADDING_TOP), 100);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]