summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2018-05-30 10:22:51 +0200
committerPablo Barciela <[email protected]>2018-05-30 10:30:25 +0200
commite28def84292e2bf1d1fa9699c040a9072bcc4548 (patch)
treea6ea11c9326896ec1b05cce7a261826afc709b6c
parent3214fd31d709a642fc5d7cdcd648fa8ec34f54fa (diff)
downloadpluma-e28def84292e2bf1d1fa9699c040a9072bcc4548.tar.bz2
pluma-e28def84292e2bf1d1fa9699c040a9072bcc4548.tar.xz
1.18: pluma-notebook: Fix: unexpected behavior with dnd selected text
Fixes https://github.com/mate-desktop/pluma/issues/329
-rw-r--r--pluma/pluma-notebook.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/pluma/pluma-notebook.c b/pluma/pluma-notebook.c
index 10d15f48..265e4f56 100644
--- a/pluma/pluma-notebook.c
+++ b/pluma/pluma-notebook.c
@@ -82,6 +82,7 @@ static void move_current_tab_to_another_notebook (PlumaNotebook *src,
/* Local variables */
static GdkCursor *cursor = NULL;
static gboolean leftdown = FALSE;
+static gboolean drag_ready = FALSE;
/* Signals */
enum
@@ -477,7 +478,11 @@ motion_notify_cb (PlumaNotebook *notebook,
event->x_root,
event->y_root))
{
- drag_start (notebook, event->time);
+ if (drag_ready)
+ drag_start (notebook, event->time);
+ else
+ drag_stop (notebook);
+
return TRUE;
}
@@ -587,6 +592,7 @@ button_release_cb (PlumaNotebook *notebook,
/* This must be called even if a drag isn't happening */
drag_stop (notebook);
+ drag_ready = FALSE;
return FALSE;
}
@@ -648,6 +654,15 @@ button_press_cb (PlumaNotebook *notebook,
return FALSE;
}
+static gboolean
+grab_focus_cb (PlumaNotebook *notebook,
+ GdkEventButton *event,
+ gpointer data)
+{
+ drag_ready = TRUE;
+ return FALSE;
+}
+
/**
* pluma_notebook_new:
*
@@ -727,10 +742,17 @@ pluma_notebook_init (PlumaNotebook *notebook)
"button-press-event",
(GCallback)button_press_cb,
NULL);
+
g_signal_connect (notebook,
"button-release-event",
(GCallback)button_release_cb,
NULL);
+
+ g_signal_connect (notebook,
+ "grab-focus",
+ (GCallback)grab_focus_cb,
+ NULL);
+
gtk_widget_add_events (GTK_WIDGET (notebook),
GDK_BUTTON1_MOTION_MASK);