[gimp] plug-ins: properly load user32.dll for SetProcessDPIAware().
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: properly load user32.dll for SetProcessDPIAware().
- Date: Tue, 15 May 2018 22:42:00 +0000 (UTC)
commit a0b28589acbe5fc901264a3bbe44e73a86aa18dd
Author: Jehan <jehan girinstud io>
Date: Tue May 15 22:18:11 2018 +0200
plug-ins: properly load user32.dll for SetProcessDPIAware().
Using similar code as other parts of Win32 code.
I hope I am not doing anything wrong. At least now it builds!
plug-ins/screenshot/screenshot-win32.c | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/screenshot/screenshot-win32.c b/plug-ins/screenshot/screenshot-win32.c
index d2ccaee..201926a 100644
--- a/plug-ins/screenshot/screenshot-win32.c
+++ b/plug-ins/screenshot/screenshot-win32.c
@@ -29,6 +29,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
+/* Necessary in order to have SetProcessDPIAware() defined.
+ * This value of _WIN32_WINNT corresponds to Windows 7, which is our
+ * minimum supported platform.
+ */
+#ifdef _WIN32_WINNT
+#undef _WIN32_WINNT
+#endif
+#define _WIN32_WINNT 0x0601
#include <windows.h>
#include <libgimp/gimp.h>
@@ -1132,8 +1141,21 @@ BOOL
InitInstance (HINSTANCE hInstance,
int nCmdShow)
{
- /* This line fix bug: https://bugzilla.gnome.org/show_bug.cgi?id=796121#c4 */
- SetProcessDPIAware();
+ HINSTANCE User32Library = LoadLibrary ("user32.dll");
+
+ if (User32Library)
+ {
+ typedef BOOL (WINAPI* SET_PROC_DPI_AWARE)();
+ SET_PROC_DPI_AWARE SetProcessDPIAware;
+
+ /* This line fix bug: https://bugzilla.gnome.org/show_bug.cgi?id=796121#c4 */
+ SetProcessDPIAware = (SET_PROC_DPI_AWARE) GetProcAddress (User32Library,
+ "SetProcessDPIAware");
+ if (SetProcessDPIAware)
+ SetProcessDPIAware();
+
+ FreeLibrary (User32Library);
+ }
/* Create our window */
mainHwnd = CreateWindow (APP_NAME, APP_NAME, WS_OVERLAPPEDWINDOW,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]