Skip to content

Commit

Permalink
Fix: pluma closes tabs unexpectedly with [right+middle] click
Browse files Browse the repository at this point in the history
Fixes #256
  • Loading branch information
sc0w authored and monsta committed Nov 12, 2017
1 parent d177ad2 commit ec438f3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pluma/pluma-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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),
Expand All @@ -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);
}
Expand Down

0 comments on commit ec438f3

Please sign in to comment.