Win32: Fix standard cursors not being DPI aware

Closes #1431.
This commit is contained in:
Max Risuhin 2019-02-11 19:14:03 +02:00 committed by Camilla Löwy
parent 90e22947c6
commit cf79f06257
2 changed files with 12 additions and 8 deletions

View File

@ -61,6 +61,9 @@
// GLFW uses DirectInput8 interfaces // GLFW uses DirectInput8 interfaces
#define DIRECTINPUT_VERSION 0x0800 #define DIRECTINPUT_VERSION 0x0800
// Enable standard cursors images defines
#define OEMRESOURCE
#include <wctype.h> #include <wctype.h>
#include <windows.h> #include <windows.h>
#include <dinput.h> #include <dinput.h>

View File

@ -1999,24 +1999,25 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
{ {
LPCWSTR name = NULL; int id = 0;
if (shape == GLFW_ARROW_CURSOR) if (shape == GLFW_ARROW_CURSOR)
name = IDC_ARROW; id = OCR_NORMAL;
else if (shape == GLFW_IBEAM_CURSOR) else if (shape == GLFW_IBEAM_CURSOR)
name = IDC_IBEAM; id = OCR_IBEAM;
else if (shape == GLFW_CROSSHAIR_CURSOR) else if (shape == GLFW_CROSSHAIR_CURSOR)
name = IDC_CROSS; id = OCR_CROSS;
else if (shape == GLFW_HAND_CURSOR) else if (shape == GLFW_HAND_CURSOR)
name = IDC_HAND; id = OCR_HAND;
else if (shape == GLFW_HRESIZE_CURSOR) else if (shape == GLFW_HRESIZE_CURSOR)
name = IDC_SIZEWE; id = OCR_SIZEWE;
else if (shape == GLFW_VRESIZE_CURSOR) else if (shape == GLFW_VRESIZE_CURSOR)
name = IDC_SIZENS; id = OCR_SIZENS;
else else
return GLFW_FALSE; return GLFW_FALSE;
cursor->win32.handle = CopyCursor(LoadCursorW(NULL, name)); cursor->win32.handle =
(HCURSOR)LoadImage(NULL, MAKEINTRESOURCE(id), IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED);
if (!cursor->win32.handle) if (!cursor->win32.handle)
{ {
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR, _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,