forked from AuroraMiddleware/gtk
Merge branch 'fix-dnd' into 'master'
Fix dnd See merge request GNOME/gtk!1273
This commit is contained in:
commit
49c6e99970
@ -938,6 +938,9 @@ gdk_drop_emit_motion_event (GdkDrop *self,
|
|||||||
{
|
{
|
||||||
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
|
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
|
||||||
GdkEvent *event;
|
GdkEvent *event;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
gdk_surface_get_origin (priv->surface, &x, &y);
|
||||||
|
|
||||||
event = gdk_event_new (GDK_DRAG_MOTION);
|
event = gdk_event_new (GDK_DRAG_MOTION);
|
||||||
event->any.surface = g_object_ref (priv->surface);
|
event->any.surface = g_object_ref (priv->surface);
|
||||||
@ -945,6 +948,8 @@ gdk_drop_emit_motion_event (GdkDrop *self,
|
|||||||
event->dnd.time = time;
|
event->dnd.time = time;
|
||||||
event->dnd.x_root = x_root;
|
event->dnd.x_root = x_root;
|
||||||
event->dnd.y_root = y_root;
|
event->dnd.y_root = y_root;
|
||||||
|
event->dnd.x = x_root - x;
|
||||||
|
event->dnd.y = y_root - y;
|
||||||
gdk_event_set_device (event, priv->device);
|
gdk_event_set_device (event, priv->device);
|
||||||
|
|
||||||
gdk_drop_do_emit_event (event, dont_queue);
|
gdk_drop_do_emit_event (event, dont_queue);
|
||||||
@ -976,6 +981,9 @@ gdk_drop_emit_drop_event (GdkDrop *self,
|
|||||||
{
|
{
|
||||||
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
|
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
|
||||||
GdkEvent *event;
|
GdkEvent *event;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
gdk_surface_get_origin (priv->surface, &x, &y);
|
||||||
|
|
||||||
event = gdk_event_new (GDK_DROP_START);
|
event = gdk_event_new (GDK_DROP_START);
|
||||||
event->any.surface = g_object_ref (priv->surface);
|
event->any.surface = g_object_ref (priv->surface);
|
||||||
@ -983,6 +991,8 @@ gdk_drop_emit_drop_event (GdkDrop *self,
|
|||||||
event->dnd.time = time;
|
event->dnd.time = time;
|
||||||
event->dnd.x_root = x_root;
|
event->dnd.x_root = x_root;
|
||||||
event->dnd.y_root = y_root;
|
event->dnd.y_root = y_root;
|
||||||
|
event->dnd.x = x_root - x;
|
||||||
|
event->dnd.y = y_root - y;
|
||||||
gdk_event_set_device (event, priv->device);
|
gdk_event_set_device (event, priv->device);
|
||||||
|
|
||||||
gdk_drop_do_emit_event (event, dont_queue);
|
gdk_drop_do_emit_event (event, dont_queue);
|
||||||
|
@ -947,6 +947,13 @@ gdk_event_get_coords (const GdkEvent *event,
|
|||||||
x = event->touchpad_pinch.x;
|
x = event->touchpad_pinch.x;
|
||||||
y = event->touchpad_pinch.y;
|
y = event->touchpad_pinch.y;
|
||||||
break;
|
break;
|
||||||
|
case GDK_DRAG_ENTER:
|
||||||
|
case GDK_DRAG_LEAVE:
|
||||||
|
case GDK_DRAG_MOTION:
|
||||||
|
case GDK_DROP_START:
|
||||||
|
x = event->dnd.x;
|
||||||
|
y = event->dnd.y;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fetched = FALSE;
|
fetched = FALSE;
|
||||||
break;
|
break;
|
||||||
|
@ -418,7 +418,9 @@ struct _GdkEventDND {
|
|||||||
GdkDrop *drop;
|
GdkDrop *drop;
|
||||||
|
|
||||||
guint32 time;
|
guint32 time;
|
||||||
gshort x_root, y_root;
|
double x_root, y_root;
|
||||||
|
double x;
|
||||||
|
double y;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1296,6 +1296,7 @@ data_device_motion (void *data,
|
|||||||
wl_fixed_t y)
|
wl_fixed_t y)
|
||||||
{
|
{
|
||||||
GdkWaylandSeat *seat = data;
|
GdkWaylandSeat *seat = data;
|
||||||
|
int origin_x, origin_y;
|
||||||
|
|
||||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||||
g_message ("data device motion, data_device = %p, time = %d, x = %f, y = %f",
|
g_message ("data device motion, data_device = %p, time = %d, x = %f, y = %f",
|
||||||
@ -1308,10 +1309,12 @@ data_device_motion (void *data,
|
|||||||
seat->pointer_info.surface_x = wl_fixed_to_double (x);
|
seat->pointer_info.surface_x = wl_fixed_to_double (x);
|
||||||
seat->pointer_info.surface_y = wl_fixed_to_double (y);
|
seat->pointer_info.surface_y = wl_fixed_to_double (y);
|
||||||
|
|
||||||
|
gdk_surface_get_origin (gdk_drop_get_surface (seat->drop), &origin_x, &origin_y);
|
||||||
|
|
||||||
gdk_drop_emit_motion_event (seat->drop,
|
gdk_drop_emit_motion_event (seat->drop,
|
||||||
FALSE,
|
FALSE,
|
||||||
seat->pointer_info.surface_x,
|
origin_x + seat->pointer_info.surface_x,
|
||||||
seat->pointer_info.surface_y,
|
origin_y + seat->pointer_info.surface_y,
|
||||||
time);
|
time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1320,14 +1323,17 @@ data_device_drop (void *data,
|
|||||||
struct wl_data_device *data_device)
|
struct wl_data_device *data_device)
|
||||||
{
|
{
|
||||||
GdkWaylandSeat *seat = data;
|
GdkWaylandSeat *seat = data;
|
||||||
|
int origin_x, origin_y;
|
||||||
|
|
||||||
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
GDK_DISPLAY_NOTE (seat->display, EVENTS,
|
||||||
g_message ("data device drop, data device %p", data_device));
|
g_message ("data device drop, data device %p", data_device));
|
||||||
|
|
||||||
|
gdk_surface_get_origin (gdk_drop_get_surface (seat->drop), &origin_x, &origin_y);
|
||||||
|
|
||||||
gdk_drop_emit_drop_event (seat->drop,
|
gdk_drop_emit_drop_event (seat->drop,
|
||||||
FALSE,
|
FALSE,
|
||||||
seat->pointer_info.surface_x,
|
origin_x + seat->pointer_info.surface_x,
|
||||||
seat->pointer_info.surface_y,
|
origin_y + seat->pointer_info.surface_y,
|
||||||
GDK_CURRENT_TIME);
|
GDK_CURRENT_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user