win-capture: Skip disconnected display devices - #13788
Conversation
Use DISPLAY_DEVICE_ATTACHED_TO_DESKTOP flag to select the attached display instead of assuming index 0 is active.
|
Thank you for your contribution. I am having a similar issue as depicted in #8181 and #12273. I have three monitors, when disconnecting Monitor 3 in Windows Display settings, changing the monitor in Display Capture dropdown only displays one of the remaining two monitors, regardless of selection. If I select Monitor 1, monitor 2 shows up. If I select Monitor 2, monitor 2 shows up. With Monitor 1 not being shown at all. I tested your changes and the issue is fixed. Now, the correct monitor shows up when the third monitor is disconnected virtually via Windows Display settings. Now the expected behavior is happening, selecting Monitor 1 shows Monitor 1 and selecting Monitor 2 shows Monitor 2. |
Description
Use DISPLAY_DEVICE_ATTACHED_TO_DESKTOP flag to select the attached display instead of assuming index 0 is active. When researching this issue I saw this flag mentioned in the Microsoft docs
Just as a note I wasn't sure whether to use LPCSTR or const char in the helper so I just followed the Microsoft docs, open to changing if this makes a difference as my C knowledge is on a "learn as you go" basis.
Motivation and Context
Not sure if there were other Github issues that I am not seeing, but #8040 described this issue and was closed although the issue remains.
How Has This Been Tested?
Ran a build of OBS before these changes with one of my 3 displays disconnected, the remaining two both displayed the same display when selected in a display capture source. Performed the same test with these changes, the two displays now showed correctly.
Types of changes
Checklist: