forked from AuroraMiddleware/gtk
gdk: Ensure GdkDragContext instantly updates drag window position
Otherwise we wait for the next gdk_drag_motion() call, which will happen on the next motion event, making the drag window briefly visible on the 0,0 root coordinates. https://bugzilla.gnome.org/show_bug.cgi?id=778203
This commit is contained in:
parent
0675fce506
commit
9029bc0f6a
@ -2027,6 +2027,8 @@ _gdk_x11_window_drag_begin (GdkWindow *window,
|
||||
|
||||
GDK_X11_DRAG_CONTEXT (context)->start_x = x_root;
|
||||
GDK_X11_DRAG_CONTEXT (context)->start_y = y_root;
|
||||
GDK_X11_DRAG_CONTEXT (context)->last_x = x_root;
|
||||
GDK_X11_DRAG_CONTEXT (context)->last_y = y_root;
|
||||
|
||||
GDK_X11_DRAG_CONTEXT (context)->drag_window = create_drag_window (gdk_window_get_display(window));
|
||||
|
||||
@ -2171,6 +2173,19 @@ gdk_x11_drag_context_find_window (GdkDragContext *context,
|
||||
return dest_window;
|
||||
}
|
||||
|
||||
static void
|
||||
move_drag_window (GdkDragContext *context,
|
||||
guint x_root,
|
||||
guint y_root)
|
||||
{
|
||||
GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context);
|
||||
|
||||
gdk_window_move (context_x11->drag_window,
|
||||
x_root - context_x11->hot_x,
|
||||
y_root - context_x11->hot_y);
|
||||
gdk_window_raise (context_x11->drag_window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_x11_drag_context_drag_motion (GdkDragContext *context,
|
||||
GdkWindow *dest_window,
|
||||
@ -2185,12 +2200,7 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
|
||||
GdkWindowImplX11 *impl;
|
||||
|
||||
if (context_x11->drag_window)
|
||||
{
|
||||
gdk_window_move (context_x11->drag_window,
|
||||
x_root - context_x11->hot_x,
|
||||
y_root - context_x11->hot_y);
|
||||
gdk_window_raise (context_x11->drag_window);
|
||||
}
|
||||
move_drag_window (context, x_root, y_root);
|
||||
|
||||
context_x11->old_actions = context->actions;
|
||||
context->actions = possible_actions;
|
||||
@ -2538,6 +2548,12 @@ gdk_x11_drag_context_set_hotspot (GdkDragContext *context,
|
||||
|
||||
x11_context->hot_x = hot_x;
|
||||
x11_context->hot_y = hot_y;
|
||||
|
||||
if (x11_context->grab_seat)
|
||||
{
|
||||
/* DnD is managed, update current position */
|
||||
move_drag_window (context, x11_context->last_x, x11_context->last_y);
|
||||
}
|
||||
}
|
||||
|
||||
static double
|
||||
@ -2792,6 +2808,7 @@ gdk_x11_drag_context_manage_dnd (GdkDragContext *context,
|
||||
if (drag_context_grab (context))
|
||||
{
|
||||
x11_context->actions = actions;
|
||||
move_drag_window (context, x11_context->start_x, x11_context->start_y);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user