From 570b78ebb52986bab65a7cc38bc73ca4a10d0ffd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 4 Mar 2022 03:36:38 +0100 Subject: [PATCH] Give a warning when using default scale factor in wxGtkImage This is not supposed to happen, but warn about it if it nevertheless does. --- src/gtk/image_gtk.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gtk/image_gtk.cpp b/src/gtk/image_gtk.cpp index 4636e5a96a..10e9af1113 100644 --- a/src/gtk/image_gtk.cpp +++ b/src/gtk/image_gtk.cpp @@ -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