From 46147a4837d2dcfc6b2922115f45be0b8c0c4642 Mon Sep 17 00:00:00 2001 From: ZenWalker Date: Mon, 15 May 2017 15:55:50 +0200 Subject: Fix: pluma closes tabs unexpectedly with middle click Fixes #228 --- pluma/pluma-notebook.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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); -- cgit v1.2.1