diff options
-rw-r--r-- | pluma/pluma-notebook.c | 22 | ||||
-rw-r--r-- | pluma/pluma-view.c | 4 | ||||
-rw-r--r-- | pluma/pluma-window.c | 19 |
3 files changed, 37 insertions, 8 deletions
diff --git a/pluma/pluma-notebook.c b/pluma/pluma-notebook.c index d2b35d25..591b6220 100644 --- a/pluma/pluma-notebook.c +++ b/pluma/pluma-notebook.c @@ -591,6 +591,9 @@ button_press_cb (PlumaNotebook *notebook, GdkEventButton *event, gpointer data) { + static gboolean newfile = FALSE; + static gint tab1click = -1; + gint tab_clicked; if (notebook->priv->drag_in_progress) @@ -599,7 +602,7 @@ button_press_cb (PlumaNotebook *notebook, tab_clicked = find_tab_num_at_pos (notebook, event->x_root, event->y_root); - + if ((event->button == 1) && (event->type == GDK_BUTTON_PRESS) && (tab_clicked >= 0)) @@ -633,6 +636,23 @@ button_press_cb (PlumaNotebook *notebook, } } + if (event->button == 1) + { + if (event->type == GDK_BUTTON_PRESS) + { + tab1click = gtk_notebook_get_current_page (notebook); + newfile = (tab_clicked == -1); + } + else if (event->type == GDK_2BUTTON_PRESS) + { + if ((tab1click != gtk_notebook_get_current_page (notebook)) || + (tab_clicked >= 0) || ((tab_clicked == -1) && (!newfile))) + return TRUE; + + newfile = FALSE; + } + } + return FALSE; } diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c index 707656a3..7dd258df 100644 --- a/pluma/pluma-view.c +++ b/pluma/pluma-view.c @@ -2000,6 +2000,10 @@ pluma_view_button_press_event (GtkWidget *widget, GdkEventButton *event) return TRUE; } + if ((event->type == GDK_2BUTTON_PRESS) && (event->button == 1) && + (event->window == gtk_text_view_get_window (GTK_TEXT_VIEW (widget), GTK_TEXT_WINDOW_TEXT))) + return TRUE; + return GTK_WIDGET_CLASS (pluma_view_parent_class)->button_press_event (widget, event); } diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c index 8bff1509..b24434df 100644 --- a/pluma/pluma-window.c +++ b/pluma/pluma-window.c @@ -3419,16 +3419,21 @@ notebook_button_press_event (GtkNotebook *notebook, GdkEventButton *event, PlumaWindow *window) { - if (GDK_BUTTON_PRESS == event->type && 3 == event->button) + if (event->type == GDK_BUTTON_PRESS) { - return show_notebook_popup_menu (notebook, window, event); + if (event->button == 3) + return show_notebook_popup_menu (notebook, window, event); + + else if (event->button == 2) + { + PlumaTab *tab; + tab = pluma_window_get_active_tab (window); + notebook_tab_close_request (PLUMA_NOTEBOOK (notebook), tab, GTK_WINDOW (window)); + } } - else if (GDK_BUTTON_PRESS == event->type && 2 == event->button) + else if ((event->type == GDK_2BUTTON_PRESS) && (event->button == 1)) { - PlumaTab *tab; - tab = pluma_window_get_active_tab (window); - notebook_tab_close_request (PLUMA_NOTEBOOK (notebook), tab, GTK_WINDOW (window)); - return FALSE; + pluma_window_create_tab (window, TRUE); } return FALSE; |