Unverified Commit a0283ead authored by Rafael Kitover's avatar Rafael Kitover
Browse files

fix game panel size on wxGTK #325



On wxWidgets 3.1.2, which is what vcpkg uses (and we use vcpkg for
Visual Studio) the wxEXPAND flag for the game area in the sizer throws
an XRC error dialog, removing the flag works correctly on Windows, but
not on wxGTK.

As a workaround, do not use the wxEXPAND flag on Windows.

TODO: with max zoom set, the game area is not centered vertically in
wxGTK.
Signed-off-by: default avatarRafael Kitover <rkitover@gmail.com>
parent f1ecd7c3
......@@ -1034,7 +1034,16 @@ void GameArea::OnIdle(wxIdleEvent& event)
// add spacers on top and bottom to center panel vertically
GetSizer()->Add(0, 0, 1, wxEXPAND);
GetSizer()->Add(w, 0, gopts.retain_aspect ? (wxSHAPED | wxALIGN_CENTER) : wxEXPAND);
// On windows with the vcpkg version of wxWidgets which is 3.1.2, the
// wxEXPAND flag throws an XRC error, but everything works fine without it.
// On GTK however, the flag is necessary.
#if defined(__WXMSW__)
GetSizer()->Add(w, 0, gopts.retain_aspect ? (wxSHAPED | wxALIGN_CENTER_HORIZONTAL) : wxEXPAND);
#else
GetSizer()->Add(w, 0, gopts.retain_aspect ? (wxSHAPED | wxALIGN_CENTER_HORIZONTAL | wxEXPAND) : wxEXPAND);
#endif
GetSizer()->Add(0, 0, 1, wxEXPAND);
Layout();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment