Skip to content
Permalink
Browse files

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>
  • Loading branch information
rkitover committed Apr 17, 2019
1 parent 9fa544d commit ac35e37ca08b0b4bdeb18d28daa249fab39dbfbd
Showing with 4 additions and 9 deletions.
  1. +4 −9 src/wx/panel.cpp
@@ -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();

0 comments on commit ac35e37

Please sign in to comment.
You can’t perform that action at this time.