Merge branch 'simplify-display'

Centralize all display-related code in wxDisplay class and avoid
duplicating or reimplementing it in wxDisplaySize() and
wxClientDisplayRect() functions.

See https://github.com/wxWidgets/wxWidgets/pull/955
This commit is contained in:
Vadim Zeitlin
2018-10-01 13:52:07 +02:00
44 changed files with 545 additions and 507 deletions

View File

@@ -170,13 +170,6 @@ bool MyApp::OnInit()
if ( !wxApp::OnInit() )
return false;
#ifdef __WXMSW__
if ( argc == 2 && !wxStricmp(argv[1], "/dx") )
{
wxSystemOptions::SetOption("msw.display.directdraw", 1);
}
#endif // __WXMSW__
// create the main application window
MyFrame *frame = new MyFrame(_("Display wxWidgets Sample"),
wxDefaultPosition, wxDefaultSize);
@@ -242,8 +235,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
wxPanel *panel = new wxPanel(this, wxID_ANY);
m_book = new wxBookCtrl(panel, wxID_ANY);
const size_t count = wxDisplay::GetCount();
for ( size_t nDpy = 0; nDpy < count; nDpy++ )
const size_t countDpy = wxDisplay::GetCount();
for ( size_t nDpy = 0; nDpy < countDpy; nDpy++ )
{
wxDisplay display(nDpy);
@@ -285,14 +278,18 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
sizer->Add(new wxStaticText(page, wxID_ANY, "Name: "));
sizer->Add(new wxStaticText(page, wxID_ANY, display.GetName()));
sizer->Add(new wxStaticText(page, wxID_ANY, "Primary: "));
sizer->Add(new wxStaticText(page, wxID_ANY,
display.IsPrimary() ? "yes" : "no"));
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
sizerTop->Add(sizer, 1, wxALL | wxEXPAND, 10);
#if wxUSE_DISPLAY
wxChoice *choiceModes = new wxChoice(page, Display_ChangeMode);
const wxArrayVideoModes modes = display.GetModes();
const size_t count = modes.GetCount();
for ( size_t nMode = 0; nMode < count; nMode++ )
const size_t countModes = modes.GetCount();
for ( size_t nMode = 0; nMode < countModes; nMode++ )
{
const wxVideoMode& mode = modes[nMode];