Give a warning when using default scale factor in wxGtkImage

This is not supposed to happen, but warn about it if it nevertheless
does.
This commit is contained in:
Vadim Zeitlin
2022-03-04 03:36:38 +01:00
parent 8f43e103e9
commit 570b78ebb5

View File

@@ -7,6 +7,7 @@
#include "wx/wxprec.h"
#include "wx/log.h"
#include "wx/window.h"
#include "wx/gtk/private/wrapgtk.h"
@@ -46,6 +47,12 @@ double BitmapProviderDefault::GetScale() const
{
return m_win->GetDPIScaleFactor();
}
// We expect to always have a window by the time this function is called,
// so while we try to do something reasonable even if we don't have it,
// at least log it because this is not expected to happen.
wxLogDebug("No window in wxGtkImage, using main window scale.");
#if GTK_CHECK_VERSION(3,10,0)
return gdk_window_get_scale_factor(wxGetTopLevelGDK());
#else