diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2019-09-15 15:19:29 +0000 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2019-09-15 15:19:29 +0000 |
commit | 8a9ffef52bb825507643eac07446dbec1af5c153 (patch) | |
tree | 51c663c737d917d7fca6ad25f1545e1d4cf18cb8 | |
parent | f4cd637056333396347f290a250f8727f2f1854c (diff) | |
download | gtk+-8a9ffef52bb825507643eac07446dbec1af5c153.tar.gz |
Revert "Merge branch 'remove-mingw-SetupDiGetDevicePropertyW-check-3-24' into 'gtk-3-24'"
This reverts merge request !862
-rw-r--r-- | config.h.meson | 3 | ||||
-rw-r--r-- | configure.ac | 26 | ||||
-rw-r--r-- | gdk/win32/gdkmonitor-win32.c | 14 | ||||
-rw-r--r-- | meson.build | 13 |
4 files changed, 56 insertions, 0 deletions
diff --git a/config.h.meson b/config.h.meson index 93495755d5..480f5689eb 100644 --- a/config.h.meson +++ b/config.h.meson @@ -116,6 +116,9 @@ /* Define to 1 if you have the `round' function. */ #mesondefine HAVE_ROUND +/* Define to 1 if SetupDiGetDevicePropertyW() is available */ +#mesondefine HAVE_SETUP_DI_GET_DEVICE_PROPERTY_W + /* Define to 1 if you have the `sincos' function. */ #mesondefine HAVE_SINCOS diff --git a/configure.ac b/configure.ac index 230df57c6e..9736f846cc 100644 --- a/configure.ac +++ b/configure.ac @@ -726,6 +726,32 @@ AS_CASE([$host_os], [AC_MSG_ERROR([DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY is unavailable])], [AC_MSG_RESULT([DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY is not OK])] ) + AC_MSG_CHECKING([for SetupDiGetDevicePropertyW]) + gtk_save_LIBS="$LIBS" + LIBS="-lsetupapi $LIBS" + AC_TRY_LINK( + [ +#define _WIN32_WINNT 0x0600 +#include <windows.h> +#include <devpropdef.h> +#include <setupapi.h> + ], + [return SetupDiGetDevicePropertyW(NULL, NULL, NULL, NULL, NULL, 0, NULL, 0);], + [have_SetupDiGetDevicePropertyW=yes], + [have_SetupDiGetDevicePropertyW=no] + ) + AS_IF( + [test x$have_SetupDiGetDevicePropertyW = xyes], + [ + AC_DEFINE( + [HAVE_SETUP_DI_GET_DEVICE_PROPERTY_W], + [1], + [Define to 1 if SetupDiGetDevicePropertyW() is available] + ) + ] + ) + AC_MSG_RESULT([$have_SetupDiGetDevicePropertyW]) + LIBS="$gtk_save_LIBS" ], [] ) diff --git a/gdk/win32/gdkmonitor-win32.c b/gdk/win32/gdkmonitor-win32.c index 43df44e095..2f7afd3a74 100644 --- a/gdk/win32/gdkmonitor-win32.c +++ b/gdk/win32/gdkmonitor-win32.c @@ -144,6 +144,20 @@ typedef LONG #define MONITORINFOF_PRIMARY 1 #endif +/* MinGW-w64 does not have a prototype for function in its headers + * at the moment of writing. + */ +#if !defined (HAVE_SETUP_DI_GET_DEVICE_PROPERTY_W) +BOOL WINAPI SetupDiGetDevicePropertyW (HDEVINFO DeviceInfoSet, + PSP_DEVINFO_DATA DeviceInfoData, + const DEVPROPKEY *PropertyKey, + DEVPROPTYPE *PropertyType, + PBYTE PropertyBuffer, + DWORD PropertyBufferSize, + PDWORD RequiredSize, + DWORD Flags); +#endif + #define G_GUID_FORMAT "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X" #define g_format_guid(guid) (guid)->Data1, \ (guid)->Data2, \ diff --git a/meson.build b/meson.build index 21d62a39c4..1127047d24 100644 --- a/meson.build +++ b/meson.build @@ -780,6 +780,19 @@ if os_win32 #include <windows.h> ''') cdata.set('SIZEOF_DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY', dvot_size) + + getdevprop_code = ''' + #define _WIN32_WINNT 0x0600 + #include <windows.h> + #include <devpropdef.h> + #include <setupapi.h> + + int main(int argc, char *argv[]) { + return SetupDiGetDevicePropertyW(NULL, NULL, NULL, NULL, NULL, 0, NULL, 0); + } + ''' + result = cc.links(getdevprop_code, args: ['-lsetupapi'], name: 'has SetupDiGetDevicePropertyW') + cdata.set('HAVE_SETUP_DI_GET_DEVICE_PROPERTY_W', result ? 1 : false) endif have_gio_unix = false |