mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 10:20:07 +00:00
Deprecate gtk_widget_translate_coordinates
Update all (non-deprecated) callers to use gtk_widget_compute_point instead. Fixes: #5697
This commit is contained in:
parent
81e61b9abf
commit
b23ac5c8da
@ -324,7 +324,7 @@ canvas_item_start_editing (CanvasItem *item)
|
||||
GtkWidget *canvas = gtk_widget_get_parent (GTK_WIDGET (item));
|
||||
GtkWidget *entry;
|
||||
GtkWidget *scale;
|
||||
double x, y;
|
||||
graphene_point_t p;
|
||||
|
||||
if (item->editor)
|
||||
return;
|
||||
@ -350,8 +350,9 @@ canvas_item_start_editing (CanvasItem *item)
|
||||
|
||||
gtk_box_append (GTK_BOX (item->editor), scale);
|
||||
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (item), canvas, 0, 0, &x, &y);
|
||||
gtk_fixed_put (GTK_FIXED (canvas), item->editor, x, y + 2 * item->r);
|
||||
if (!gtk_widget_compute_point (GTK_WIDGET (item), canvas, &GRAPHENE_POINT_INIT (0, 0), &p))
|
||||
graphene_point_init (&p, 0, 0);
|
||||
gtk_fixed_put (GTK_FIXED (canvas), item->editor, p.x, p.y + 2 * item->r);
|
||||
gtk_widget_grab_focus (entry);
|
||||
|
||||
}
|
||||
@ -368,6 +369,7 @@ prepare (GtkDragSource *source,
|
||||
GtkWidget *canvas;
|
||||
GtkWidget *item;
|
||||
Hotspot *hotspot;
|
||||
graphene_point_t p;
|
||||
|
||||
canvas = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
|
||||
item = gtk_widget_pick (canvas, x, y, GTK_PICK_DEFAULT);
|
||||
@ -379,7 +381,10 @@ prepare (GtkDragSource *source,
|
||||
g_object_set_data (G_OBJECT (canvas), "dragged-item", item);
|
||||
|
||||
hotspot = g_new (Hotspot, 1);
|
||||
gtk_widget_translate_coordinates (canvas, item, x, y, &hotspot->x, &hotspot->y);
|
||||
if (!gtk_widget_compute_point (canvas, item, &GRAPHENE_POINT_INIT (x, y), &p))
|
||||
graphene_point_init (&p, x, y);
|
||||
hotspot->x = p.x;
|
||||
hotspot->y = p.y;
|
||||
g_object_set_data_full (G_OBJECT (canvas), "hotspot", hotspot, g_free);
|
||||
|
||||
return gdk_content_provider_new_typed (GTK_TYPE_WIDGET, item);
|
||||
|
@ -44,35 +44,32 @@ translate_coordinates_to_widget (GtkWidget *widget,
|
||||
int *xo,
|
||||
int *yo)
|
||||
{
|
||||
double x = xi;
|
||||
double y = yi;
|
||||
graphene_point_t p;
|
||||
GtkWidget *source;
|
||||
|
||||
switch (coordtype)
|
||||
{
|
||||
case ATSPI_COORD_TYPE_SCREEN:
|
||||
g_warning ("Screen coordinates not supported, reported positions will be wrong");
|
||||
G_GNUC_FALLTHROUGH;
|
||||
return;
|
||||
|
||||
case ATSPI_COORD_TYPE_WINDOW:
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (gtk_widget_get_root (widget)),
|
||||
widget,
|
||||
x, y,
|
||||
&x, &y);
|
||||
source = GTK_WIDGET (gtk_widget_get_root (widget));
|
||||
break;
|
||||
|
||||
case ATSPI_COORD_TYPE_PARENT:
|
||||
gtk_widget_translate_coordinates (gtk_widget_get_parent (widget),
|
||||
widget,
|
||||
x, y,
|
||||
&x, &y);
|
||||
source = gtk_widget_get_parent (widget);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
*xo = (int)x;
|
||||
*yo = (int)y;
|
||||
if (!gtk_widget_compute_point (source, widget, &GRAPHENE_POINT_INIT (xi, yi), &p))
|
||||
graphene_point_init (&p, xi, yi);
|
||||
|
||||
*xo = (int)p.x;
|
||||
*yo = (int)p.y;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -83,35 +80,32 @@ translate_coordinates_from_widget (GtkWidget *widget,
|
||||
int *xo,
|
||||
int *yo)
|
||||
{
|
||||
double x = xi;
|
||||
double y = yi;
|
||||
graphene_point_t p;
|
||||
GtkWidget *target;
|
||||
|
||||
switch (coordtype)
|
||||
{
|
||||
case ATSPI_COORD_TYPE_SCREEN:
|
||||
g_warning ("Screen coordinates not supported, reported positions will be wrong");
|
||||
G_GNUC_FALLTHROUGH;
|
||||
return;
|
||||
|
||||
case ATSPI_COORD_TYPE_WINDOW:
|
||||
gtk_widget_translate_coordinates (widget,
|
||||
GTK_WIDGET (gtk_widget_get_root (widget)),
|
||||
x, y,
|
||||
&x, &y);
|
||||
target = GTK_WIDGET (gtk_widget_get_root (widget));
|
||||
break;
|
||||
|
||||
case ATSPI_COORD_TYPE_PARENT:
|
||||
gtk_widget_translate_coordinates (widget,
|
||||
gtk_widget_get_parent (widget),
|
||||
x, y,
|
||||
&x, &y);
|
||||
target = gtk_widget_get_parent (widget);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
*xo = (int)x;
|
||||
*yo = (int)y;
|
||||
if (!gtk_widget_compute_point (widget, target, &GRAPHENE_POINT_INIT (xi, yi), &p))
|
||||
graphene_point_init (&p, xi, yi);
|
||||
|
||||
*xo = (int)p.x;
|
||||
*yo = (int)p.y;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1397,12 +1397,12 @@ text_view_handle_method (GDBusConnection *connection,
|
||||
rect.x, rect.y,
|
||||
&x, &y);
|
||||
|
||||
double dx, dy;
|
||||
gtk_widget_translate_coordinates (widget,
|
||||
GTK_WIDGET (gtk_widget_get_native (widget)),
|
||||
(double) x, (double) y, &dx, &dy);
|
||||
x = floor (dx);
|
||||
y = floor (dy);
|
||||
graphene_point_t p;
|
||||
if (!gtk_widget_compute_point (widget, GTK_WIDGET (gtk_widget_get_native (widget)),
|
||||
&GRAPHENE_POINT_INIT (x, y), &p))
|
||||
graphene_point_init (&p, x, y);
|
||||
x = floor (p.x);
|
||||
y = floor (p.y);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation,
|
||||
g_variant_new ("(iiii)",
|
||||
|
@ -275,7 +275,7 @@ get_child_position (GtkOverlay *overlay,
|
||||
GtkRequisition req;
|
||||
GtkAllocation alloc;
|
||||
int s, e;
|
||||
double x, y;
|
||||
graphene_point_t p;
|
||||
|
||||
gtk_widget_get_preferred_size (widget, &req, NULL);
|
||||
|
||||
@ -286,46 +286,45 @@ get_child_position (GtkOverlay *overlay,
|
||||
|
||||
if (widget == editor->sv_popup)
|
||||
{
|
||||
gtk_widget_translate_coordinates (editor->sv_plane,
|
||||
if (!gtk_widget_compute_point (editor->sv_plane,
|
||||
gtk_widget_get_parent (editor->grid),
|
||||
0, -6,
|
||||
&x, &y);
|
||||
&GRAPHENE_POINT_INIT (0, -6),
|
||||
&p))
|
||||
return FALSE;
|
||||
if (gtk_widget_get_direction (GTK_WIDGET (overlay)) == GTK_TEXT_DIR_RTL)
|
||||
x = 0;
|
||||
p.x = 0;
|
||||
else
|
||||
x = gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width;
|
||||
p.x = gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width;
|
||||
}
|
||||
else if (widget == editor->h_popup)
|
||||
{
|
||||
gtk_widget_get_allocation (editor->h_slider, &alloc);
|
||||
gtk_range_get_slider_range (GTK_RANGE (editor->h_slider), &s, &e);
|
||||
|
||||
if (gtk_widget_get_direction (GTK_WIDGET (overlay)) == GTK_TEXT_DIR_RTL)
|
||||
gtk_widget_translate_coordinates (editor->h_slider,
|
||||
if (!gtk_widget_compute_point (editor->h_slider,
|
||||
gtk_widget_get_parent (editor->grid),
|
||||
- req.width - 6, editor->popup_position - req.height / 2,
|
||||
&x, &y);
|
||||
else
|
||||
gtk_widget_translate_coordinates (editor->h_slider,
|
||||
gtk_widget_get_parent (editor->grid),
|
||||
alloc.width + 6, editor->popup_position - req.height / 2,
|
||||
&x, &y);
|
||||
gtk_widget_get_direction (GTK_WIDGET (overlay)) == GTK_TEXT_DIR_RTL
|
||||
? &GRAPHENE_POINT_INIT (- req.width - 6, editor->popup_position - req.height / 2)
|
||||
: &GRAPHENE_POINT_INIT (alloc.width + 6, editor->popup_position - req.height / 2),
|
||||
&p))
|
||||
return FALSE;
|
||||
}
|
||||
else if (widget == editor->a_popup)
|
||||
{
|
||||
gtk_widget_get_allocation (editor->a_slider, &alloc);
|
||||
gtk_range_get_slider_range (GTK_RANGE (editor->a_slider), &s, &e);
|
||||
|
||||
gtk_widget_translate_coordinates (editor->a_slider,
|
||||
if (!gtk_widget_compute_point (editor->a_slider,
|
||||
gtk_widget_get_parent (editor->grid),
|
||||
editor->popup_position - req.width / 2, - req.height - 6,
|
||||
&x, &y);
|
||||
&GRAPHENE_POINT_INIT (editor->popup_position - req.width / 2, - req.height - 6),
|
||||
&p))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
allocation->x = CLAMP (x, 0, gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width);
|
||||
allocation->y = CLAMP (y, 0, gtk_widget_get_height (GTK_WIDGET (overlay)) - req.height);
|
||||
allocation->x = CLAMP (p.x, 0, gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width);
|
||||
allocation->y = CLAMP (p.y, 0, gtk_widget_get_height (GTK_WIDGET (overlay)) - req.height);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -864,16 +864,19 @@ update_autoscroll (GtkColumnView *self,
|
||||
{
|
||||
double width;
|
||||
double delta;
|
||||
double vx, vy;
|
||||
graphene_point_t v;
|
||||
|
||||
/* x is in header coordinates */
|
||||
gtk_widget_translate_coordinates (self->header, GTK_WIDGET (self), x, 0, &vx, &vy);
|
||||
if (!gtk_widget_compute_point (self->header, GTK_WIDGET (self),
|
||||
&GRAPHENE_POINT_INIT (x, 0),
|
||||
&v))
|
||||
graphene_point_init (&v, 0, 0);
|
||||
width = gtk_widget_get_width (GTK_WIDGET (self));
|
||||
|
||||
if (vx < SCROLL_EDGE_SIZE)
|
||||
delta = - (SCROLL_EDGE_SIZE - vx)/3.0;
|
||||
else if (width - vx < SCROLL_EDGE_SIZE)
|
||||
delta = (SCROLL_EDGE_SIZE - (width - vx))/3.0;
|
||||
if (v.x < SCROLL_EDGE_SIZE)
|
||||
delta = - (SCROLL_EDGE_SIZE - v.x)/3.0;
|
||||
else if (width - v.x < SCROLL_EDGE_SIZE)
|
||||
delta = (SCROLL_EDGE_SIZE - (width - v.x))/3.0;
|
||||
else
|
||||
delta = 0;
|
||||
|
||||
@ -1264,10 +1267,12 @@ gtk_column_view_drag_motion (GtkDropControllerMotion *motion,
|
||||
{
|
||||
GtkWidget *widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (motion));
|
||||
GtkColumnView *self = GTK_COLUMN_VIEW (widget);
|
||||
double hx, hy;
|
||||
graphene_point_t h;
|
||||
|
||||
gtk_widget_translate_coordinates (widget, self->header, x, 0, &hx, &hy);
|
||||
update_autoscroll (GTK_COLUMN_VIEW (widget), hx);
|
||||
if (!gtk_widget_compute_point (widget, self->header,
|
||||
&GRAPHENE_POINT_INIT (x, 0), &h))
|
||||
graphene_point_init (&h, 0, 0);
|
||||
update_autoscroll (GTK_COLUMN_VIEW (widget), h.x);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -564,7 +564,7 @@ gtk_drag_source_drag_begin (GtkDragSource *source)
|
||||
GtkWidget *widget;
|
||||
GdkDevice *device, *pointer;
|
||||
GdkSeat *seat;
|
||||
double x, y;
|
||||
graphene_point_t p;
|
||||
GtkNative *native;
|
||||
GdkSurface *surface;
|
||||
double px, py;
|
||||
@ -583,11 +583,15 @@ gtk_drag_source_drag_begin (GtkDragSource *source)
|
||||
native = gtk_widget_get_native (widget);
|
||||
surface = gtk_native_get_surface (native);
|
||||
|
||||
gtk_widget_translate_coordinates (widget, GTK_WIDGET (native), source->start_x, source->start_y, &x, &y);
|
||||
if (!gtk_widget_compute_point (widget, GTK_WIDGET (native),
|
||||
&GRAPHENE_POINT_INIT (source->start_x, source->start_y),
|
||||
&p))
|
||||
return;
|
||||
|
||||
gdk_surface_get_device_position (surface, pointer, &px, &py, NULL);
|
||||
|
||||
dx = round (px - x);
|
||||
dy = round (py - y);
|
||||
dx = round (px - p.x);
|
||||
dy = round (py - p.y);
|
||||
|
||||
g_signal_emit (source, signals[PREPARE], 0, source->start_x, source->start_y, &content);
|
||||
if (!content)
|
||||
|
@ -276,7 +276,7 @@ scroll_to_child (GtkWidget *child)
|
||||
GtkEmojiChooser *chooser;
|
||||
GtkAdjustment *adj;
|
||||
GtkAllocation alloc;
|
||||
double pos;
|
||||
graphene_point_t p;
|
||||
double value;
|
||||
double page_size;
|
||||
|
||||
@ -289,12 +289,14 @@ scroll_to_child (GtkWidget *child)
|
||||
value = gtk_adjustment_get_value (adj);
|
||||
page_size = gtk_adjustment_get_page_size (adj);
|
||||
|
||||
gtk_widget_translate_coordinates (child, gtk_widget_get_parent (chooser->recent.box), 0, 0, NULL, &pos);
|
||||
if (!gtk_widget_compute_point (child, gtk_widget_get_parent (chooser->recent.box),
|
||||
&GRAPHENE_POINT_INIT (0, 0), &p))
|
||||
return;
|
||||
|
||||
if (pos < value)
|
||||
gtk_adjustment_animate_to_value (adj, pos);
|
||||
else if (pos + alloc.height >= value + page_size)
|
||||
gtk_adjustment_animate_to_value (adj, value + ((pos + alloc.height) - (value + page_size)));
|
||||
if (p.y < value)
|
||||
gtk_adjustment_animate_to_value (adj, p.y);
|
||||
else if (p.y + alloc.height >= value + page_size)
|
||||
gtk_adjustment_animate_to_value (adj, value + ((p.y + alloc.height) - (value + page_size)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2829,15 +2829,16 @@ gtk_entry_get_icon_at_pos (GtkEntry *entry,
|
||||
for (i = 0; i < MAX_ICONS; i++)
|
||||
{
|
||||
EntryIconInfo *icon_info = priv->icons[i];
|
||||
double icon_x, icon_y;
|
||||
graphene_point_t p;
|
||||
|
||||
if (icon_info == NULL)
|
||||
continue;
|
||||
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (entry), icon_info->widget,
|
||||
x, y, &icon_x, &icon_y);
|
||||
if (!gtk_widget_compute_point (GTK_WIDGET (entry), icon_info->widget,
|
||||
&GRAPHENE_POINT_INIT (x, y), &p))
|
||||
continue;
|
||||
|
||||
if (gtk_widget_contains (icon_info->widget, icon_x, icon_y))
|
||||
if (gtk_widget_contains (icon_info->widget, p.x, p.y))
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -71,18 +71,19 @@ popup_menu (GtkFileChooserCell *self,
|
||||
GtkWidget *widget = GTK_WIDGET (self);
|
||||
GtkSelectionModel *model;
|
||||
GtkWidget *impl;
|
||||
double xx, yy;
|
||||
graphene_point_t p;
|
||||
|
||||
impl = gtk_widget_get_ancestor (widget, GTK_TYPE_FILE_CHOOSER_WIDGET);
|
||||
|
||||
model = gtk_file_chooser_widget_get_selection_model (GTK_FILE_CHOOSER_WIDGET (impl));
|
||||
gtk_selection_model_select_item (model, self->position, TRUE);
|
||||
|
||||
gtk_widget_translate_coordinates (widget, GTK_WIDGET (impl),
|
||||
x, y, &xx, &yy);
|
||||
if (!gtk_widget_compute_point (widget, GTK_WIDGET (impl),
|
||||
&GRAPHENE_POINT_INIT (x, y), &p))
|
||||
return;
|
||||
|
||||
gtk_widget_activate_action (widget, "item.popup-file-list-menu",
|
||||
"(udd)", self->position, xx, yy);
|
||||
"(udd)", self->position, p.x, p.y);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -259,13 +259,21 @@ gtk_fixed_get_child_position (GtkFixed *fixed,
|
||||
double *x,
|
||||
double *y)
|
||||
{
|
||||
graphene_point_t p;
|
||||
|
||||
g_return_if_fail (GTK_IS_FIXED (fixed));
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (x != NULL);
|
||||
g_return_if_fail (y != NULL);
|
||||
g_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (fixed));
|
||||
|
||||
gtk_widget_translate_coordinates (widget, GTK_WIDGET (fixed), 0, 0, x, y);
|
||||
|
||||
if (!gtk_widget_compute_point (widget, GTK_WIDGET (fixed),
|
||||
&GRAPHENE_POINT_INIT (0, 0), &p))
|
||||
graphene_point_init (&p, 0, 0);
|
||||
|
||||
*x = p.x;
|
||||
*y = p.y;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -871,21 +871,21 @@ gtk_im_context_ime_message_filter (GdkWin32Display *display,
|
||||
GtkNative *native = gtk_native_get_for_surface (context_ime->client_surface);
|
||||
if G_LIKELY (native)
|
||||
{
|
||||
double x = 0.0;
|
||||
double y = 0.0;
|
||||
graphene_point_t p;
|
||||
double decor_x = 0.0;
|
||||
double decor_y = 0.0;
|
||||
|
||||
gtk_widget_translate_coordinates (context_ime->client_widget,
|
||||
if (!gtk_widget_compute_point (context_ime->client_widget,
|
||||
GTK_WIDGET (native),
|
||||
0.0, 0.0, &x, &y);
|
||||
&GRAPHENE_POINT_INIT (0, 0), &p))
|
||||
graphene_point_init (&p, 0, 0);
|
||||
|
||||
gtk_native_get_surface_transform (native, &decor_x, &decor_y);
|
||||
x += decor_x;
|
||||
y += decor_y;
|
||||
p.x += decor_x;
|
||||
p.y += decor_y;
|
||||
|
||||
wx = (int) x;
|
||||
wy = (int) y;
|
||||
wx = (int) p.x;
|
||||
wy = (int) p.y;
|
||||
}
|
||||
|
||||
scale = gtk_widget_get_scale_factor (context_ime->client_widget);
|
||||
|
@ -307,7 +307,7 @@ quartz_set_cursor_location (GtkIMContext *context, GdkRectangle *area)
|
||||
GtkIMContextQuartz *qc = GTK_IM_CONTEXT_QUARTZ (context);
|
||||
GtkWidget* surface_widget;
|
||||
int sx, sy;
|
||||
double wx, wy;
|
||||
graphene_point_t p;
|
||||
|
||||
GTK_DEBUG (MODULES, "quartz_set_cursor_location");
|
||||
|
||||
@ -323,11 +323,12 @@ quartz_set_cursor_location (GtkIMContext *context, GdkRectangle *area)
|
||||
return;
|
||||
|
||||
gdk_surface_get_origin (qc->client_surface, &sx, &sy);
|
||||
gtk_widget_translate_coordinates(qc->client_widget, surface_widget,
|
||||
area->x, area->y, &wx, &wy);
|
||||
if (!gtk_widget_compute_point (qc->client_widget, surface_widget,
|
||||
&GRAPHENE_POINT_INIT (area->x, area->y), &p))
|
||||
graphene_point_init (&p, area->x, area->y);
|
||||
|
||||
qc->cursor_rect->x = sx + (int) wx;
|
||||
qc->cursor_rect->y = sy + (int) wy;
|
||||
qc->cursor_rect->x = sx + (int) p.x;
|
||||
qc->cursor_rect->y = sy + (int) p.y;
|
||||
qc->cursor_rect->width = area->width;
|
||||
qc->cursor_rect->height = area->height;
|
||||
|
||||
|
@ -392,23 +392,24 @@ notify_cursor_location (GtkIMContextWayland *context)
|
||||
{
|
||||
GtkIMContextWaylandGlobal *global;
|
||||
cairo_rectangle_int_t rect;
|
||||
double x, y, sx, sy;
|
||||
double nx, ny;
|
||||
graphene_point_t p;
|
||||
|
||||
global = gtk_im_context_wayland_get_global (context);
|
||||
if (global == NULL)
|
||||
return;
|
||||
|
||||
rect = context->cursor_rect;
|
||||
gtk_widget_translate_coordinates (context->widget,
|
||||
if (!gtk_widget_compute_point (context->widget,
|
||||
GTK_WIDGET (gtk_widget_get_root (context->widget)),
|
||||
rect.x, rect.y,
|
||||
&x, &y);
|
||||
&GRAPHENE_POINT_INIT (rect.x, rect.y),
|
||||
&p))
|
||||
graphene_point_init (&p, rect.x, rect.y);
|
||||
|
||||
gtk_native_get_surface_transform (gtk_widget_get_native (context->widget),
|
||||
&sx, &sy);
|
||||
gtk_native_get_surface_transform (gtk_widget_get_native (context->widget), &nx, &ny);
|
||||
|
||||
rect.x = x + sx;
|
||||
rect.y = y + sy;
|
||||
rect.x = p.x + nx;
|
||||
rect.y = p.y + ny;
|
||||
zwp_text_input_v3_set_cursor_rectangle (global->text_input,
|
||||
rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
|
@ -464,11 +464,13 @@ gtk_native_update_opaque_region (GtkNative *native,
|
||||
|
||||
if (contents != GTK_WIDGET (native))
|
||||
{
|
||||
double contents_x, contents_y;
|
||||
graphene_point_t p;
|
||||
|
||||
gtk_widget_translate_coordinates (contents, GTK_WIDGET (native), 0, 0, &contents_x, &contents_y);
|
||||
rect.x += contents_x;
|
||||
rect.y += contents_y;
|
||||
if (!gtk_widget_compute_point (contents, GTK_WIDGET (native),
|
||||
&GRAPHENE_POINT_INIT (0, 0), &p))
|
||||
graphene_point_init (&p, 0, 0);
|
||||
rect.x += p.x;
|
||||
rect.y += p.y;
|
||||
}
|
||||
|
||||
opaque_region = cairo_region_create_rectangle (&rect);
|
||||
|
@ -1674,6 +1674,8 @@ drag_motion_callback (GtkDropTarget *target,
|
||||
|
||||
if (row != NULL)
|
||||
{
|
||||
graphene_point_t p;
|
||||
|
||||
g_object_get (row, "order-index", &row_index, NULL);
|
||||
g_object_get (sidebar->row_placeholder, "order-index", &row_placeholder_index, NULL);
|
||||
/* We order the bookmarks sections based on the bookmark index that we
|
||||
@ -1687,9 +1689,11 @@ drag_motion_callback (GtkDropTarget *target,
|
||||
* of the row, we need to increase the order-index.
|
||||
*/
|
||||
row_placeholder_index = row_index;
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (sidebar), GTK_WIDGET (row),
|
||||
x, y,
|
||||
&x, &y);
|
||||
if (!gtk_widget_compute_point (GTK_WIDGET (sidebar), GTK_WIDGET (row),
|
||||
&GRAPHENE_POINT_INIT (x, y), &p))
|
||||
graphene_point_init (&p, x, y);
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
|
||||
if (y > sidebar->drag_row_height / 2 && row_index > 0)
|
||||
row_placeholder_index++;
|
||||
@ -2373,13 +2377,16 @@ _popover_set_pointing_to_widget (GtkPopover *popover,
|
||||
GtkWidget *target)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
graphene_point_t p;
|
||||
double x, y, w, h;
|
||||
|
||||
parent = gtk_widget_get_parent (GTK_WIDGET (popover));
|
||||
|
||||
if (!gtk_widget_translate_coordinates (target, parent, 0, 0, &x, &y))
|
||||
if (!gtk_widget_compute_point (target, parent, &GRAPHENE_POINT_INIT (0, 0), &p))
|
||||
return;
|
||||
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
w = gtk_widget_get_allocated_width (GTK_WIDGET (target));
|
||||
h = gtk_widget_get_allocated_height (GTK_WIDGET (target));
|
||||
|
||||
@ -3473,7 +3480,7 @@ on_row_dragged (GtkGestureDrag *gesture,
|
||||
if (gtk_drag_check_threshold_double (GTK_WIDGET (row), 0, 0, x, y))
|
||||
{
|
||||
double start_x, start_y;
|
||||
double drag_x, drag_y;
|
||||
graphene_point_t p;
|
||||
GdkContentProvider *content;
|
||||
GdkSurface *surface;
|
||||
GdkDevice *device;
|
||||
@ -3482,10 +3489,11 @@ on_row_dragged (GtkGestureDrag *gesture,
|
||||
GdkDrag *drag;
|
||||
|
||||
gtk_gesture_drag_get_start_point (gesture, &start_x, &start_y);
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (row),
|
||||
if (!gtk_widget_compute_point (GTK_WIDGET (row),
|
||||
GTK_WIDGET (sidebar),
|
||||
start_x, start_y,
|
||||
&drag_x, &drag_y);
|
||||
&GRAPHENE_POINT_INIT (start_x, start_y),
|
||||
&p))
|
||||
graphene_point_init (&p, start_x, start_y);
|
||||
|
||||
sidebar->dragging_over = TRUE;
|
||||
|
||||
@ -3494,7 +3502,7 @@ on_row_dragged (GtkGestureDrag *gesture,
|
||||
surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (sidebar)));
|
||||
device = gtk_gesture_get_device (GTK_GESTURE (gesture));
|
||||
|
||||
drag = gdk_drag_begin (surface, device, content, GDK_ACTION_MOVE, drag_x, drag_y);
|
||||
drag = gdk_drag_begin (surface, device, content, GDK_ACTION_MOVE, p.x, p.y);
|
||||
|
||||
g_object_unref (content);
|
||||
|
||||
|
@ -1692,13 +1692,16 @@ _popover_set_pointing_to_widget (GtkPopover *popover,
|
||||
GtkWidget *target)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
graphene_point_t p;
|
||||
double x, y, w, h;
|
||||
|
||||
parent = gtk_widget_get_parent (GTK_WIDGET (popover));
|
||||
|
||||
if (!gtk_widget_translate_coordinates (target, parent, 0, 0, &x, &y))
|
||||
if (!gtk_widget_compute_point (target, parent, &GRAPHENE_POINT_INIT (0, 0), &p))
|
||||
return;
|
||||
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
w = gtk_widget_get_allocated_width (GTK_WIDGET (target));
|
||||
h = gtk_widget_get_allocated_height (GTK_WIDGET (target));
|
||||
|
||||
@ -1715,7 +1718,6 @@ real_popup_menu (GtkWidget *widget,
|
||||
GMount *mount;
|
||||
GFile *file;
|
||||
gboolean is_network;
|
||||
double x_in_view, y_in_view;
|
||||
|
||||
view = GTK_PLACES_VIEW (gtk_widget_get_ancestor (GTK_WIDGET (row), GTK_TYPE_PLACES_VIEW));
|
||||
|
||||
@ -1753,10 +1755,13 @@ real_popup_menu (GtkWidget *widget,
|
||||
_popover_set_pointing_to_widget (GTK_POPOVER (view->popup_menu), GTK_WIDGET (row));
|
||||
else
|
||||
{
|
||||
gtk_widget_translate_coordinates (widget, GTK_WIDGET (view),
|
||||
x, y, &x_in_view, &y_in_view);
|
||||
graphene_point_t p;
|
||||
if (!gtk_widget_compute_point (widget, GTK_WIDGET (view),
|
||||
&GRAPHENE_POINT_INIT (x, y),
|
||||
&p))
|
||||
graphene_point_init (&p, x, y);
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (view->popup_menu),
|
||||
&(GdkRectangle){x_in_view, y_in_view, 0, 0});
|
||||
&(GdkRectangle){p.x, p.y, 0, 0});
|
||||
}
|
||||
|
||||
view->row_for_action = row;
|
||||
@ -1930,17 +1935,18 @@ on_address_entry_show_help_pressed (GtkPlacesView *view,
|
||||
GtkEntry *entry)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
double x, y;
|
||||
graphene_point_t p;
|
||||
|
||||
/* Setup the auxiliary popover's rectangle */
|
||||
gtk_entry_get_icon_area (GTK_ENTRY (view->address_entry),
|
||||
GTK_ENTRY_ICON_SECONDARY,
|
||||
&rect);
|
||||
gtk_widget_translate_coordinates (view->address_entry, GTK_WIDGET (view),
|
||||
rect.x, rect.y, &x, &y);
|
||||
if (!gtk_widget_compute_point (view->address_entry, GTK_WIDGET (view),
|
||||
&GRAPHENE_POINT_INIT (rect.x, rect.y), &p))
|
||||
graphene_point_init (&p, rect.x, rect.y);
|
||||
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.x = p.x;
|
||||
rect.y = p.y;
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (view->server_adresses_popover), &rect);
|
||||
gtk_widget_set_visible (view->server_adresses_popover, TRUE);
|
||||
}
|
||||
|
@ -1358,7 +1358,7 @@ gtk_popover_update_shape (GtkPopover *popover)
|
||||
cairo_surface_t *cairo_surface;
|
||||
cairo_region_t *region;
|
||||
cairo_t *cr;
|
||||
double x, y;
|
||||
graphene_point_t p;
|
||||
double native_x, native_y;
|
||||
|
||||
gtk_native_get_surface_transform (GTK_NATIVE (popover), &native_x, &native_y);
|
||||
@ -1380,10 +1380,11 @@ gtk_popover_update_shape (GtkPopover *popover)
|
||||
cairo_fill (cr);
|
||||
|
||||
box = gtk_css_boxes_get_border_box (&content_css_boxes);
|
||||
gtk_widget_translate_coordinates (priv->contents_widget, GTK_WIDGET (popover),
|
||||
0, 0,
|
||||
&x, &y);
|
||||
cairo_translate (cr, x, y);
|
||||
if (!gtk_widget_compute_point (priv->contents_widget, GTK_WIDGET (popover),
|
||||
&GRAPHENE_POINT_INIT (0, 0), &p))
|
||||
graphene_point_init (&p, 0, 0);
|
||||
|
||||
cairo_translate (cr, p.x, p.y);
|
||||
gsk_rounded_rect_path (box, cr);
|
||||
cairo_fill (cr);
|
||||
cairo_destroy (cr);
|
||||
|
@ -1857,19 +1857,21 @@ update_initial_slider_position (GtkRange *range,
|
||||
double y)
|
||||
{
|
||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||
graphene_point_t p;
|
||||
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (range), priv->trough_widget,
|
||||
x, y, &x, &y);
|
||||
if (!gtk_widget_compute_point (GTK_WIDGET (range), priv->trough_widget,
|
||||
&GRAPHENE_POINT_INIT (x, y), &p))
|
||||
graphene_point_init (&p, x, y);
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
priv->slide_initial_slider_position = MAX (0, priv->slider_x);
|
||||
priv->slide_initial_coordinate_delta = x - priv->slide_initial_slider_position;
|
||||
priv->slide_initial_coordinate_delta = p.x - priv->slide_initial_slider_position;
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->slide_initial_slider_position = MAX (0, priv->slider_y);
|
||||
priv->slide_initial_coordinate_delta = y - priv->slide_initial_slider_position;
|
||||
priv->slide_initial_coordinate_delta = p.y - priv->slide_initial_slider_position;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1949,22 +1951,23 @@ gtk_range_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
(!primary_warps && shift_pressed && button == GDK_BUTTON_PRIMARY) ||
|
||||
(!primary_warps && button == GDK_BUTTON_MIDDLE)))
|
||||
{
|
||||
double slider_range_x, slider_range_y;
|
||||
graphene_point_t p;
|
||||
graphene_rect_t slider_bounds;
|
||||
|
||||
gtk_widget_translate_coordinates (priv->trough_widget, widget,
|
||||
priv->slider_x, priv->slider_y,
|
||||
&slider_range_x, &slider_range_y);
|
||||
if (!gtk_widget_compute_point (priv->trough_widget, widget,
|
||||
&GRAPHENE_POINT_INIT (priv->slider_x, priv->slider_y),
|
||||
&p))
|
||||
graphene_point_init (&p, priv->slider_x, priv->slider_y);
|
||||
|
||||
/* If we aren't fixed, center on the slider. I.e. if this is not a scale... */
|
||||
if (!priv->slider_size_fixed &&
|
||||
gtk_widget_compute_bounds (priv->slider_widget, priv->slider_widget, &slider_bounds))
|
||||
{
|
||||
slider_range_x += (slider_bounds.size.width / 2);
|
||||
slider_range_y += (slider_bounds.size.height / 2);
|
||||
p.x += (slider_bounds.size.width / 2);
|
||||
p.y += (slider_bounds.size.height / 2);
|
||||
}
|
||||
|
||||
update_initial_slider_position (range, slider_range_x, slider_range_y);
|
||||
update_initial_slider_position (range, p.x, p.y);
|
||||
|
||||
range_grab_add (range, priv->slider_widget);
|
||||
|
||||
@ -2030,10 +2033,11 @@ update_slider_position (GtkRange *range,
|
||||
double mark_delta;
|
||||
double zoom;
|
||||
int i;
|
||||
double x, y;
|
||||
graphene_point_t p;
|
||||
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (range), priv->trough_widget,
|
||||
mouse_x, mouse_y, &x, &y);
|
||||
if (!gtk_widget_compute_point(GTK_WIDGET (range), priv->trough_widget,
|
||||
&GRAPHENE_POINT_INIT (mouse_x, mouse_y), &p))
|
||||
graphene_point_init (&p, mouse_x, mouse_y);
|
||||
|
||||
if (priv->zoom &&
|
||||
gtk_widget_compute_bounds (priv->trough_widget, priv->trough_widget, &trough_bounds))
|
||||
@ -2066,15 +2070,15 @@ update_slider_position (GtkRange *range,
|
||||
zoom_divisor = zoom - 1.0;
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
||||
priv->slide_initial_slider_position = (zoom * (y - priv->slide_initial_coordinate_delta) - slider_bounds.origin.y) / zoom_divisor;
|
||||
priv->slide_initial_slider_position = (zoom * (p.y - priv->slide_initial_coordinate_delta) - slider_bounds.origin.y) / zoom_divisor;
|
||||
else
|
||||
priv->slide_initial_slider_position = (zoom * (x - priv->slide_initial_coordinate_delta) - slider_bounds.origin.x) / zoom_divisor;
|
||||
priv->slide_initial_slider_position = (zoom * (p.x - priv->slide_initial_coordinate_delta) - slider_bounds.origin.x) / zoom_divisor;
|
||||
}
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
||||
delta = y - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
|
||||
delta = p.y - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
|
||||
else
|
||||
delta = x - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
|
||||
delta = p.x - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
|
||||
|
||||
c = priv->slide_initial_slider_position + zoom * delta;
|
||||
|
||||
@ -2694,19 +2698,20 @@ gtk_range_calc_marks (GtkRange *range)
|
||||
{
|
||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||
GdkRectangle slider;
|
||||
double x, y;
|
||||
graphene_point_t p;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < priv->n_marks; i++)
|
||||
{
|
||||
gtk_range_compute_slider_position (range, priv->marks[i], &slider);
|
||||
gtk_widget_translate_coordinates (priv->trough_widget, GTK_WIDGET (range),
|
||||
slider.x, slider.y, &x, &y);
|
||||
if (!gtk_widget_compute_point (priv->trough_widget, GTK_WIDGET (range),
|
||||
&GRAPHENE_POINT_INIT (slider.x, slider.y), &p))
|
||||
graphene_point_init (&p, slider.x, slider.y);
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
priv->mark_pos[i] = x + slider.width / 2;
|
||||
priv->mark_pos[i] = p.x + slider.width / 2;
|
||||
else
|
||||
priv->mark_pos[i] = y + slider.height / 2;
|
||||
priv->mark_pos[i] = p.y + slider.height / 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ handle_drag_begin (GtkGestureDrag *gesture,
|
||||
GtkTextHandle *handle)
|
||||
{
|
||||
GtkBorder input_extents;
|
||||
double widget_x, widget_y;
|
||||
graphene_point_t p;
|
||||
|
||||
x -= handle->pointing_to.x;
|
||||
y -= handle->pointing_to.y;
|
||||
@ -434,12 +434,14 @@ handle_drag_begin (GtkGestureDrag *gesture,
|
||||
* are relative to the parent widget.
|
||||
*/
|
||||
handle_get_input_extents (handle, &input_extents);
|
||||
gtk_widget_translate_coordinates (handle->controller_widget,
|
||||
if (!gtk_widget_compute_point (handle->controller_widget,
|
||||
gtk_widget_get_parent (GTK_WIDGET (handle)),
|
||||
x, y, &widget_x, &widget_y);
|
||||
&GRAPHENE_POINT_INIT (x, y),
|
||||
&p))
|
||||
graphene_point_init (&p, x, y);
|
||||
|
||||
if (widget_x < input_extents.left || widget_x >= input_extents.right ||
|
||||
widget_y < input_extents.top || widget_y >= input_extents.bottom)
|
||||
if (p.x < input_extents.left || p.x >= input_extents.right ||
|
||||
p.y < input_extents.top || p.y >= input_extents.bottom)
|
||||
{
|
||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
|
||||
return;
|
||||
|
@ -9088,18 +9088,20 @@ gtk_text_view_do_popup (GtkTextView *text_view,
|
||||
GdkSurface *surface;
|
||||
double px, py;
|
||||
double nx, ny;
|
||||
graphene_point_t p;
|
||||
|
||||
native = gtk_widget_get_native (GTK_WIDGET (text_view));
|
||||
surface = gtk_native_get_surface (native);
|
||||
gdk_surface_get_device_position (surface, device, &px, &py, NULL);
|
||||
gtk_native_get_surface_transform (native, &nx, &ny);
|
||||
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (gtk_widget_get_native (GTK_WIDGET (text_view))),
|
||||
if (!gtk_widget_compute_point (GTK_WIDGET (gtk_widget_get_native (GTK_WIDGET (text_view))),
|
||||
GTK_WIDGET (text_view),
|
||||
px - nx, py - ny,
|
||||
&px, &py);
|
||||
rect.x = px;
|
||||
rect.y = py;
|
||||
&GRAPHENE_POINT_INIT (px - nx, py - ny),
|
||||
&p))
|
||||
graphene_point_init (&p, px - nx, px - nx);
|
||||
rect.x = p.x;
|
||||
rect.y = p.y;
|
||||
}
|
||||
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (priv->popup_menu), &rect);
|
||||
|
@ -367,6 +367,7 @@ gtk_tooltip_trigger_tooltip_query (GtkWidget *widget)
|
||||
GdkDevice *device;
|
||||
GdkSurface *surface;
|
||||
double x, y;
|
||||
graphene_point_t p;
|
||||
GtkWidget *toplevel;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
@ -394,9 +395,10 @@ gtk_tooltip_trigger_tooltip_query (GtkWidget *widget)
|
||||
if (gtk_native_get_surface (GTK_NATIVE (toplevel)) != surface)
|
||||
return;
|
||||
|
||||
gtk_widget_translate_coordinates (toplevel, widget, x, y, &x, &y);
|
||||
if (!gtk_widget_compute_point (toplevel, widget, &GRAPHENE_POINT_INIT (x, y), &p))
|
||||
graphene_point_init (&p, x, y);
|
||||
|
||||
gtk_tooltip_handle_event_internal (GDK_MOTION_NOTIFY, surface, widget, x, y);
|
||||
gtk_tooltip_handle_event_internal (GDK_MOTION_NOTIFY, surface, widget, p.x, p.y);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -434,7 +436,15 @@ _gtk_widget_find_at_coords (GdkSurface *surface,
|
||||
picked_widget = gtk_widget_pick (event_widget, x, y, GTK_PICK_INSENSITIVE);
|
||||
|
||||
if (picked_widget != NULL)
|
||||
gtk_widget_translate_coordinates (event_widget, picked_widget, x, y, &x, &y);
|
||||
{
|
||||
graphene_point_t p;
|
||||
|
||||
if (!gtk_widget_compute_point (event_widget, picked_widget,
|
||||
&GRAPHENE_POINT_INIT (x, y), &p))
|
||||
graphene_point_init (&p, x, y);
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
}
|
||||
|
||||
*widget_x = x;
|
||||
*widget_y = y;
|
||||
@ -552,16 +562,14 @@ gtk_tooltip_run_requery (GtkWidget **widget,
|
||||
|
||||
if (parent)
|
||||
{
|
||||
double xx = *x;
|
||||
double yy = *y;
|
||||
graphene_point_t r = GRAPHENE_POINT_INIT (*x, *y);
|
||||
graphene_point_t p;
|
||||
|
||||
if (gtk_widget_get_native (parent) != gtk_widget_get_native (*widget))
|
||||
if (!gtk_widget_compute_point (*widget, parent, &r, &p))
|
||||
break;
|
||||
|
||||
gtk_widget_translate_coordinates (*widget, parent, xx, yy, &xx, &yy);
|
||||
|
||||
*x = xx;
|
||||
*y = yy;
|
||||
*x = p.x;
|
||||
*y = p.y;
|
||||
}
|
||||
|
||||
*widget = parent;
|
||||
@ -933,8 +941,13 @@ _gtk_tooltip_handle_event (GtkWidget *target,
|
||||
surface = gdk_event_get_surface (event);
|
||||
if (gdk_event_get_position (event, &x, &y))
|
||||
{
|
||||
graphene_point_t p;
|
||||
gtk_native_get_surface_transform (native, &nx, &ny);
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (native), target, x - nx, y - ny, &x, &y);
|
||||
if (!gtk_widget_compute_point (GTK_WIDGET (native), target,
|
||||
&GRAPHENE_POINT_INIT (x - nx, y - ny), &p))
|
||||
graphene_point_init (&p, x - nx, y - ny);
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
}
|
||||
gtk_tooltip_handle_event_internal (event_type, surface, target, x, y);
|
||||
}
|
||||
|
@ -623,7 +623,7 @@ focus_change_handler (GtkWidget *widget)
|
||||
GtkRoot *root;
|
||||
GtkWidget *focus_widget;
|
||||
graphene_rect_t rect;
|
||||
double x, y;
|
||||
graphene_point_t p;
|
||||
|
||||
if ((gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_FOCUS_WITHIN) == 0)
|
||||
return;
|
||||
@ -640,13 +640,13 @@ focus_change_handler (GtkWidget *widget)
|
||||
if (!gtk_widget_compute_bounds (focus_widget, viewport->child, &rect))
|
||||
return;
|
||||
|
||||
gtk_widget_translate_coordinates (viewport->child, widget,
|
||||
rect.origin.x,
|
||||
rect.origin.y,
|
||||
&x, &y);
|
||||
if (!gtk_widget_compute_point (viewport->child, widget,
|
||||
&GRAPHENE_POINT_INIT (rect.origin.x, rect.origin.y),
|
||||
&p))
|
||||
return;
|
||||
|
||||
scroll_to_view (viewport->adjustment[GTK_ORIENTATION_HORIZONTAL], x, rect.size.width);
|
||||
scroll_to_view (viewport->adjustment[GTK_ORIENTATION_VERTICAL], y, rect.size.height);
|
||||
scroll_to_view (viewport->adjustment[GTK_ORIENTATION_HORIZONTAL], p.x, rect.size.width);
|
||||
scroll_to_view (viewport->adjustment[GTK_ORIENTATION_VERTICAL], p.y, rect.size.height);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -4197,6 +4197,8 @@ gtk_widget_common_ancestor (GtkWidget *widget_a,
|
||||
* Returns: %FALSE if @src_widget and @dest_widget have no common
|
||||
* ancestor. In this case, 0 is stored in *@dest_x and *@dest_y.
|
||||
* Otherwise %TRUE.
|
||||
*
|
||||
* Deprecated: 4.12: Use gtk_widget_compute_point() instead
|
||||
*/
|
||||
gboolean
|
||||
gtk_widget_translate_coordinates (GtkWidget *src_widget,
|
||||
@ -8593,7 +8595,6 @@ gtk_widget_accessible_get_bounds (GtkAccessible *self,
|
||||
GtkWidget *widget;
|
||||
GtkWidget *parent;
|
||||
GtkWidget *bounds_relative_to;
|
||||
double translated_x, translated_y;
|
||||
graphene_rect_t bounds = GRAPHENE_RECT_INIT_ZERO;
|
||||
|
||||
widget = GTK_WIDGET (self);
|
||||
@ -8603,9 +8604,11 @@ gtk_widget_accessible_get_bounds (GtkAccessible *self,
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
if (parent != NULL)
|
||||
{
|
||||
gtk_widget_translate_coordinates (widget, parent, 0., 0., &translated_x, &translated_y);
|
||||
*x = floorf (translated_x);
|
||||
*y = floorf (translated_y);
|
||||
graphene_point_t p;
|
||||
if (!gtk_widget_compute_point (widget, parent, &GRAPHENE_POINT_INIT (0, 0), &p))
|
||||
graphene_point_init (&p, 0, 0);
|
||||
*x = floorf (p.x);
|
||||
*y = floorf (p.y);
|
||||
bounds_relative_to = parent;
|
||||
}
|
||||
else
|
||||
|
@ -607,7 +607,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_widget_is_ancestor (GtkWidget *widget,
|
||||
GtkWidget *ancestor);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_12_FOR(gtk_widget_compute_point)
|
||||
gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget,
|
||||
GtkWidget *dest_widget,
|
||||
double src_x,
|
||||
|
@ -199,18 +199,21 @@ do_popup_fallback (GtkWindowHandle *self,
|
||||
GdkSurface *surface;
|
||||
double px, py;
|
||||
double nx, ny;
|
||||
graphene_point_t p;
|
||||
|
||||
native = gtk_widget_get_native (GTK_WIDGET (self));
|
||||
surface = gtk_native_get_surface (native);
|
||||
gdk_surface_get_device_position (surface, device, &px, &py, NULL);
|
||||
gtk_native_get_surface_transform (native, &nx, &ny);
|
||||
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (gtk_widget_get_native (GTK_WIDGET (self))),
|
||||
if (!gtk_widget_compute_point (GTK_WIDGET (gtk_widget_get_native (GTK_WIDGET (self))),
|
||||
GTK_WIDGET (self),
|
||||
px - nx, py - ny,
|
||||
&px, &py);
|
||||
rect.x = px;
|
||||
rect.y = py;
|
||||
&GRAPHENE_POINT_INIT (px - nx, py - ny),
|
||||
&p))
|
||||
graphene_point_init (&p, 0, 0);
|
||||
|
||||
rect.x = p.x;
|
||||
rect.y = p.y;
|
||||
}
|
||||
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (self->fallback_menu), &rect);
|
||||
@ -422,7 +425,7 @@ drag_gesture_update_cb (GtkGestureDrag *gesture,
|
||||
{
|
||||
double start_x, start_y;
|
||||
double native_x, native_y;
|
||||
double window_x, window_y;
|
||||
graphene_point_t p;
|
||||
GtkNative *native;
|
||||
GdkSurface *surface;
|
||||
|
||||
@ -432,21 +435,22 @@ drag_gesture_update_cb (GtkGestureDrag *gesture,
|
||||
|
||||
native = gtk_widget_get_native (GTK_WIDGET (self));
|
||||
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (self),
|
||||
if (!gtk_widget_compute_point (GTK_WIDGET (self),
|
||||
GTK_WIDGET (native),
|
||||
start_x, start_y,
|
||||
&window_x, &window_y);
|
||||
&GRAPHENE_POINT_INIT (start_x, start_y),
|
||||
&p))
|
||||
graphene_point_init (&p, start_x, start_y);
|
||||
|
||||
gtk_native_get_surface_transform (native, &native_x, &native_y);
|
||||
window_x += native_x;
|
||||
window_y += native_y;
|
||||
p.x += native_x;
|
||||
p.y += native_y;
|
||||
|
||||
surface = gtk_native_get_surface (native);
|
||||
if (GDK_IS_TOPLEVEL (surface))
|
||||
gdk_toplevel_begin_move (GDK_TOPLEVEL (surface),
|
||||
gtk_gesture_get_device (GTK_GESTURE (gesture)),
|
||||
gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)),
|
||||
window_x, window_y,
|
||||
p.x, p.y,
|
||||
gtk_event_controller_get_current_event_time (GTK_EVENT_CONTROLLER (gesture)));
|
||||
|
||||
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static const char *css =
|
||||
".overlay-green {"
|
||||
" background-image: none;"
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static const char *css =
|
||||
"test>button {"
|
||||
" all: unset; "
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
start_resize (GtkGestureClick *gesture,
|
||||
int n_press,
|
||||
|
Loading…
Reference in New Issue
Block a user