diff --git a/src/win32_monitor.c b/src/win32_monitor.c index 8c308ae2..a92a2080 100644 --- a/src/win32_monitor.c +++ b/src/win32_monitor.c @@ -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);