mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-04 01:31:13 +00:00
natives: Use GtkCssBoxes in get_surface_transform
This commit is contained in:
parent
bac6e79614
commit
2e9d772e66
@ -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;
|
||||
GtkCssBoxes css_boxes;
|
||||
const graphene_rect_t *margin_rect;
|
||||
|
||||
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);
|
||||
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;
|
||||
GtkCssBoxes css_boxes;
|
||||
const graphene_rect_t *margin_rect;
|
||||
|
||||
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);
|
||||
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 *
|
||||
|
Loading…
Reference in New Issue
Block a user