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

From: Ship Mints <[email-masked]>
Date: Sun, 2 Mar 2025 16:12:23 -0500

If you try the following Emacs 30.1 NS build and it works for you, I think
I know which one-liner patch might need to be applied to make this work.  I
don't have more than one monitor so I can't easily test this on my own.  If
I submit a patch for this, would you be able to build from master?  I could
try to use my iPad as an external monitor, I suppose but not sure if that
will work.

https://github.com/jimeh/emacs-builds/releases/tag/Emacs-30.1

On Sun, Mar 2, 2025 at 4:00 PM Ruiyang Wu <[email-masked]> wrote:

> Hi,
>
> I am using the official NS port Emacs 30.1 on a MacBook (macOS Sequoia)
> with an external monitor. The output of `display-monitor-attributes-list`
> is as follows:
>
> (((geometry 0 0 1512 982) (workarea 0 38 1512 944) (mm-size 301 195)
> (frames) (source . "NS")) ((geometry 1512 -517 1600 900 (workarea 1512 -517
> 1600 875) (mm-size 549 311) (frames #<frame scratch* 0x12d08e430>) (source
> . "NS")))
>
> It fails to recognize my monitors. Furthermore, when I run `M-x
> make-frame-on-monitor`, no candidate is provided.
>
>
> However, if I use `emacs-mac` from
> https://bitbucket.org/mituharu/emacs-mac/src/master/, the monitors can be
> correctly recognized. `display-monitor-attributes-list` prints
>
> (((geometry 0 0 1512 982) (workarea 0 38 1512 944) (mm-size 301 196)
> (frames) (name . "Built-in Retina Display") (backing-scale-factor . 2))
> ((geometry 1512 -517 1600 900) (workarea 1512 -492 1600 875) (mm-size 549
> 311) (frames #<frame *scratch* - GNU Emacs at Ruiyangs-MBP 0x1400a62c8>)
> (name . "DELL U2515H") (backing-scale-factor . 2)))
>
> And I can also use `make-frame-on-monitor` to create new frames without
> issue.
>
>
> Is it possible to have the aforementioned behavior from `emacs-mac` in
> the official NS port? That would greatly improve my workflow. Thank you
> very much!
>
>
> Best,
> Ruiyang
>
>