fix game geometry on windows

Previously when working on Visual Studio support I noticed an XRC error
dialog when adding the game area to the BoxSizer.

I tried removing the wxEXPAND flag with insufficient testing, the flag
is actually necessary.

The error is actually an incorrect debug assertion that is present in
3.1.2 and later fixed in master. The assertion is not triggered when
the project is built in release mode.

Remove the windows conditional code that removes the wxEXPAND flag.

TODO: silence assertion in debug mode or patch the wxWidgets vcpkg port.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-04-17 13:38:29 +00:00
parent 9fa544d1bb
commit ac35e37ca0
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 4 additions and 9 deletions

View File

@ -1038,21 +1038,16 @@ void GameArea::OnIdle(wxIdleEvent& event)
// add spacers on top and bottom to center panel vertically
// but not on 2.8 which does not handle this correctly
#if wxCHECK_VERSION(2, 9, 0)
GetSizer()->Add(0, 0, 1, wxEXPAND);
GetSizer()->Add(0, 0, wxEXPAND);
#else
frame_priority = 1;
#endif
// On windows with the vcpkg version of wxWidgets which is 3.1.2, the
// wxEXPAND flag throws an XRC error, but it is necessary on earlier versions of wxWidgets
#if defined(__WXMSW__) && wxCHECK_VERSION(3, 1, 2)
GetSizer()->Add(w, frame_priority, gopts.retain_aspect ? (wxSHAPED | wxALIGN_CENTER) : wxEXPAND);
#else
GetSizer()->Add(w, frame_priority, gopts.retain_aspect ? (wxSHAPED | wxALIGN_CENTER | wxEXPAND) : wxEXPAND);
#endif
// this triggers an assertion dialog in <= 3.1.2 in debug mode
GetSizer()->Add(w, frame_priority, gopts.retain_aspect ? (wxSHAPED | wxALIGN_CENTER | wxEXPAND) : wxEXPAND);
#if wxCHECK_VERSION(2, 9, 0)
GetSizer()->Add(0, 0, 1, wxEXPAND);
GetSizer()->Add(0, 0, wxEXPAND);
#endif
Layout();