Subject: bug#34516: Multi-monitor frame sets

From: Andy Moreton <[email-masked]>
Date: Tue, 05 Mar 2019 00:44:44 +0000

On Mon 04 Mar 2019, Alan Third wrote:

> On Mon, Mar 04, 2019 at 05:10:59PM +0100, Robert Pluim wrote:
>> Andy Moreton <[email-masked]> writes:
>> 
>> >> At least in 'system preferences/display', when you have two identical monitors
>> >> attached, they're called something like 'DELL 1234X' and 'DELL 1234X
>> >> (2)' (I canʼt test that right now). If you can show me code on how to
>> >> get those names in 10.14, I can confirm. That would be better than
>> >> making up names.
>> >
>> 
>> So 'DELL 1234X (1)' and 'DELL 1234X (2)', where (1) is the primary
>> monitor.
>> 
>> > There are usually two different names involved: the name of the
>> > file/device that represents the monitor, and a human-readable name for
>> > the UI.
>> >
>> > In Windows, the GUI settings/display describes the monitors as 1 and
>> > 2. In emacs, display-monitor-attributes-list reports the device
>> > names \\.\DISPLAY1 and \\.\DISPLAY2 (you can see these device names
>> > with the WinObj tool from SysInternals). Note that the device names do
>> > not mention the make/model of the hardware.
>> >
>> > For OSX, ioreg or the IoRegistryExplorer app show similar information
>> > from the IO registry (a non-persistent database of IO device
>> > information). I don't use a mac any more, so I don't know if these tools
>> > are still available).
>> 
>> I donʼt know, but the code in ns_screen_name which appears to do
>> something similar does not work for me in 10.14
>
> Try this:
>
>     ioreg -lw0 | grep IODisplayEDID | sed "/[^<]*</s///" | xxd -p -r | strings -6
>
> and see if it returns usable information. If so then that’s what we
> should be targeting in ns_screen_name.
>
> I think the approach used in ns_screen_name must have been removed in
> some version of macOS. I tried to modify it to find the information
> returned by the above command, but it looks like there’s no direct way
> to match up the DID number with IODisplayConnect, which is where
> IODisplayEDID is stored.

The #if tests in ns_screen_name suggest that the old method is no longer
available in OSX 10.9 and later.

>From a quick web search, GLFW (a graphics library) seems to have
encountered this problem, and added a workaround in this commit:

https://github.com/glfw/glfw/commit/8101d7a7b67fc3414769b25944dc7c02b58d53d0

The patch matches on "IODisplayConnect" instances and then iterates over
the collection checking that the vendor ID and product ID match those
values looked up from the DID number.

A similar approach should help to solve this problem.

    AndyM