X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7e1bcfa80e19ac853b8bc7084075fe3b01e63f03..77e0239d76ac5f2dbe9ba53e3278184ce83868ed:/src/motif/app.cpp diff --git a/src/motif/app.cpp b/src/motif/app.cpp index 330ba91007..63cfd7ab1c 100644 --- a/src/motif/app.cpp +++ b/src/motif/app.cpp @@ -36,15 +36,13 @@ #include "wx/log.h" #include "wx/intl.h" #include "wx/evtloop.h" +#include "wx/hash.h" +#include "wx/hashmap.h" #if wxUSE_THREADS #include "wx/thread.h" #endif -#if wxUSE_WX_RESOURCES - #include "wx/resource.h" -#endif - #ifdef __VMS__ #pragma message disable nosimpint #endif @@ -61,6 +59,8 @@ #include +WX_DECLARE_VOIDPTR_HASH_MAP( wxXVisualInfo*, wxXVisualInfoMap ); + extern wxList wxPendingDelete; extern bool wxAddIdleCallback(); @@ -104,21 +104,6 @@ bool wxApp::Initialize() wxInitializeStockLists(); wxInitializeStockObjects(); -#if wxUSE_WX_RESOURCES - wxInitializeResourceSystem(); -#endif - - // For PostScript printing -#if wxUSE_POSTSCRIPT - /* Done using wxModule now - wxInitializePrintSetupData(); - wxThePrintPaperDatabase = new wxPrintPaperDatabase; - wxThePrintPaperDatabase->CreateDatabase(); - */ -#endif - - wxBitmap::InitStandardHandlers(); - wxWidgetHashTable = new wxHashTable(wxKEY_INTEGER); wxModule::RegisterModules(); @@ -134,10 +119,6 @@ void wxApp::CleanUp() wxModule::CleanUpModules(); -#if wxUSE_WX_RESOURCES - wxCleanUpResourceSystem(); -#endif - wxDeleteStockObjects() ; // Destroy all GDI lists, etc. @@ -147,16 +128,6 @@ void wxApp::CleanUp() delete wxTheColourDatabase; wxTheColourDatabase = NULL; -#if wxUSE_POSTSCRIPT - /* Done using wxModule now - wxInitializePrintSetupData(FALSE); - delete wxThePrintPaperDatabase; - wxThePrintPaperDatabase = NULL; - */ -#endif - - wxBitmap::CleanUpHandlers(); - wxClassInfo::CleanUpClasses(); delete wxTheApp; @@ -243,8 +214,8 @@ int wxEntry( int argc, char *argv[] ) if ( pLog != NULL && pLog->HasPendingMessages() ) pLog->Flush(); - delete wxLog::SetActiveTarget(new wxLogStderr); // So dialog boxes aren't used - // for further messages + // So dialog boxes aren't used for further messages + delete wxLog::SetActiveTarget(new wxLogStderr); if (wxTheApp->GetTopWindow()) { @@ -275,11 +246,21 @@ wxApp::wxApp() m_topLevelWidget = (WXWidget) NULL; m_maxRequestSize = 0; m_initialDisplay = (WXDisplay*) 0; + m_visualInfoMap = new wxXVisualInfoMap; } wxApp::~wxApp() { delete m_eventLoop; + + for( wxXVisualInfoMap::iterator it = m_visualInfoMap->begin(), + end = m_visualInfoMap->end(); + it != end; ++it ) + { + delete it->second; + } + + delete m_visualInfoMap; } bool wxApp::Initialized() @@ -325,11 +306,14 @@ void wxApp::ExitMainLoop() // Is a message/event pending? bool wxApp::Pending() { + return m_eventLoop->Pending(); +#if 0 XFlush(XtDisplay( (Widget) wxTheApp->GetTopLevelWidget() )); // Fix by Doug from STI, to prevent a stall if non-X event // is found. return ((XtAppPending( (XtAppContext) GetAppContext() ) & XtIMXEvent) != 0) ; +#endif } // Dispatch a message. @@ -463,7 +447,7 @@ bool wxApp::OnInitGui() XtAppSetFallbackResources((XtAppContext) wxTheApp->m_appContext, fallbackResources); Display *dpy = XtOpenDisplay((XtAppContext) wxTheApp->m_appContext,(String)NULL,NULL, - (const char*) wxTheApp->GetClassName(), NULL, 0, + wxTheApp->GetClassName().c_str(), NULL, 0, # if XtSpecificationRelease < 5 (Cardinal*) &argc, # else @@ -476,7 +460,7 @@ bool wxApp::OnInitGui() delete wxLog::SetActiveTarget(new wxLogStderr); wxString className(wxTheApp->GetClassName()); wxLogError(_("wxWindows could not open display for '%s': exiting."), - (const char*) className); + className.c_str()); exit(-1); } m_initialDisplay = (WXDisplay*) dpy; @@ -486,9 +470,11 @@ bool wxApp::OnInitGui() gs_pfnXErrorHandler = XSetErrorHandler(wxXErrorHandler); #endif // __WXDEBUG__ - wxTheApp->m_topLevelWidget = (WXWidget) XtAppCreateShell((String)NULL, (const char*) wxTheApp->GetClassName(), - applicationShellWidgetClass,dpy, - NULL,0) ; + wxTheApp->m_topLevelWidget = + (WXWidget) XtAppCreateShell((String)NULL, + wxTheApp->GetClassName().c_str(), + applicationShellWidgetClass,dpy, + NULL,0) ; // Add general resize proc XtActionsRec rec; @@ -520,6 +506,20 @@ WXColormap wxApp::GetMainColormap(WXDisplay* display) return (WXColormap) c; } +wxXVisualInfo* wxApp::GetVisualInfo( WXDisplay* display ) +{ + wxXVisualInfoMap::iterator it = m_visualInfoMap->find( display ); + + if( it != m_visualInfoMap->end() ) return it->second; + + wxXVisualInfo* vi = new wxXVisualInfo; + wxFillXVisualInfo( vi, (Display*)display ); + + (*m_visualInfoMap)[display] = vi; + + return vi; +} + void wxExit() { int retValue = 0; @@ -528,7 +528,8 @@ void wxExit() wxApp::CleanUp(); /* - * Exit in some platform-specific way. Not recommended that the app calls this: + * Exit in some platform-specific way. + * Not recommended that the app calls this: * only for emergencies. */ exit(retValue);