reworked display mode stuff once again
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12320 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -170,11 +170,11 @@ static bool wxCreateMGL_WM(const wxDisplayModeInfo& displayMode)
|
|||||||
displayMode.GetDepth());
|
displayMode.GetDepth());
|
||||||
if ( mode == -1 )
|
if ( mode == -1 )
|
||||||
{
|
{
|
||||||
wxLogWarning(_("Mode %ix%i-%i not available, falling back to default mode."),
|
wxLogError(_("Mode %ix%i-%i not available."),
|
||||||
displayMode.GetScreenSize().x,
|
displayMode.GetScreenSize().x,
|
||||||
displayMode.GetScreenSize().y,
|
displayMode.GetScreenSize().y,
|
||||||
displayMode.GetDepth());
|
displayMode.GetDepth());
|
||||||
mode = 0; // always available
|
return FALSE;
|
||||||
}
|
}
|
||||||
g_displayDC = new MGLDisplayDC(mode, 1, refresh);
|
g_displayDC = new MGLDisplayDC(mode, 1, refresh);
|
||||||
if ( !g_displayDC->isValid() )
|
if ( !g_displayDC->isValid() )
|
||||||
@@ -218,7 +218,6 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
wxApp::wxApp() : m_mainLoop(NULL)
|
wxApp::wxApp() : m_mainLoop(NULL)
|
||||||
{
|
{
|
||||||
m_displayMode = wxDisplayModeInfo(wxSize(640, 480), 16);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxApp::~wxApp()
|
wxApp::~wxApp()
|
||||||
@@ -234,27 +233,25 @@ bool wxApp::SetDisplayMode(const wxDisplayModeInfo& mode)
|
|||||||
if ( g_displayDC != NULL )
|
if ( g_displayDC != NULL )
|
||||||
{
|
{
|
||||||
// FIXME_MGL -- we currently don't allow to switch video mode
|
// FIXME_MGL -- we currently don't allow to switch video mode
|
||||||
// at runtime. This can hopefully be changed...
|
// more than once. This can hopefully be changed...
|
||||||
wxFAIL_MSG(wxT("Can't change display mode after intialization!"));
|
wxFAIL_MSG(wxT("Can't change display mode after intialization!"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !wxCreateMGL_WM(mode) )
|
||||||
|
return FALSE;
|
||||||
|
gs_rootWindow = new wxRootWindow;
|
||||||
|
|
||||||
m_displayMode = mode;
|
m_displayMode = mode;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxApp::OnInitGui()
|
bool wxApp::OnInitGui()
|
||||||
{
|
{
|
||||||
if ( !wxCreateMGL_WM(m_displayMode) )
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
// This has to be done *after* wxCreateMGL_WM() because it initializes
|
|
||||||
// wxUniv's themes
|
|
||||||
if ( !wxAppBase::OnInitGui() )
|
if ( !wxAppBase::OnInitGui() )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// ...and this has to be done after wxUniv themes were initialized
|
|
||||||
gs_rootWindow = new wxRootWindow;
|
|
||||||
|
|
||||||
#ifdef MGL_DEBUG
|
#ifdef MGL_DEBUG
|
||||||
// That damn MGL redirects stdin and stdout to physical console
|
// That damn MGL redirects stdin and stdout to physical console
|
||||||
FILE *file = fopen("stderr", "wt");
|
FILE *file = fopen("stderr", "wt");
|
||||||
|
@@ -42,14 +42,14 @@ void wxBell()
|
|||||||
|
|
||||||
void wxDisplaySize(int *width, int *height)
|
void wxDisplaySize(int *width, int *height)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( g_displayDC, wxT("MGL display DC not created yet.") );
|
wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
|
||||||
if (width) *width = g_displayDC->sizex()+1;
|
if (width) *width = g_displayDC->sizex()+1;
|
||||||
if (height) *height = g_displayDC->sizey()+1;
|
if (height) *height = g_displayDC->sizey()+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDisplaySizeMM(int *width, int *height)
|
void wxDisplaySizeMM(int *width, int *height)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( g_displayDC, wxT("MGL display DC not created yet.") );
|
wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
|
||||||
if ( width )
|
if ( width )
|
||||||
*width = (g_displayDC->sizex()+1) * 25/72;
|
*width = (g_displayDC->sizex()+1) * 25/72;
|
||||||
if ( height )
|
if ( height )
|
||||||
@@ -67,14 +67,14 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
|||||||
|
|
||||||
bool wxColourDisplay()
|
bool wxColourDisplay()
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( g_displayDC, wxT("MGL display DC not created yet.") );
|
wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
|
||||||
|
|
||||||
return (wxDisplayDepth() > 1);
|
return (wxDisplayDepth() > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxDisplayDepth()
|
int wxDisplayDepth()
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( g_displayDC, wxT("MGL display DC not created yet.") );
|
wxASSERT_MSG( g_displayDC, wxT("You must call wxApp::SetDisplayMode before using this function") );
|
||||||
|
|
||||||
return g_displayDC->getBitsPerPixel();
|
return g_displayDC->getBitsPerPixel();
|
||||||
}
|
}
|
||||||
|
@@ -466,6 +466,11 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
void wxWindowMGL::Init()
|
void wxWindowMGL::Init()
|
||||||
{
|
{
|
||||||
|
// First of all, make sure window manager is up and running. If it is
|
||||||
|
// not the case, initialize it in default display mode
|
||||||
|
if ( !g_winMng )
|
||||||
|
wxTheApp->SetDisplayMode(wxDisplayModeInfo(wxSize(640, 480), 16));
|
||||||
|
|
||||||
// generic:
|
// generic:
|
||||||
InitBase();
|
InitBase();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user