mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 12:02:00 +00:00
parent
6a41d5e7ad
commit
9f3636a103
@ -70,6 +70,7 @@ used by the tests and examples and are not required to build the library.
|
||||
- Added `GLFW_CONTEXT_NO_ERROR` context hint for `GL_KHR_no_error` support
|
||||
- Added `GLFW_TRUE` and `GLFW_FALSE` as client API independent boolean values
|
||||
- Removed dependency on external OpenGL or OpenGL ES headers
|
||||
- [Win32] Added support for Windows 8.1 per-monitor DPI
|
||||
- [Cocoa] Removed support for OS X 10.6
|
||||
- [X11] Bugfix: Monitor connection and disconnection events were not reported
|
||||
- [X11] Bugfix: Decoding of UTF-8 text from XIM could continue past the end
|
||||
|
@ -99,6 +99,13 @@ static GLFWbool initLibraries(void)
|
||||
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush");
|
||||
}
|
||||
|
||||
_glfw.win32.shcore.instance = LoadLibraryW(L"shcore.dll");
|
||||
if (_glfw.win32.shcore.instance)
|
||||
{
|
||||
_glfw.win32.shcore.SetProcessDPIAwareness = (SETPROCESSDPIAWARENESS_T)
|
||||
GetProcAddress(_glfw.win32.shcore.instance, "SetProcessDPIAwareness");
|
||||
}
|
||||
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
@ -114,6 +121,9 @@ static void terminateLibraries(void)
|
||||
|
||||
if (_glfw.win32.dwmapi.instance)
|
||||
FreeLibrary(_glfw.win32.dwmapi.instance);
|
||||
|
||||
if (_glfw.win32.shcore.instance)
|
||||
FreeLibrary(_glfw.win32.shcore.instance);
|
||||
}
|
||||
|
||||
// Create key code translation tables
|
||||
@ -328,7 +338,9 @@ int _glfwPlatformInit(void)
|
||||
|
||||
createKeyTables();
|
||||
|
||||
if (_glfw_SetProcessDPIAware)
|
||||
if (_glfw_SetProcessDPIAwareness)
|
||||
_glfw_SetProcessDPIAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
|
||||
else if (_glfw_SetProcessDPIAware)
|
||||
_glfw_SetProcessDPIAware();
|
||||
|
||||
if (!_glfwRegisterWindowClass())
|
||||
|
@ -86,6 +86,9 @@
|
||||
#ifndef UNICODE_NOCHAR
|
||||
#define UNICODE_NOCHAR 0xFFFF
|
||||
#endif
|
||||
#ifndef WM_DPICHANGED
|
||||
#define WM_DPICHANGED 0x02E0
|
||||
#endif
|
||||
|
||||
#if WINVER < 0x0601
|
||||
typedef struct tagCHANGEFILTERSTRUCT
|
||||
@ -99,6 +102,15 @@ typedef struct tagCHANGEFILTERSTRUCT
|
||||
#endif
|
||||
#endif /*Windows 7*/
|
||||
|
||||
#ifndef DPI_ENUMS_DECLARED
|
||||
typedef enum PROCESS_DPI_AWARENESS
|
||||
{
|
||||
PROCESS_DPI_UNAWARE = 0,
|
||||
PROCESS_SYSTEM_DPI_AWARE = 1,
|
||||
PROCESS_PER_MONITOR_DPI_AWARE = 2
|
||||
} PROCESS_DPI_AWARENESS;
|
||||
#endif /*DPI_ENUMS_DECLARED*/
|
||||
|
||||
// winmm.dll function pointer typedefs
|
||||
typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T)(UINT,LPJOYCAPS,UINT);
|
||||
typedef MMRESULT (WINAPI * JOYGETPOS_T)(UINT,LPJOYINFO);
|
||||
@ -121,6 +133,10 @@ typedef HRESULT (WINAPI * DWMFLUSH_T)(VOID);
|
||||
#define _glfw_DwmIsCompositionEnabled _glfw.win32.dwmapi.DwmIsCompositionEnabled
|
||||
#define _glfw_DwmFlush _glfw.win32.dwmapi.DwmFlush
|
||||
|
||||
// shcore.dll function pointer typedefs
|
||||
typedef HRESULT (WINAPI * SETPROCESSDPIAWARENESS_T)(PROCESS_DPI_AWARENESS);
|
||||
#define _glfw_SetProcessDPIAwareness _glfw.win32.shcore.SetProcessDPIAwareness
|
||||
|
||||
#include "win32_tls.h"
|
||||
#include "winmm_joystick.h"
|
||||
|
||||
@ -191,6 +207,12 @@ typedef struct _GLFWlibraryWin32
|
||||
DWMFLUSH_T DwmFlush;
|
||||
} dwmapi;
|
||||
|
||||
// shcore.dll
|
||||
struct {
|
||||
HINSTANCE instance;
|
||||
SETPROCESSDPIAWARENESS_T SetProcessDPIAwareness;
|
||||
} shcore;
|
||||
|
||||
} _GLFWlibraryWin32;
|
||||
|
||||
|
||||
|
@ -584,6 +584,19 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DPICHANGED:
|
||||
{
|
||||
RECT* rect = (RECT*) lParam;
|
||||
SetWindowPos(window->win32.handle,
|
||||
HWND_TOP,
|
||||
rect->left,
|
||||
rect->top,
|
||||
rect->right - rect->left,
|
||||
rect->bottom - rect->top,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DEVICECHANGE:
|
||||
{
|
||||
if (DBT_DEVNODES_CHANGED == wParam)
|
||||
|
Loading…
Reference in New Issue
Block a user