]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/app.cpp
compilation fix for wxUSE_RICHEDIT == 0 (closes bug 662252)
[wxWidgets.git] / src / msw / app.cpp
index cfaf7b34e96d9afc9558d078c9456cde7ff2c99e..7e26d1504f424f726f03109db06b6977e5d91f01 100644 (file)
@@ -701,8 +701,10 @@ int wxEntry(WXHINSTANCE hInstance,
         // we can't simply double-click on the error message and get to that
         // line in the source. So VC++ at least, let's have a sensible default.
 #ifdef __VISUALC__
+#if wxUSE_LOG
         wxLog::SetTimestamp(NULL);
-#endif
+#endif // wxUSE_LOG
+#endif // __VISUALC__
 
         // init the app
         int retValue = wxEntryInitGui() && wxTheApp->OnInit() ? 0 : -1;
@@ -712,7 +714,7 @@ int wxEntry(WXHINSTANCE hInstance,
             if ( enterLoop )
             {
                 // run the main loop
-                retValue = wxTheApp->OnRun();
+                wxTheApp->OnRun();
             }
             else
             {
@@ -739,7 +741,7 @@ int wxEntry(WXHINSTANCE hInstance,
             }
         }
 
-        wxTheApp->OnExit();
+        retValue = wxTheApp->OnExit();
 
         wxEntryCleanup();
 
@@ -1066,15 +1068,21 @@ bool wxApp::ProcessMessage(WXMSG *wxmsg)
     return FALSE;
 }
 
+// this is a temporary hack and will be replaced by using wxEventLoop in the
+// future
+//
+// it is needed to allow other event loops (currently only one: the modal
+// dialog one) to reset the OnIdle() semaphore because otherwise OnIdle()
+// wouldn't do anything while a modal dialog shown from OnIdle() call is shown.
+bool wxIsInOnIdleFlag = FALSE;
+
 void wxApp::OnIdle(wxIdleEvent& event)
 {
-    static bool s_inOnIdle = FALSE;
-
     // Avoid recursion (via ProcessEvent default case)
-    if ( s_inOnIdle )
+    if ( wxIsInOnIdleFlag )
         return;
 
-    s_inOnIdle = TRUE;
+    wxIsInOnIdleFlag = TRUE;
 
     // If there are pending events, we must process them: pending events
     // are either events to the threads other than main or events posted
@@ -1109,7 +1117,7 @@ void wxApp::OnIdle(wxIdleEvent& event)
         event.RequestMore(TRUE);
     }
 
-    s_inOnIdle = FALSE;
+    wxIsInOnIdleFlag = FALSE;
 }
 
 // Send idle event to all top-level windows
@@ -1294,9 +1302,11 @@ bool wxApp::Yield(bool onlyIfNeeded)
     // MT-FIXME
     static bool s_inYield = FALSE;
 
+#if wxUSE_LOG
     // disable log flushing from here because a call to wxYield() shouldn't
     // normally result in message boxes popping up &c
     wxLog::Suspend();
+#endif // wxUSE_LOG
 
     if ( s_inYield )
     {
@@ -1327,8 +1337,10 @@ bool wxApp::Yield(bool onlyIfNeeded)
     // if there are pending events, we must process them.
     ProcessPendingEvents();
 
+#if wxUSE_LOG
     // let the logs be flashed again
     wxLog::Resume();
+#endif // wxUSE_LOG
 
     s_inYield = FALSE;
 
@@ -1375,6 +1387,6 @@ void wxWakeUpIdle()
 
 // For some reason, with MSVC++ 1.5, WinMain isn't linked in properly
 // if in a separate file. So include it here to ensure it's linked.
-#if (defined(__VISUALC__) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !defined(__TWIN32__) && !defined(WXMAKINGDLL))
+#if (defined(__VISUALC__) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !defined(__WINE__) && !defined(__TWIN32__) && !defined(WXMAKINGDLL))
 #include "main.cpp"
 #endif