diff options
author | Davide Beatrici <davidebeatrici@gmail.com> | 2019-09-12 23:03:26 +0300 |
---|---|---|
committer | Davide Beatrici <davidebeatrici@gmail.com> | 2019-09-12 23:03:26 +0300 |
commit | e29897c784f546dc8c7150811994663818911608 (patch) | |
tree | c6fde77b7427fe65a5369c60ea64f0b6d061609c | |
parent | 58d27c68a9d131e111ca488b42469bdae68e06e2 (diff) |
Add "win.h" header, meant to be included instead of <windows.h>
This commit also merges "qos2_mingw.h" into the new header.
-rw-r--r-- | src/qos2_mingw.h | 19 | ||||
-rw-r--r-- | src/win.h | 52 |
2 files changed, 52 insertions, 19 deletions
diff --git a/src/qos2_mingw.h b/src/qos2_mingw.h deleted file mode 100644 index 95b529758..000000000 --- a/src/qos2_mingw.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2005-2019 The Mumble Developers. All rights reserved. -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file at the root of the -// Mumble source tree or at <https://www.mumble.info/LICENSE>. - -// This is a collection of fixes for MinGW's <qos2.h> header. -// MinGW's <qos2.h> header does not provide everything we need, -// so define QOS_FLOWID (and PQOS_FLOWID) as well as QOS_NON_ADAPTIVE_FLOW ourselves -// to allow us to build with QoS support on MinGW. - -#ifndef MUMBLE_QOS2_MINGW_H_ -#define MUMBLE_QOS2_MINGW_H_ - -#ifdef __MINGW32__ - typedef UINT32 QOS_FLOWID, *PQOS_FLOWID; - #define QOS_NON_ADAPTIVE_FLOW 0x00000002 // MinGW's qos2.h header doesn't define QOS_NON_ADAPTIVE_FLOW, so we define it ourselves for MinGW to use. -#endif - -#endif diff --git a/src/win.h b/src/win.h new file mode 100644 index 000000000..0a9e1d58b --- /dev/null +++ b/src/win.h @@ -0,0 +1,52 @@ +// Copyright 2005-2019 The Mumble Developers. All rights reserved. +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file at the root of the +// Mumble source tree or at <https://www.mumble.info/LICENSE>. + +// This header is meant to be included instead of <windows.h>. +// It takes care of including <windows.h> with the right settings and +// for MinGW compilers it defines stuff that is missing in MinGW’s headers. + +#ifndef MUMBLE_WIN_H_ +#define MUMBLE_WIN_H_ + +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif + +#ifndef UNICODE +# define UNICODE +#endif + +#ifndef NOMINMAX +# define NOMINMAX +#endif + +#ifdef __MINGW32__ +// Our MinGW build targets Windows 7 for now. +// Set up the appropriate Windows macros such that +// MinGW's Windows headers expose all the functionality +// we need. +// This seems to be required only with MXE, with MSYS2 +// the target is already Windows 7 +# if (_WIN32_WINNT < 0x0601) +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0601 +# endif +# if (NTDDI_VERSION < NTDDI_WIN7) +# undef NTDDI_VERSION +# define NTDDI_VERSION NTDDI_WIN7 +# endif + +// MinGW's <qos2.h> header does not provide everything we need, +// so define QOS_FLOWID (and PQOS_FLOWID) as well as QOS_NON_ADAPTIVE_FLOW +// ourselves to allow us to build with QoS support on MinGW. +typedef UINT32 QOS_FLOWID, *PQOS_FLOWID; +# ifndef QOS_NON_ADAPTIVE_FLOW +# define QOS_NON_ADAPTIVE_FLOW 0x00000002 +# endif +#endif + +#include <windows.h> + +#endif // MUMBLE_WIN_H_ |