Win32: Fix calls to encoding compatibility macros

Calls to Unicode specific functions should be made explicit.
This commit is contained in:
Camilla Löwy 2022-03-08 23:45:53 +01:00 committed by Camilla Löwy
parent 723f3eb40d
commit 8ff9ed92b4
4 changed files with 16 additions and 16 deletions

View File

@ -490,7 +490,7 @@ void _glfwUpdateKeyNamesWin32(void)
vk = vks[key - GLFW_KEY_KP_0]; vk = vks[key - GLFW_KEY_KP_0];
} }
else else
vk = MapVirtualKey(scancode, MAPVK_VSC_TO_VK); vk = MapVirtualKeyW(scancode, MAPVK_VSC_TO_VK);
length = ToUnicode(vk, scancode, state, length = ToUnicode(vk, scancode, state,
chars, sizeof(chars) / sizeof(WCHAR), chars, sizeof(chars) / sizeof(WCHAR),

View File

@ -574,7 +574,7 @@ GLFWbool _glfwInitJoysticksWin32(void)
{ {
if (_glfw.win32.dinput8.instance) if (_glfw.win32.dinput8.instance)
{ {
if (FAILED(DirectInput8Create(GetModuleHandle(NULL), if (FAILED(DirectInput8Create(GetModuleHandleW(NULL),
DIRECTINPUT_VERSION, DIRECTINPUT_VERSION,
&IID_IDirectInput8W, &IID_IDirectInput8W,
(void**) &_glfw.win32.dinput8.api, (void**) &_glfw.win32.dinput8.api,

View File

@ -381,7 +381,7 @@ void _glfwGetMonitorWorkareaWin32(_GLFWmonitor* monitor,
int* width, int* height) int* width, int* height)
{ {
MONITORINFO mi = { sizeof(mi) }; MONITORINFO mi = { sizeof(mi) };
GetMonitorInfo(monitor->win32.handle, &mi); GetMonitorInfoW(monitor->win32.handle, &mi);
if (xpos) if (xpos)
*xpos = mi.rcWork.left; *xpos = mi.rcWork.left;

View File

@ -434,7 +434,7 @@ static int getKeyMods(void)
static void fitToMonitor(_GLFWwindow* window) static void fitToMonitor(_GLFWwindow* window)
{ {
MONITORINFO mi = { sizeof(mi) }; MONITORINFO mi = { sizeof(mi) };
GetMonitorInfo(window->monitor->win32.handle, &mi); GetMonitorInfoW(window->monitor->win32.handle, &mi);
SetWindowPos(window->win32.handle, HWND_TOPMOST, SetWindowPos(window->win32.handle, HWND_TOPMOST,
mi.rcMonitor.left, mi.rcMonitor.left,
mi.rcMonitor.top, mi.rcMonitor.top,
@ -453,8 +453,8 @@ static void acquireMonitor(_GLFWwindow* window)
// HACK: When mouse trails are enabled the cursor becomes invisible when // HACK: When mouse trails are enabled the cursor becomes invisible when
// the OpenGL ICD switches to page flipping // the OpenGL ICD switches to page flipping
SystemParametersInfo(SPI_GETMOUSETRAILS, 0, &_glfw.win32.mouseTrailSize, 0); SystemParametersInfoW(SPI_GETMOUSETRAILS, 0, &_glfw.win32.mouseTrailSize, 0);
SystemParametersInfo(SPI_SETMOUSETRAILS, 0, 0, 0); SystemParametersInfoW(SPI_SETMOUSETRAILS, 0, 0, 0);
} }
if (!window->monitor->window) if (!window->monitor->window)
@ -477,7 +477,7 @@ static void releaseMonitor(_GLFWwindow* window)
SetThreadExecutionState(ES_CONTINUOUS); SetThreadExecutionState(ES_CONTINUOUS);
// HACK: Restore mouse trail length saved in acquireMonitor // HACK: Restore mouse trail length saved in acquireMonitor
SystemParametersInfo(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0); SystemParametersInfoW(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0);
} }
_glfwInputMonitorWindow(window->monitor, NULL); _glfwInputMonitorWindow(window->monitor, NULL);
@ -492,8 +492,8 @@ static void maximizeWindowManually(_GLFWwindow* window)
DWORD style; DWORD style;
MONITORINFO mi = { sizeof(mi) }; MONITORINFO mi = { sizeof(mi) };
GetMonitorInfo(MonitorFromWindow(window->win32.handle, GetMonitorInfoW(MonitorFromWindow(window->win32.handle,
MONITOR_DEFAULTTONEAREST), &mi); MONITOR_DEFAULTTONEAREST), &mi);
rect = mi.rcWork; rect = mi.rcWork;
@ -1126,7 +1126,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
ZeroMemory(&mi, sizeof(mi)); ZeroMemory(&mi, sizeof(mi));
mi.cbSize = sizeof(mi); mi.cbSize = sizeof(mi);
GetMonitorInfo(mh, &mi); GetMonitorInfoW(mh, &mi);
mmi->ptMaxPosition.x = mi.rcWork.left - mi.rcMonitor.left; mmi->ptMaxPosition.x = mi.rcWork.left - mi.rcMonitor.left;
mmi->ptMaxPosition.y = mi.rcWork.top - mi.rcMonitor.top; mmi->ptMaxPosition.y = mi.rcWork.top - mi.rcMonitor.top;
@ -1392,7 +1392,7 @@ static int createNativeWindow(_GLFWwindow* window,
if (wndconfig->maximized && !wndconfig->decorated) if (wndconfig->maximized && !wndconfig->decorated)
{ {
MONITORINFO mi = { sizeof(mi) }; MONITORINFO mi = { sizeof(mi) };
GetMonitorInfo(mh, &mi); GetMonitorInfoW(mh, &mi);
SetWindowPos(window->win32.handle, HWND_TOP, SetWindowPos(window->win32.handle, HWND_TOP,
mi.rcWork.left, mi.rcWork.left,
@ -1561,8 +1561,8 @@ void _glfwSetWindowIconWin32(_GLFWwindow* window,
smallIcon = (HICON) GetClassLongPtrW(window->win32.handle, GCLP_HICONSM); smallIcon = (HICON) GetClassLongPtrW(window->win32.handle, GCLP_HICONSM);
} }
SendMessage(window->win32.handle, WM_SETICON, ICON_BIG, (LPARAM) bigIcon); SendMessageW(window->win32.handle, WM_SETICON, ICON_BIG, (LPARAM) bigIcon);
SendMessage(window->win32.handle, WM_SETICON, ICON_SMALL, (LPARAM) smallIcon); SendMessageW(window->win32.handle, WM_SETICON, ICON_SMALL, (LPARAM) smallIcon);
if (window->win32.bigIcon) if (window->win32.bigIcon)
DestroyIcon(window->win32.bigIcon); DestroyIcon(window->win32.bigIcon);
@ -1831,7 +1831,7 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
acquireMonitor(window); acquireMonitor(window);
GetMonitorInfo(window->monitor->win32.handle, &mi); GetMonitorInfoW(window->monitor->win32.handle, &mi);
SetWindowPos(window->win32.handle, HWND_TOPMOST, SetWindowPos(window->win32.handle, HWND_TOPMOST,
mi.rcMonitor.left, mi.rcMonitor.left,
mi.rcMonitor.top, mi.rcMonitor.top,
@ -2128,7 +2128,7 @@ void _glfwWaitEventsTimeoutWin32(double timeout)
void _glfwPostEmptyEventWin32(void) void _glfwPostEmptyEventWin32(void)
{ {
PostMessage(_glfw.win32.helperWindowHandle, WM_NULL, 0, 0); PostMessageW(_glfw.win32.helperWindowHandle, WM_NULL, 0, 0);
} }
void _glfwGetCursorPosWin32(_GLFWwindow* window, double* xpos, double* ypos) void _glfwGetCursorPosWin32(_GLFWwindow* window, double* xpos, double* ypos)
@ -2445,7 +2445,7 @@ VkResult _glfwCreateWindowSurfaceWin32(VkInstance instance,
memset(&sci, 0, sizeof(sci)); memset(&sci, 0, sizeof(sci));
sci.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; sci.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
sci.hinstance = GetModuleHandle(NULL); sci.hinstance = GetModuleHandleW(NULL);
sci.hwnd = window->win32.handle; sci.hwnd = window->win32.handle;
err = vkCreateWin32SurfaceKHR(instance, &sci, allocator, surface); err = vkCreateWin32SurfaceKHR(instance, &sci, allocator, surface);