extern bool g_isIdle;
+bool g_mainThreadLocked = FALSE;
+
+GtkWidget *wxRootWindow = (GtkWidget*) NULL;
+
//-----------------------------------------------------------------------------
// local functions
//-----------------------------------------------------------------------------
{
#if wxUSE_THREADS
if (!wxThread::IsMain())
- gdk_threads_enter();
+ wxMutexGuiEnter();
#endif
if (g_isIdle)
#if wxUSE_THREADS
if (!wxThread::IsMain())
- gdk_threads_leave();
+ wxMutexGuiLeave();
#endif
}
// thread so we must lock it here ourselves
gdk_threads_enter();
- /* sent idle event to all who request them */
- while (wxTheApp->ProcessIdle()) { }
-
/* we don't want any more idle events until the next event is
sent to wxGTK */
gtk_idle_remove( wxTheApp->m_idleTag );
emptied */
g_isIdle = TRUE;
+ /* sent idle event to all who request them */
+ while (wxTheApp->ProcessIdle()) { }
+
// release lock again
gdk_threads_leave();
// when getting called from GDK's time-out handler
// we are no longer within GDK's grab on the GUI
// thread so we must lock it here ourselves
-
gdk_threads_enter();
wxapp_uninstall_thread_wakeup();
// unblock other threads wishing to do some GUI things
wxMutexGuiLeave();
+
+ g_mainThreadLocked = TRUE;
// wake up other threads
wxUsleep( 1 );
// block other thread again
wxMutexGuiEnter();
+ g_mainThreadLocked = FALSE;
+
wxapp_install_thread_wakeup();
// release lock again
/* on some machines, the default visual is just 256 colours, so
we make sure we get the best. this can sometimes be wasteful,
of course, but what do these guys pay $30.000 for? */
-/*
+
if (gdk_visual_get_best() != gdk_visual_get_system())
{
GdkVisual* vis = gdk_visual_get_best();
visual = vis;
}
-*/
+
+ wxRootWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ gtk_widget_realize( wxRootWindow );
/* Nothing to do for 15, 16, 24, 32 bit displays */
if (visual->depth > 8) return TRUE;
void wxApp::OnIdle( wxIdleEvent &event )
{
static bool s_inOnIdle = FALSE;
-
+
/* Avoid recursion (via ProcessEvent default case) */
if (s_inOnIdle)
return;
-
+
s_inOnIdle = TRUE;
/* Resend in the main thread events which have been prepared in other
/* 'Garbage' collection of windows deleted with Close(). */
DeletePendingObjects();
- /* flush the logged messages if any */
-#if wxUSE_LOG
- wxLog *log = wxLog::GetActiveTarget();
- if (log != NULL && log->HasPendingMessages())
- log->Flush();
-#endif // wxUSE_LOG
-
/* Send OnIdle events to all windows */
bool needMore = SendIdleEvents();
event.RequestMore(TRUE);
s_inOnIdle = FALSE;
+
+ /* flush the logged messages if any */
+#if wxUSE_LOG
+ wxLog *log = wxLog::GetActiveTarget();
+ if (log != NULL && log->HasPendingMessages())
+ log->Flush();
+#endif // wxUSE_LOG
}
bool wxApp::SendIdleEvents()
wxPendingEventsLocker = new wxCriticalSection();
#endif
-/*
- wxTheFontNameDirectory = new wxFontNameDirectory;
- wxTheFontNameDirectory->Initialize();
-*/
-
wxTheColourDatabase = new wxColourDatabase( wxKEY_STRING );
wxTheColourDatabase->Initialize();
wxInitializeStockLists();
wxInitializeStockObjects();
+#if wxUSE_WX_RESOURCES
+ wxInitializeResourceSystem();
+#endif
+
wxModule::RegisterModules();
if (!wxModule::InitializeModules()) return FALSE;
{
wxModule::CleanUpModules();
+#if wxUSE_WX_RESOURCES
+ wxCleanUpResourceSystem();
+#endif
+
if (wxTheColourDatabase)
delete wxTheColourDatabase;
+
wxTheColourDatabase = (wxColourDatabase*) NULL;
-/*
- if (wxTheFontNameDirectory) delete wxTheFontNameDirectory;
- wxTheFontNameDirectory = (wxFontNameDirectory*) NULL;
-*/
-
wxDeleteStockObjects();
wxDeleteStockLists();
int wxEntry( int argc, char *argv[] )
{
#if wxUSE_THREADS
- g_thread_init(NULL);
+ /* GTK 1.2 up to version 1.2.3 has broken threads */
+ if ((gtk_major_version == 1) &&
+ (gtk_minor_version == 2) &&
+ (gtk_micro_version < 4))
+ {
+ printf( "wxWindows warning: Disabled GUI threading due to outdated GTK version\n" );
+ }
+ else
+ {
+ g_thread_init(NULL);
+ }
#endif
gtk_set_locale();