win32_platform.h
Go to the documentation of this file.
1 //========================================================================
2 // GLFW 3.1 Win32 - www.glfw.org
3 //------------------------------------------------------------------------
4 // Copyright (c) 2002-2006 Marcus Geelnard
5 // Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
6 //
7 // This software is provided 'as-is', without any express or implied
8 // warranty. In no event will the authors be held liable for any damages
9 // arising from the use of this software.
10 //
11 // Permission is granted to anyone to use this software for any purpose,
12 // including commercial applications, and to alter it and redistribute it
13 // freely, subject to the following restrictions:
14 //
15 // 1. The origin of this software must not be misrepresented; you must not
16 // claim that you wrote the original software. If you use this software
17 // in a product, an acknowledgment in the product documentation would
18 // be appreciated but is not required.
19 //
20 // 2. Altered source versions must be plainly marked as such, and must not
21 // be misrepresented as being the original software.
22 //
23 // 3. This notice may not be removed or altered from any source
24 // distribution.
25 //
26 //========================================================================
27 
28 #ifndef _glfw3_win32_platform_h_
29 #define _glfw3_win32_platform_h_
30 
31 // We don't need all the fancy stuff
32 #ifndef NOMINMAX
33  #define NOMINMAX
34 #endif
35 
36 #ifndef VC_EXTRALEAN
37  #define VC_EXTRALEAN
38 #endif
39 
40 #ifndef WIN32_LEAN_AND_MEAN
41  #define WIN32_LEAN_AND_MEAN
42 #endif
43 
44 // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
45 // example to allow applications to correctly declare a GL_ARB_debug_output
46 // callback) but windows.h assumes no one will define APIENTRY before it does
47 #undef APIENTRY
48 
49 // GLFW on Windows is Unicode only and does not work in MBCS mode
50 #ifndef UNICODE
51  #define UNICODE
52 #endif
53 
54 // GLFW requires Windows XP or later
55 #if WINVER < 0x0501
56  #undef WINVER
57  #define WINVER 0x0501
58 #endif
59 #if _WIN32_WINNT < 0x0501
60  #undef _WIN32_WINNT
61  #define _WIN32_WINNT 0x0501
62 #endif
63 
64 #include <windows.h>
65 #include <mmsystem.h>
66 #include <dbt.h>
67 
68 #if defined(_MSC_VER)
69  #include <malloc.h>
70  #define strdup _strdup
71 #endif
72 
73 // HACK: Define macros that some older windows.h variants don't
74 #ifndef WM_MOUSEHWHEEL
75  #define WM_MOUSEHWHEEL 0x020E
76 #endif
77 #ifndef WM_DWMCOMPOSITIONCHANGED
78  #define WM_DWMCOMPOSITIONCHANGED 0x031E
79 #endif
80 #ifndef WM_COPYGLOBALDATA
81  #define WM_COPYGLOBALDATA 0x0049
82 #endif
83 #ifndef WM_UNICHAR
84  #define WM_UNICHAR 0x0109
85 #endif
86 #ifndef UNICODE_NOCHAR
87  #define UNICODE_NOCHAR 0xFFFF
88 #endif
89 
90 #if WINVER < 0x0601
91 typedef struct tagCHANGEFILTERSTRUCT
92 {
93  DWORD cbSize;
94  DWORD ExtStatus;
95 
97 #ifndef MSGFLT_ALLOW
98  #define MSGFLT_ALLOW 1
99 #endif
100 #endif /*Windows 7*/
101 
102 // winmm.dll function pointer typedefs
103 typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T)(UINT,LPJOYCAPS,UINT);
104 typedef MMRESULT (WINAPI * JOYGETPOS_T)(UINT,LPJOYINFO);
105 typedef MMRESULT (WINAPI * JOYGETPOSEX_T)(UINT,LPJOYINFOEX);
106 typedef DWORD (WINAPI * TIMEGETTIME_T)(void);
107 #define _glfw_joyGetDevCaps _glfw.win32.winmm.joyGetDevCaps
108 #define _glfw_joyGetPos _glfw.win32.winmm.joyGetPos
109 #define _glfw_joyGetPosEx _glfw.win32.winmm.joyGetPosEx
110 #define _glfw_timeGetTime _glfw.win32.winmm.timeGetTime
111 
112 // user32.dll function pointer typedefs
113 typedef BOOL (WINAPI * SETPROCESSDPIAWARE_T)(void);
115 #define _glfw_SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware
116 #define _glfw_ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx
117 
118 // dwmapi.dll function pointer typedefs
119 typedef HRESULT (WINAPI * DWMISCOMPOSITIONENABLED_T)(BOOL*);
120 typedef HRESULT (WINAPI * DWMFLUSH_T)(VOID);
121 #define _glfw_DwmIsCompositionEnabled _glfw.win32.dwmapi.DwmIsCompositionEnabled
122 #define _glfw_DwmFlush _glfw.win32.dwmapi.DwmFlush
123 
124 #define _GLFW_RECREATION_NOT_NEEDED 0
125 #define _GLFW_RECREATION_REQUIRED 1
126 #define _GLFW_RECREATION_IMPOSSIBLE 2
127 
128 #include "win32_tls.h"
129 #include "winmm_joystick.h"
130 
131 #if defined(_GLFW_WGL)
132  #include "wgl_context.h"
133 #elif defined(_GLFW_EGL)
134  #define _GLFW_EGL_NATIVE_WINDOW window->win32.handle
135  #define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
136  #include "egl_context.h"
137 #else
138  #error "No supported context creation API selected"
139 #endif
140 
141 #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 win32
142 #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32
143 #define _GLFW_PLATFORM_LIBRARY_TIME_STATE _GLFWtimeWin32 win32_time
144 #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWin32 win32
145 #define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWin32 win32
146 
147 
148 // Win32-specific per-window data
149 //
150 typedef struct _GLFWwindowWin32
151 {
152  HWND handle;
153 
156 
157  // The last received cursor position, regardless of source
158  int cursorPosX, cursorPosY;
159 
161 
162 
163 // Win32-specific global data
164 //
165 typedef struct _GLFWlibraryWin32
166 {
169  short int publicKeys[512];
170 
171  // winmm.dll
172  struct {
173  HINSTANCE instance;
178  } winmm;
179 
180  // user32.dll
181  struct {
182  HINSTANCE instance;
185  } user32;
186 
187  // dwmapi.dll
188  struct {
189  HINSTANCE instance;
192  } dwmapi;
193 
195 
196 
197 // Win32-specific per-monitor data
198 //
199 typedef struct _GLFWmonitorWin32
200 {
201  // This size matches the static size of DISPLAY_DEVICE.DeviceName
202  WCHAR adapterName[32];
203  WCHAR displayName[32];
204  char publicAdapterName[64];
205  char publicDisplayName[64];
208 
210 
211 
212 // Win32-specific per-cursor data
213 //
214 typedef struct _GLFWcursorWin32
215 {
216  HCURSOR handle;
217 
219 
220 
221 // Win32-specific global timer data
222 //
223 typedef struct _GLFWtimeWin32
224 {
226  double resolution;
227  unsigned __int64 base;
228 
230 
231 
233 void _glfwUnregisterWindowClass(void);
234 
236 
237 WCHAR* _glfwCreateWideStringFromUTF8(const char* source);
238 char* _glfwCreateUTF8FromWideString(const WCHAR* source);
239 
240 void _glfwInitTimer(void);
241 
242 GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
243 void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
244 
245 #endif // _glfw3_win32_platform_h_
unsigned __int64 base
JOYGETPOSEX_T joyGetPosEx
struct _GLFWmonitorWin32 _GLFWmonitorWin32
MMRESULT(WINAPI * JOYGETDEVCAPS_T)(UINT, LPJOYCAPS, UINT)
struct tagCHANGEFILTERSTRUCT * PCHANGEFILTERSTRUCT
void _glfwInitTimer(void)
Definition: win32_time.c:52
DWMISCOMPOSITIONENABLED_T DwmIsCompositionEnabled
WCHAR * _glfwCreateWideStringFromUTF8(const char *source)
Definition: win32_init.c:277
struct _GLFWwindowWin32 _GLFWwindowWin32
struct _GLFWcursorWin32 _GLFWcursorWin32
CHANGEWINDOWMESSAGEFILTEREX_T ChangeWindowMessageFilterEx
GLboolean _glfwRegisterWindowClass(void)
Definition: win32_window.c:753
TIMEGETTIME_T timeGetTime
BOOL(WINAPI * SETPROCESSDPIAWARE_T)(void)
Monitor structure.
Definition: internal.h:299
struct tagCHANGEFILTERSTRUCT CHANGEFILTERSTRUCT
void _glfwRestoreVideoMode(_GLFWmonitor *monitor)
Definition: win32_monitor.c:89
MMRESULT(WINAPI * JOYGETPOSEX_T)(UINT, LPJOYINFOEX)
typedef GLboolean(APIENTRYP PFNGLISQUERYPROC)(GLuint id)
void _glfwUnregisterWindowClass(void)
Definition: win32_window.c:787
SETPROCESSDPIAWARE_T SetProcessDPIAware
BOOL(WINAPI * CHANGEWINDOWMESSAGEFILTEREX_T)(HWND, UINT, DWORD, PCHANGEFILTERSTRUCT)
struct _GLFWtimeWin32 _GLFWtimeWin32
char * _glfwCreateUTF8FromWideString(const WCHAR *source)
Definition: win32_init.c:299
JOYGETPOS_T joyGetPos
typedef BOOL(WINAPI *PFNWGLSAVEBUFFERREGIONARBPROC)(HANDLE hRegion
HRESULT(WINAPI * DWMISCOMPOSITIONENABLED_T)(BOOL *)
typedef VOID(WINAPI *PFNWGLDELETEBUFFERREGIONARBPROC)(HANDLE hRegion)
GLboolean cursorTracked
typedef void(APIENTRYP PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode
Video mode type.
Definition: glfw3.h:983
GLsizei GLsizei GLchar * source
Definition: glext.h:672
DWORD(WINAPI * TIMEGETTIME_T)(void)
struct _GLFWlibraryWin32 _GLFWlibraryWin32
JOYGETDEVCAPS_T joyGetDevCaps
BOOL _glfwIsCompositionEnabled(void)
Definition: win32_init.c:262
typedef UINT(WINAPI *PFNWGLGETGPUIDSAMDPROC)(UINT maxCount
HRESULT(WINAPI * DWMFLUSH_T)(VOID)
GLboolean _glfwSetVideoMode(_GLFWmonitor *monitor, const GLFWvidmode *desired)
Definition: win32_monitor.c:50
MMRESULT(WINAPI * JOYGETPOS_T)(UINT, LPJOYINFO)


librealsense
Author(s): Sergey Dorodnicov , Mark Horn , Reagan Lopez
autogenerated on Fri Mar 13 2020 03:16:18