Skip to content
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

Signed-off-by: Rafael Kitover <>
  • Loading branch information...
rkitover committed Mar 22, 2019
1 parent f1ecd7c commit a0283eadb68179ef025daee5259c889cdcb54f10
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/wx/panel.cpp
@@ -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);
GetSizer()->Add(w, 0, gopts.retain_aspect ? (wxSHAPED | wxALIGN_CENTER_HORIZONTAL | wxEXPAND) : wxEXPAND);

GetSizer()->Add(0, 0, 1, wxEXPAND);

0 comments on commit a0283ea

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