diff --git a/include/wx/osx/window.h b/include/wx/osx/window.h index af92472618..479307975e 100644 --- a/include/wx/osx/window.h +++ b/include/wx/osx/window.h @@ -151,6 +151,7 @@ public: // -------------- void OnMouseEvent( wxMouseEvent &event ); + void OnDPIChanged( wxDPIChangedEvent& event ); void MacOnScroll( wxScrollEvent&event ); diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index 6e0ab1cfe8..0aac85e24a 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -79,6 +79,7 @@ wxBEGIN_EVENT_TABLE(wxWindowMac, wxWindowBase) EVT_MOUSE_EVENTS(wxWindowMac::OnMouseEvent) + EVT_DPI_CHANGED(wxWindowMac::OnDPIChanged) wxEND_EVENT_TABLE() #define wxMAC_DEBUG_REDRAW 0 @@ -2345,6 +2346,25 @@ void wxWindowMac::OnMouseEvent( wxMouseEvent &event ) } } +// propagate the dpi changed event to the subwindows +void wxWindowMac::OnDPIChanged(wxDPIChangedEvent& event) +{ + wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); + while ( node ) + { + // Only propagate to non-top-level windows + wxWindow *win = node->GetData(); + if ( !win->IsTopLevel() ) + { + wxDPIChangedEvent event2( event.GetOldDPI(), event.GetNewDPI() ); + event2.SetEventObject(win); + win->GetEventHandler()->ProcessEvent(event2); + } + + node = node->GetNext(); + } +} + void wxWindowMac::TriggerScrollEvent( wxEventType WXUNUSED(scrollEvent) ) { }