From 53938a85d356dbb510d25c784f25d1ecae5ee8ff Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 20 Mar 2022 17:32:52 +0100 Subject: [PATCH] Fix wxTaskBarIconWindow::GetContentScaleFactor() in wxOSX Don't crash if this function is called (which is not the case yet, but will be after the upcoming commit, when it's going to be implicitly used when updating the bitmaps for taskbar icon menu), but return the content scale factor for the main screen, which should be the right thing to do here. --- src/osx/cocoa/taskbar.mm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/osx/cocoa/taskbar.mm b/src/osx/cocoa/taskbar.mm index 04c574dc82..b3966549d5 100644 --- a/src/osx/cocoa/taskbar.mm +++ b/src/osx/cocoa/taskbar.mm @@ -40,6 +40,8 @@ class wxTaskBarIconWindow : public wxTopLevelWindow public: wxTaskBarIconWindow(wxTaskBarIconImpl *impl); + double GetContentScaleFactor() const wxOVERRIDE; + void OnMenuEvent(wxCommandEvent& event); void OnUpdateUIEvent(wxUpdateUIEvent& event); @@ -426,6 +428,13 @@ wxTaskBarIconWindow::wxTaskBarIconWindow(wxTaskBarIconImpl *impl) { } +double wxTaskBarIconWindow::GetContentScaleFactor() const +{ + // We don't have any real window here, so use the main screen scale, which + // should be appropriate for dock/status icons. + return wxOSXGetMainScreenContentScaleFactor(); +} + void wxTaskBarIconWindow::OnMenuEvent(wxCommandEvent& event) { m_impl->GetTaskBarIcon()->ProcessEvent(event);