Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _glfw3_win32_platform_h_
00029 #define _glfw3_win32_platform_h_
00030
00031
00032 #ifndef NOMINMAX
00033 #define NOMINMAX
00034 #endif
00035
00036 #ifndef VC_EXTRALEAN
00037 #define VC_EXTRALEAN
00038 #endif
00039
00040 #ifndef WIN32_LEAN_AND_MEAN
00041 #define WIN32_LEAN_AND_MEAN
00042 #endif
00043
00044
00045
00046
00047 #undef APIENTRY
00048
00049
00050 #ifndef UNICODE
00051 #define UNICODE
00052 #endif
00053
00054
00055 #if WINVER < 0x0501
00056 #undef WINVER
00057 #define WINVER 0x0501
00058 #endif
00059 #if _WIN32_WINNT < 0x0501
00060 #undef _WIN32_WINNT
00061 #define _WIN32_WINNT 0x0501
00062 #endif
00063
00064 #include <windows.h>
00065 #include <mmsystem.h>
00066 #include <dbt.h>
00067
00068 #if defined(_MSC_VER)
00069 #include <malloc.h>
00070 #define strdup _strdup
00071 #endif
00072
00073
00074 #ifndef WM_MOUSEHWHEEL
00075 #define WM_MOUSEHWHEEL 0x020E
00076 #endif
00077 #ifndef WM_DWMCOMPOSITIONCHANGED
00078 #define WM_DWMCOMPOSITIONCHANGED 0x031E
00079 #endif
00080 #ifndef WM_COPYGLOBALDATA
00081 #define WM_COPYGLOBALDATA 0x0049
00082 #endif
00083 #ifndef WM_UNICHAR
00084 #define WM_UNICHAR 0x0109
00085 #endif
00086 #ifndef UNICODE_NOCHAR
00087 #define UNICODE_NOCHAR 0xFFFF
00088 #endif
00089
00090 #if WINVER < 0x0601
00091 typedef struct tagCHANGEFILTERSTRUCT
00092 {
00093 DWORD cbSize;
00094 DWORD ExtStatus;
00095
00096 } CHANGEFILTERSTRUCT, *PCHANGEFILTERSTRUCT;
00097 #ifndef MSGFLT_ALLOW
00098 #define MSGFLT_ALLOW 1
00099 #endif
00100 #endif
00101
00102
00103 typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T)(UINT,LPJOYCAPS,UINT);
00104 typedef MMRESULT (WINAPI * JOYGETPOS_T)(UINT,LPJOYINFO);
00105 typedef MMRESULT (WINAPI * JOYGETPOSEX_T)(UINT,LPJOYINFOEX);
00106 typedef DWORD (WINAPI * TIMEGETTIME_T)(void);
00107 #define _glfw_joyGetDevCaps _glfw.win32.winmm.joyGetDevCaps
00108 #define _glfw_joyGetPos _glfw.win32.winmm.joyGetPos
00109 #define _glfw_joyGetPosEx _glfw.win32.winmm.joyGetPosEx
00110 #define _glfw_timeGetTime _glfw.win32.winmm.timeGetTime
00111
00112
00113 typedef BOOL (WINAPI * SETPROCESSDPIAWARE_T)(void);
00114 typedef BOOL (WINAPI * CHANGEWINDOWMESSAGEFILTEREX_T)(HWND,UINT,DWORD,PCHANGEFILTERSTRUCT);
00115 #define _glfw_SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware
00116 #define _glfw_ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx
00117
00118
00119 typedef HRESULT (WINAPI * DWMISCOMPOSITIONENABLED_T)(BOOL*);
00120 typedef HRESULT (WINAPI * DWMFLUSH_T)(VOID);
00121 #define _glfw_DwmIsCompositionEnabled _glfw.win32.dwmapi.DwmIsCompositionEnabled
00122 #define _glfw_DwmFlush _glfw.win32.dwmapi.DwmFlush
00123
00124 #define _GLFW_RECREATION_NOT_NEEDED 0
00125 #define _GLFW_RECREATION_REQUIRED 1
00126 #define _GLFW_RECREATION_IMPOSSIBLE 2
00127
00128 #include "win32_tls.h"
00129 #include "winmm_joystick.h"
00130
00131 #if defined(_GLFW_WGL)
00132 #include "wgl_context.h"
00133 #elif defined(_GLFW_EGL)
00134 #define _GLFW_EGL_NATIVE_WINDOW window->win32.handle
00135 #define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
00136 #include "egl_context.h"
00137 #else
00138 #error "No supported context creation API selected"
00139 #endif
00140
00141 #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 win32
00142 #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32
00143 #define _GLFW_PLATFORM_LIBRARY_TIME_STATE _GLFWtimeWin32 win32_time
00144 #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWin32 win32
00145 #define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWin32 win32
00146
00147
00148
00149
00150 typedef struct _GLFWwindowWin32
00151 {
00152 HWND handle;
00153
00154 GLboolean cursorTracked;
00155 GLboolean iconified;
00156
00157
00158 int cursorPosX, cursorPosY;
00159
00160 } _GLFWwindowWin32;
00161
00162
00163
00164
00165 typedef struct _GLFWlibraryWin32
00166 {
00167 DWORD foregroundLockTimeout;
00168 char* clipboardString;
00169 short int publicKeys[512];
00170
00171
00172 struct {
00173 HINSTANCE instance;
00174 JOYGETDEVCAPS_T joyGetDevCaps;
00175 JOYGETPOS_T joyGetPos;
00176 JOYGETPOSEX_T joyGetPosEx;
00177 TIMEGETTIME_T timeGetTime;
00178 } winmm;
00179
00180
00181 struct {
00182 HINSTANCE instance;
00183 SETPROCESSDPIAWARE_T SetProcessDPIAware;
00184 CHANGEWINDOWMESSAGEFILTEREX_T ChangeWindowMessageFilterEx;
00185 } user32;
00186
00187
00188 struct {
00189 HINSTANCE instance;
00190 DWMISCOMPOSITIONENABLED_T DwmIsCompositionEnabled;
00191 DWMFLUSH_T DwmFlush;
00192 } dwmapi;
00193
00194 } _GLFWlibraryWin32;
00195
00196
00197
00198
00199 typedef struct _GLFWmonitorWin32
00200 {
00201
00202 WCHAR adapterName[32];
00203 WCHAR displayName[32];
00204 char publicAdapterName[64];
00205 char publicDisplayName[64];
00206 GLboolean modesPruned;
00207 GLboolean modeChanged;
00208
00209 } _GLFWmonitorWin32;
00210
00211
00212
00213
00214 typedef struct _GLFWcursorWin32
00215 {
00216 HCURSOR handle;
00217
00218 } _GLFWcursorWin32;
00219
00220
00221
00222
00223 typedef struct _GLFWtimeWin32
00224 {
00225 GLboolean hasPC;
00226 double resolution;
00227 unsigned __int64 base;
00228
00229 } _GLFWtimeWin32;
00230
00231
00232 GLboolean _glfwRegisterWindowClass(void);
00233 void _glfwUnregisterWindowClass(void);
00234
00235 BOOL _glfwIsCompositionEnabled(void);
00236
00237 WCHAR* _glfwCreateWideStringFromUTF8(const char* source);
00238 char* _glfwCreateUTF8FromWideString(const WCHAR* source);
00239
00240 void _glfwInitTimer(void);
00241
00242 GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
00243 void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
00244
00245 #endif // _glfw3_win32_platform_h_