check for validity of did when only one display is connected (#316)

This commit is contained in:
Felix Kratz 2023-01-25 11:29:32 +01:00
parent 883798968e
commit 21b8d7cf5f

View file

@ -114,7 +114,13 @@ uint64_t *display_space_list(uint32_t did, int *count) {
} }
int display_arrangement(uint32_t did) { int display_arrangement(uint32_t did) {
if (display_active_display_count() == 1) return 1; if (display_active_display_count() == 1) {
uint32_t result = 0;
uint32_t count = 0;
CGGetActiveDisplayList(1, &result, &count);
if (did == result && count == 1) return 1;
else return 0;
}
CFStringRef uuid = display_uuid(did); CFStringRef uuid = display_uuid(did);
if (!uuid) return 0; if (!uuid) return 0;