summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-05-15 15:55:50 +0200
committerZenWalker <[email protected]>2017-05-15 15:59:20 +0200
commit46147a4837d2dcfc6b2922115f45be0b8c0c4642 (patch)
tree193a20dcdfb9f84c878fa0f6c12ba0fb12e9ba37
parent54992c3d01bd58baa33320c96446c13c55329814 (diff)
downloadpluma-46147a4837d2dcfc6b2922115f45be0b8c0c4642.tar.bz2
pluma-46147a4837d2dcfc6b2922115f45be0b8c0c4642.tar.xz
Fix: pluma closes tabs unexpectedly with middle click
Fixes #228
-rw-r--r--pluma/pluma-notebook.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/pluma/pluma-notebook.c b/pluma/pluma-notebook.c
index b8dade78..26e07d9c 100644
--- a/pluma/pluma-notebook.c
+++ b/pluma/pluma-notebook.c
@@ -81,6 +81,7 @@ static void move_current_tab_to_another_notebook (PlumaNotebook *src,
/* Local variables */
static GdkCursor *cursor = NULL;
+static gboolean leftdown = FALSE;
/* Signals */
enum
@@ -389,6 +390,8 @@ static void
drag_start (PlumaNotebook *notebook,
guint32 time)
{
+ if (!leftdown) return;
+
notebook->priv->drag_in_progress = TRUE;
/* get a new cursor, if necessary */
@@ -552,6 +555,8 @@ button_release_cb (PlumaNotebook *notebook,
GdkEventButton *event,
gpointer data)
{
+ if (event->button == 1) leftdown = FALSE;
+
if (notebook->priv->drag_in_progress)
{
gint cur_page_num;
@@ -607,6 +612,8 @@ button_press_cb (PlumaNotebook *notebook,
(event->type == GDK_BUTTON_PRESS) &&
(tab_clicked >= 0))
{
+ leftdown = TRUE;
+
notebook->priv->x_start = event->x_root;
notebook->priv->y_start = event->y_root;
@@ -630,6 +637,11 @@ button_press_cb (PlumaNotebook *notebook,
}
else
{
+ if (leftdown) {
+ leftdown = FALSE;
+ return TRUE;
+ }
+
/* Switch to the page the mouse is over, but don't consume the event */
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook),
tab_clicked);