forked from AuroraMiddleware/gtk
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master See merge request GNOME/gtk!2538
This commit is contained in:
commit
06c866f45e
@ -2910,6 +2910,16 @@ dnd_finished_cb (GdkDrag *drag,
|
|||||||
priv->drag = NULL;
|
priv->drag = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dnd_cancel_cb (GdkDrag *drag,
|
||||||
|
GdkDragCancelReason reason,
|
||||||
|
GtkText *self)
|
||||||
|
{
|
||||||
|
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||||
|
|
||||||
|
priv->drag = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
|
gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
|
||||||
double offset_x,
|
double offset_x,
|
||||||
@ -2973,6 +2983,7 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
|
|||||||
g_object_unref (content);
|
g_object_unref (content);
|
||||||
|
|
||||||
g_signal_connect (drag, "dnd-finished", G_CALLBACK (dnd_finished_cb), self);
|
g_signal_connect (drag, "dnd-finished", G_CALLBACK (dnd_finished_cb), self);
|
||||||
|
g_signal_connect (drag, "cancel", G_CALLBACK (dnd_cancel_cb), self);
|
||||||
|
|
||||||
paintable = gtk_text_util_create_drag_icon (widget, text, -1);
|
paintable = gtk_text_util_create_drag_icon (widget, text, -1);
|
||||||
gtk_drag_icon_set_from_paintable (drag, paintable, ranges[0], 0);
|
gtk_drag_icon_set_from_paintable (drag, paintable, ranges[0], 0);
|
||||||
@ -2986,6 +2997,9 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
|
|||||||
g_free (text);
|
g_free (text);
|
||||||
|
|
||||||
priv->in_drag = FALSE;
|
priv->in_drag = FALSE;
|
||||||
|
|
||||||
|
/* Deny the gesture so we don't get further updates */
|
||||||
|
gtk_gesture_set_state (priv->drag_gesture, GTK_EVENT_SEQUENCE_DENIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -7188,11 +7188,11 @@ selection_data_free (SelectionData *data)
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
drag_gesture_get_text_surface_coords (GtkGestureDrag *gesture,
|
drag_gesture_get_text_surface_coords (GtkGestureDrag *gesture,
|
||||||
GtkTextView *text_view,
|
GtkTextView *text_view,
|
||||||
int *start_x,
|
int *start_x,
|
||||||
int *start_y,
|
int *start_y,
|
||||||
int *x,
|
int *x,
|
||||||
int *y)
|
int *y)
|
||||||
{
|
{
|
||||||
double sx, sy, ox, oy;
|
double sx, sy, ox, oy;
|
||||||
|
|
||||||
@ -7262,6 +7262,10 @@ gtk_text_view_drag_gesture_update (GtkGestureDrag *gesture,
|
|||||||
|
|
||||||
gtk_text_view_start_selection_dnd (text_view, &iter, event,
|
gtk_text_view_start_selection_dnd (text_view, &iter, event,
|
||||||
start_x, start_y);
|
start_x, start_y);
|
||||||
|
|
||||||
|
/* Deny the gesture so we don't get further updates */
|
||||||
|
gtk_gesture_set_state (text_view->priv->drag_gesture,
|
||||||
|
GTK_EVENT_SEQUENCE_DENIED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -7275,6 +7279,8 @@ gtk_text_view_drag_gesture_update (GtkGestureDrag *gesture,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_assert (data != NULL);
|
||||||
|
|
||||||
/* Text selection */
|
/* Text selection */
|
||||||
if (data->granularity == SELECT_CHARACTERS)
|
if (data->granularity == SELECT_CHARACTERS)
|
||||||
{
|
{
|
||||||
@ -7782,6 +7788,14 @@ dnd_finished_cb (GdkDrag *drag,
|
|||||||
self->priv->drag = NULL;
|
self->priv->drag = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dnd_cancel_cb (GdkDrag *drag,
|
||||||
|
GdkDragCancelReason reason,
|
||||||
|
GtkTextView *self)
|
||||||
|
{
|
||||||
|
self->priv->drag = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_text_view_start_selection_dnd (GtkTextView *text_view,
|
gtk_text_view_start_selection_dnd (GtkTextView *text_view,
|
||||||
const GtkTextIter *iter,
|
const GtkTextIter *iter,
|
||||||
@ -7808,9 +7822,11 @@ gtk_text_view_start_selection_dnd (GtkTextView *text_view,
|
|||||||
surface = gdk_event_get_surface (event);
|
surface = gdk_event_get_surface (event);
|
||||||
device = gdk_event_get_device (event);
|
device = gdk_event_get_device (event);
|
||||||
drag = gdk_drag_begin (surface, device, content, actions, x, y);
|
drag = gdk_drag_begin (surface, device, content, actions, x, y);
|
||||||
|
|
||||||
g_object_unref (content);
|
g_object_unref (content);
|
||||||
|
|
||||||
g_signal_connect (drag, "dnd-finished", G_CALLBACK (dnd_finished_cb), text_view);
|
g_signal_connect (drag, "dnd-finished", G_CALLBACK (dnd_finished_cb), text_view);
|
||||||
|
g_signal_connect (drag, "cancel", G_CALLBACK (dnd_cancel_cb), text_view);
|
||||||
|
|
||||||
if (gtk_text_buffer_get_selection_bounds (buffer, &start, &end))
|
if (gtk_text_buffer_get_selection_bounds (buffer, &start, &end))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user