2010-09-07 11:34:51 -04:00
|
|
|
//========================================================================
|
2019-04-16 08:43:29 -04:00
|
|
|
// GLFW 3.4 Win32 - www.glfw.org
|
2010-09-07 11:34:51 -04:00
|
|
|
//------------------------------------------------------------------------
|
|
|
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
2019-04-15 14:50:00 -04:00
|
|
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
2010-09-07 11:34:51 -04:00
|
|
|
//
|
|
|
|
// This software is provided 'as-is', without any express or implied
|
|
|
|
// warranty. In no event will the authors be held liable for any damages
|
|
|
|
// arising from the use of this software.
|
|
|
|
//
|
|
|
|
// Permission is granted to anyone to use this software for any purpose,
|
|
|
|
// including commercial applications, and to alter it and redistribute it
|
|
|
|
// freely, subject to the following restrictions:
|
|
|
|
//
|
|
|
|
// 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
// claim that you wrote the original software. If you use this software
|
|
|
|
// in a product, an acknowledgment in the product documentation would
|
|
|
|
// be appreciated but is not required.
|
|
|
|
//
|
|
|
|
// 2. Altered source versions must be plainly marked as such, and must not
|
|
|
|
// be misrepresented as being the original software.
|
|
|
|
//
|
|
|
|
// 3. This notice may not be removed or altered from any source
|
|
|
|
// distribution.
|
|
|
|
//
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
// We don't need all the fancy stuff
|
2012-03-29 17:41:05 -04:00
|
|
|
#ifndef NOMINMAX
|
|
|
|
#define NOMINMAX
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef VC_EXTRALEAN
|
|
|
|
#define VC_EXTRALEAN
|
|
|
|
#endif
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2011-07-27 11:09:17 -04:00
|
|
|
#ifndef WIN32_LEAN_AND_MEAN
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#endif
|
|
|
|
|
2014-08-20 11:49:58 -04:00
|
|
|
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
|
|
|
// example to allow applications to correctly declare a GL_ARB_debug_output
|
|
|
|
// callback) but windows.h assumes no one will define APIENTRY before it does
|
2012-01-18 12:44:28 -05:00
|
|
|
#undef APIENTRY
|
|
|
|
|
2012-02-04 20:41:52 -05:00
|
|
|
// GLFW on Windows is Unicode only and does not work in MBCS mode
|
|
|
|
#ifndef UNICODE
|
|
|
|
#define UNICODE
|
|
|
|
#endif
|
|
|
|
|
2013-09-03 07:38:16 -04:00
|
|
|
// GLFW requires Windows XP or later
|
2013-09-13 06:27:43 -04:00
|
|
|
#if WINVER < 0x0501
|
|
|
|
#undef WINVER
|
2012-03-29 19:55:28 -04:00
|
|
|
#define WINVER 0x0501
|
2012-03-22 09:58:14 -04:00
|
|
|
#endif
|
2013-09-13 06:27:43 -04:00
|
|
|
#if _WIN32_WINNT < 0x0501
|
|
|
|
#undef _WIN32_WINNT
|
2013-09-03 07:38:16 -04:00
|
|
|
#define _WIN32_WINNT 0x0501
|
|
|
|
#endif
|
2012-02-03 14:34:24 -05:00
|
|
|
|
2016-02-16 17:06:29 -05:00
|
|
|
// GLFW uses DirectInput8 interfaces
|
|
|
|
#define DIRECTINPUT_VERSION 0x0800
|
|
|
|
|
2019-02-13 17:21:05 -05:00
|
|
|
// GLFW uses OEM cursor resources
|
2019-02-11 12:14:03 -05:00
|
|
|
#define OEMRESOURCE
|
|
|
|
|
2016-03-31 08:22:54 -04:00
|
|
|
#include <wctype.h>
|
2014-03-31 16:33:22 -04:00
|
|
|
#include <windows.h>
|
2016-02-16 17:06:29 -05:00
|
|
|
#include <dinput.h>
|
2014-08-15 09:08:09 -04:00
|
|
|
#include <xinput.h>
|
2014-03-31 16:33:22 -04:00
|
|
|
#include <dbt.h>
|
|
|
|
|
2016-02-16 17:06:29 -05:00
|
|
|
// HACK: Define macros that some windows.h variants don't
|
2010-09-26 20:32:41 -04:00
|
|
|
#ifndef WM_MOUSEHWHEEL
|
2012-02-04 20:43:49 -05:00
|
|
|
#define WM_MOUSEHWHEEL 0x020E
|
2010-09-07 11:34:51 -04:00
|
|
|
#endif
|
2013-03-11 15:54:32 -04:00
|
|
|
#ifndef WM_DWMCOMPOSITIONCHANGED
|
|
|
|
#define WM_DWMCOMPOSITIONCHANGED 0x031E
|
|
|
|
#endif
|
2014-02-10 09:03:23 -05:00
|
|
|
#ifndef WM_COPYGLOBALDATA
|
|
|
|
#define WM_COPYGLOBALDATA 0x0049
|
|
|
|
#endif
|
2014-03-06 17:33:09 -05:00
|
|
|
#ifndef WM_UNICHAR
|
|
|
|
#define WM_UNICHAR 0x0109
|
|
|
|
#endif
|
|
|
|
#ifndef UNICODE_NOCHAR
|
|
|
|
#define UNICODE_NOCHAR 0xFFFF
|
|
|
|
#endif
|
2015-11-01 11:29:13 -05:00
|
|
|
#ifndef WM_DPICHANGED
|
|
|
|
#define WM_DPICHANGED 0x02E0
|
|
|
|
#endif
|
2015-11-10 07:42:56 -05:00
|
|
|
#ifndef GET_XBUTTON_WPARAM
|
|
|
|
#define GET_XBUTTON_WPARAM(w) (HIWORD(w))
|
|
|
|
#endif
|
2016-02-18 07:34:21 -05:00
|
|
|
#ifndef EDS_ROTATEDMODE
|
|
|
|
#define EDS_ROTATEDMODE 0x00000004
|
|
|
|
#endif
|
|
|
|
#ifndef DISPLAY_DEVICE_ACTIVE
|
|
|
|
#define DISPLAY_DEVICE_ACTIVE 0x00000001
|
|
|
|
#endif
|
2017-09-18 12:10:57 -04:00
|
|
|
#ifndef _WIN32_WINNT_WINBLUE
|
|
|
|
#define _WIN32_WINNT_WINBLUE 0x0602
|
|
|
|
#endif
|
2019-04-14 14:51:46 -04:00
|
|
|
#ifndef _WIN32_WINNT_WIN8
|
|
|
|
#define _WIN32_WINNT_WIN8 0x0602
|
|
|
|
#endif
|
2018-06-07 13:01:07 -04:00
|
|
|
#ifndef WM_GETDPISCALEDSIZE
|
|
|
|
#define WM_GETDPISCALEDSIZE 0x02e4
|
|
|
|
#endif
|
|
|
|
#ifndef USER_DEFAULT_SCREEN_DPI
|
|
|
|
#define USER_DEFAULT_SCREEN_DPI 96
|
|
|
|
#endif
|
2019-02-23 22:04:23 -05:00
|
|
|
#ifndef OCR_HAND
|
|
|
|
#define OCR_HAND 32649
|
|
|
|
#endif
|
2014-02-10 09:03:23 -05:00
|
|
|
|
2014-02-10 15:12:20 -05:00
|
|
|
#if WINVER < 0x0601
|
2017-11-29 15:04:57 -05:00
|
|
|
typedef struct
|
2014-02-10 09:03:23 -05:00
|
|
|
{
|
|
|
|
DWORD cbSize;
|
|
|
|
DWORD ExtStatus;
|
2017-11-29 15:04:57 -05:00
|
|
|
} CHANGEFILTERSTRUCT;
|
2014-02-10 15:12:20 -05:00
|
|
|
#ifndef MSGFLT_ALLOW
|
|
|
|
#define MSGFLT_ALLOW 1
|
|
|
|
#endif
|
|
|
|
#endif /*Windows 7*/
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2017-09-18 12:10:57 -04:00
|
|
|
#if WINVER < 0x0600
|
|
|
|
#define DWM_BB_ENABLE 0x00000001
|
|
|
|
#define DWM_BB_BLURREGION 0x00000002
|
2016-02-23 23:40:22 -05:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DWORD dwFlags;
|
|
|
|
BOOL fEnable;
|
|
|
|
HRGN hRgnBlur;
|
|
|
|
BOOL fTransitionOnMaximized;
|
|
|
|
} DWM_BLURBEHIND;
|
2018-04-15 04:23:34 -04:00
|
|
|
#else
|
2018-04-17 17:02:47 -04:00
|
|
|
#include <dwmapi.h>
|
2017-09-18 12:10:57 -04:00
|
|
|
#endif /*Windows Vista*/
|
2016-02-23 23:40:22 -05:00
|
|
|
|
2017-09-18 12:10:57 -04:00
|
|
|
#ifndef DPI_ENUMS_DECLARED
|
2017-11-29 15:04:57 -05:00
|
|
|
typedef enum
|
2017-08-29 14:05:44 -04:00
|
|
|
{
|
2017-09-18 12:10:57 -04:00
|
|
|
PROCESS_DPI_UNAWARE = 0,
|
|
|
|
PROCESS_SYSTEM_DPI_AWARE = 1,
|
|
|
|
PROCESS_PER_MONITOR_DPI_AWARE = 2
|
|
|
|
} PROCESS_DPI_AWARENESS;
|
2017-11-29 15:04:57 -05:00
|
|
|
typedef enum
|
2017-08-29 13:19:00 -04:00
|
|
|
{
|
|
|
|
MDT_EFFECTIVE_DPI = 0,
|
|
|
|
MDT_ANGULAR_DPI = 1,
|
|
|
|
MDT_RAW_DPI = 2,
|
|
|
|
MDT_DEFAULT = MDT_EFFECTIVE_DPI
|
|
|
|
} MONITOR_DPI_TYPE;
|
2017-09-18 12:10:57 -04:00
|
|
|
#endif /*DPI_ENUMS_DECLARED*/
|
2017-08-29 14:05:44 -04:00
|
|
|
|
2018-09-05 16:45:06 -04:00
|
|
|
#ifndef DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
|
2018-09-26 12:04:53 -04:00
|
|
|
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((HANDLE) -4)
|
2018-09-05 16:45:06 -04:00
|
|
|
#endif /*DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2*/
|
2018-06-07 13:01:07 -04:00
|
|
|
|
2017-09-18 12:10:57 -04:00
|
|
|
// HACK: Define versionhelpers.h functions manually as MinGW lacks the header
|
2018-08-01 18:01:26 -04:00
|
|
|
#define IsWindowsXPOrGreater() \
|
2018-06-07 13:01:07 -04:00
|
|
|
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINXP), \
|
|
|
|
LOBYTE(_WIN32_WINNT_WINXP), 0)
|
|
|
|
#define IsWindowsVistaOrGreater() \
|
|
|
|
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_VISTA), \
|
|
|
|
LOBYTE(_WIN32_WINNT_VISTA), 0)
|
|
|
|
#define IsWindows7OrGreater() \
|
|
|
|
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WIN7), \
|
|
|
|
LOBYTE(_WIN32_WINNT_WIN7), 0)
|
|
|
|
#define IsWindows8OrGreater() \
|
|
|
|
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WIN8), \
|
|
|
|
LOBYTE(_WIN32_WINNT_WIN8), 0)
|
|
|
|
#define IsWindows8Point1OrGreater() \
|
|
|
|
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINBLUE), \
|
|
|
|
LOBYTE(_WIN32_WINNT_WINBLUE), 0)
|
|
|
|
|
|
|
|
#define _glfwIsWindows10AnniversaryUpdateOrGreaterWin32() \
|
|
|
|
_glfwIsWindows10BuildOrGreaterWin32(14393)
|
|
|
|
#define _glfwIsWindows10CreatorsUpdateOrGreaterWin32() \
|
|
|
|
_glfwIsWindows10BuildOrGreaterWin32(15063)
|
2017-08-29 14:05:44 -04:00
|
|
|
|
2016-02-16 17:06:29 -05:00
|
|
|
// HACK: Define macros that some xinput.h variants don't
|
2014-08-15 09:08:09 -04:00
|
|
|
#ifndef XINPUT_CAPS_WIRELESS
|
|
|
|
#define XINPUT_CAPS_WIRELESS 0x0002
|
|
|
|
#endif
|
|
|
|
#ifndef XINPUT_DEVSUBTYPE_WHEEL
|
|
|
|
#define XINPUT_DEVSUBTYPE_WHEEL 0x02
|
|
|
|
#endif
|
|
|
|
#ifndef XINPUT_DEVSUBTYPE_ARCADE_STICK
|
|
|
|
#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
|
|
|
|
#endif
|
|
|
|
#ifndef XINPUT_DEVSUBTYPE_FLIGHT_STICK
|
|
|
|
#define XINPUT_DEVSUBTYPE_FLIGHT_STICK 0x04
|
|
|
|
#endif
|
|
|
|
#ifndef XINPUT_DEVSUBTYPE_DANCE_PAD
|
|
|
|
#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
|
|
|
|
#endif
|
|
|
|
#ifndef XINPUT_DEVSUBTYPE_GUITAR
|
|
|
|
#define XINPUT_DEVSUBTYPE_GUITAR 0x06
|
|
|
|
#endif
|
|
|
|
#ifndef XINPUT_DEVSUBTYPE_DRUM_KIT
|
|
|
|
#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
|
|
|
|
#endif
|
|
|
|
#ifndef XINPUT_DEVSUBTYPE_ARCADE_PAD
|
|
|
|
#define XINPUT_DEVSUBTYPE_ARCADE_PAD 0x13
|
|
|
|
#endif
|
2016-03-31 07:07:06 -04:00
|
|
|
#ifndef XUSER_MAX_COUNT
|
|
|
|
#define XUSER_MAX_COUNT 4
|
|
|
|
#endif
|
2014-08-15 09:08:09 -04:00
|
|
|
|
2016-02-16 17:06:29 -05:00
|
|
|
// HACK: Define macros that some dinput.h variants don't
|
|
|
|
#ifndef DIDFT_OPTIONAL
|
|
|
|
#define DIDFT_OPTIONAL 0x80000000
|
|
|
|
#endif
|
|
|
|
|
2010-09-07 11:34:51 -04:00
|
|
|
// winmm.dll function pointer typedefs
|
2016-12-06 14:10:51 -05:00
|
|
|
typedef DWORD (WINAPI * PFN_timeGetTime)(void);
|
2017-01-29 12:03:51 -05:00
|
|
|
#define timeGetTime _glfw.win32.winmm.GetTime
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2014-08-15 09:08:09 -04:00
|
|
|
// xinput.dll function pointer typedefs
|
2016-12-06 14:10:51 -05:00
|
|
|
typedef DWORD (WINAPI * PFN_XInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*);
|
|
|
|
typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*);
|
2017-01-29 12:03:51 -05:00
|
|
|
#define XInputGetCapabilities _glfw.win32.xinput.GetCapabilities
|
|
|
|
#define XInputGetState _glfw.win32.xinput.GetState
|
2014-08-15 09:08:09 -04:00
|
|
|
|
2016-02-16 17:06:29 -05:00
|
|
|
// dinput8.dll function pointer typedefs
|
2016-12-06 14:10:51 -05:00
|
|
|
typedef HRESULT (WINAPI * PFN_DirectInput8Create)(HINSTANCE,DWORD,REFIID,LPVOID*,LPUNKNOWN);
|
2017-01-29 12:03:51 -05:00
|
|
|
#define DirectInput8Create _glfw.win32.dinput8.Create
|
2016-02-16 17:06:29 -05:00
|
|
|
|
2013-03-10 14:23:42 -04:00
|
|
|
// user32.dll function pointer typedefs
|
2016-12-06 14:10:51 -05:00
|
|
|
typedef BOOL (WINAPI * PFN_SetProcessDPIAware)(void);
|
2017-11-29 15:04:57 -05:00
|
|
|
typedef BOOL (WINAPI * PFN_ChangeWindowMessageFilterEx)(HWND,UINT,DWORD,CHANGEFILTERSTRUCT*);
|
2018-06-07 13:01:07 -04:00
|
|
|
typedef BOOL (WINAPI * PFN_EnableNonClientDpiScaling)(HWND);
|
2018-09-26 12:04:53 -04:00
|
|
|
typedef BOOL (WINAPI * PFN_SetProcessDpiAwarenessContext)(HANDLE);
|
2018-06-07 13:01:07 -04:00
|
|
|
typedef UINT (WINAPI * PFN_GetDpiForWindow)(HWND);
|
|
|
|
typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT);
|
2017-08-29 14:05:44 -04:00
|
|
|
#define SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware_
|
|
|
|
#define ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx_
|
2018-06-07 13:01:07 -04:00
|
|
|
#define EnableNonClientDpiScaling _glfw.win32.user32.EnableNonClientDpiScaling_
|
|
|
|
#define SetProcessDpiAwarenessContext _glfw.win32.user32.SetProcessDpiAwarenessContext_
|
|
|
|
#define GetDpiForWindow _glfw.win32.user32.GetDpiForWindow_
|
|
|
|
#define AdjustWindowRectExForDpi _glfw.win32.user32.AdjustWindowRectExForDpi_
|
2013-03-10 14:23:42 -04:00
|
|
|
|
2013-03-11 15:54:32 -04:00
|
|
|
// dwmapi.dll function pointer typedefs
|
2016-12-06 14:10:51 -05:00
|
|
|
typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*);
|
|
|
|
typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID);
|
2017-09-18 12:10:57 -04:00
|
|
|
typedef HRESULT(WINAPI * PFN_DwmEnableBlurBehindWindow)(HWND,const DWM_BLURBEHIND*);
|
2017-08-20 08:41:49 -04:00
|
|
|
#define DwmIsCompositionEnabled _glfw.win32.dwmapi.IsCompositionEnabled
|
|
|
|
#define DwmFlush _glfw.win32.dwmapi.Flush
|
2017-09-18 12:10:57 -04:00
|
|
|
#define DwmEnableBlurBehindWindow _glfw.win32.dwmapi.EnableBlurBehindWindow
|
2013-03-11 15:54:32 -04:00
|
|
|
|
2015-11-01 11:29:13 -05:00
|
|
|
// shcore.dll function pointer typedefs
|
2016-12-06 14:10:51 -05:00
|
|
|
typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS);
|
2017-08-29 13:19:00 -04:00
|
|
|
typedef HRESULT (WINAPI * PFN_GetDpiForMonitor)(HMONITOR,MONITOR_DPI_TYPE,UINT*,UINT*);
|
2017-08-29 14:05:44 -04:00
|
|
|
#define SetProcessDpiAwareness _glfw.win32.shcore.SetProcessDpiAwareness_
|
2017-08-29 13:19:00 -04:00
|
|
|
#define GetDpiForMonitor _glfw.win32.shcore.GetDpiForMonitor_
|
2015-11-01 11:29:13 -05:00
|
|
|
|
2018-06-07 13:01:07 -04:00
|
|
|
// ntdll.dll function pointer typedefs
|
|
|
|
typedef LONG (WINAPI * PFN_RtlVerifyVersionInfo)(OSVERSIONINFOEXW*,ULONG,ULONGLONG);
|
|
|
|
#define RtlVerifyVersionInfo _glfw.win32.ntdll.RtlVerifyVersionInfo_
|
|
|
|
|
2015-08-10 14:19:04 -04:00
|
|
|
typedef VkFlags VkWin32SurfaceCreateFlagsKHR;
|
|
|
|
|
|
|
|
typedef struct VkWin32SurfaceCreateInfoKHR
|
|
|
|
{
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkWin32SurfaceCreateFlagsKHR flags;
|
|
|
|
HINSTANCE hinstance;
|
|
|
|
HWND hwnd;
|
|
|
|
} VkWin32SurfaceCreateInfoKHR;
|
|
|
|
|
|
|
|
typedef VkResult (APIENTRY *PFN_vkCreateWin32SurfaceKHR)(VkInstance,const VkWin32SurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
|
|
|
|
typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice,uint32_t);
|
|
|
|
|
2015-12-06 09:53:10 -05:00
|
|
|
#include "win32_joystick.h"
|
2016-03-28 07:19:31 -04:00
|
|
|
#include "wgl_context.h"
|
|
|
|
#include "egl_context.h"
|
2017-02-28 13:23:25 -05:00
|
|
|
#include "osmesa_context.h"
|
2010-09-10 16:26:17 -04:00
|
|
|
|
2018-05-16 10:42:51 -04:00
|
|
|
#if !defined(_GLFW_WNDCLASSNAME)
|
|
|
|
#define _GLFW_WNDCLASSNAME L"GLFW30"
|
|
|
|
#endif
|
2015-11-03 09:28:56 -05:00
|
|
|
|
2015-08-10 14:19:04 -04:00
|
|
|
#define _glfw_dlopen(name) LoadLibraryA(name)
|
|
|
|
#define _glfw_dlclose(handle) FreeLibrary((HMODULE) handle)
|
|
|
|
#define _glfw_dlsym(handle, name) GetProcAddress((HMODULE) handle, name)
|
|
|
|
|
2016-03-28 07:19:31 -04:00
|
|
|
#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->win32.handle)
|
|
|
|
#define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
|
|
|
|
|
2013-01-01 19:40:42 -05:00
|
|
|
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 win32
|
|
|
|
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32
|
2017-03-18 18:09:34 -04:00
|
|
|
#define _GLFW_PLATFORM_LIBRARY_TIMER_STATE _GLFWtimerWin32 win32
|
2013-01-01 19:40:42 -05:00
|
|
|
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWin32 win32
|
2013-12-04 08:19:22 -05:00
|
|
|
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWin32 win32
|
2017-03-08 07:58:09 -05:00
|
|
|
#define _GLFW_PLATFORM_TLS_STATE _GLFWtlsWin32 win32
|
2017-05-25 12:23:09 -04:00
|
|
|
#define _GLFW_PLATFORM_MUTEX_STATE _GLFWmutexWin32 win32
|
2010-09-10 16:26:17 -04:00
|
|
|
|
|
|
|
|
2014-09-02 13:42:43 -04:00
|
|
|
// Win32-specific per-window data
|
|
|
|
//
|
2010-09-10 16:26:17 -04:00
|
|
|
typedef struct _GLFWwindowWin32
|
|
|
|
{
|
2014-09-02 13:42:43 -04:00
|
|
|
HWND handle;
|
2016-03-07 08:55:30 -05:00
|
|
|
HICON bigIcon;
|
|
|
|
HICON smallIcon;
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2015-08-23 13:30:04 -04:00
|
|
|
GLFWbool cursorTracked;
|
2017-09-08 10:15:57 -04:00
|
|
|
GLFWbool frameAction;
|
2015-08-23 13:30:04 -04:00
|
|
|
GLFWbool iconified;
|
2016-06-16 07:09:28 -04:00
|
|
|
GLFWbool maximized;
|
2017-09-18 12:10:57 -04:00
|
|
|
// Whether to enable framebuffer transparency on DWM
|
|
|
|
GLFWbool transparent;
|
2018-08-31 07:33:48 -04:00
|
|
|
GLFWbool scaleToMonitor;
|
2014-02-11 12:24:01 -05:00
|
|
|
|
|
|
|
// The last received cursor position, regardless of source
|
2016-05-24 06:23:58 -04:00
|
|
|
int lastCursorPosX, lastCursorPosY;
|
2014-09-02 13:42:43 -04:00
|
|
|
|
2010-09-10 16:26:17 -04:00
|
|
|
} _GLFWwindowWin32;
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2014-09-02 13:42:43 -04:00
|
|
|
// Win32-specific global data
|
|
|
|
//
|
2010-09-10 16:26:17 -04:00
|
|
|
typedef struct _GLFWlibraryWin32
|
|
|
|
{
|
2016-05-30 15:19:00 -04:00
|
|
|
HWND helperWindowHandle;
|
2018-01-04 14:45:55 -05:00
|
|
|
HDEVNOTIFY deviceNotificationHandle;
|
2013-01-02 10:48:02 -05:00
|
|
|
DWORD foregroundLockTimeout;
|
2017-02-09 15:21:58 -05:00
|
|
|
int acquiredMonitorCount;
|
2013-01-02 10:48:02 -05:00
|
|
|
char* clipboardString;
|
2016-09-07 09:43:39 -04:00
|
|
|
short int keycodes[512];
|
|
|
|
short int scancodes[GLFW_KEY_LAST + 1];
|
2017-02-06 21:29:57 -05:00
|
|
|
char keynames[GLFW_KEY_LAST + 1][5];
|
2016-05-25 08:06:02 -04:00
|
|
|
// Where to place the cursor when re-enabled
|
|
|
|
double restoreCursorPosX, restoreCursorPosY;
|
2016-05-30 15:21:09 -04:00
|
|
|
// The window whose disabled cursor mode is active
|
|
|
|
_GLFWwindow* disabledCursorWindow;
|
2017-01-10 12:16:15 -05:00
|
|
|
RAWINPUT* rawInput;
|
|
|
|
int rawInputSize;
|
2018-08-01 18:01:26 -04:00
|
|
|
UINT mouseTrailSize;
|
2010-09-10 16:26:17 -04:00
|
|
|
|
2010-09-13 22:27:02 -04:00
|
|
|
struct {
|
2016-12-06 16:47:25 -05:00
|
|
|
HINSTANCE instance;
|
2017-01-29 12:03:51 -05:00
|
|
|
PFN_timeGetTime GetTime;
|
2010-09-13 22:27:02 -04:00
|
|
|
} winmm;
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2016-02-16 17:06:29 -05:00
|
|
|
struct {
|
2016-12-06 16:47:25 -05:00
|
|
|
HINSTANCE instance;
|
2017-01-29 12:03:51 -05:00
|
|
|
PFN_DirectInput8Create Create;
|
2016-12-06 16:47:25 -05:00
|
|
|
IDirectInput8W* api;
|
2016-02-16 17:06:29 -05:00
|
|
|
} dinput8;
|
|
|
|
|
2013-03-10 14:23:42 -04:00
|
|
|
struct {
|
2016-12-06 16:47:25 -05:00
|
|
|
HINSTANCE instance;
|
2017-01-29 12:03:51 -05:00
|
|
|
PFN_XInputGetCapabilities GetCapabilities;
|
|
|
|
PFN_XInputGetState GetState;
|
2014-08-15 09:08:09 -04:00
|
|
|
} xinput;
|
|
|
|
|
|
|
|
struct {
|
2016-12-06 16:47:25 -05:00
|
|
|
HINSTANCE instance;
|
2017-08-29 14:05:44 -04:00
|
|
|
PFN_SetProcessDPIAware SetProcessDPIAware_;
|
|
|
|
PFN_ChangeWindowMessageFilterEx ChangeWindowMessageFilterEx_;
|
2018-06-07 13:01:07 -04:00
|
|
|
PFN_EnableNonClientDpiScaling EnableNonClientDpiScaling_;
|
|
|
|
PFN_SetProcessDpiAwarenessContext SetProcessDpiAwarenessContext_;
|
|
|
|
PFN_GetDpiForWindow GetDpiForWindow_;
|
|
|
|
PFN_AdjustWindowRectExForDpi AdjustWindowRectExForDpi_;
|
2013-03-10 14:23:42 -04:00
|
|
|
} user32;
|
|
|
|
|
2013-03-11 15:54:32 -04:00
|
|
|
struct {
|
2016-12-06 16:47:25 -05:00
|
|
|
HINSTANCE instance;
|
2017-08-20 08:41:49 -04:00
|
|
|
PFN_DwmIsCompositionEnabled IsCompositionEnabled;
|
|
|
|
PFN_DwmFlush Flush;
|
2017-09-18 12:10:57 -04:00
|
|
|
PFN_DwmEnableBlurBehindWindow EnableBlurBehindWindow;
|
2013-03-11 15:54:32 -04:00
|
|
|
} dwmapi;
|
|
|
|
|
2015-11-01 11:29:13 -05:00
|
|
|
struct {
|
2016-12-06 16:47:25 -05:00
|
|
|
HINSTANCE instance;
|
2017-08-29 14:05:44 -04:00
|
|
|
PFN_SetProcessDpiAwareness SetProcessDpiAwareness_;
|
2017-08-29 13:19:00 -04:00
|
|
|
PFN_GetDpiForMonitor GetDpiForMonitor_;
|
2015-11-01 11:29:13 -05:00
|
|
|
} shcore;
|
|
|
|
|
2018-06-07 13:01:07 -04:00
|
|
|
struct {
|
|
|
|
HINSTANCE instance;
|
|
|
|
PFN_RtlVerifyVersionInfo RtlVerifyVersionInfo_;
|
|
|
|
} ntdll;
|
|
|
|
|
2010-09-10 16:26:17 -04:00
|
|
|
} _GLFWlibraryWin32;
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2014-09-02 13:42:43 -04:00
|
|
|
// Win32-specific per-monitor data
|
|
|
|
//
|
2011-10-03 03:24:35 -04:00
|
|
|
typedef struct _GLFWmonitorWin32
|
2011-10-02 16:13:47 -04:00
|
|
|
{
|
2017-08-27 16:42:23 -04:00
|
|
|
HMONITOR handle;
|
2013-02-20 09:44:37 -05:00
|
|
|
// This size matches the static size of DISPLAY_DEVICE.DeviceName
|
2014-09-12 11:00:05 -04:00
|
|
|
WCHAR adapterName[32];
|
|
|
|
WCHAR displayName[32];
|
2017-11-06 12:27:39 -05:00
|
|
|
char publicAdapterName[32];
|
|
|
|
char publicDisplayName[32];
|
2015-08-23 13:30:04 -04:00
|
|
|
GLFWbool modesPruned;
|
|
|
|
GLFWbool modeChanged;
|
2011-10-06 17:28:56 -04:00
|
|
|
|
2011-10-03 03:24:35 -04:00
|
|
|
} _GLFWmonitorWin32;
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2014-09-02 13:42:43 -04:00
|
|
|
// Win32-specific per-cursor data
|
|
|
|
//
|
2013-12-04 08:19:22 -05:00
|
|
|
typedef struct _GLFWcursorWin32
|
|
|
|
{
|
2016-12-06 16:47:25 -05:00
|
|
|
HCURSOR handle;
|
2014-09-02 13:42:43 -04:00
|
|
|
|
2013-12-04 08:19:22 -05:00
|
|
|
} _GLFWcursorWin32;
|
|
|
|
|
2014-09-02 13:42:43 -04:00
|
|
|
// Win32-specific global timer data
|
|
|
|
//
|
2017-03-18 18:09:34 -04:00
|
|
|
typedef struct _GLFWtimerWin32
|
2014-03-27 12:19:22 -04:00
|
|
|
{
|
2015-08-23 13:30:04 -04:00
|
|
|
GLFWbool hasPC;
|
2016-03-23 05:09:07 -04:00
|
|
|
uint64_t frequency;
|
2014-03-27 12:19:22 -04:00
|
|
|
|
2017-03-18 18:09:34 -04:00
|
|
|
} _GLFWtimerWin32;
|
2014-03-27 12:19:22 -04:00
|
|
|
|
2017-03-08 07:58:09 -05:00
|
|
|
// Win32-specific thread local storage data
|
2015-12-03 12:16:46 -05:00
|
|
|
//
|
|
|
|
typedef struct _GLFWtlsWin32
|
|
|
|
{
|
2016-12-06 16:47:25 -05:00
|
|
|
GLFWbool allocated;
|
2017-03-08 07:58:09 -05:00
|
|
|
DWORD index;
|
2015-12-03 12:16:46 -05:00
|
|
|
|
|
|
|
} _GLFWtlsWin32;
|
|
|
|
|
2017-05-25 12:23:09 -04:00
|
|
|
// Win32-specific mutex data
|
|
|
|
//
|
|
|
|
typedef struct _GLFWmutexWin32
|
|
|
|
{
|
|
|
|
GLFWbool allocated;
|
|
|
|
CRITICAL_SECTION section;
|
|
|
|
|
|
|
|
} _GLFWmutexWin32;
|
|
|
|
|
2015-12-03 12:16:46 -05:00
|
|
|
|
|
|
|
GLFWbool _glfwRegisterWindowClassWin32(void);
|
|
|
|
void _glfwUnregisterWindowClassWin32(void);
|
|
|
|
|
|
|
|
WCHAR* _glfwCreateWideStringFromUTF8Win32(const char* source);
|
|
|
|
char* _glfwCreateUTF8FromWideStringWin32(const WCHAR* source);
|
2018-06-07 13:01:07 -04:00
|
|
|
BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp);
|
|
|
|
BOOL _glfwIsWindows10BuildOrGreaterWin32(WORD build);
|
2017-01-19 14:29:27 -05:00
|
|
|
void _glfwInputErrorWin32(int error, const char* description);
|
2017-02-06 21:29:57 -05:00
|
|
|
void _glfwUpdateKeyNamesWin32(void);
|
2012-02-04 20:07:50 -05:00
|
|
|
|
2015-12-03 12:16:46 -05:00
|
|
|
void _glfwInitTimerWin32(void);
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2016-12-04 19:19:48 -05:00
|
|
|
void _glfwPollMonitorsWin32(void);
|
2018-02-05 11:11:04 -05:00
|
|
|
void _glfwSetVideoModeWin32(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
2015-12-03 12:16:46 -05:00
|
|
|
void _glfwRestoreVideoModeWin32(_GLFWmonitor* monitor);
|
2017-08-29 13:19:00 -04:00
|
|
|
void _glfwGetMonitorContentScaleWin32(HMONITOR handle, float* xscale, float* yscale);
|
2010-09-07 11:34:51 -04:00
|
|
|
|