Commit 2e9d772e authored by Timm Bäder's avatar Timm Bäder 🤔
Browse files

natives: Use GtkCssBoxes in get_surface_transform

parent bac6e796
......@@ -27,6 +27,7 @@
#include "gtkcsstypesprivate.h"
#include "gtknativeprivate.h"
#include "gtkpicture.h"
#include "gtkcssboxesimplprivate.h"
#include "gtkcssnumbervalueprivate.h"
/* for the drag icons */
......@@ -122,15 +123,14 @@ gtk_drag_icon_native_get_surface_transform (GtkNative *native,
int *x,
int *y)
{
GtkCssStyle *style;
style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (native)));
*x = _gtk_css_number_value_get (style->size->margin_left, 100) +
_gtk_css_number_value_get (style->border->border_left_width, 100) +
_gtk_css_number_value_get (style->size->padding_left, 100);
*y = _gtk_css_number_value_get (style->size->margin_top, 100) +
_gtk_css_number_value_get (style->border->border_top_width, 100) +
_gtk_css_number_value_get (style->size->padding_top, 100);
GtkCssBoxes css_boxes;
const graphene_rect_t *margin_rect;
gtk_css_boxes_init (&css_boxes, GTK_WIDGET (native));
margin_rect = gtk_css_boxes_get_margin_rect (&css_boxes);
*x = - margin_rect->origin.x;
*y = - margin_rect->origin.y;
}
static void
......
......@@ -23,9 +23,10 @@
#include "gtkmarshalers.h"
#include "gtkprivate.h"
#include "gtkwindowprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkrendericonprivate.h"
#include "gtkcssboxesimplprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkintl.h"
......@@ -82,15 +83,14 @@ gtk_text_handle_native_get_surface_transform (GtkNative *native,
int *x,
int *y)
{
GtkCssStyle *style;
style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (native)));
*x = _gtk_css_number_value_get (style->size->margin_left, 100) +
_gtk_css_number_value_get (style->border->border_left_width, 100) +
_gtk_css_number_value_get (style->size->padding_left, 100);
*y = _gtk_css_number_value_get (style->size->margin_top, 100) +
_gtk_css_number_value_get (style->border->border_top_width, 100) +
_gtk_css_number_value_get (style->size->padding_top, 100);
GtkCssBoxes css_boxes;
const graphene_rect_t *margin_rect;
gtk_css_boxes_init (&css_boxes, GTK_WIDGET (native));
margin_rect = gtk_css_boxes_get_margin_rect (&css_boxes);
*x = - margin_rect->origin.x;
*y = - margin_rect->origin.y;
}
static void
......
......@@ -39,8 +39,7 @@
#include "gtkwindowprivate.h"
#include "gtkwidgetprivate.h"
#include "gtknative.h"
#include "gtkstylecontext.h"
#include "gtkcssnodeprivate.h"
#include "gtkcssboxesimplprivate.h"
struct _GtkTooltipWindow
{
......@@ -98,16 +97,14 @@ gtk_tooltip_window_native_get_surface_transform (GtkNative *native,
int *x,
int *y)
{
GtkStyleContext *context;
GtkBorder margin, border, padding;
GtkCssBoxes css_boxes;
const graphene_rect_t *margin_rect;
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);
gtk_css_boxes_init (&css_boxes, GTK_WIDGET (native));
margin_rect = gtk_css_boxes_get_margin_rect (&css_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 GdkPopupLayout *
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment