[gtk/wip.win32.fixes: 7/10] gtk: Define _WIN32_WINNT and friends as cflags




commit 0eb207a2078e5531ed5286e3430e23dcfdf878a1
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 bd08939e86..2f9b436390 100644
--- a/gtk/gtkfilechoosernativewin32.c
+++ b/gtk/gtkfilechoosernativewin32.c
@@ -19,10 +19,6 @@
 
 #include "config.h"
 
-/* Vista or newer */
-#define _WIN32_WINNT 0x0600
-#define WINVER _WIN32_WINNT
-#define NTDDI_VERSION NTDDI_VISTA
 #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 43d63bb815..308c81e03a 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 2e404f2ac4..50816b28d2 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -1140,7 +1140,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]