]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/app.cpp
Added DoSetSize and DoMoveWindow to generic wxStaticLine.
[wxWidgets.git] / src / x11 / app.cpp
index 3408003de49891d8276d3111fb6f02404fc04635..2f2a28be2916bc97bff4b3523a77320d12bf28b9 100644 (file)
@@ -105,6 +105,10 @@ bool wxApp::Initialize()
 {
     wxClassInfo::InitializeClasses();
 
+#if wxUSE_INTL
+    wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
+#endif
+
     // GL: I'm annoyed ... I don't know where to put this and I don't want to
     // create a module for that as it's part of the core.
 #if wxUSE_THREADS
@@ -568,9 +572,9 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
         {
             printf( "GraphicExpose event\n" );
 
-            // wxLogDebug( "GraphicsExpose from %s", win->GetName().c_str(),
-            //                              event->xgraphicsexpose.x, event->xgraphicsexpose.y,
-            //                              event->xgraphicsexpose.width, event->xgraphicsexpose.height);
+            wxLogTrace( _T("expose"), _T("GraphicsExpose from %s"), win->GetName().c_str(),
+                                          event->xgraphicsexpose.x, event->xgraphicsexpose.y,
+                                          event->xgraphicsexpose.width, event->xgraphicsexpose.height);
 
             win->GetUpdateRegion().Union( event->xgraphicsexpose.x, event->xgraphicsexpose.y,
                                           event->xgraphicsexpose.width, event->xgraphicsexpose.height);
@@ -758,6 +762,15 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
                     g_prevFocus = wxWindow::FindFocus();
                     g_nextFocus = win;
 
+                    wxLogTrace( _T("focus"), _T("About to call SetFocus on %s of type %s due to button press"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
+
+                    // Record the fact that this window is
+                    // getting the focus, because we'll need to
+                    // check if its parent is getting a bogus
+                    // focus and duly ignore it.
+                    // TODO: may need to have this code in SetFocus, too.
+                    extern wxWindow* g_GettingFocus;
+                    g_GettingFocus = win;
                     win->SetFocus();
                 }
             }
@@ -781,14 +794,26 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
                     (event->xfocus.mode == NotifyNormal))
 #endif
                 {
-                    // wxLogDebug( "FocusIn from %s of type %s", win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
-
-                    wxFocusEvent focusEvent(wxEVT_SET_FOCUS, win->GetId());
-                    focusEvent.SetEventObject(win);
-                    focusEvent.SetWindow( g_prevFocus );
-                    g_prevFocus = NULL;
+                    wxLogTrace( _T("focus"), _T("FocusIn from %s of type %s"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
+                    
+                    extern wxWindow* g_GettingFocus;
+                    if (g_GettingFocus && g_GettingFocus->GetParent() == win)
+                    {
+                        // Ignore this, this can be a spurious FocusIn
+                        // caused by a child having its focus set.
+                        g_GettingFocus = NULL;
+                        wxLogTrace( _T("focus"), _T("FocusIn from %s of type %s being deliberately ignored"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
+                        return TRUE;
+                    }
+                    else
+                    {
+                        wxFocusEvent focusEvent(wxEVT_SET_FOCUS, win->GetId());
+                        focusEvent.SetEventObject(win);
+                        focusEvent.SetWindow( g_prevFocus );
+                        g_prevFocus = NULL;
 
-                    return win->GetEventHandler()->ProcessEvent(focusEvent);
+                        return win->GetEventHandler()->ProcessEvent(focusEvent);
+                    }
                 }
                 return FALSE;
                 break;
@@ -800,7 +825,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
                     (event->xfocus.mode == NotifyNormal))
 #endif
                 {
-                    // wxLogDebug( "FocusOut from %s of type %s", win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
+                    wxLogTrace( _T("focus"), _T("FocusOut from %s of type %s"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
 
                     wxFocusEvent focusEvent(wxEVT_KILL_FOCUS, win->GetId());
                     focusEvent.SetEventObject(win);
@@ -924,8 +949,6 @@ bool wxApp::SendIdleEvents(wxWindow* win)
 
     win->GetEventHandler()->ProcessEvent(event);
 
-    win->OnInternalIdle();
-
     if (event.MoreRequested())
         needMore = TRUE;
 
@@ -939,6 +962,8 @@ bool wxApp::SendIdleEvents(wxWindow* win)
         node = node->Next();
     }
 
+    win->OnInternalIdle();
+
     return needMore;
 }
 
@@ -1198,12 +1223,14 @@ bool wxApp::Yield(bool onlyIfNeeded)
     return TRUE;
 }
 
-void wxApp::OnAssert(const wxChar *file, int line, const wxChar *msg)
+#ifdef __WXDEBUG__
+
+void wxApp::OnAssert(const wxChar *file, int line, const wxChar* cond, const wxChar *msg)
 {
     // While the GUI isn't working that well, just print out the
     // message.
-#if 0
-    wxAppBase::OnAssert(file, line, msg);
+#if 1
+    wxAppBase::OnAssert(file, line, cond, msg);
 #else
     wxString msg2;
     msg2.Printf("At file %s:%d: %s", file, line, msg);
@@ -1211,3 +1238,5 @@ void wxApp::OnAssert(const wxChar *file, int line, const wxChar *msg)
 #endif
 }
 
+#endif // __WXDEBUG__
+