Subject: bug#76691: `display-monitor-attributes-list` not working properly on macOS

From: Ship Mints <[email-masked]>
Date: Wed, 28 May 2025 15:17:33 -0400

On Wed, May 28, 2025 at 2:15 PM Alan Third <[email-masked]> wrote:

> On Mon, May 26, 2025 at 06:43:54PM -0400, Ship Mints wrote:
> > On Mon, May 26, 2025 at 5:17 PM Alan Third <[email-masked]> wrote:
> >
> > > package emacs
> > > merge 76691 76051
> > > user emacs
> > > usertag 76691 + ns
> > > thankyou
> > >
> > > On Mon, Apr 07, 2025 at 01:10:49AM -0400, Ruiyang Wu wrote:
> > > > Hi all,
> > > >
> > > > How can we move this forward? It would be great to see Ship Mints'
> > > > patch merged to master and backported to emacs-30.
> > >
> > > Is there anything blocking this other than getting the OK from the
> > > maintainers? I'm inclined to say it's good to go as the existing names
> > > don't work at all, afaik, so we can't be any worse off than we were
> > > before.
> > >
> > > Stephane, when you get a chance can you forward the latest version of
> > > this patch so I can compare it with my patch for 76051 so we can see
> > > if they're covering the same ground? Thanks.
> > >
> >
> > See attached.  I didn't rebase this recently but I doubt nsfns.m has
> > changed much, if at all.
>
> It applied cleanly alongside my patch, so I think we're good. I'll do
> a test build in a bit and I think we can get both patches pushed up
> once someone with two screen checks mine.
>
> Do you want to finish off the commit message or should I give it a go?
>

Nice.  Not home where I have that branch locally, so writing this
manually...

*snip*
Fix ns_make_monitor_attribute_list (bug#76691)

This is the NS implementation for 'display-monitor-attributes-list'.
Change implementation from IORegistry to direct introspection
of NSScreen.

* src/nsfns.m (ns_make_monitor_attribute_list): Use localizedName
selector on NSScreen.  For anonymous displays, synthesize names
of the form ("%dx%d@%d,%d" width height x y).
(ns_get_name_from_ioreg) (ns_screen_name): Removed.
*snip*

Feel free to adapt, and thank you.

-Stephane