Return display PPI from wxDC::GetPPI() in wxGTK3
For wxDC associated with a window, such as wx{Window,Client,Paint}DC, this method should return the window PPI, not the hard coded 72 DPI of Cairo graphics context. This still doesn't work correctly when using multiple monitors with different DPI settings, but is still a (modest) improvement.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "wx/dcclient.h"
|
||||
#include "wx/dcmemory.h"
|
||||
#include "wx/dcscreen.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/gtk/dc.h"
|
||||
|
||||
@@ -237,6 +238,18 @@ void* wxGTKCairoDCImpl::GetCairoContext() const
|
||||
return cr;
|
||||
}
|
||||
|
||||
wxSize wxGTKCairoDCImpl::GetPPI() const
|
||||
{
|
||||
if ( m_window )
|
||||
{
|
||||
return wxGetDisplayPPI();
|
||||
}
|
||||
|
||||
// For a non-window-based DC the concept of PPI doesn't make much sense
|
||||
// anyhow, so just return the hardcoded value used by the base class.
|
||||
return wxGCDCImpl::GetPPI();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
wxWindowDCImpl::wxWindowDCImpl(wxWindowDC* owner, wxWindow* window)
|
||||
|
Reference in New Issue
Block a user