Made use of Win32 W-suffixed symbols explicit.
This commit is contained in:
parent
d169557b00
commit
0701d4ce6e
@ -306,7 +306,7 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
||||
//
|
||||
int _glfwInitContextAPI(void)
|
||||
{
|
||||
_glfw.wgl.opengl32.instance = LoadLibrary(L"opengl32.dll");
|
||||
_glfw.wgl.opengl32.instance = LoadLibraryW(L"opengl32.dll");
|
||||
if (!_glfw.wgl.opengl32.instance)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Failed to load opengl32.dll");
|
||||
|
@ -37,13 +37,13 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||
{
|
||||
HDC dc;
|
||||
WORD values[768];
|
||||
DISPLAY_DEVICE display;
|
||||
DISPLAY_DEVICEW display;
|
||||
|
||||
ZeroMemory(&display, sizeof(DISPLAY_DEVICE));
|
||||
display.cb = sizeof(DISPLAY_DEVICE);
|
||||
EnumDisplayDevices(monitor->win32.name, 0, &display, 0);
|
||||
ZeroMemory(&display, sizeof(DISPLAY_DEVICEW));
|
||||
display.cb = sizeof(DISPLAY_DEVICEW);
|
||||
EnumDisplayDevicesW(monitor->win32.name, 0, &display, 0);
|
||||
|
||||
dc = CreateDC(L"DISPLAY", display.DeviceString, NULL, NULL);
|
||||
dc = CreateDCW(L"DISPLAY", display.DeviceString, NULL, NULL);
|
||||
GetDeviceGammaRamp(dc, values);
|
||||
DeleteDC(dc);
|
||||
|
||||
@ -71,11 +71,11 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||
memcpy(values + 256, ramp->green, 256 * sizeof(unsigned short));
|
||||
memcpy(values + 512, ramp->blue, 256 * sizeof(unsigned short));
|
||||
|
||||
ZeroMemory(&display, sizeof(DISPLAY_DEVICE));
|
||||
display.cb = sizeof(DISPLAY_DEVICE);
|
||||
EnumDisplayDevices(monitor->win32.name, 0, &display, 0);
|
||||
ZeroMemory(&display, sizeof(DISPLAY_DEVICEW));
|
||||
display.cb = sizeof(DISPLAY_DEVICEW);
|
||||
EnumDisplayDevicesW(monitor->win32.name, 0, &display, 0);
|
||||
|
||||
dc = CreateDC(L"DISPLAY", display.DeviceString, NULL, NULL);
|
||||
dc = CreateDCW(L"DISPLAY", display.DeviceString, NULL, NULL);
|
||||
SetDeviceGammaRamp(dc, values);
|
||||
DeleteDC(dc);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ static GLboolean initLibraries(void)
|
||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
||||
// winmm.dll (for joystick and timer support)
|
||||
|
||||
_glfw.win32.winmm.instance = LoadLibrary(L"winmm.dll");
|
||||
_glfw.win32.winmm.instance = LoadLibraryW(L"winmm.dll");
|
||||
if (!_glfw.win32.winmm.instance)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
@ -91,7 +91,7 @@ static GLboolean initLibraries(void)
|
||||
}
|
||||
#endif // _GLFW_NO_DLOAD_WINMM
|
||||
|
||||
_glfw.win32.user32.instance = LoadLibrary(L"user32.dll");
|
||||
_glfw.win32.user32.instance = LoadLibraryW(L"user32.dll");
|
||||
if (_glfw.win32.user32.instance)
|
||||
{
|
||||
_glfw.win32.user32.SetProcessDPIAware = (SETPROCESSDPIAWARE_T)
|
||||
@ -100,7 +100,7 @@ static GLboolean initLibraries(void)
|
||||
GetProcAddress(_glfw.win32.user32.instance, "ChangeWindowMessageFilterEx");
|
||||
}
|
||||
|
||||
_glfw.win32.dwmapi.instance = LoadLibrary(L"dwmapi.dll");
|
||||
_glfw.win32.dwmapi.instance = LoadLibraryW(L"dwmapi.dll");
|
||||
if (_glfw.win32.dwmapi.instance)
|
||||
{
|
||||
_glfw.win32.dwmapi.DwmIsCompositionEnabled = (DWMISCOMPOSITIONENABLED_T)
|
||||
@ -203,10 +203,10 @@ int _glfwPlatformInit(void)
|
||||
// To make SetForegroundWindow work as we want, we need to fiddle
|
||||
// with the FOREGROUNDLOCKTIMEOUT system setting (we do this as early
|
||||
// as possible in the hope of still being the foreground process)
|
||||
SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0,
|
||||
&_glfw.win32.foregroundLockTimeout, 0);
|
||||
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0),
|
||||
SPIF_SENDCHANGE);
|
||||
SystemParametersInfoW(SPI_GETFOREGROUNDLOCKTIMEOUT, 0,
|
||||
&_glfw.win32.foregroundLockTimeout, 0);
|
||||
SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0),
|
||||
SPIF_SENDCHANGE);
|
||||
|
||||
if (!initLibraries())
|
||||
return GL_FALSE;
|
||||
@ -233,14 +233,14 @@ void _glfwPlatformTerminate(void)
|
||||
{
|
||||
if (_glfw.win32.classAtom)
|
||||
{
|
||||
UnregisterClass(_GLFW_WNDCLASSNAME, GetModuleHandle(NULL));
|
||||
UnregisterClassW(_GLFW_WNDCLASSNAME, GetModuleHandleW(NULL));
|
||||
_glfw.win32.classAtom = 0;
|
||||
}
|
||||
|
||||
// Restore previous foreground lock timeout system setting
|
||||
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0,
|
||||
UIntToPtr(_glfw.win32.foregroundLockTimeout),
|
||||
SPIF_SENDCHANGE);
|
||||
SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0,
|
||||
UIntToPtr(_glfw.win32.foregroundLockTimeout),
|
||||
SPIF_SENDCHANGE);
|
||||
|
||||
free(_glfw.win32.clipboardString);
|
||||
|
||||
|
@ -51,7 +51,7 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
||||
{
|
||||
GLFWvidmode current;
|
||||
const GLFWvidmode* best;
|
||||
DEVMODE dm;
|
||||
DEVMODEW dm;
|
||||
|
||||
best = _glfwChooseVideoMode(monitor, desired);
|
||||
|
||||
@ -60,7 +60,7 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
||||
return GL_TRUE;
|
||||
|
||||
ZeroMemory(&dm, sizeof(dm));
|
||||
dm.dmSize = sizeof(DEVMODE);
|
||||
dm.dmSize = sizeof(DEVMODEW);
|
||||
dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL |
|
||||
DM_DISPLAYFREQUENCY;
|
||||
dm.dmPelsWidth = best->width;
|
||||
@ -71,11 +71,11 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
||||
if (dm.dmBitsPerPel < 15 || dm.dmBitsPerPel >= 24)
|
||||
dm.dmBitsPerPel = 32;
|
||||
|
||||
if (ChangeDisplaySettingsEx(monitor->win32.name,
|
||||
&dm,
|
||||
NULL,
|
||||
CDS_FULLSCREEN,
|
||||
NULL) != DISP_CHANGE_SUCCESSFUL)
|
||||
if (ChangeDisplaySettingsExW(monitor->win32.name,
|
||||
&dm,
|
||||
NULL,
|
||||
CDS_FULLSCREEN,
|
||||
NULL) != DISP_CHANGE_SUCCESSFUL)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to set video mode");
|
||||
return GL_FALSE;
|
||||
@ -91,8 +91,8 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
||||
{
|
||||
if (monitor->win32.modeChanged)
|
||||
{
|
||||
ChangeDisplaySettingsEx(monitor->win32.name,
|
||||
NULL, NULL, CDS_FULLSCREEN, NULL);
|
||||
ChangeDisplaySettingsExW(monitor->win32.name,
|
||||
NULL, NULL, CDS_FULLSCREEN, NULL);
|
||||
monitor->win32.modeChanged = GL_FALSE;
|
||||
}
|
||||
}
|
||||
@ -113,14 +113,14 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
DISPLAY_DEVICE adapter, display;
|
||||
DISPLAY_DEVICEW adapter, display;
|
||||
char* name;
|
||||
HDC dc;
|
||||
|
||||
ZeroMemory(&adapter, sizeof(DISPLAY_DEVICE));
|
||||
adapter.cb = sizeof(DISPLAY_DEVICE);
|
||||
ZeroMemory(&adapter, sizeof(DISPLAY_DEVICEW));
|
||||
adapter.cb = sizeof(DISPLAY_DEVICEW);
|
||||
|
||||
if (!EnumDisplayDevices(NULL, adapterIndex, &adapter, 0))
|
||||
if (!EnumDisplayDevicesW(NULL, adapterIndex, &adapter, 0))
|
||||
break;
|
||||
|
||||
adapterIndex++;
|
||||
@ -141,11 +141,11 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
monitors = (_GLFWmonitor**) realloc(monitors, sizeof(_GLFWmonitor*) * size);
|
||||
}
|
||||
|
||||
ZeroMemory(&display, sizeof(DISPLAY_DEVICE));
|
||||
display.cb = sizeof(DISPLAY_DEVICE);
|
||||
ZeroMemory(&display, sizeof(DISPLAY_DEVICEW));
|
||||
display.cb = sizeof(DISPLAY_DEVICEW);
|
||||
|
||||
EnumDisplayDevices(adapter.DeviceName, 0, &display, 0);
|
||||
dc = CreateDC(L"DISPLAY", display.DeviceString, NULL, NULL);
|
||||
EnumDisplayDevicesW(adapter.DeviceName, 0, &display, 0);
|
||||
dc = CreateDCW(L"DISPLAY", display.DeviceString, NULL, NULL);
|
||||
|
||||
if (adapter.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
|
||||
primaryIndex = found;
|
||||
@ -190,14 +190,14 @@ GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
|
||||
|
||||
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
||||
{
|
||||
DEVMODE settings;
|
||||
ZeroMemory(&settings, sizeof(DEVMODE));
|
||||
settings.dmSize = sizeof(DEVMODE);
|
||||
DEVMODEW settings;
|
||||
ZeroMemory(&settings, sizeof(DEVMODEW));
|
||||
settings.dmSize = sizeof(DEVMODEW);
|
||||
|
||||
EnumDisplaySettingsEx(monitor->win32.name,
|
||||
ENUM_CURRENT_SETTINGS,
|
||||
&settings,
|
||||
EDS_ROTATEDMODE);
|
||||
EnumDisplaySettingsExW(monitor->win32.name,
|
||||
ENUM_CURRENT_SETTINGS,
|
||||
&settings,
|
||||
EDS_ROTATEDMODE);
|
||||
|
||||
if (xpos)
|
||||
*xpos = settings.dmPosition.x;
|
||||
@ -216,12 +216,12 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
||||
{
|
||||
int i;
|
||||
GLFWvidmode mode;
|
||||
DEVMODE dm;
|
||||
DEVMODEW dm;
|
||||
|
||||
ZeroMemory(&dm, sizeof(DEVMODE));
|
||||
dm.dmSize = sizeof(DEVMODE);
|
||||
ZeroMemory(&dm, sizeof(DEVMODEW));
|
||||
dm.dmSize = sizeof(DEVMODEW);
|
||||
|
||||
if (!EnumDisplaySettings(monitor->win32.name, modeIndex, &dm))
|
||||
if (!EnumDisplaySettingsW(monitor->win32.name, modeIndex, &dm))
|
||||
break;
|
||||
|
||||
modeIndex++;
|
||||
@ -271,12 +271,12 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
||||
|
||||
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
||||
{
|
||||
DEVMODE dm;
|
||||
DEVMODEW dm;
|
||||
|
||||
ZeroMemory(&dm, sizeof(DEVMODE));
|
||||
dm.dmSize = sizeof(DEVMODE);
|
||||
ZeroMemory(&dm, sizeof(DEVMODEW));
|
||||
dm.dmSize = sizeof(DEVMODEW);
|
||||
|
||||
EnumDisplaySettings(monitor->win32.name, ENUM_CURRENT_SETTINGS, &dm);
|
||||
EnumDisplaySettingsW(monitor->win32.name, ENUM_CURRENT_SETTINGS, &dm);
|
||||
|
||||
mode->width = dm.dmPelsWidth;
|
||||
mode->height = dm.dmPelsHeight;
|
||||
|
@ -100,7 +100,7 @@ static void restoreCursor(_GLFWwindow* window)
|
||||
if (GetCursorPos(&pos))
|
||||
{
|
||||
if (WindowFromPoint(pos) == window->win32.handle)
|
||||
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||
SetCursor(LoadCursorW(NULL, IDC_ARROW));
|
||||
}
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ static int translateKey(WPARAM wParam, LPARAM lParam)
|
||||
// is a RALT message. In that case, this is a false LCTRL!
|
||||
time = GetMessageTime();
|
||||
|
||||
if (PeekMessage(&next, NULL, 0, 0, PM_NOREMOVE))
|
||||
if (PeekMessageW(&next, NULL, 0, 0, PM_NOREMOVE))
|
||||
{
|
||||
if (next.message == WM_KEYDOWN ||
|
||||
next.message == WM_SYSKEYDOWN ||
|
||||
@ -369,14 +369,14 @@ static int translateKey(WPARAM wParam, LPARAM lParam)
|
||||
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) GetWindowLongPtr(hWnd, 0);
|
||||
_GLFWwindow* window = (_GLFWwindow*) GetWindowLongPtrW(hWnd, 0);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_CREATE:
|
||||
{
|
||||
CREATESTRUCT* cs = (CREATESTRUCT*) lParam;
|
||||
SetWindowLongPtr(hWnd, 0, (LONG_PTR) cs->lpCreateParams);
|
||||
CREATESTRUCTW* cs = (CREATESTRUCTW*) lParam;
|
||||
SetWindowLongPtrW(hWnd, 0, (LONG_PTR) cs->lpCreateParams);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -755,7 +755,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
POINT pt;
|
||||
int i;
|
||||
|
||||
const int count = DragQueryFile(hDrop, 0xffffffff, NULL, 0);
|
||||
const int count = DragQueryFileW(hDrop, 0xffffffff, NULL, 0);
|
||||
char** names = calloc(count, sizeof(char*));
|
||||
|
||||
// Move the mouse to the position of the drop
|
||||
@ -764,10 +764,10 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
const UINT length = DragQueryFile(hDrop, i, NULL, 0);
|
||||
const UINT length = DragQueryFileW(hDrop, i, NULL, 0);
|
||||
WCHAR* buffer = calloc(length + 1, sizeof(WCHAR));
|
||||
|
||||
DragQueryFile(hDrop, i, buffer, length + 1);
|
||||
DragQueryFileW(hDrop, i, buffer, length + 1);
|
||||
names[i] = _glfwCreateUTF8FromWideString(buffer);
|
||||
|
||||
free(buffer);
|
||||
@ -812,21 +812,21 @@ static ATOM registerWindowClass(void)
|
||||
wc.lpfnWndProc = (WNDPROC) windowProc;
|
||||
wc.cbClsExtra = 0; // No extra class data
|
||||
wc.cbWndExtra = sizeof(void*) + sizeof(int); // Make room for one pointer
|
||||
wc.hInstance = GetModuleHandle(NULL);
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hInstance = GetModuleHandleW(NULL);
|
||||
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = NULL; // No background
|
||||
wc.lpszMenuName = NULL; // No menu
|
||||
wc.lpszClassName = _GLFW_WNDCLASSNAME;
|
||||
|
||||
// Load user-provided icon if available
|
||||
wc.hIcon = LoadIcon(GetModuleHandle(NULL), L"GLFW_ICON");
|
||||
wc.hIcon = LoadIconW(GetModuleHandleW(NULL), L"GLFW_ICON");
|
||||
if (!wc.hIcon)
|
||||
{
|
||||
// No user-provided icon found, load default icon
|
||||
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
|
||||
wc.hIcon = LoadIconW(NULL, IDI_WINLOGO);
|
||||
}
|
||||
|
||||
classAtom = RegisterClass(&wc);
|
||||
classAtom = RegisterClassW(&wc);
|
||||
if (!classAtom)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
@ -888,16 +888,16 @@ static int createWindow(_GLFWwindow* window,
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
window->win32.handle = CreateWindowEx(window->win32.dwExStyle,
|
||||
_GLFW_WNDCLASSNAME,
|
||||
wideTitle,
|
||||
window->win32.dwStyle,
|
||||
xpos, ypos,
|
||||
fullWidth, fullHeight,
|
||||
NULL, // No parent window
|
||||
NULL, // No window menu
|
||||
GetModuleHandle(NULL),
|
||||
window); // Pass object to WM_CREATE
|
||||
window->win32.handle = CreateWindowExW(window->win32.dwExStyle,
|
||||
_GLFW_WNDCLASSNAME,
|
||||
wideTitle,
|
||||
window->win32.dwStyle,
|
||||
xpos, ypos,
|
||||
fullWidth, fullHeight,
|
||||
NULL, // No parent window
|
||||
NULL, // No window menu
|
||||
GetModuleHandleW(NULL),
|
||||
window); // Pass object to WM_CREATE
|
||||
|
||||
free(wideTitle);
|
||||
|
||||
@ -1027,7 +1027,7 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
||||
return;
|
||||
}
|
||||
|
||||
SetWindowText(window->win32.handle, wideTitle);
|
||||
SetWindowTextW(window->win32.handle, wideTitle);
|
||||
free(wideTitle);
|
||||
}
|
||||
|
||||
@ -1118,7 +1118,7 @@ void _glfwPlatformPollEvents(void)
|
||||
MSG msg;
|
||||
_GLFWwindow* window;
|
||||
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
if (msg.message == WM_QUIT)
|
||||
{
|
||||
@ -1134,7 +1134,7 @@ void _glfwPlatformPollEvents(void)
|
||||
else
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
DispatchMessageW(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user