mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 06:21:14 +00:00
text: Fix dragging of text across focus changes
When dragging selected text from an entry over a stackswitcher to show a different page, the focus changes, causing the selection to be lost; we should not lose the dragged content in this case.
This commit is contained in:
parent
f83f7a2b4d
commit
a04d314910
@ -2845,6 +2845,8 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
|
||||
GdkDragAction actions;
|
||||
GdkDrag *drag;
|
||||
GdkPaintable *paintable;
|
||||
GdkContentProvider *content;
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
text = _gtk_text_get_selected_text (self);
|
||||
gtk_text_get_pixel_ranges (self, &ranges, &n_ranges);
|
||||
@ -2854,12 +2856,18 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
|
||||
else
|
||||
actions = GDK_ACTION_COPY;
|
||||
|
||||
g_value_init (&value, G_TYPE_STRING);
|
||||
g_value_set_string (&value, text);
|
||||
content = gdk_content_provider_new_for_value (&value);
|
||||
g_value_unset (&value);
|
||||
|
||||
drag = gdk_drag_begin (gdk_event_get_surface ((GdkEvent*) event),
|
||||
gdk_event_get_device ((GdkEvent*) event),
|
||||
priv->selection_content,
|
||||
content,
|
||||
actions,
|
||||
priv->drag_start_x,
|
||||
priv->drag_start_y);
|
||||
g_object_unref (content);
|
||||
|
||||
g_signal_connect (drag, "dnd-finished", G_CALLBACK (dnd_finished_cb), self);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user