1
0
forked from 0ad/0ad

Make WxWidgets High-DPI aware / Upgrade WXWidgets to 3.1.4 on MacOS

Fixes issues on Big Sur with the development 0 A.D. (bundles were
working correctly because they are Low-DPI).

Thanks to @wik for investigations on High-DPI in WxWidgets.

Differential Revision: https://code.wildfiregames.com/D3326
This was SVN commit r25111.
This commit is contained in:
wraitii 2021-03-23 15:47:29 +00:00
parent 275a5bccde
commit de02f9870c
3 changed files with 11 additions and 5 deletions

View File

@ -28,7 +28,7 @@ SDL2_VERSION="SDL2-2.0.12"
# NOTE: remember to also update LIB_URL below when changing version
BOOST_VERSION="boost_1_74_0"
# NOTE: remember to also update LIB_URL below when changing version
WXWIDGETS_VERSION="wxWidgets-3.0.5.1"
WXWIDGETS_VERSION="wxWidgets-3.1.4"
# libpng was included as part of X11 but that's removed from Mountain Lion
# (also the Snow Leopard version was ancient 1.2)
PNG_VERSION="libpng-1.6.36"
@ -393,7 +393,7 @@ echo -e "Building wxWidgets..."
LIB_VERSION="${WXWIDGETS_VERSION}"
LIB_ARCHIVE="$LIB_VERSION.tar.bz2"
LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://github.com/wxWidgets/wxWidgets/releases/download/v3.0.5.1/"
LIB_URL="http://github.com/wxWidgets/wxWidgets/releases/download/v3.1.4/"
mkdir -p wxwidgets
pushd wxwidgets > /dev/null

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2012 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -40,7 +40,9 @@ void Canvas::OnResize(wxSizeEvent&)
// Be careful not to send 'resize' messages to the game before we've
// told it that this canvas exists
if (! m_SuppressResize)
POST_MESSAGE(ResizeScreen, (GetClientSize().GetWidth(), GetClientSize().GetHeight()));
POST_MESSAGE(ResizeScreen, (
GetClientSize().GetWidth() * GetContentScaleFactor(),
GetClientSize().GetHeight() * GetContentScaleFactor()));
// TODO: fix flashing
}
@ -64,6 +66,9 @@ void Canvas::OnMouseCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(evt))
void Canvas::OnMouse(wxMouseEvent& evt)
{
evt.SetX(evt.GetX() * GetContentScaleFactor());
evt.SetY(evt.GetY() * GetContentScaleFactor());
// Capture on button-down, so we can respond even when the mouse
// moves off the window
if (!m_MouseCaptured && evt.ButtonDown())

View File

@ -592,7 +592,8 @@ ScenarioEditor::ScenarioEditor(wxWindow* parent)
POST_MESSAGE(InitSDL, ());
POST_MESSAGE(SetCanvas, (static_cast<wxGLCanvas*>(canvas),
canvas->GetClientSize().GetWidth(), canvas->GetClientSize().GetHeight()));
canvas->GetClientSize().GetWidth() * canvas->GetContentScaleFactor(),
canvas->GetClientSize().GetHeight() * canvas->GetContentScaleFactor()));
POST_MESSAGE(InitGraphics, ());