mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 22:30:22 +00:00
gtk: Stop using gdk_surface_get_device_position
Use the double version directly.
This commit is contained in:
parent
54a969e0ad
commit
2d10a7b9c4
10
gtk/gtkdnd.c
10
gtk/gtkdnd.c
@ -886,6 +886,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
GtkDragSourceInfo *info;
|
||||
GtkWidget *toplevel;
|
||||
GdkDrag *drag;
|
||||
double px, py;
|
||||
int dx, dy;
|
||||
GtkDragContent *content;
|
||||
|
||||
@ -893,14 +894,13 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
device = gdk_device_get_associated_device (device);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
gtk_widget_translate_coordinates (widget, toplevel,
|
||||
x, y, &x, &y);
|
||||
gtk_widget_translate_coordinates (widget, toplevel, x, y, &x, &y);
|
||||
gdk_surface_get_device_position (gtk_widget_get_surface (toplevel),
|
||||
device,
|
||||
&dx, &dy,
|
||||
&px, &py,
|
||||
NULL);
|
||||
dx -= x;
|
||||
dy -= y;
|
||||
dx = round (px) - x;
|
||||
dy = round (py) - y;
|
||||
|
||||
content = g_object_new (GTK_TYPE_DRAG_CONTENT, NULL);
|
||||
content->widget = g_object_ref (widget);
|
||||
|
@ -1823,7 +1823,12 @@ gtk_menu_popup_at_pointer (GtkMenu *menu,
|
||||
device = gdk_device_get_associated_device (device);
|
||||
|
||||
if (device)
|
||||
gdk_surface_get_device_position (rect_surface, device, &rect.x, &rect.y, NULL);
|
||||
{
|
||||
double px, py;
|
||||
gdk_surface_get_device_position_double (rect_surface, device, &px, &py, NULL);
|
||||
rect.x = round (px);
|
||||
rect.y = round (py);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -618,6 +618,7 @@ gtk_tooltip_position (GtkTooltip *tooltip,
|
||||
const int max_x_distance = 32;
|
||||
/* Max 48x48 icon + default padding */
|
||||
const int max_anchor_rect_height = 48 + 8;
|
||||
double px, py;
|
||||
int pointer_x, pointer_y;
|
||||
|
||||
/*
|
||||
@ -633,9 +634,11 @@ gtk_tooltip_position (GtkTooltip *tooltip,
|
||||
* far away from the pointer position.
|
||||
*/
|
||||
effective_toplevel = _gtk_widget_get_surface (toplevel);
|
||||
gdk_surface_get_device_position (effective_toplevel,
|
||||
gdk_surface_get_device_position_double (effective_toplevel,
|
||||
device,
|
||||
&pointer_x, &pointer_y, NULL);
|
||||
&px, &py, NULL);
|
||||
pointer_x = round (px);
|
||||
pointer_y = round (py);
|
||||
|
||||
if (anchor_rect.height > max_anchor_rect_height)
|
||||
{
|
||||
@ -674,6 +677,7 @@ gtk_tooltip_position (GtkTooltip *tooltip,
|
||||
static void
|
||||
gtk_tooltip_show_tooltip (GdkDisplay *display)
|
||||
{
|
||||
double px, py;
|
||||
gint x, y;
|
||||
GdkSurface *surface;
|
||||
GtkWidget *tooltip_widget;
|
||||
@ -693,7 +697,9 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
|
||||
|
||||
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
|
||||
|
||||
gdk_surface_get_device_position (surface, device, &x, &y, NULL);
|
||||
gdk_surface_get_device_position_double (surface, device, &px, &py, NULL);
|
||||
x = round (px);
|
||||
y = round (py);
|
||||
|
||||
gdk_surface_get_root_coords (surface, x, y, &tx, &ty);
|
||||
tooltip_widget = _gtk_widget_find_at_coords (surface, x, y, &x, &y);
|
||||
|
@ -6717,57 +6717,6 @@ remove_info (GtkTreeView *tree_view)
|
||||
g_object_set_data (G_OBJECT (tree_view), I_("gtk-tree-view-drag-info"), NULL);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static gint
|
||||
drag_scan_timeout (gpointer data)
|
||||
{
|
||||
GtkTreeView *tree_view;
|
||||
gint x, y;
|
||||
GdkModifierType state;
|
||||
GtkTreePath *path = NULL;
|
||||
GtkTreeViewColumn *column = NULL;
|
||||
GdkRectangle visible_rect;
|
||||
GdkSeat *seat;
|
||||
|
||||
tree_view = GTK_TREE_VIEW (data);
|
||||
|
||||
seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (tree_view)));
|
||||
gdk_surface_get_device_position (tree_view->priv->bin_window,
|
||||
gdk_seat_get_pointer (seat),
|
||||
&x, &y, &state);
|
||||
|
||||
gtk_tree_view_get_visible_rect (tree_view, &visible_rect);
|
||||
|
||||
/* See if we are near the edge. */
|
||||
if ((x - visible_rect.x) < SCROLL_EDGE_SIZE ||
|
||||
(visible_rect.x + visible_rect.width - x) < SCROLL_EDGE_SIZE ||
|
||||
(y - visible_rect.y) < SCROLL_EDGE_SIZE ||
|
||||
(visible_rect.y + visible_rect.height - y) < SCROLL_EDGE_SIZE)
|
||||
{
|
||||
gtk_tree_view_get_path_at_pos (tree_view,
|
||||
tree_view->priv->bin_window,
|
||||
x, y,
|
||||
&path,
|
||||
&column,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
if (path != NULL)
|
||||
{
|
||||
gtk_tree_view_scroll_to_cell (tree_view,
|
||||
path,
|
||||
column,
|
||||
TRUE,
|
||||
0.5, 0.5);
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
static void
|
||||
add_scroll_timeout (GtkTreeView *tree_view)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user