@@ -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
@@ -664,7 +665,11 @@ button_press_cb (PlumaNotebook *notebook,
664
665
if (event -> type == GDK_BUTTON_PRESS )
665
666
{
666
667
tab1click = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook ));
667
- newfile = (tab_clicked == -1 );
668
+
669
+ if (newfile_ready )
670
+ newfile = (tab_clicked == -1 );
671
+ else
672
+ newfile = FALSE;
668
673
}
669
674
else if (event -> type == GDK_2BUTTON_PRESS )
670
675
{
@@ -688,6 +693,24 @@ grab_focus_cb (PlumaNotebook *notebook,
688
693
return FALSE;
689
694
}
690
695
696
+ static gboolean
697
+ focus_in_cb (PlumaNotebook * notebook ,
698
+ GdkEventButton * event ,
699
+ gpointer data )
700
+ {
701
+ newfile_ready = FALSE;
702
+ return FALSE;
703
+ }
704
+
705
+ static gboolean
706
+ focus_out_cb (PlumaNotebook * notebook ,
707
+ GdkEventButton * event ,
708
+ gpointer data )
709
+ {
710
+ newfile_ready = TRUE;
711
+ return FALSE;
712
+ }
713
+
691
714
/**
692
715
* pluma_notebook_new:
693
716
*
@@ -789,6 +812,16 @@ pluma_notebook_init (PlumaNotebook *notebook)
789
812
(GCallback )grab_focus_cb ,
790
813
NULL );
791
814
815
+ g_signal_connect (notebook ,
816
+ "focus-in-event" ,
817
+ (GCallback )focus_in_cb ,
818
+ NULL );
819
+
820
+ g_signal_connect (notebook ,
821
+ "focus-out-event" ,
822
+ (GCallback )focus_out_cb ,
823
+ NULL );
824
+
792
825
gtk_widget_add_events (GTK_WIDGET (notebook ),
793
826
GDK_BUTTON1_MOTION_MASK );
794
827
0 commit comments