@@ -84,6 +84,7 @@ static void move_current_tab_to_another_notebook (PlumaNotebook *src,
84
84
static GdkCursor * cursor = NULL ;
85
85
static gboolean leftdown = FALSE;
86
86
static gboolean drag_ready = FALSE;
87
+ static gboolean newfile_ready = TRUE;
87
88
88
89
/* Signals */
89
90
enum
@@ -690,7 +691,11 @@ button_press_cb (PlumaNotebook *notebook,
690
691
if (event -> type == GDK_BUTTON_PRESS )
691
692
{
692
693
tab1click = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook ));
693
- newfile = (tab_clicked == -1 );
694
+
695
+ if (newfile_ready )
696
+ newfile = (tab_clicked == -1 );
697
+ else
698
+ newfile = FALSE;
694
699
}
695
700
else if (event -> type == GDK_2BUTTON_PRESS )
696
701
{
@@ -714,6 +719,24 @@ grab_focus_cb (PlumaNotebook *notebook,
714
719
return FALSE;
715
720
}
716
721
722
+ static gboolean
723
+ focus_in_cb (PlumaNotebook * notebook ,
724
+ GdkEventButton * event ,
725
+ gpointer data )
726
+ {
727
+ newfile_ready = FALSE;
728
+ return FALSE;
729
+ }
730
+
731
+ static gboolean
732
+ focus_out_cb (PlumaNotebook * notebook ,
733
+ GdkEventButton * event ,
734
+ gpointer data )
735
+ {
736
+ newfile_ready = TRUE;
737
+ return FALSE;
738
+ }
739
+
717
740
/**
718
741
* pluma_notebook_new:
719
742
*
@@ -815,6 +838,16 @@ pluma_notebook_init (PlumaNotebook *notebook)
815
838
(GCallback )grab_focus_cb ,
816
839
NULL );
817
840
841
+ g_signal_connect (notebook ,
842
+ "focus-in-event" ,
843
+ (GCallback )focus_in_cb ,
844
+ NULL );
845
+
846
+ g_signal_connect (notebook ,
847
+ "focus-out-event" ,
848
+ (GCallback )focus_out_cb ,
849
+ NULL );
850
+
818
851
gtk_widget_add_events (GTK_WIDGET (notebook ),
819
852
GDK_BUTTON1_MOTION_MASK );
820
853
0 commit comments