@@ -606,13 +606,11 @@ static gboolean icvOnKeyPress( GtkWidget* widget, GdkEventKey* event, gpointer u
606606static void icvOnTrackbar ( GtkWidget* widget, gpointer user_data );
607607static gboolean icvOnMouse ( GtkWidget *widget, GdkEvent *event, gpointer user_data );
608608
609- #ifdef HAVE_GTHREAD
610609int thread_started=0 ;
611610static gpointer icvWindowThreadLoop (gpointer data);
612611GMutex* last_key_mutex = NULL ;
613612GCond* cond_have_key = NULL ;
614613GThread* window_thread = NULL ;
615- #endif
616614
617615static int last_key = -1 ;
618616
@@ -658,7 +656,6 @@ CV_IMPL int cvInitSystem( int argc, char** argv )
658656}
659657
660658CV_IMPL int cvStartWindowThread (){
661- #ifdef HAVE_GTHREAD
662659 cvInitSystem (0 ,NULL );
663660 if (!thread_started)
664661 {
@@ -674,12 +671,8 @@ CV_IMPL int cvStartWindowThread(){
674671 }
675672 thread_started = window_thread!=NULL ;
676673 return thread_started;
677- #else
678- return 0 ;
679- #endif
680674}
681675
682- #ifdef HAVE_GTHREAD
683676gpointer icvWindowThreadLoop (gpointer /* data*/ )
684677{
685678 while (1 ){
@@ -696,8 +689,6 @@ gpointer icvWindowThreadLoop(gpointer /*data*/)
696689 return NULL ;
697690}
698691
699- #endif
700-
701692#define CV_LOCK_MUTEX () cv::AutoLock lock (getWindowMutex())
702693
703694static
@@ -1196,15 +1187,13 @@ static void checkLastWindow()
11961187 // if last window...
11971188 if (getGTKWindows ().empty ())
11981189 {
1199- #ifdef HAVE_GTHREAD
12001190 if ( thread_started )
12011191 {
12021192 // send key press signal to jump out of any waiting cvWaitKey's
12031193 g_cond_broadcast ( cond_have_key );
12041194 }
12051195 else
12061196 {
1207- #endif
12081197 // Some GTK+ modules (like the Unity module) use GDBusConnection,
12091198 // which has a habit of postponing cleanup by performing it via
12101199 // idle sources added to the main loop. Since this was the last window,
@@ -1215,9 +1204,7 @@ static void checkLastWindow()
12151204 // thread will process events continuously.
12161205 while ( gtk_events_pending () )
12171206 gtk_main_iteration ();
1218- #ifdef HAVE_GTHREAD
12191207 }
1220- #endif
12211208 }
12221209}
12231210
@@ -1766,7 +1753,6 @@ static gboolean icvOnKeyPress(GtkWidget* widget, GdkEventKey* event, gpointer us
17661753
17671754 code |= event->state << 16 ;
17681755
1769- #ifdef HAVE_GTHREAD
17701756 if (thread_started)
17711757 {
17721758 g_mutex_lock (last_key_mutex);
@@ -1776,7 +1762,6 @@ static gboolean icvOnKeyPress(GtkWidget* widget, GdkEventKey* event, gpointer us
17761762 g_mutex_unlock (last_key_mutex);
17771763 }
17781764 else
1779- #endif
17801765 {
17811766 last_key = code;
17821767 }
@@ -1967,7 +1952,6 @@ static gboolean icvAlarm( gpointer user_data )
19671952
19681953CV_IMPL int cvWaitKey ( int delay )
19691954{
1970- #ifdef HAVE_GTHREAD
19711955 if (thread_started && g_thread_self () != window_thread)
19721956 {
19731957 gboolean expired = true ;
@@ -2001,7 +1985,6 @@ CV_IMPL int cvWaitKey( int delay )
20011985 return my_last_key;
20021986 }
20031987 else
2004- #endif
20051988 {
20061989 int expired = 0 ;
20071990 guint timer = 0 ;
0 commit comments