[gtk/wip.win32.fixes: 490/494] gtk: Define _WIN32_WINNT and friends as cflags




commit e78f74f26536d5573a4d37388c005fd747c210ec
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Sat Mar 26 11:12:18 2022 +0800

    gtk: Define _WIN32_WINNT and friends as cflags
    
    Instead of scattering them around, define _WIN32_WINNT, WINVER and
    NTDDIVER in gtk/meson.build, like what we do in GDK-Win32.
    
    Also, since we are requiring Windows 7 or later in GDK-Win32, do
    likewise in GTK, since GDK nowadays is in the same DLL/library as GTK,
    so we should make things more uniform.

 gtk/gtkfilechoosernativewin32.c |  4 ----
 gtk/gtkprint-win32.c            | 10 ----------
 gtk/gtkprintoperation-win32.c   | 10 ----------
 gtk/meson.build                 |  7 ++++++-
 4 files changed, 6 insertions(+), 25 deletions(-)
---
diff --git a/gtk/gtkfilechoosernativewin32.c b/gtk/gtkfilechoosernativewin32.c
index 97150e650d..76674394a4 100644
--- a/gtk/gtkfilechoosernativewin32.c
+++ b/gtk/gtkfilechoosernativewin32.c
@@ -19,10 +19,6 @@
 
 #include "config.h"
 
-/* Vista or newer */
-#define _WIN32_WINNT 0x0600
-#include <sdkddkver.h>
-
 #define COBJMACROS
 
 #include "gtkfilechoosernativeprivate.h"
diff --git a/gtk/gtkprint-win32.c b/gtk/gtkprint-win32.c
index 76b1d699cd..f71eb77081 100644
--- a/gtk/gtkprint-win32.c
+++ b/gtk/gtkprint-win32.c
@@ -16,16 +16,6 @@
  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _MSC_VER
-#ifndef _WIN32_WINNT
-/* Vista or newer */
-#define _WIN32_WINNT 0x0600
-#endif
-#ifndef WINVER
-#define WINVER _WIN32_WINNT
-#endif
-#endif
-
 #include "config.h"
 #include "gtkprint-win32.h"
 
diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c
index 0e81beefd6..3701d12687 100644
--- a/gtk/gtkprintoperation-win32.c
+++ b/gtk/gtkprintoperation-win32.c
@@ -16,16 +16,6 @@
  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _MSC_VER
-#ifndef _WIN32_WINNT
-/* Vista or newer */
-#define _WIN32_WINNT 0x0600
-#endif
-#ifndef WINVER
-#define WINVER _WIN32_WINNT
-#endif
-#endif
-
 #define COBJMACROS
 #include "config.h"
 #include <math.h>
diff --git a/gtk/meson.build b/gtk/meson.build
index 4e7325ad57..cf6428738a 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -1072,7 +1072,12 @@ if broadway_enabled
 endif
 
 if win32_enabled
-  gtk_cargs += ['-DGTK_PRINT_BACKENDS="file,lpr"']
+  gtk_cargs += [
+    '-DGTK_PRINT_BACKENDS="file,lpr"',
+    '-D_WIN32_WINNT=0x0601',  # Windows 7 or later
+    '-DWINVER=0x0601',
+    '-DNTDDI_VERSION=NTDDI_WIN7',
+  ]
   gtk_deps += [ giowin32_dep, pangowin32_dep ]
 
   gtk_deps += [


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]