summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2018-05-27 03:26:07 +0200
committerVictor Kareh <[email protected]>2018-05-27 23:20:03 -0400
commitf6f9fdc477f1fe5565563db877713e06a94bde74 (patch)
treec469a99afc5c00d9f3f2b3f158c0c8f624e815e6
parent12e55b6c7071277293155f4971507124a666a0a3 (diff)
downloadpluma-f6f9fdc477f1fe5565563db877713e06a94bde74.tar.bz2
pluma-f6f9fdc477f1fe5565563db877713e06a94bde74.tar.xz
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 5936ed82..1b84bdb7 100644
--- a/pluma/pluma-notebook.c
+++ b/pluma/pluma-notebook.c
@@ -83,6 +83,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
@@ -493,7 +494,11 @@ motion_notify_cb (PlumaNotebook *notebook,
event->x_root,
event->y_root))
{
- drag_start (notebook, (GdkEvent *) event);
+ if (drag_ready)
+ drag_start (notebook, (GdkEvent *) event);
+ else
+ drag_stop (notebook);
+
return TRUE;
}
@@ -618,6 +623,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;
}
@@ -699,6 +705,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:
*
@@ -789,10 +804,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);