|
|
|
@ -608,13 +608,11 @@ static gboolean icvOnKeyPress( GtkWidget* widget, GdkEventKey* event, gpointer u |
|
|
|
|
static void icvOnTrackbar( GtkWidget* widget, gpointer user_data ); |
|
|
|
|
static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_data ); |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_GTHREAD |
|
|
|
|
int thread_started=0; |
|
|
|
|
static gpointer icvWindowThreadLoop(gpointer data); |
|
|
|
|
GMutex* last_key_mutex = NULL; |
|
|
|
|
GCond* cond_have_key = NULL; |
|
|
|
|
GThread* window_thread = NULL; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
static int last_key = -1; |
|
|
|
|
|
|
|
|
@ -660,7 +658,6 @@ CV_IMPL int cvInitSystem( int argc, char** argv ) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
CV_IMPL int cvStartWindowThread(){ |
|
|
|
|
#ifdef HAVE_GTHREAD |
|
|
|
|
cvInitSystem(0,NULL); |
|
|
|
|
if (!thread_started) |
|
|
|
|
{ |
|
|
|
@ -676,12 +673,8 @@ CV_IMPL int cvStartWindowThread(){ |
|
|
|
|
} |
|
|
|
|
thread_started = window_thread!=NULL; |
|
|
|
|
return thread_started; |
|
|
|
|
#else |
|
|
|
|
return 0; |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_GTHREAD |
|
|
|
|
gpointer icvWindowThreadLoop(gpointer /*data*/) |
|
|
|
|
{ |
|
|
|
|
while(1){ |
|
|
|
@ -698,8 +691,6 @@ gpointer icvWindowThreadLoop(gpointer /*data*/) |
|
|
|
|
return NULL; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#define CV_LOCK_MUTEX() cv::AutoLock lock(getWindowMutex()) |
|
|
|
|
|
|
|
|
|
static |
|
|
|
@ -1282,7 +1273,6 @@ static void checkLastWindow() |
|
|
|
|
// if last window...
|
|
|
|
|
if (getGTKWindows().empty()) |
|
|
|
|
{ |
|
|
|
|
#ifdef HAVE_GTHREAD |
|
|
|
|
if( thread_started ) |
|
|
|
|
{ |
|
|
|
|
// send key press signal to jump out of any waiting cvWaitKey's
|
|
|
|
@ -1290,7 +1280,6 @@ static void checkLastWindow() |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
#endif |
|
|
|
|
// Some GTK+ modules (like the Unity module) use GDBusConnection,
|
|
|
|
|
// which has a habit of postponing cleanup by performing it via
|
|
|
|
|
// idle sources added to the main loop. Since this was the last window,
|
|
|
|
@ -1301,9 +1290,7 @@ static void checkLastWindow() |
|
|
|
|
// thread will process events continuously.
|
|
|
|
|
while( gtk_events_pending() ) |
|
|
|
|
gtk_main_iteration(); |
|
|
|
|
#ifdef HAVE_GTHREAD |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1852,7 +1839,6 @@ static gboolean icvOnKeyPress(GtkWidget* widget, GdkEventKey* event, gpointer us |
|
|
|
|
|
|
|
|
|
code |= event->state << 16; |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_GTHREAD |
|
|
|
|
if(thread_started) |
|
|
|
|
{ |
|
|
|
|
g_mutex_lock(last_key_mutex); |
|
|
|
@ -1862,7 +1848,6 @@ static gboolean icvOnKeyPress(GtkWidget* widget, GdkEventKey* event, gpointer us |
|
|
|
|
g_mutex_unlock(last_key_mutex); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
#endif |
|
|
|
|
{ |
|
|
|
|
last_key = code; |
|
|
|
|
} |
|
|
|
@ -2053,7 +2038,6 @@ static gboolean icvAlarm( gpointer user_data ) |
|
|
|
|
|
|
|
|
|
CV_IMPL int cvWaitKey( int delay ) |
|
|
|
|
{ |
|
|
|
|
#ifdef HAVE_GTHREAD |
|
|
|
|
if (thread_started && g_thread_self() != window_thread) |
|
|
|
|
{ |
|
|
|
|
gboolean expired = true; |
|
|
|
@ -2087,7 +2071,6 @@ CV_IMPL int cvWaitKey( int delay ) |
|
|
|
|
return my_last_key; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
#endif |
|
|
|
|
{ |
|
|
|
|
int expired = 0; |
|
|
|
|
guint timer = 0; |
|
|
|
|