diff --git a/src/detection/displayserver/displayserver.c b/src/detection/displayserver/displayserver.c index 538ff7d89..0b0db7833 100644 --- a/src/detection/displayserver/displayserver.c +++ b/src/detection/displayserver/displayserver.c @@ -11,7 +11,8 @@ bool ffdsAppendDisplay( uint32_t rotation, FFstrbuf* name, FFDisplayType type, - bool primary) + bool primary, + uint64_t id) { if(width == 0 || height == 0) return false; @@ -26,6 +27,7 @@ bool ffdsAppendDisplay( ffStrbufInitMove(&display->name, name); display->type = type; display->primary = primary; + display->id = id; return true; } diff --git a/src/detection/displayserver/displayserver.h b/src/detection/displayserver/displayserver.h index d45f43070..b4ab5283b 100644 --- a/src/detection/displayserver/displayserver.h +++ b/src/detection/displayserver/displayserver.h @@ -58,6 +58,7 @@ typedef struct FFDisplayResult FFDisplayType type; uint32_t rotation; bool primary; + uint64_t id; // platform dependent } FFDisplayResult; typedef struct FFDisplayServerResult @@ -83,6 +84,7 @@ bool ffdsAppendDisplay( uint32_t rotation, FFstrbuf* name, FFDisplayType type, - bool primary); + bool primary, + uint64_t id); #endif diff --git a/src/detection/displayserver/displayserver_apple.c b/src/detection/displayserver/displayserver_apple.c index 0a7ddde5a..d004647d4 100644 --- a/src/detection/displayserver/displayserver_apple.c +++ b/src/detection/displayserver/displayserver_apple.c @@ -63,7 +63,8 @@ static void detectDisplays(FFDisplayServerResult* ds) (uint32_t)CGDisplayRotation(screen), &name, CGDisplayIsBuiltin(screen) ? FF_DISPLAY_TYPE_BUILTIN : FF_DISPLAY_TYPE_EXTERNAL, - screen == primary + screen == primary, + (uint64_t)screen ); CGDisplayModeRelease(mode); } diff --git a/src/detection/displayserver/displayserver_windows.c b/src/detection/displayserver/displayserver_windows.c index 0a91eedb1..a37c506b1 100644 --- a/src/detection/displayserver/displayserver_windows.c +++ b/src/detection/displayserver/displayserver_windows.c @@ -6,6 +6,12 @@ #include #include +typedef struct FFMonitorInfo +{ + HMONITOR handle; + MONITORINFOEXW info; +} FFMonitorInfo; + static CALLBACK BOOL MonitorEnumProc( HMONITOR hMonitor, FF_MAYBE_UNUSED HDC hdc, @@ -14,14 +20,16 @@ static CALLBACK BOOL MonitorEnumProc( ) { FFlist* monitors = (FFlist*) lParam; - MONITORINFOEXW* newMonitor = ffListAdd(monitors); - newMonitor->cbSize = sizeof(*newMonitor); - return GetMonitorInfoW(hMonitor, (MONITORINFO*) newMonitor); + FFMonitorInfo* newMonitor = ffListAdd(monitors); + newMonitor->handle = hMonitor; + newMonitor->info.cbSize = sizeof(newMonitor->info); + + return GetMonitorInfoW(hMonitor, (MONITORINFO*) &newMonitor->info); } static void detectDisplays(FFDisplayServerResult* ds) { - FF_LIST_AUTO_DESTROY monitors = ffListCreate(sizeof(MONITORINFOEXW)); + FF_LIST_AUTO_DESTROY monitors = ffListCreate(sizeof(FFMonitorInfo)); EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (LPARAM) &monitors); DISPLAYCONFIG_PATH_INFO paths[128]; @@ -50,12 +58,12 @@ static void detectDisplays(FFDisplayServerResult* ds) }, }; - MONITORINFOEXW* monitorInfo = NULL; + FFMonitorInfo* monitorInfo = NULL; if (DisplayConfigGetDeviceInfo(&sourceName.header) == ERROR_SUCCESS) { - FF_LIST_FOR_EACH(MONITORINFOEXW, item, monitors) + FF_LIST_FOR_EACH(FFMonitorInfo, item, monitors) { - if (wcsncmp(item->szDevice, sourceName.viewGdiDeviceName, sizeof(sourceName.viewGdiDeviceName) / sizeof(wchar_t)) == 0) + if (wcsncmp(item->info.szDevice, sourceName.viewGdiDeviceName, sizeof(sourceName.viewGdiDeviceName) / sizeof(wchar_t)) == 0) { monitorInfo = item; break; @@ -117,15 +125,16 @@ static void detectDisplays(FFDisplayServerResult* ds) width, height, path->targetInfo.refreshRate.Numerator / (double) path->targetInfo.refreshRate.Denominator, - (uint32_t) (monitorInfo->rcMonitor.right - monitorInfo->rcMonitor.left), - (uint32_t) (monitorInfo->rcMonitor.bottom - monitorInfo->rcMonitor.top), + (uint32_t) (monitorInfo->info.rcMonitor.right - monitorInfo->info.rcMonitor.left), + (uint32_t) (monitorInfo->info.rcMonitor.bottom - monitorInfo->info.rcMonitor.top), rotation, &name, path->targetInfo.outputTechnology == DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL || path->targetInfo.outputTechnology == DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EMBEDDED || path->targetInfo.outputTechnology == DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EMBEDDED ? FF_DISPLAY_TYPE_BUILTIN : FF_DISPLAY_TYPE_EXTERNAL, - !!(monitorInfo->dwFlags & MONITORINFOF_PRIMARY) + !!(monitorInfo->info.dwFlags & MONITORINFOF_PRIMARY), + (uint64_t)(uintptr_t) monitorInfo->handle ); } } diff --git a/src/detection/displayserver/linux/displayserver_linux.c b/src/detection/displayserver/linux/displayserver_linux.c index 65f1075ba..506f519b1 100644 --- a/src/detection/displayserver/linux/displayserver_linux.c +++ b/src/detection/displayserver/linux/displayserver_linux.c @@ -53,7 +53,8 @@ static void parseDRM(FFDisplayServerResult* result) 0, &name, FF_DISPLAY_TYPE_UNKNOWN, - false + false, + 0 ); } diff --git a/src/detection/displayserver/linux/wayland.c b/src/detection/displayserver/linux/wayland.c index 0f2ec77c6..814129e8a 100644 --- a/src/detection/displayserver/linux/wayland.c +++ b/src/detection/displayserver/linux/wayland.c @@ -187,7 +187,8 @@ static void waylandOutputHandler(WaylandData* wldata, struct wl_registry* regist rotation, &display.name, display.type, - false + false, + 0 ); ffThreadMutexUnlock(&mutex); diff --git a/src/detection/displayserver/linux/xcb.c b/src/detection/displayserver/linux/xcb.c index 47c5ec851..0858690ed 100644 --- a/src/detection/displayserver/linux/xcb.c +++ b/src/detection/displayserver/linux/xcb.c @@ -128,7 +128,8 @@ void ffdsConnectXcb(FFDisplayServerResult* result) 0, NULL, FF_DISPLAY_TYPE_UNKNOWN, - false + false, + 0 ); ffxcb_screen_next(&iterator); } @@ -198,7 +199,8 @@ static bool xcbRandrHandleModeInfo(XcbRandrData* data, xcb_randr_mode_info_t* mo rotation, name, FF_DISPLAY_TYPE_UNKNOWN, - primary + primary, + 0 ); } @@ -255,7 +257,8 @@ static bool xcbRandrHandleCrtc(XcbRandrData* data, xcb_randr_crtc_t crtc, FFstrb rotation, name, FF_DISPLAY_TYPE_UNKNOWN, - primary + primary, + 0 ); free(crtcInfoReply); @@ -315,7 +318,8 @@ static bool xcbRandrHandleMonitor(XcbRandrData* data, xcb_randr_monitor_info_t* 0, &name, FF_DISPLAY_TYPE_UNKNOWN, - !!monitor->primary + !!monitor->primary, + 0 ); } @@ -379,7 +383,8 @@ static void xcbRandrHandleScreen(XcbRandrData* data, xcb_screen_t* screen) 0, NULL, FF_DISPLAY_TYPE_UNKNOWN, - false + false, + 0 ); } diff --git a/src/detection/displayserver/linux/xlib.c b/src/detection/displayserver/linux/xlib.c index 288763ee6..7bccf5faa 100644 --- a/src/detection/displayserver/linux/xlib.c +++ b/src/detection/displayserver/linux/xlib.c @@ -86,7 +86,8 @@ void ffdsConnectXlib(FFDisplayServerResult* result) 0, NULL, FF_DISPLAY_TYPE_UNKNOWN, - false + false, + 0 ); } @@ -184,7 +185,8 @@ static bool xrandrHandleCrtc(XrandrData* data, RRCrtc crtc, bool primary) rotation, NULL, FF_DISPLAY_TYPE_UNKNOWN, - primary + primary, + 0 ); data->ffXRRFreeCrtcInfo(crtcInfo); @@ -224,7 +226,8 @@ static bool xrandrHandleMonitor(XrandrData* data, XRRMonitorInfo* monitorInfo) 0, NULL, FF_DISPLAY_TYPE_UNKNOWN, - !!monitorInfo->primary + !!monitorInfo->primary, + 0 ); } @@ -282,7 +285,8 @@ static void xrandrHandleScreen(XrandrData* data, Screen* screen) 0, NULL, FF_DISPLAY_TYPE_UNKNOWN, - false + false, + 0 ); }