mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 22:14:34 +00:00
Win32 Unicode fixes.
This commit is contained in:
parent
78bc624ba9
commit
db066b4f46
@ -199,7 +199,15 @@ int _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, GLFWvidmode* list, int ma
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (!EnumDisplaySettings(monitor->Win32.name, deviceModeNum, &deviceMode))
|
BOOL result;
|
||||||
|
WCHAR* wideName = _glfwCreateWideStringFromUTF8(monitor->Win32.name);
|
||||||
|
if (!wideName)
|
||||||
|
break;
|
||||||
|
|
||||||
|
result = EnumDisplaySettings(wideName, deviceModeNum, &deviceMode);
|
||||||
|
free(wideName);
|
||||||
|
|
||||||
|
if (!result)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (vidModesCount >= maxcount)
|
if (vidModesCount >= maxcount)
|
||||||
|
@ -58,21 +58,20 @@ _GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current,
|
|||||||
*current = malloc(sizeof(_GLFWmonitor));
|
*current = malloc(sizeof(_GLFWmonitor));
|
||||||
memset(*current, 0, sizeof(_GLFWmonitor));
|
memset(*current, 0, sizeof(_GLFWmonitor));
|
||||||
|
|
||||||
dc = CreateDC("DISPLAY", monitor->DeviceString, NULL, NULL);
|
dc = CreateDC(L"DISPLAY", monitor->DeviceString, NULL, NULL);
|
||||||
|
|
||||||
(*current)->physicalWidth = GetDeviceCaps(dc, HORZSIZE);
|
(*current)->physicalWidth = GetDeviceCaps(dc, HORZSIZE);
|
||||||
(*current)->physicalHeight = GetDeviceCaps(dc, VERTSIZE);
|
(*current)->physicalHeight = GetDeviceCaps(dc, VERTSIZE);
|
||||||
|
|
||||||
DeleteDC(dc);
|
DeleteDC(dc);
|
||||||
|
|
||||||
(*current)->name = malloc(strlen(monitor->DeviceName) + 1);
|
(*current)->name = _glfwCreateUTF8FromWideString(monitor->DeviceName);
|
||||||
memcpy((*current)->name, monitor->DeviceName, strlen(monitor->DeviceName) + 1);
|
|
||||||
(*current)->name[strlen(monitor->DeviceName)] = '\0';
|
|
||||||
|
|
||||||
(*current)->screenX = setting->dmPosition.x;
|
(*current)->screenX = setting->dmPosition.x;
|
||||||
(*current)->screenY = setting->dmPosition.y;
|
(*current)->screenY = setting->dmPosition.y;
|
||||||
|
|
||||||
memcpy((*current)->Win32.name, adapter->DeviceName, 32);
|
(*current)->Win32.name = _glfwCreateUTF8FromWideString(adapter->DeviceName);
|
||||||
|
|
||||||
return &((*current)->next);
|
return &((*current)->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,6 +81,7 @@ _GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor)
|
|||||||
|
|
||||||
result = monitor->next;
|
result = monitor->next;
|
||||||
|
|
||||||
|
free(monitor->Win32.name);
|
||||||
free(monitor->name);
|
free(monitor->name);
|
||||||
free(monitor);
|
free(monitor);
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ typedef struct _GLFWlibraryWin32
|
|||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
typedef struct _GLFWmonitorWin32
|
typedef struct _GLFWmonitorWin32
|
||||||
{
|
{
|
||||||
char name[32];
|
char* name;
|
||||||
|
|
||||||
} _GLFWmonitorWin32;
|
} _GLFWmonitorWin32;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user