diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index c999473fc2c8..66fc0fa0c33a 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -90,6 +90,9 @@ class WXDLLIMPEXP_CORE wxWindowGTK : public wxWindowBase virtual int GetCharHeight() const; virtual int GetCharWidth() const; +#if defined __WXGTK3__ + virtual double GetContentScaleFactor() const; +#endif virtual void SetScrollbar( int orient, int pos, int thumbVisible, int range, bool refresh = true ); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index ec693187280c..eaaa42fde71d 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -3429,6 +3429,20 @@ void wxWindowGTK::DoGetTextExtent( const wxString& string, txm.GetTextExtent(string, x, y, descent, externalLeading); } +#ifdef __WXGTK3__ +double wxWindowGTK::GetContentScaleFactor() const +{ + double scaleFactor = 1; +#if GTK_CHECK_VERSION(3,10,0) + if (m_widget && gtk_check_version(3,10,0) == NULL) + { + scaleFactor = gtk_widget_get_scale_factor(m_widget); + } +#endif + return scaleFactor; +} +#endif + void wxWindowGTK::GTKDisableFocusOutEvent() { g_signal_handlers_block_by_func( m_focusWidget, diff --git a/version-script.in b/version-script.in index 51cf8dde64e2..f74b5afc2da4 100644 --- a/version-script.in +++ b/version-script.in @@ -27,6 +27,7 @@ *wxSVGFileDCImpl*SetAxisOrientation*; *wxSVGFileDCImpl*SetDeviceOrigin*; *wxSVGFileDCImpl*SetLogicalOrigin*; + *wxWindow*GetContentScaleFactor*; }; # public symbols added in 3.0.4 (please keep in alphabetical order): @@ -64,5 +65,8 @@ # Explicitly mention this one as otherwise it would be caught by # wxDataViewRenderer*FinishEditing wildcard in 3.0.3 above. *wxDataViewRendererBase*FinishEditing*; + # This would otherwise match *wxWindow*GetContentScaleFactor* + # in 3.0.5 above. + *wxWindowBase*GetContentScaleFactor*; *; };