forked from AuroraMiddleware/gtk
entry: Fix drag threshold check
It was passing offsets as current oordinates.
This commit is contained in:
parent
28f5d26719
commit
bbca4c38df
@ -1586,32 +1586,33 @@ icon_released_cb (GtkGestureClick *gesture,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
icon_drag_update_cb (GtkGestureDrag *gesture,
|
icon_drag_update_cb (GtkGestureDrag *gesture,
|
||||||
double x,
|
double offset_x,
|
||||||
double y,
|
double offset_y,
|
||||||
GtkEntry *entry)
|
GtkEntry *entry)
|
||||||
{
|
{
|
||||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||||
double start_x, start_y;
|
|
||||||
GtkEntryIconPosition pos;
|
GtkEntryIconPosition pos;
|
||||||
EntryIconInfo *icon_info;
|
EntryIconInfo *icon_info;
|
||||||
|
|
||||||
gtk_gesture_drag_get_start_point (gesture, &start_x, &start_y);
|
|
||||||
pos = get_icon_position_from_controller (entry, GTK_EVENT_CONTROLLER (gesture));
|
pos = get_icon_position_from_controller (entry, GTK_EVENT_CONTROLLER (gesture));
|
||||||
icon_info = priv->icons[pos];
|
icon_info = priv->icons[pos];
|
||||||
|
|
||||||
if (icon_info->content != NULL &&
|
if (icon_info->content != NULL &&
|
||||||
gtk_drag_check_threshold (icon_info->widget, start_x, start_y, x, y))
|
gtk_drag_check_threshold (icon_info->widget, 0, 0, offset_x, offset_y))
|
||||||
{
|
{
|
||||||
GdkPaintable *paintable;
|
GdkPaintable *paintable;
|
||||||
GdkSurface *surface;
|
GdkSurface *surface;
|
||||||
GdkDevice *device;
|
GdkDevice *device;
|
||||||
GdkDrag *drag;
|
GdkDrag *drag;
|
||||||
|
double start_x, start_y;
|
||||||
|
|
||||||
icon_info->in_drag = TRUE;
|
icon_info->in_drag = TRUE;
|
||||||
|
|
||||||
surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (entry)));
|
surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (entry)));
|
||||||
device = gtk_gesture_get_device (GTK_GESTURE (gesture));
|
device = gtk_gesture_get_device (GTK_GESTURE (gesture));
|
||||||
|
|
||||||
|
gtk_gesture_drag_get_start_point (gesture, &start_x, &start_y);
|
||||||
|
|
||||||
drag = gdk_drag_begin (surface, device, icon_info->content, icon_info->actions, start_x, start_y);
|
drag = gdk_drag_begin (surface, device, icon_info->content, icon_info->actions, start_x, start_y);
|
||||||
paintable = gtk_widget_paintable_new (icon_info->widget);
|
paintable = gtk_widget_paintable_new (icon_info->widget);
|
||||||
gtk_drag_icon_set_from_paintable (drag, paintable, -2, -2);
|
gtk_drag_icon_set_from_paintable (drag, paintable, -2, -2);
|
||||||
|
Loading…
Reference in New Issue
Block a user