From a3e76614adbcebebc7ec4f64407d6b09a12d0892 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 30 Dec 2001 00:05:18 +0000 Subject: [PATCH] extended display mode handling to accept WXMODE env. variable git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13230 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mgl/app.cpp | 14 ++++++++++++++ src/mgl/window.cpp | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mgl/app.cpp b/src/mgl/app.cpp index d40b8d7062..4ff72018bc 100644 --- a/src/mgl/app.cpp +++ b/src/mgl/app.cpp @@ -220,6 +220,20 @@ wxApp::~wxApp() { } +wxDisplayModeInfo wxGetDefaultDisplayMode() +{ + wxString mode; + unsigned w, h, bpp; + + if ( !wxGetEnv(wxT("WXMODE"), &mode) || + (wxSscanf(mode.c_str(), _T("%ux%u-%u"), &w, &h, &bpp) != 3) ) + { + w = 640, h = 480, bpp = 16; + } + + return wxDisplayModeInfo(w, h, bpp); +} + bool wxApp::SetDisplayMode(const wxDisplayModeInfo& mode) { if ( !mode.IsOk() ) diff --git a/src/mgl/window.cpp b/src/mgl/window.cpp index 217508e325..f749bc1251 100644 --- a/src/mgl/window.cpp +++ b/src/mgl/window.cpp @@ -469,12 +469,14 @@ END_EVENT_TABLE() // constructors and such // ---------------------------------------------------------------------------- +extern wxDisplayModeInfo wxGetDefaultDisplayMode(); + 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(640, 480, 16)); + wxTheApp->SetDisplayMode(wxGetDefaultDisplayMode()); // generic: InitBase(); -- 2.45.2