@@ -83,6 +83,7 @@ static void move_current_tab_to_another_notebook (PlumaNotebook *src,
8383/* Local variables */
8484static GdkCursor * cursor = NULL ;
8585static gboolean leftdown = FALSE;
86+ static gboolean drag_ready = FALSE;
8687
8788/* Signals */
8889enum
@@ -493,7 +494,11 @@ motion_notify_cb (PlumaNotebook *notebook,
493494 event -> x_root ,
494495 event -> y_root ))
495496 {
496- drag_start (notebook , (GdkEvent * ) event );
497+ if (drag_ready )
498+ drag_start (notebook , (GdkEvent * ) event );
499+ else
500+ drag_stop (notebook );
501+
497502 return TRUE;
498503 }
499504
@@ -618,6 +623,7 @@ button_release_cb (PlumaNotebook *notebook,
618623
619624 /* This must be called even if a drag isn't happening */
620625 drag_stop (notebook );
626+ drag_ready = FALSE;
621627
622628 return FALSE;
623629}
@@ -699,6 +705,15 @@ button_press_cb (PlumaNotebook *notebook,
699705 return FALSE;
700706}
701707
708+ static gboolean
709+ grab_focus_cb (PlumaNotebook * notebook ,
710+ GdkEventButton * event ,
711+ gpointer data )
712+ {
713+ drag_ready = TRUE;
714+ return FALSE;
715+ }
716+
702717/**
703718 * pluma_notebook_new:
704719 *
@@ -789,10 +804,17 @@ pluma_notebook_init (PlumaNotebook *notebook)
789804 "button-press-event" ,
790805 (GCallback )button_press_cb ,
791806 NULL );
807+
792808 g_signal_connect (notebook ,
793809 "button-release-event" ,
794810 (GCallback )button_release_cb ,
795811 NULL );
812+
813+ g_signal_connect (notebook ,
814+ "grab-focus" ,
815+ (GCallback )grab_focus_cb ,
816+ NULL );
817+
796818 gtk_widget_add_events (GTK_WIDGET (notebook ),
797819 GDK_BUTTON1_MOTION_MASK );
798820
0 commit comments