win32_platform.h
Go to the documentation of this file.
00001 //========================================================================
00002 // GLFW 3.1 Win32 - www.glfw.org
00003 //------------------------------------------------------------------------
00004 // Copyright (c) 2002-2006 Marcus Geelnard
00005 // Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
00006 //
00007 // This software is provided 'as-is', without any express or implied
00008 // warranty. In no event will the authors be held liable for any damages
00009 // arising from the use of this software.
00010 //
00011 // Permission is granted to anyone to use this software for any purpose,
00012 // including commercial applications, and to alter it and redistribute it
00013 // freely, subject to the following restrictions:
00014 //
00015 // 1. The origin of this software must not be misrepresented; you must not
00016 //    claim that you wrote the original software. If you use this software
00017 //    in a product, an acknowledgment in the product documentation would
00018 //    be appreciated but is not required.
00019 //
00020 // 2. Altered source versions must be plainly marked as such, and must not
00021 //    be misrepresented as being the original software.
00022 //
00023 // 3. This notice may not be removed or altered from any source
00024 //    distribution.
00025 //
00026 //========================================================================
00027 
00028 #ifndef _glfw3_win32_platform_h_
00029 #define _glfw3_win32_platform_h_
00030 
00031 // We don't need all the fancy stuff
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 // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
00045 // example to allow applications to correctly declare a GL_ARB_debug_output
00046 // callback) but windows.h assumes no one will define APIENTRY before it does
00047 #undef APIENTRY
00048 
00049 // GLFW on Windows is Unicode only and does not work in MBCS mode
00050 #ifndef UNICODE
00051  #define UNICODE
00052 #endif
00053 
00054 // GLFW requires Windows XP or later
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 // HACK: Define macros that some older windows.h variants don't
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 /*Windows 7*/
00101 
00102 // winmm.dll function pointer typedefs
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 // user32.dll function pointer typedefs
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 // dwmapi.dll function pointer typedefs
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 // Win32-specific per-window data
00149 //
00150 typedef struct _GLFWwindowWin32
00151 {
00152     HWND                handle;
00153 
00154     GLboolean           cursorTracked;
00155     GLboolean           iconified;
00156 
00157     // The last received cursor position, regardless of source
00158     int                 cursorPosX, cursorPosY;
00159 
00160 } _GLFWwindowWin32;
00161 
00162 
00163 // Win32-specific global data
00164 //
00165 typedef struct _GLFWlibraryWin32
00166 {
00167     DWORD               foregroundLockTimeout;
00168     char*               clipboardString;
00169     short int           publicKeys[512];
00170 
00171     // winmm.dll
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     // user32.dll
00181     struct {
00182         HINSTANCE       instance;
00183         SETPROCESSDPIAWARE_T SetProcessDPIAware;
00184         CHANGEWINDOWMESSAGEFILTEREX_T ChangeWindowMessageFilterEx;
00185     } user32;
00186 
00187     // dwmapi.dll
00188     struct {
00189         HINSTANCE       instance;
00190         DWMISCOMPOSITIONENABLED_T DwmIsCompositionEnabled;
00191         DWMFLUSH_T      DwmFlush;
00192     } dwmapi;
00193 
00194 } _GLFWlibraryWin32;
00195 
00196 
00197 // Win32-specific per-monitor data
00198 //
00199 typedef struct _GLFWmonitorWin32
00200 {
00201     // This size matches the static size of DISPLAY_DEVICE.DeviceName
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 // Win32-specific per-cursor data
00213 //
00214 typedef struct _GLFWcursorWin32
00215 {
00216     HCURSOR handle;
00217 
00218 } _GLFWcursorWin32;
00219 
00220 
00221 // Win32-specific global timer data
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_


librealsense
Author(s): Sergey Dorodnicov , Mark Horn , Reagan Lopez
autogenerated on Tue Jun 25 2019 19:54:39