summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-05-18 00:08:44 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-05-18 00:08:44 +0000
commitf958a6ecf75ab50dcd7b8729e4fbf2b9e65ac65d (patch)
tree3298efba930717afbe3cc0618abeb1c7b0fd73ce
parentc0faf0c6b60508be67770f23bbbd79acae0bfb89 (diff)
parent71bad81affe4bbd14ab7b98d617eb10213c4c6bf (diff)
downloadgtk+-f958a6ecf75ab50dcd7b8729e4fbf2b9e65ac65d.tar.gz
Merge branch 'coordinate-api' into 'master'
Coordinate api See merge request GNOME/gtk!1924
-rw-r--r--docs/reference/gtk/gtk4-sections.txt1
-rw-r--r--gdk/broadway/gdkdnd-broadway.c4
-rw-r--r--gdk/broadway/gdkprivate-broadway.h4
-rw-r--r--gdk/gdkdrag.h4
-rw-r--r--gdk/gdksurface.c4
-rw-r--r--gdk/gdksurfaceprivate.h12
-rw-r--r--gdk/wayland/gdkdrag-wayland.c4
-rw-r--r--gdk/wayland/gdkprivate-wayland.h4
-rw-r--r--gdk/win32/gdkdrag-win32.c8
-rw-r--r--gdk/win32/gdkprivate-win32.h4
-rw-r--r--gdk/x11/gdkdrag-x11.c8
-rw-r--r--gdk/x11/gdkprivate-x11.h4
-rw-r--r--gtk/gtkcellarea.c2
-rw-r--r--gtk/gtkcoloreditor.c17
-rw-r--r--gtk/gtkdragicon.c4
-rw-r--r--gtk/gtkdragsource.c6
-rw-r--r--gtk/gtkemojichooser.c2
-rw-r--r--gtk/gtkentry.c2
-rw-r--r--gtk/gtkfilechooserwidget.c15
-rw-r--r--gtk/gtkimcontextwayland.c5
-rw-r--r--gtk/gtkmain.c8
-rw-r--r--gtk/gtknative.c8
-rw-r--r--gtk/gtknative.h9
-rw-r--r--gtk/gtknativeprivate.h4
-rw-r--r--gtk/gtkplacessidebar.c10
-rw-r--r--gtk/gtkplacesview.c5
-rw-r--r--gtk/gtkpopover.c8
-rw-r--r--gtk/gtkrange.c27
-rw-r--r--gtk/gtktexthandle.c9
-rw-r--r--gtk/gtktextview.c10
-rw-r--r--gtk/gtktooltip.c58
-rw-r--r--gtk/gtktooltipwindow.c4
-rw-r--r--gtk/gtkviewport.c6
-rw-r--r--gtk/gtkwidget.c14
-rw-r--r--gtk/gtkwidget.h8
-rw-r--r--gtk/gtkwindow.c4
-rw-r--r--gtk/gtkwindowhandle.c14
-rw-r--r--gtk/inspector/focusoverlay.c2
-rw-r--r--gtk/inspector/inspect-button.c2
-rw-r--r--gtk/inspector/layoutoverlay.c2
-rw-r--r--tests/testellipsise.c2
-rw-r--r--tests/testlist3.c2
-rw-r--r--tests/testoverlay.c2
-rw-r--r--tests/testwidgettransforms.c2
-rw-r--r--tests/testwindowdrag.c16
45 files changed, 183 insertions, 167 deletions
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 1daaa1ad22..641582d021 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -6617,6 +6617,7 @@ gtk_native_get_for_surface
gtk_native_get_surface
gtk_native_get_renderer
gtk_native_check_resize
+gtk_native_get_surface_transform
<SUBSECTION Private>
gtk_native_get_type
diff --git a/gdk/broadway/gdkdnd-broadway.c b/gdk/broadway/gdkdnd-broadway.c
index 04db887b26..7d7ccdc637 100644
--- a/gdk/broadway/gdkdnd-broadway.c
+++ b/gdk/broadway/gdkdnd-broadway.c
@@ -87,8 +87,8 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
- gint dx,
- gint dy)
+ double dx,
+ double dy)
{
GdkDrag *new_context;
diff --git a/gdk/broadway/gdkprivate-broadway.h b/gdk/broadway/gdkprivate-broadway.h
index 5a4499b408..0a3b6d8b9d 100644
--- a/gdk/broadway/gdkprivate-broadway.h
+++ b/gdk/broadway/gdkprivate-broadway.h
@@ -51,8 +51,8 @@ GdkDrag * _gdk_broadway_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
- gint dx,
- gint dy);
+ double dx,
+ double dy);
void _gdk_broadway_surface_translate (GdkSurface *surface,
cairo_region_t *area,
gint dx,
diff --git a/gdk/gdkdrag.h b/gdk/gdkdrag.h
index 2c093c4eb2..a3aea2ad7e 100644
--- a/gdk/gdkdrag.h
+++ b/gdk/gdkdrag.h
@@ -76,8 +76,8 @@ GdkDrag * gdk_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
- gint dx,
- gint dy);
+ double dx,
+ double dy);
GDK_AVAILABLE_IN_ALL
void gdk_drag_drop_done (GdkDrag *drag,
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 86d6277f7e..7f89bedb8d 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -2398,8 +2398,8 @@ gdk_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
- gint dx,
- gint dy)
+ double dx,
+ double dy)
{
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
diff --git a/gdk/gdksurfaceprivate.h b/gdk/gdksurfaceprivate.h
index 5685d781f9..e93fe4f625 100644
--- a/gdk/gdksurfaceprivate.h
+++ b/gdk/gdksurfaceprivate.h
@@ -149,12 +149,12 @@ struct _GdkSurfaceClass
gboolean (* beep) (GdkSurface *surface);
void (* destroy_notify) (GdkSurface *surface);
- GdkDrag * (* drag_begin) (GdkSurface *surface,
- GdkDevice *device,
- GdkContentProvider*content,
- GdkDragAction actions,
- gint dx,
- gint dy);
+ GdkDrag * (* drag_begin) (GdkSurface *surface,
+ GdkDevice *device,
+ GdkContentProvider *content,
+ GdkDragAction actions,
+ double dx,
+ double dy);
gint (* get_scale_factor) (GdkSurface *surface);
void (* get_unscaled_size) (GdkSurface *surface,
diff --git a/gdk/wayland/gdkdrag-wayland.c b/gdk/wayland/gdkdrag-wayland.c
index 320ae27a9a..e09129f02f 100644
--- a/gdk/wayland/gdkdrag-wayland.c
+++ b/gdk/wayland/gdkdrag-wayland.c
@@ -352,8 +352,8 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
- gint dx,
- gint dy)
+ double dx,
+ double dy)
{
GdkWaylandDrag *drag_wayland;
GdkDrag *drag;
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index 47079bcfa6..a824f7bb7d 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -103,8 +103,8 @@ GdkDrag *_gdk_wayland_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
- gint dx,
- gint dy);
+ double dx,
+ double dy);
void _gdk_wayland_surface_offset_next_wl_buffer (GdkSurface *surface,
int x,
int y);
diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c
index c8074444dc..b07f19d24e 100644
--- a/gdk/win32/gdkdrag-win32.c
+++ b/gdk/win32/gdkdrag-win32.c
@@ -1709,8 +1709,8 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
- gint dx,
- gint dy)
+ double dx,
+ double dy)
{
GdkDrag *drag;
GdkWin32Drag *drag_win32;
@@ -1731,8 +1731,8 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n"));
gdk_device_get_position (device, &px, &py);
- x_root = round (px) + dx;
- y_root = round (py) + dy;
+ x_root = round (px + dx);
+ y_root = round (py + dy);
drag_win32->start_x = x_root;
drag_win32->start_y = y_root;
diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h
index ea86a917a3..e9d92d0df6 100644
--- a/gdk/win32/gdkprivate-win32.h
+++ b/gdk/win32/gdkprivate-win32.h
@@ -395,8 +395,8 @@ GdkDrag *_gdk_win32_surface_drag_begin (GdkSurface *window,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
- gint x_root,
- gint y_root);
+ double x_root,
+ double y_root);
/* Stray GdkWin32Screen members */
gboolean _gdk_win32_get_setting (const gchar *name, GValue *value);
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c
index c15673f7ee..cbbe0414ab 100644
--- a/gdk/x11/gdkdrag-x11.c
+++ b/gdk/x11/gdkdrag-x11.c
@@ -1985,8 +1985,8 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
- gint dx,
- gint dy)
+ double dx,
+ double dy)
{
GdkX11Drag *x11_drag;
GdkDrag *drag;
@@ -2013,8 +2013,8 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
_gdk_device_query_state (device, surface, NULL, &px, &py, NULL);
gdk_x11_surface_get_root_coords (surface,
- round (px) + dx,
- round (py) + dy,
+ round (px + dx),
+ round (py + dy),
&x_root,
&y_root);
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index 667b14a142..7b8fbc7711 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -223,8 +223,8 @@ GdkDrag * _gdk_x11_surface_drag_begin (GdkSurface *window,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
- gint dx,
- gint dy);
+ double dx,
+ double dy);
void gdk_x11_surface_get_root_coords (GdkSurface *surface,
gint x,
diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c
index 3f743c84e7..1a6c29f636 100644
--- a/gtk/gtkcellarea.c
+++ b/gtk/gtkcellarea.c
@@ -1043,7 +1043,7 @@ gtk_cell_area_real_event (GtkCellArea *area,
GtkCellRenderer *focus_renderer;
GdkRectangle alloc_area;
double event_x, event_y;
- int x, y;
+ double x, y;
GtkNative *native;
/* We may need some semantics to tell us the offset of the event
diff --git a/gtk/gtkcoloreditor.c b/gtk/gtkcoloreditor.c
index 66c2c49e4a..b9a285d823 100644
--- a/gtk/gtkcoloreditor.c
+++ b/gtk/gtkcoloreditor.c
@@ -274,6 +274,7 @@ get_child_position (GtkOverlay *overlay,
GtkRequisition req;
GtkAllocation alloc;
gint s, e;
+ double x, y;
gtk_widget_get_preferred_size (widget, &req, NULL);
@@ -287,11 +288,11 @@ get_child_position (GtkOverlay *overlay,
gtk_widget_translate_coordinates (editor->sv_plane,
gtk_widget_get_parent (editor->grid),
0, -6,
- &allocation->x, &allocation->y);
+ &x, &y);
if (gtk_widget_get_direction (GTK_WIDGET (overlay)) == GTK_TEXT_DIR_RTL)
- allocation->x = 0;
+ x = 0;
else
- allocation->x = gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width;
+ x = gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width;
}
else if (widget == editor->h_popup)
{
@@ -302,12 +303,12 @@ get_child_position (GtkOverlay *overlay,
gtk_widget_translate_coordinates (editor->h_slider,
gtk_widget_get_parent (editor->grid),
- req.width - 6, editor->popup_position - req.height / 2,
- &allocation->x, &allocation->y);
+ &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,
- &allocation->x, &allocation->y);
+ &x, &y);
}
else if (widget == editor->a_popup)
{
@@ -317,13 +318,13 @@ get_child_position (GtkOverlay *overlay,
gtk_widget_translate_coordinates (editor->a_slider,
gtk_widget_get_parent (editor->grid),
editor->popup_position - req.width / 2, - req.height - 6,
- &allocation->x, &allocation->y);
+ &x, &y);
}
else
return FALSE;
- allocation->x = CLAMP (allocation->x, 0, gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width);
- allocation->y = CLAMP (allocation->y, 0, gtk_widget_get_height (GTK_WIDGET (overlay)) - req.height);
+ 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);
return TRUE;
}
diff --git a/gtk/gtkdragicon.c b/gtk/gtkdragicon.c
index 999ab113ca..5099220d3f 100644
--- a/gtk/gtkdragicon.c
+++ b/gtk/gtkdragicon.c
@@ -120,8 +120,8 @@ gtk_drag_icon_native_get_renderer (GtkNative *native)
static void
gtk_drag_icon_native_get_surface_transform (GtkNative *native,
- int *x,
- int *y)
+ double *x,
+ double *y)
{
GtkCssBoxes css_boxes;
const graphene_rect_t *margin_rect;
diff --git a/gtk/gtkdragsource.c b/gtk/gtkdragsource.c
index 779fbefb81..3d45cec163 100644
--- a/gtk/gtkdragsource.c
+++ b/gtk/gtkdragsource.c
@@ -490,7 +490,7 @@ gtk_drag_source_drag_begin (GtkDragSource *source)
{
GtkWidget *widget;
GdkDevice *device;
- int x, y;
+ double x, y;
GtkNative *native;
GdkSurface *surface;
double px, py;
@@ -509,8 +509,8 @@ gtk_drag_source_drag_begin (GtkDragSource *source)
gtk_widget_translate_coordinates (widget, GTK_WIDGET (native), source->start_x, source->start_y, &x, &y);
gdk_surface_get_device_position (surface, device, &px, &py, NULL);
- dx = round (px) - x;
- dy = round (py) - y;
+ dx = round (px - x);
+ dy = round (py - y);
g_signal_emit (source, signals[PREPARE], 0, source->start_x, source->start_y, &content);
if (!content)
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c
index 6a925ebe63..9f704c87f6 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -253,7 +253,7 @@ scroll_to_child (GtkWidget *child)
GtkEmojiChooser *chooser;
GtkAdjustment *adj;
GtkAllocation alloc;
- int pos;
+ double pos;
double value;
double page_size;
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 08a458cff8..7a30849846 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -2799,7 +2799,7 @@ gtk_entry_get_icon_at_pos (GtkEntry *entry,
for (i = 0; i < MAX_ICONS; i++)
{
EntryIconInfo *icon_info = priv->icons[i];
- int icon_x, icon_y;
+ double icon_x, icon_y;
if (icon_info == NULL)
continue;
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index e9cb8cd06c..ba4961c280 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -1428,6 +1428,7 @@ rename_selected_cb (GtkTreeModel *model,
GtkFileChooserWidget *impl = data;
GdkRectangle rect;
gchar *filename;
+ double x, y;
gtk_tree_model_get (model, iter,
MODEL_COL_FILE, &impl->rename_file_source_file,
@@ -1442,7 +1443,9 @@ rename_selected_cb (GtkTreeModel *model,
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
GTK_WIDGET (impl),
rect.x, rect.y,
- &rect.x, &rect.y);
+ &x, &y);
+ rect.x = x;
+ rect.y = y;
filename = g_file_get_basename (impl->rename_file_source_file);
gtk_editable_set_text (GTK_EDITABLE (impl->rename_file_name_entry), filename);
@@ -2009,9 +2012,10 @@ file_list_show_popover (GtkFileChooserWidget *impl,
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
GTK_WIDGET (impl),
rect.x, rect.y,
- &rect.x, &rect.y);
+ &x, &y);
rect.x = CLAMP (x - 20, 0, bounds.size.width - 40);
+ rect.y = y;
rect.width = 40;
g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
@@ -2113,15 +2117,14 @@ click_cb (GtkGesture *gesture,
GtkFileChooserWidget *impl)
{
PopoverData *pd;
- int xx, yy;
pd = g_new (PopoverData, 1);
pd->impl = impl;
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
GTK_WIDGET (impl),
- x, y, &xx, &yy);
- pd->x = xx;
- pd->y = yy;
+ x, y, &x, &y);
+ pd->x = x;
+ pd->y = y;
g_idle_add (file_list_show_popover_in_idle, pd);
}
diff --git a/gtk/gtkimcontextwayland.c b/gtk/gtkimcontextwayland.c
index 6c3b2b393a..658e6e7f7b 100644
--- a/gtk/gtkimcontextwayland.c
+++ b/gtk/gtkimcontextwayland.c
@@ -354,6 +354,7 @@ notify_cursor_location (GtkIMContextWayland *context)
{
GtkIMContextWaylandGlobal *global;
cairo_rectangle_int_t rect;
+ double x, y;
global = gtk_im_context_wayland_get_global (context);
if (global == NULL)
@@ -363,8 +364,10 @@ notify_cursor_location (GtkIMContextWayland *context)
gtk_widget_translate_coordinates (context->widget,
GTK_WIDGET (gtk_widget_get_root (context->widget)),
rect.x, rect.y,
- &rect.x, &rect.y);
+ &x, &y);
+ rect.x = x;
+ rect.y = y;
zwp_text_input_v3_set_cursor_rectangle (global->text_input,
rect.x, rect.y,
rect.width, rect.height);
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index f58c73890b..ed9a70c7b2 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1284,7 +1284,7 @@ translate_event_coordinates (GdkEvent *event,
GtkNative *native;
graphene_point_t p;
double event_x, event_y;
- int native_x, native_y;
+ double native_x, native_y;
*x = *y = 0;
@@ -1432,8 +1432,8 @@ update_pointer_focus_state (GtkWindow *toplevel,
GtkWidget *old_target = NULL;
GdkEventSequence *sequence;
GdkDevice *device;
- gdouble x, y;
- int nx, ny;
+ double x, y;
+ double nx, ny;
device = gdk_event_get_device (event);
sequence = gdk_event_get_event_sequence (event);
@@ -1525,7 +1525,7 @@ handle_pointing_event (GdkEvent *event)
GdkEventSequence *sequence;
GdkDevice *device;
double x, y;
- int native_x, native_y;
+ double native_x, native_y;
GtkWidget *native;
GdkEventType type;
diff --git a/gtk/gtknative.c b/gtk/gtknative.c
index 23996e59b3..201453587b 100644
--- a/gtk/gtknative.c
+++ b/gtk/gtknative.c
@@ -48,8 +48,8 @@ gtk_native_default_get_renderer (GtkNative *self)
static void
gtk_native_default_get_surface_transform (GtkNative *self,
- int *x,
- int *y)
+ double *x,
+ double *y)
{
*x = 0;
*y = 0;
@@ -111,8 +111,8 @@ gtk_native_get_renderer (GtkNative *self)
*/
void
gtk_native_get_surface_transform (GtkNative *self,
- int *x,
- int *y)
+ double *x,
+ double *y)
{
g_return_if_fail (GTK_IS_NATIVE (self));
g_return_if_fail (x != NULL);
diff --git a/gtk/gtknative.h b/gtk/gtknative.h
index bca65089e3..ba596e0e9d 100644
--- a/gtk/gtknative.h
+++ b/gtk/gtknative.h
@@ -49,8 +49,8 @@ struct _GtkNativeInterface
GskRenderer * (* get_renderer) (GtkNative *self);
void (* get_surface_transform) (GtkNative *self,
- int *x,
- int *y);
+ double *x,
+ double *y);
void (* check_resize) (GtkNative *self);
};
@@ -67,6 +67,11 @@ GdkSurface *gtk_native_get_surface (GtkNative *self);
GDK_AVAILABLE_IN_ALL
GskRenderer *gtk_native_get_renderer (GtkNative *self);
+GDK_AVAILABLE_IN_ALL
+void gtk_native_get_surface_transform (GtkNative *self,
+ double *x,
+ double *y);
+
G_END_DECLS
#endif /* __GTK_NATIVE_H__ */
diff --git a/gtk/gtknativeprivate.h b/gtk/gtknativeprivate.h
index c6b62bd67b..ec33c017b1 100644
--- a/gtk/gtknativeprivate.h
+++ b/gtk/gtknativeprivate.h
@@ -5,10 +5,6 @@
G_BEGIN_DECLS
-void gtk_native_get_surface_transform (GtkNative *self,
- int *x,
- int *y);
-
G_END_DECLS
#endif /* __GTK_NATIVE_PRIVATE_H__ */
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 0b43e070f3..07c2b5c31d 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -1686,8 +1686,6 @@ drag_motion_callback (GtkDropTarget *target,
if (row != NULL)
{
- gint dest_y, dest_x;
-
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
@@ -1703,9 +1701,9 @@ drag_motion_callback (GtkDropTarget *target,
row_placeholder_index = row_index;
gtk_widget_translate_coordinates (GTK_WIDGET (sidebar), GTK_WIDGET (row),
x, y,
- &dest_x, &dest_y);
+ &x, &y);
- if (dest_y > sidebar->drag_row_height / 2 && row_index > 0)
+ if (y > sidebar->drag_row_height / 2 && row_index > 0)
row_placeholder_index++;
}
else
@@ -3459,8 +3457,8 @@ on_row_dragged (GtkGestureDrag *gesture,
if (gtk_drag_check_threshold (GTK_WIDGET (row), 0, 0, x, y))
{
- gdouble start_x, start_y;
- gint drag_x, drag_y;
+ double start_x, start_y;
+ double drag_x, drag_y;
GdkContentProvider *content;
GdkSurface *surface;
GdkDevice *device;
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index 0b299bb2c1..eb2b9baf7d 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -1898,14 +1898,17 @@ on_address_entry_show_help_pressed (GtkPlacesView *view,
GtkEntry *entry)
{
GdkRectangle rect;
+ double x, y;
/* 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, &rect.x, &rect.y);
+ rect.x, rect.y, &x, &y);
+ rect.x = x;
+ rect.y = y;
gtk_popover_set_pointing_to (GTK_POPOVER (view->server_adresses_popover), &rect);
gtk_widget_set_visible (view->server_adresses_popover, TRUE);
}
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index c42587981f..7f46641a42 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -218,8 +218,8 @@ gtk_popover_native_get_renderer (GtkNative *native)
static void
gtk_popover_native_get_surface_transform (GtkNative *native,
- int *x,
- int *y)
+ double *x,
+ double *y)
{
GtkCssBoxes css_boxes;
const graphene_rect_t *margin_rect;
@@ -1212,8 +1212,8 @@ gtk_popover_update_shape (GtkPopover *popover)
cairo_surface_t *cairo_surface;
cairo_region_t *region;
cairo_t *cr;
- int x, y;
- int native_x, native_y;
+ double x, y;
+ double native_x, native_y;
gtk_native_get_surface_transform (GTK_NATIVE (popover), &native_x, &native_y);
gtk_css_boxes_init (&content_css_boxes, priv->contents_widget);
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 38efd2aec4..6e96362914 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -1806,20 +1806,19 @@ update_initial_slider_position (GtkRange *range,
double y)
{
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
- int trough_x, trough_y;
gtk_widget_translate_coordinates (GTK_WIDGET (range), priv->trough_widget,
- x, y, &trough_x, &trough_y);
+ x, y, &x, &y);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
priv->slide_initial_slider_position = MAX (0, priv->slider_x);
- priv->slide_initial_coordinate_delta = trough_x - priv->slide_initial_slider_position;
+ priv->slide_initial_coordinate_delta = x - priv->slide_initial_slider_position;
}
else
{
priv->slide_initial_slider_position = MAX (0, priv->slider_y);
- priv->slide_initial_coordinate_delta = trough_y - priv->slide_initial_slider_position;
+ priv->slide_initial_coordinate_delta = y - priv->slide_initial_slider_position;
}
}
@@ -1899,7 +1898,7 @@ gtk_range_click_gesture_pressed (GtkGestureClick *gesture,
(!primary_warps && shift_pressed && button == GDK_BUTTON_PRIMARY) ||
(!primary_warps && button == GDK_BUTTON_MIDDLE)))
{
- int slider_range_x, slider_range_y;
+ double slider_range_x, slider_range_y;
graphene_rect_t slider_bounds;
gtk_widget_translate_coordinates (priv->trough_widget, widget,
@@ -1993,9 +1992,10 @@ update_slider_position (GtkRange *range,
gdouble mark_delta;
gdouble zoom;
gint i;
+ double x, y;
gtk_widget_translate_coordinates (GTK_WIDGET (range), priv->trough_widget,
- mouse_x, mouse_y, &mouse_x, &mouse_y);
+ mouse_x, mouse_y, &x, &y);
if (priv->zoom &&
gtk_widget_compute_bounds (priv->trough_widget, priv->trough_widget, &trough_bounds))
@@ -2028,15 +2028,15 @@ update_slider_position (GtkRange *range,
zoom_divisor = zoom - 1.0;
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
- priv->slide_initial_slider_position = (zoom * (mouse_y - priv->slide_initial_coordinate_delta) - slider_bounds.origin.y) / zoom_divisor;
+ priv->slide_initial_slider_position = (zoom * (y - priv->slide_initial_coordinate_delta) - slider_bounds.origin.y) / zoom_divisor;
else
- priv->slide_initial_slider_position = (zoom * (mouse_x - priv->slide_initial_coordinate_delta) - slider_bounds.origin.x) / zoom_divisor;
+ priv->slide_initial_slider_position = (zoom * (x - priv->slide_initial_coordinate_delta) - slider_bounds.origin.x) / zoom_divisor;
}
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
- delta = mouse_y - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
+ delta = y - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
else
- delta = mouse_x - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
+ delta = x - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
c = priv->slide_initial_slider_position + zoom * delta;
@@ -2635,18 +2635,19 @@ gtk_range_calc_marks (GtkRange *range)
{
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
GdkRectangle slider;
+ double x, y;
gint 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, &slider.x, &slider.y);
+ slider.x, slider.y, &x, &y);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- priv->mark_pos[i] = slider.x + slider.width / 2;
+ priv->mark_pos[i] = x + slider.width / 2;
else
- priv->mark_pos[i] = slider.y + slider.height / 2;
+ priv->mark_pos[i] = y + slider.height / 2;
}
}
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index 7da012c9e7..ce6c4d8d37 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -80,8 +80,8 @@ gtk_text_handle_native_get_renderer (GtkNative *native)
static void
gtk_text_handle_native_get_surface_transform (GtkNative *native,
- int *x,
- int *y)
+ double *x,
+ double *y)
{
GtkCssBoxes css_boxes;
const graphene_rect_t *margin_rect;
@@ -115,6 +115,7 @@ gtk_text_handle_present_surface (GtkTextHandle *handle)
GdkPopupLayout *layout;
GdkRectangle rect;
GtkRequisition req;
+ double x, y;
gtk_widget_get_preferred_size (widget, NULL, &req);
gtk_text_handle_get_padding (handle, &handle->border);
@@ -126,7 +127,9 @@ gtk_text_handle_present_surface (GtkTextHandle *handle)
gtk_widget_translate_coordinates (gtk_widget_get_parent (widget),
gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW),
- rect.x, rect.y, &rect.x, &rect.y);
+ rect.x, rect.y, &x, &y);
+ rect.x = x;
+ rect.y = y;
if (handle->role == GTK_TEXT_HANDLE_ROLE_CURSOR)
rect.x -= rect.width / 2;
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 5486e13339..2d9c72f6e3 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -8618,19 +8618,19 @@ gtk_text_view_do_popup (GtkTextView *text_view,
GtkNative *native;
GdkSurface *surface;
double px, py;
- int nx, ny;
+ double nx, ny;
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);
- rect.x = round (px) - nx;
- rect.y = round (py) - ny;
gtk_widget_translate_coordinates (GTK_WIDGET (gtk_widget_get_native (GTK_WIDGET (text_view))),
GTK_WIDGET (text_view),
- rect.x, rect.y,
- &rect.x, &rect.y);
+ px - nx, py - ny,
+ &px, &py);
+ rect.x = px;
+ rect.y = py;
}
gtk_popover_set_pointing_to (GTK_POPOVER (priv->popup_menu), &rect);
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index 2e65ee1ca5..36b162885b 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -376,7 +376,6 @@ gtk_tooltip_trigger_tooltip_query (GtkWidget *widget)
GdkSurface *surface;
double x, y;
GtkWidget *toplevel;
- int dx, dy;
g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -403,9 +402,9 @@ gtk_tooltip_trigger_tooltip_query (GtkWidget *widget)
if (gtk_native_get_surface (GTK_NATIVE (toplevel)) != surface)
return;
- gtk_widget_translate_coordinates (toplevel, widget, round (x), round (y), &dx, &dy);
+ gtk_widget_translate_coordinates (toplevel, widget, x, y, &x, &y);
- gtk_tooltip_handle_event_internal (GDK_MOTION_NOTIFY, surface, widget, dx, dy);
+ gtk_tooltip_handle_event_internal (GDK_MOTION_NOTIFY, surface, widget, x, y);
}
static void
@@ -426,7 +425,8 @@ _gtk_widget_find_at_coords (GdkSurface *surface,
{
GtkWidget *event_widget;
GtkWidget *picked_widget;
- int native_x, native_y;
+ double x, y;
+ double native_x, native_y;
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
@@ -436,13 +436,16 @@ _gtk_widget_find_at_coords (GdkSurface *surface,
return NULL;
gtk_native_get_surface_transform (GTK_NATIVE (event_widget), &native_x, &native_y);
- surface_x -= native_x;
- surface_y -= native_y;
+ x = surface_x - native_x;
+ y = surface_y - native_y;
- picked_widget = gtk_widget_pick (event_widget, surface_x, surface_y, GTK_PICK_INSENSITIVE);
+ picked_widget = gtk_widget_pick (event_widget, x, y, GTK_PICK_INSENSITIVE);
if (picked_widget != NULL)
- gtk_widget_translate_coordinates (event_widget, picked_widget, surface_x, surface_y, widget_x, widget_y);
+ gtk_widget_translate_coordinates (event_widget, picked_widget, x, y, &x, &y);
+
+ *widget_x = x;
+ *widget_y = y;
return picked_widget;
}
@@ -553,15 +556,23 @@ gtk_tooltip_run_requery (GtkWidget **widget,
if (!return_value)
{
- GtkWidget *parent = gtk_widget_get_parent (*widget);
+ GtkWidget *parent = gtk_widget_get_parent (*widget);
+
+ if (parent)
+ {
+ double xx = *x;
+ double yy = *y;
+
+ gtk_widget_translate_coordinates (*widget, parent, xx, yy, &xx, &yy);
- if (parent)
- gtk_widget_translate_coordinates (*widget, parent, *x, *y, x, y);
+ *x = xx;
+ *y = yy;
+ }
- *widget = parent;
- }
+ *widget = parent;
+ }
else
- break;
+ break;
}
while (*widget);
@@ -588,7 +599,7 @@ gtk_tooltip_position (GtkTooltip *tooltip,
int rect_anchor_dx = 0;
int cursor_size;
int anchor_rect_padding;
- int native_x, native_y;
+ double native_x, native_y;
gtk_widget_realize (GTK_WIDGET (tooltip->window));
@@ -907,8 +918,7 @@ _gtk_tooltip_handle_event (GtkWidget *target,
GdkEventType event_type;
GdkSurface *surface;
double x, y;
- int native_x, native_y;
- int tx, ty;
+ double nx, ny;
GtkWidget *native;
if (!tooltips_enabled (event))
@@ -919,13 +929,9 @@ _gtk_tooltip_handle_event (GtkWidget *target,
gdk_event_get_position (event, &x, &y);
native = GTK_WIDGET (gtk_widget_get_native (target));
- gtk_native_get_surface_transform (GTK_NATIVE (native), &native_x, &native_y);
- gtk_widget_translate_coordinates (native, target,
- x - native_x,
- y - native_y,
- &tx, &ty);
-
- gtk_tooltip_handle_event_internal (event_type, surface, target, tx, ty);
+ gtk_native_get_surface_transform (GTK_NATIVE (native), &nx, &ny);
+ gtk_widget_translate_coordinates (native, target, x - nx, y - ny, &x, &y);
+ gtk_tooltip_handle_event_internal (event_type, surface, target, x, y);
}
/* dx/dy must be in @target_widget's coordinates */
@@ -933,8 +939,8 @@ static void
gtk_tooltip_handle_event_internal (GdkEventType event_type,
GdkSurface *surface,
GtkWidget *target_widget,
- gdouble dx,
- gdouble dy)
+ double dx,
+ double dy)
{
int x = dx, y = dy;
GdkDisplay *display;
diff --git a/gtk/gtktooltipwindow.c b/gtk/gtktooltipwindow.c
index 2e871c534c..432f2aef8e 100644
--- a/gtk/gtktooltipwindow.c
+++ b/gtk/gtktooltipwindow.c
@@ -94,8 +94,8 @@ gtk_tooltip_window_native_get_renderer (GtkNative *native)
static void
gtk_tooltip_window_native_get_surface_transform (GtkNative *native,
- int *x,
- int *y)
+ double *x,
+ double *y)
{
GtkCssBoxes css_boxes;
const graphene_rect_t *margin_rect;
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 72c949ee73..7e4aefc573 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -648,7 +648,7 @@ focus_change_handler (GtkWidget *widget)
GtkRoot *root;
GtkWidget *focus_widget;
graphene_rect_t rect;
- int x, y;
+ double x, y;
if ((gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_FOCUS_WITHIN) == 0)
return;
@@ -666,8 +666,8 @@ focus_change_handler (GtkWidget *widget)
return;
gtk_widget_translate_coordinates (viewport->child, widget,
- (int)rect.origin.x,
- (int)rect.origin.y,
+ rect.origin.x,
+ rect.origin.y,
&x, &y);
scroll_to_view (viewport->hadjustment, x, rect.size.width);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 823964b2cc..54c45644bc 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3447,7 +3447,7 @@ gtk_widget_get_surface_allocation (GtkWidget *widget,
{
GtkWidget *parent;
graphene_rect_t bounds;
- int nx, ny;
+ double nx, ny;
/* Don't consider the parent == widget case here. */
parent = _gtk_widget_get_parent (widget);
@@ -4104,10 +4104,10 @@ gtk_widget_common_ancestor (GtkWidget *widget_a,
gboolean
gtk_widget_translate_coordinates (GtkWidget *src_widget,
GtkWidget *dest_widget,
- gint src_x,
- gint src_y,
- gint *dest_x,
- gint *dest_y)
+ double src_x,
+ double src_y,
+ double *dest_x,
+ double *dest_y)
{
graphene_point_t p;
@@ -4552,7 +4552,7 @@ translate_event_coordinates (GdkEvent *event,
graphene_point_t p;
double event_x, event_y;
GtkNative *native;
- int nx, ny;
+ double nx, ny;
*x = *y = 0;
@@ -11657,7 +11657,7 @@ gtk_widget_render (GtkWidget *widget,
GtkSnapshot *snapshot;
GskRenderer *renderer;
GskRenderNode *root;
- int x, y;
+ double x, y;
gint64 before_snapshot = g_get_monotonic_time ();
gint64 before_render = 0;
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 88ecc47fc8..278c1228c7 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -653,10 +653,10 @@ gboolean gtk_widget_is_ancestor (GtkWidget *widget,
GDK_AVAILABLE_IN_ALL
gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget,
GtkWidget *dest_widget,
- gint src_x,
- gint src_y,
- gint *dest_x,
- gint *dest_y);
+ double src_x,
+ double src_y,
+ double *dest_x,
+ double *dest_y);
GDK_AVAILABLE_IN_ALL
gboolean gtk_widget_contains (GtkWidget *widget,
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index a158f23425..99cbb64ea2 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1931,8 +1931,8 @@ gtk_window_root_set_focus (GtkRoot *root,
static void
gtk_window_native_get_surface_transform (GtkNative *native,
- int *x,
- int *y)
+ double *x,
+ double *y)
{
const graphene_rect_t *margin_rect;
GtkCssBoxes boxes;
diff --git a/gtk/gtkwindowhandle.c b/gtk/gtkwindowhandle.c
index 7fb0e85ea7..efe26714d6 100644
--- a/gtk/gtkwindowhandle.c
+++ b/gtk/gtkwindowhandle.c
@@ -224,19 +224,19 @@ do_popup_fallback (GtkWindowHandle *self,
GtkNative *native;
GdkSurface *surface;
double px, py;
- int nx, ny;
+ double nx, ny;
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);
- rect.x = round (px) - nx;
- rect.y = round (py) - ny;
gtk_widget_translate_coordinates (GTK_WIDGET (gtk_widget_get_native (GTK_WIDGET (self))),
GTK_WIDGET (self),
- rect.x, rect.y,
- &rect.x, &rect.y);
+ px - nx, py - ny,
+ &px, &py);
+ rect.x = px;
+ rect.y = py;
}
gtk_popover_set_pointing_to (GTK_POPOVER (self->fallback_menu), &rect);
@@ -444,8 +444,8 @@ drag_gesture_update_cb (GtkGestureDrag *gesture,
{
GdkEventSequence *sequence;
double start_x, start_y;
- int native_x, native_y;
- int window_x, window_y;
+ double native_x, native_y;
+ double window_x, window_y;
GtkNative *native;
GdkSurface *surface;
diff --git a/gtk/inspector/focusoverlay.c b/gtk/inspector/focusoverlay.c
index 3df045936f..d96181c19f 100644
--- a/gtk/inspector/focusoverlay.c
+++ b/gtk/inspector/focusoverlay.c
@@ -49,7 +49,7 @@ gtk_focus_overlay_snapshot (GtkInspectorOverlay *overlay,
GtkFocusOverlay *self = GTK_FOCUS_OVERLAY (overlay);
GtkWidget *focus;
graphene_rect_t bounds;
- int nx, ny;
+ double nx, ny;
if (!GTK_IS_NATIVE (widget))
return;
diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c
index e03584ea8f..ca6e3e0299 100644
--- a/gtk/inspector/inspect-button.c
+++ b/gtk/inspector/inspect-button.c
@@ -51,7 +51,7 @@ find_widget_at_pointer (GdkDevice *device)
if (widget)
{
double x, y;
- int nx, ny;
+ double nx, ny;
gdk_surface_get_device_position (gtk_native_get_surface (GTK_NATIVE (widget)),
device, &x, &y, NULL);
diff --git a/gtk/inspector/layoutoverlay.c b/gtk/inspector/layoutoverlay.c
index 67cef77ef7..59900c603c 100644
--- a/gtk/inspector/layoutoverlay.c
+++ b/gtk/inspector/layoutoverlay.c
@@ -157,7 +157,7 @@ gtk_layout_overlay_snapshot (GtkInspectorOverlay *overlay,
GskRenderNode *node,
GtkWidget *widget)
{
- int nx, ny;
+ double nx, ny;
gtk_native_get_surface_transform (GTK_NATIVE (widget), &nx, &ny);
gtk_snapshot_save (snapshot);
diff --git a/tests/testellipsise.c b/tests/testellipsise.c
index 70f5be1385..07090289db 100644
--- a/tests/testellipsise.c
+++ b/tests/testellipsise.c
@@ -48,7 +48,7 @@ overlay_draw (GtkDrawingArea *da,
GtkAllocation label_allocation;
GtkRequisition minimum_size, natural_size;
GtkWidget *label = data;
- gint x, y;
+ double x, y;
cairo_translate (cr, -0.5, -0.5);
cairo_set_line_width (cr, 1);
diff --git a/tests/testlist3.c b/tests/testlist3.c
index e3940a2c46..80ab08a58d 100644
--- a/tests/testlist3.c
+++ b/tests/testlist3.c
@@ -17,7 +17,7 @@ drag_begin (GtkDragSource *source,
GtkWidget *row;
GtkAllocation alloc;
GdkPaintable *paintable;
- int x, y;
+ double x, y;
row = gtk_widget_get_ancestor (widget, GTK_TYPE_LIST_BOX_ROW);
gtk_widget_get_allocation (row, &alloc);
diff --git a/tests/testoverlay.c b/tests/testoverlay.c
index 7c115a1a31..4929a75166 100644
--- a/tests/testoverlay.c
+++ b/tests/testoverlay.c
@@ -96,7 +96,7 @@ get_child_position (GtkOverlay *overlay,
GtkRequisition req;
GtkWidget *child;
GtkAllocation main_alloc;
- gint x, y;
+ double x, y;
child = gtk_overlay_get_child (GTK_OVERLAY (overlay));
diff --git a/tests/testwidgettransforms.c b/tests/testwidgettransforms.c
index aead504f9b..5071131446 100644
--- a/tests/testwidgettransforms.c
+++ b/tests/testwidgettransforms.c
@@ -162,7 +162,7 @@ gtk_transform_tester_snapshot (GtkWidget *widget,
for (x = 0; x < G_N_ELEMENTS (points); x ++)
{
- int px, py;
+ double px, py;
gtk_widget_translate_coordinates (self->test_widget, widget,
points[x].coords.x, points[x].coords.y,
diff --git a/tests/testwindowdrag.c b/tests/testwindowdrag.c
index d53a0c17c5..1c25a906fa 100644
--- a/tests/testwindowdrag.c
+++ b/tests/testwindowdrag.c
@@ -13,22 +13,20 @@ start_resize (GtkGestureClick *gesture,
GdkEvent *event;
guint button;
guint32 timestamp;
- int xx = x;
- int yy = y;
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
surface = gtk_native_get_surface (gtk_widget_get_native (widget));
event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (gesture));
if (gdk_event_get_event_type (event) == GDK_BUTTON_PRESS)
- button = gdk_button_event_get_button (event);
+ button = gdk_button_event_get_button (event);
else
button = 0;
timestamp = gdk_event_get_time (event);
gtk_widget_translate_coordinates (widget, GTK_WIDGET (gtk_widget_get_root (widget)),
- xx, yy, &xx, &yy);
- gdk_toplevel_begin_resize (GDK_TOPLEVEL (surface), edge, gdk_event_get_device (event), button, xx, yy, timestamp);
+ x, y, &x, &y);
+ gdk_toplevel_begin_resize (GDK_TOPLEVEL (surface), edge, gdk_event_get_device (event), button, x, y, timestamp);
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
}
@@ -61,22 +59,20 @@ start_move (GtkGestureClick *gesture,
GdkEvent *event;
guint button;
guint32 timestamp;
- int xx = x;
- int yy = y;
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
surface = gtk_native_get_surface (gtk_widget_get_native (widget));
event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (gesture));
if (gdk_event_get_event_type (event) == GDK_BUTTON_PRESS)
- button = gdk_button_event_get_button (event);
+ button = gdk_button_event_get_button (event);
else
button = 0;
timestamp = gdk_event_get_time (event);
gtk_widget_translate_coordinates (widget, GTK_WIDGET (gtk_widget_get_root (widget)),
- xx, yy, &xx, &yy);
- gdk_toplevel_begin_move (GDK_TOPLEVEL (surface), gdk_event_get_device (event), button, xx, yy, timestamp);
+ x, y, &x, &y);
+ gdk_toplevel_begin_move (GDK_TOPLEVEL (surface), gdk_event_get_device (event), button, x, y, timestamp);
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
}