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.
This commit is contained in:
Vadim Zeitlin 2022-03-20 17:32:52 +01:00
parent 5eab94b7d6
commit 53938a85d3

View File

@ -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);