mirror of
https://github.com/glfw/glfw.git
synced 2024-11-14 02:31:46 +00:00
Bugfix : handle localised default monitor names
If your OS is not in English you won't have "Generic PnP Monitor" so the test will succeed inspite of having a localised default monitor name. I changed the test to look for the output port between parenthesis as this is how the monitor will look like when driver is installed AFAICT.
This commit is contained in:
parent
99ed2a3d22
commit
9f7a40059e
@ -182,6 +182,14 @@ char* tryGetAccurateMonitorName(const WCHAR *deviceName)
|
||||
return monitorName;
|
||||
}
|
||||
|
||||
BOOL nameContainsOutputPort(const char *const i_nameToCheck)
|
||||
{
|
||||
const size_t nameLength = strlen(i_nameToCheck);
|
||||
const char lastChar = i_nameToCheck[nameLength - 1];
|
||||
|
||||
return lastChar == ')'; // Non generic initial names contain the output port use. E.g. MonitorName(DisplayPort)
|
||||
}
|
||||
|
||||
// Callback for EnumDisplayMonitors in createMonitor
|
||||
//
|
||||
static BOOL CALLBACK monitorCallback(HMONITOR handle,
|
||||
@ -205,7 +213,7 @@ static BOOL CALLBACK monitorCallback(HMONITOR handle,
|
||||
monitor->win32.handle = handle;
|
||||
|
||||
// If the monitor driver is installed, we will already have an accurate name for the monitor.
|
||||
if (strcmp(monitor->name, "Generic PnP Monitor") != 0)
|
||||
if (nameContainsOutputPort(monitor->name))
|
||||
return TRUE;
|
||||
|
||||
accurateMonitorName = tryGetAccurateMonitorName(mi.szDevice);
|
||||
|
Loading…
Reference in New Issue
Block a user