summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2017-10-18 15:55:29 +0200
committermonsta <[email protected]>2017-11-12 23:43:45 +0300
commitec438f3d262ef178a898612211335d3c9fa2f4ee (patch)
treea6251ecb10e2be2ff269acdc26fa9c6023f215ce
parentd177ad26be53ec2c52cc17e7290dd414f620db19 (diff)
downloadpluma-ec438f3d262ef178a898612211335d3c9fa2f4ee.tar.bz2
pluma-ec438f3d262ef178a898612211335d3c9fa2f4ee.tar.xz
Fix: pluma closes tabs unexpectedly with [right+middle] click
Fixes https://github.com/mate-desktop/pluma/issues/256
-rw-r--r--pluma/pluma-view.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c
index 437d7017..9bf60985 100644
--- a/pluma/pluma-view.c
+++ b/pluma/pluma-view.c
@@ -56,7 +56,9 @@
#define PLUMA_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), PLUMA_TYPE_VIEW, PlumaViewPrivate))
+/* Local variables */
static gboolean middledown = FALSE;
+static gboolean rightdown = FALSE;
typedef enum
{
@@ -1993,15 +1995,20 @@ show_line_numbers_menu (GtkWidget *view,
static gboolean
pluma_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
{
- if ((event->button == 3) && (middledown))
+ if (((event->button == 3) && (middledown)) || ((event->button == 2) && (rightdown)))
{
middledown = FALSE;
+ rightdown = FALSE;
return TRUE;
}
else if (event->button == 2)
{
middledown = TRUE;
}
+ else if (event->button == 3)
+ {
+ rightdown = TRUE;
+ }
if ((event->type == GDK_BUTTON_PRESS) &&
(event->window == gtk_text_view_get_window (GTK_TEXT_VIEW (widget),
@@ -2027,9 +2034,9 @@ static gboolean
pluma_view_button_release_event (GtkWidget *widget, GdkEventButton *event)
{
if (event->button == 2)
- {
middledown = FALSE;
- }
+ else if (event->button == 3)
+ rightdown = FALSE;
return GTK_WIDGET_CLASS (pluma_view_parent_class)->button_release_event (widget, event);
}