]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/app.cpp
gtk_signal_connect -> g_signal_connect in unix/mediactrl.cpp
[wxWidgets.git] / src / x11 / app.cpp
index 086654892a62a735365be2f83339d2f8e47c6e7f..9f070313554942ecdb7bc547c12699e23ae598f0 100644 (file)
@@ -9,10 +9,6 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "app.h"
-#endif
-
 #include "wx/frame.h"
 #include "wx/app.h"
 #include "wx/utils.h"
 #include "wx/frame.h"
 #include "wx/app.h"
 #include "wx/utils.h"
@@ -46,8 +42,8 @@
 
 extern wxList wxPendingDelete;
 
 
 extern wxList wxPendingDelete;
 
-wxHashTable *wxWidgetHashTable = NULL;
-wxHashTable *wxClientWidgetHashTable = NULL;
+wxWindowHash *wxWidgetHashTable = NULL;
+wxWindowHash *wxClientWidgetHashTable = NULL;
 
 static bool g_showIconic = FALSE;
 static wxSize g_initialSize = wxDefaultSize;
 
 static bool g_showIconic = FALSE;
 static wxSize g_initialSize = wxDefaultSize;
@@ -173,7 +169,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
         xdisplay = XOpenDisplay( displayName.ToAscii() );
     if (!xdisplay)
     {
         xdisplay = XOpenDisplay( displayName.ToAscii() );
     if (!xdisplay)
     {
-        wxLogError( _("wxWindows could not open display. Exiting.") );
+        wxLogError( _("wxWidgets could not open display. Exiting.") );
         return false;
     }
 
         return false;
     }
 
@@ -203,8 +199,8 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
     wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
 #endif
 
     wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
 #endif
 
-    wxWidgetHashTable = new wxHashTable(wxKEY_INTEGER);
-    wxClientWidgetHashTable = new wxHashTable(wxKEY_INTEGER);
+    wxWidgetHashTable = new wxWindowHash;
+    wxClientWidgetHashTable = new wxWindowHash;
 
     return true;
 }
 
     return true;
 }
@@ -228,7 +224,6 @@ wxApp::wxApp()
     m_mainColormap = (WXColormap) NULL;
     m_topLevelWidget = (WXWindow) NULL;
     m_maxRequestSize = 0;
     m_mainColormap = (WXColormap) NULL;
     m_topLevelWidget = (WXWindow) NULL;
     m_maxRequestSize = 0;
-    m_mainLoop = NULL;
     m_showIconic = FALSE;
     m_initialSize = wxDefaultSize;
 
     m_showIconic = FALSE;
     m_initialSize = wxDefaultSize;
 
@@ -244,26 +239,6 @@ wxApp::~wxApp()
 #endif
 }
 
 #endif
 }
 
-bool wxApp::Initialized()
-{
-    if (GetTopWindow())
-        return TRUE;
-    else
-        return FALSE;
-}
-
-int wxApp::MainLoop()
-{
-    int rt;
-    m_mainLoop = new wxEventLoop;
-
-    rt = m_mainLoop->Run();
-
-    delete m_mainLoop;
-    m_mainLoop = NULL;
-    return rt;
-}
-
 #if !wxUSE_NANOX
 //-----------------------------------------------------------------------
 // X11 predicate function for exposure compression
 #if !wxUSE_NANOX
 //-----------------------------------------------------------------------
 // X11 predicate function for exposure compression
@@ -396,8 +371,6 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
 #if !wxUSE_NANOX
         case GraphicsExpose:
         {
 #if !wxUSE_NANOX
         case GraphicsExpose:
         {
-            printf( "GraphicExpose event\n" );
-
             wxLogTrace( _T("expose"), _T("GraphicsExpose from %s"), win->GetName().c_str());
 
             win->GetUpdateRegion().Union( event->xgraphicsexpose.x, event->xgraphicsexpose.y,
             wxLogTrace( _T("expose"), _T("GraphicsExpose from %s"), win->GetName().c_str());
 
             win->GetUpdateRegion().Union( event->xgraphicsexpose.x, event->xgraphicsexpose.y,
@@ -469,16 +442,15 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
             if (event->update.utype == GR_UPDATE_SIZE)
 #endif
             {
             if (event->update.utype == GR_UPDATE_SIZE)
 #endif
             {
-                if (win->IsTopLevel())
+                wxTopLevelWindow *tlw = wxDynamicCast(win, wxTopLevelWindow);
+                if ( tlw )
                 {
                 {
-                    wxTopLevelWindow *tlw = (wxTopLevelWindow*) win;
                     tlw->SetConfigureGeometry( XConfigureEventGetX(event), XConfigureEventGetY(event),
                         XConfigureEventGetWidth(event), XConfigureEventGetHeight(event) );
                 }
 
                     tlw->SetConfigureGeometry( XConfigureEventGetX(event), XConfigureEventGetY(event),
                         XConfigureEventGetWidth(event), XConfigureEventGetHeight(event) );
                 }
 
-                if (win->IsTopLevel() && win->IsShown())
+                if ( tlw && tlw->IsShown() )
                 {
                 {
-                    wxTopLevelWindowX11 *tlw = (wxTopLevelWindowX11 *) win;
                     tlw->SetNeedResizeInIdle();
                 }
                 else
                     tlw->SetNeedResizeInIdle();
                 }
                 else
@@ -490,7 +462,6 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
                 }
             }
             return FALSE;
                 }
             }
             return FALSE;
-            break;
         }
 #if !wxUSE_NANOX
         case PropertyNotify:
         }
 #if !wxUSE_NANOX
         case PropertyNotify:
@@ -615,83 +586,59 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
             return win->GetEventHandler()->ProcessEvent( wxevent );
         }
         case FocusIn:
             return win->GetEventHandler()->ProcessEvent( wxevent );
         }
         case FocusIn:
-            {
 #if !wxUSE_NANOX
 #if !wxUSE_NANOX
-                if ((event->xfocus.detail != NotifyPointer) &&
-                    (event->xfocus.mode == NotifyNormal))
+            if ((event->xfocus.detail != NotifyPointer) &&
+                (event->xfocus.mode == NotifyNormal))
 #endif
 #endif
+            {
+                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
                 {
                 {
-                    wxLogTrace( _T("focus"), _T("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;
 
 
-                    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;
             }
             }
+            return FALSE;
+
         case FocusOut:
         case FocusOut:
-            {
 #if !wxUSE_NANOX
 #if !wxUSE_NANOX
-                if ((event->xfocus.detail != NotifyPointer) &&
-                    (event->xfocus.mode == NotifyNormal))
+            if ((event->xfocus.detail != NotifyPointer) &&
+                (event->xfocus.mode == NotifyNormal))
 #endif
 #endif
-                {
-                    wxLogTrace( _T("focus"), _T("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);
-                    focusEvent.SetWindow( g_nextFocus );
-                    g_nextFocus = NULL;
-                    return win->GetEventHandler()->ProcessEvent(focusEvent);
-                }
-                return FALSE;
-                break;
+                wxFocusEvent focusEvent(wxEVT_KILL_FOCUS, win->GetId());
+                focusEvent.SetEventObject(win);
+                focusEvent.SetWindow( g_nextFocus );
+                g_nextFocus = NULL;
+                return win->GetEventHandler()->ProcessEvent(focusEvent);
             }
             }
-        default:
-        {
+            return FALSE;
+
 #ifdef __WXDEBUG__
 #ifdef __WXDEBUG__
+        default:
             //wxString eventName = wxGetXEventName(XEvent& event);
             //wxLogDebug(wxT("Event %s not handled"), eventName.c_str());
             //wxString eventName = wxGetXEventName(XEvent& event);
             //wxLogDebug(wxT("Event %s not handled"), eventName.c_str());
-#endif
-            return FALSE;
             break;
             break;
-        }
+#endif // __WXDEBUG__
     }
     }
-    return FALSE;
-}
-
-void wxApp::ExitMainLoop()
-{
-    if (m_mainLoop)
-        m_mainLoop->Exit(0);
-}
-
-// Is a message/event pending?
-bool wxApp::Pending()
-{
-    return wxEventLoop::GetActive()->Pending();
-}
 
 
-// Dispatch a message.
-void wxApp::Dispatch()
-{
-    wxEventLoop::GetActive()->Dispatch();
+    return FALSE;
 }
 
 // This should be redefined in a derived class for
 }
 
 // This should be redefined in a derived class for
@@ -739,7 +686,9 @@ bool wxApp::OnInitGui()
 
 #include <pango/pango.h>
 #include <pango/pangox.h>
 
 #include <pango/pango.h>
 #include <pango/pangox.h>
-#include <pango/pangoxft.h>
+#ifdef HAVE_PANGO_XFT
+    #include <pango/pangoxft.h>
+#endif
 
 PangoContext* wxApp::GetPangoContext()
 {
 
 PangoContext* wxApp::GetPangoContext()
 {
@@ -749,7 +698,7 @@ PangoContext* wxApp::GetPangoContext()
 
     Display *xdisplay = (Display*) wxApp::GetDisplay();
 
 
     Display *xdisplay = (Display*) wxApp::GetDisplay();
 
-#if 1
+#ifdef HAVE_PANGO_XFT
     int xscreen = DefaultScreen(xdisplay);
     static int use_xft = -1;
     if (use_xft == -1)
     int xscreen = DefaultScreen(xdisplay);
     static int use_xft = -1;
     if (use_xft == -1)
@@ -789,11 +738,13 @@ WXColormap wxApp::GetMainColormap(WXDisplay* display)
 
 Window wxGetWindowParent(Window window)
 {
 
 Window wxGetWindowParent(Window window)
 {
-    wxASSERT_MSG( window, "invalid window" );
+    wxASSERT_MSG( window, _T("invalid window") );
 
     return (Window) 0;
 
 
     return (Window) 0;
 
-    Window parent, root = 0;
+#ifndef __VMS
+   // VMS chokes on unreacheable code
+   Window parent, root = 0;
 #if wxUSE_NANOX
     int noChildren = 0;
 #else
 #if wxUSE_NANOX
     int noChildren = 0;
 #else
@@ -814,6 +765,7 @@ Window wxGetWindowParent(Window window)
         return parent;
     else
         return (Window) 0;
         return parent;
     else
         return (Window) 0;
+#endif
 }
 
 void wxApp::Exit()
 }
 
 void wxApp::Exit()
@@ -833,7 +785,7 @@ bool wxApp::Yield(bool onlyIfNeeded)
     int i;
     for (i = 0; i < 2; i++)
     {
     int i;
     for (i = 0; i < 2; i++)
     {
-        bool s_inYield = FALSE;
+        static bool s_inYield = FALSE;
 
         if ( s_inYield )
         {
 
         if ( s_inYield )
         {