Moved m_visual* wxApp[X11] members used by wxBitmap and

wxColour into a new wxXVisualInfo structure, and moved code
to initialize it to a new src/x11/utilsx.cpp file (utility
functions shared by wxMotif and wxX11).
  Added (currently unused) code in wxMotif to
retrieve wxXVisualInfo; it will be used when wxMotif
is switched to bitmap.cpp from wxX11.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20056 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2003-04-07 17:15:11 +00:00
parent 13fc3db40e
commit 9ce8d6a2b0
11 changed files with 276 additions and 166 deletions

View File

@@ -37,6 +37,7 @@
#include "wx/intl.h"
#include "wx/evtloop.h"
#include "wx/hash.h"
#include "wx/hashmap.h"
#if wxUSE_THREADS
#include "wx/thread.h"
@@ -58,6 +59,8 @@
#include <string.h>
WX_DECLARE_VOIDPTR_HASH_MAP( wxXVisualInfo*, wxXVisualInfoMap );
extern wxList wxPendingDelete;
extern bool wxAddIdleCallback();
@@ -243,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()
@@ -493,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;