1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 07:39:42 +02:00
audacity/win/wxWidgets_additions/changeset_14f052a7680fc5ddb3e95d29c23b79c7209c9353.diff
2015-07-20 09:31:06 -05:00

89 lines
3.1 KiB
Diff

Index: include/wx/msw/init.h
===================================================================
--- include/wx/msw/init.h (revision 3f66f6a5b3583b02c34854556eb83e3a808524ce)
+++ include/wx/msw/init.h (revision 14f052a7680fc5ddb3e95d29c23b79c7209c9353)
@@ -30,4 +30,8 @@
typedef char *wxCmdLineArgType;
#endif
+
+// Call this function to prevent wxMSW from calling SetProcessDPIAware().
+// Must be called before wxEntry().
+extern WXDLLIMPEXP_CORE void wxMSWDisableSettingHighDPIAware();
// Windows-only overloads of wxEntry() and wxEntryStart() which take the
Index: interface/wx/app.h
===================================================================
--- interface/wx/app.h (revision ab48d8299099bf1979c1c797bf1cf17b086c46f2)
+++ interface/wx/app.h (revision 14f052a7680fc5ddb3e95d29c23b79c7209c9353)
@@ -1090,5 +1090,9 @@
@endcode
- @header{wx/app.h}
+ @onlyfor{wxmsw}
+
+ @header{wx/app.h}
+
+ @see wxMSWDisableSettingHighDPIAware()
*/
int wxEntry(HINSTANCE hInstance,
Index: interface/wx/init.h
===================================================================
--- interface/wx/init.h (revision 3f66f6a5b3583b02c34854556eb83e3a808524ce)
+++ interface/wx/init.h (revision 14f052a7680fc5ddb3e95d29c23b79c7209c9353)
@@ -108,4 +108,21 @@
void wxUninitialize();
+/**
+ Prevents wxWidgets from setting HighDPI awareness mode.
+
+ wxEntry calls SetDPIProcessAware() early during initialization on Windows.
+ To prevent this (e.g. because wx is embedded in native code and disabling
+ DPI awareness in the manifest is not an option), call this function
+ *before* wxEntry() is called.
+
+ @onlyfor{wxmsw}
+
+ @header{wx/init.h}
+
+ @since 3.0.3, but only available in 3.0.x, not 3.1+ which doesn't make
+ the SetDPIProcessAware() call anymore.
+*/
+void wxMSWDisableSettingHighDPIAware();
+
//@}
Index: src/msw/main.cpp
===================================================================
--- src/msw/main.cpp (revision 3f66f6a5b3583b02c34854556eb83e3a808524ce)
+++ src/msw/main.cpp (revision 14f052a7680fc5ddb3e95d29c23b79c7209c9353)
@@ -298,5 +298,20 @@
}
+// It is sometimes undesirable to force DPI awareness on appplications, e.g.
+// when they are artwork heavy and don't have appropriately scaled bitmaps, or
+// when they are using non-wx, DPI-unaware code. Allow disabling
+// SetProcessDPIAware() call.
+//
+// Further discussion:
+// http://trac.wxwidgets.org/ticket/16116
+// https://groups.google.com/d/topic/wx-dev/Z0VpgzCY34U/discussion
+bool gs_allowChangingDPIAwareness = true;
+
} //anonymous namespace
+
+void wxMSWDisableSettingHighDPIAware()
+{
+ gs_allowChangingDPIAwareness = false;
+}
// ----------------------------------------------------------------------------
@@ -406,5 +421,7 @@
// Note that we intentionally do it here and not in wxApp, so that it
// doesn't happen if wx code is hosted in another app (e.g. a plugin).
- wxSetProcessDPIAware();
+ // It can be disabled by calling wxMSWAllowChangingDPIAwareness().
+ if ( gs_allowChangingDPIAwareness )
+ wxSetProcessDPIAware();
if ( !wxMSWEntryCommon(hInstance, nCmdShow) )