use common contentScaleFactor also for DPI on macOS
and give a reasonable default for missing tlw
This commit is contained in:
committed by
Vadim Zeitlin
parent
c346fd0321
commit
08a63c3b49
@@ -2648,7 +2648,10 @@ void wxWidgetCocoaImpl::SetVisibility( bool visible )
|
||||
double wxWidgetCocoaImpl::GetContentScaleFactor() const
|
||||
{
|
||||
NSWindow* tlw = [m_osxView window];
|
||||
return [tlw backingScaleFactor];
|
||||
if ( tlw )
|
||||
return [tlw backingScaleFactor];
|
||||
else
|
||||
return wxOSXGetMainScreenContentScaleFactor();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -2636,13 +2636,7 @@ wxSize wxWindowMac::GetDPI() const
|
||||
// on mac ContentScale and DPIScale are identical
|
||||
double wxWindowMac::GetDPIScaleFactor() const
|
||||
{
|
||||
double scaleFactor;
|
||||
if ( wxNonOwnedWindow* tlw = MacGetTopLevelWindow() )
|
||||
scaleFactor = tlw->GetContentScaleFactor();
|
||||
else
|
||||
scaleFactor = wxOSXGetMainScreenContentScaleFactor();
|
||||
|
||||
return scaleFactor;
|
||||
return GetContentScaleFactor();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user