X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0728199b911be9095406cf05059a5a180e707778..bcf324bebe65cd7ee49c139533ceea52dceb4b91:/src/gtk1/app.cpp diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 84590d5759..17aa402900 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -7,12 +7,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __VMS -// vms_jackets.h should for proper working be included before anything else -# include -#undef ConnectionNumber -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -91,7 +85,7 @@ bool g_mainThreadLocked = false; gint g_pendingTag = 0; -static GtkWidget *gs_RootWindow = (GtkWidget*) NULL; +static GtkWidget *gs_RootWindow = NULL; //----------------------------------------------------------------------------- // idle system @@ -109,14 +103,9 @@ static wxMutex gs_idleTagsMutex; // wxYield //----------------------------------------------------------------------------- -// not static because used by textctrl.cpp -// -// MT-FIXME -bool wxIsInsideYield = false; - -bool wxApp::Yield(bool onlyIfNeeded) +bool wxApp::DoYield(bool onlyIfNeeded, long eventsToProcess) { - if ( wxIsInsideYield ) + if ( m_isInsideYield ) { if ( !onlyIfNeeded ) { @@ -134,7 +123,8 @@ bool wxApp::Yield(bool onlyIfNeeded) } #endif // wxUSE_THREADS - wxIsInsideYield = true; + m_isInsideYield = true; + m_eventsToProcessInsideYield = eventsToProcess; // We need to remove idle callbacks or the loop will // never finish. @@ -146,6 +136,7 @@ bool wxApp::Yield(bool onlyIfNeeded) wxLog::Suspend(); #endif + // TODO: implement event filtering using the eventsToProcess mask while (gtk_events_pending()) gtk_main_iteration(); @@ -162,7 +153,7 @@ bool wxApp::Yield(bool onlyIfNeeded) wxLog::Resume(); #endif - wxIsInsideYield = false; + m_isInsideYield = false; return true; } @@ -183,14 +174,14 @@ void wxApp::WakeUpIdle() #if wxUSE_THREADS if (!wxThread::IsMain()) wxMutexGuiEnter(); -#endif // wxUSE_THREADS_ +#endif // wxUSE_THREADS wxapp_install_idle_handler(); #if wxUSE_THREADS if (!wxThread::IsMain()) wxMutexGuiLeave(); -#endif // wxUSE_THREADS_ +#endif // wxUSE_THREADS } //----------------------------------------------------------------------------- @@ -405,6 +396,28 @@ void wxapp_install_idle_handler() wxTheApp->m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL ); } +static bool wxOKlibc() +{ +#if defined(__UNIX__) && defined(__GLIBC__) + // glibc 2.0 uses UTF-8 even when it shouldn't + wchar_t res = 0; + if ((MB_CUR_MAX == 2) && + (wxMB2WC(&res, "\xdd\xa5", 1) == 1) && + (res==0x765)) + { + // this is UTF-8 allright, check whether that's what we want + char *cur_locale = setlocale(LC_CTYPE, NULL); + if ((strlen(cur_locale) < 4) || + (strcasecmp(cur_locale + strlen(cur_locale) - 4, "utf8")) || + (strcasecmp(cur_locale + strlen(cur_locale) - 5, "utf-8"))) { + // nope, don't use libc conversion + return false; + } + } +#endif + return true; +} + //----------------------------------------------------------------------------- // Access to the root window global //----------------------------------------------------------------------------- @@ -442,8 +455,8 @@ wxApp::wxApp() m_colorCube = (unsigned char*) NULL; // this is NULL for a "regular" wxApp, but is set (and freed) by a wxGLApp - m_glVisualInfo = (void *) NULL; - m_glFBCInfo = (void *) NULL; + m_glVisualInfo = NULL; + m_glFBCInfo = NULL; } wxApp::~wxApp() @@ -579,13 +592,8 @@ bool wxApp::Initialize(int& argc, wxChar **argv) gtk_set_locale(); // We should have the wxUSE_WCHAR_T test on the _outside_ -#if wxUSE_WCHAR_T - if (!wxOKlibc()) - wxConvCurrent = &wxConvLocal; -#else // !wxUSE_WCHAR_T if (!wxOKlibc()) - wxConvCurrent = (wxMBConv*) NULL; -#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T + wxConvCurrent = &wxConvLocal; #if wxUSE_UNICODE // gtk_init() wants UTF-8, not wchar_t, so convert