Subject: bug#76051: closed (Re: 29.4; Incorrect workarea entry in display-monitor-attributes-list on macOS)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 02 Jun 2025 20:18:03 +0000

Your bug report

#76051: 29.4; Incorrect workarea entry in display-monitor-attributes-list on macOS

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
76051: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76051
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: 29.4; Incorrect workarea entry in display-monitor-attributes-list on macOS
From: Alan Third <[email-masked]>
To: Anders Lindgren <[email-masked]>
Cc: [email-masked]
Date: Mon, 2 Jun 2025 21:16:53 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

On Mon, Jun 02, 2025 at 10:01:24PM +0200, Anders Lindgren wrote:
> Hi!
> 
> I have built a fresh Emacs with your patch, and it appears to be working
> well. Thanks!

Superb, thanks! I'll push it up to master now.

> I also put together a small Emacs package to draw the monitor layout with
> workareas as ASCII-boxes, based on the information provided by
> display-monitor-attributes-list. This makes it easier to check that the
> values returned are sane. I haven't published it yet, so I attached a copy.
> 
> For example, this is my mac layout with the laptop screen with doc to the
> right and an external monitor to the left. The numbers are the margin (in
> pixels), i.e. the space between the workarea and the full area of the
> monitor.
> 
> +---------------------------------------+
> |                                       |
> |                   ^ 25                |
> |                                       |
> |                                       |
> |                                       |
> |                                       |
> |                                       |
> |                                       |
> |                                       |
> |                                       |
> | < 0                              > 0  +--------------------------+
> |                                       |                          |
> |                                       |            ^ 38          |
> |                                       |                          |
> |                                       |                          |
> |                                       |                          |
> |                                       |                          |
> |                                       |                          |
> |                                       |                          |
> |                   v 0                 | < 0                 > 0  |
> |                                       |                          |
> +---------------------------------------+                          |
>                                         |                          |
>                                         |                          |
>                                         |                          |
>                                         |            v 66          |
>                                         |                          |
>                                         +--------------------------+
> 
> 
>     -- Anders

That's pretty cool!

-- 
Alan Third

Subject: 29.4; Incorrect workarea entry in display-monitor-attributes-list on macOS
From: Anders Lindgren <[email-masked]>
To: Emacs bug reports and feature requests <[email-masked]>
Date: Tue, 4 Feb 2025 14:42:07 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi!

I think the `display-monitor-attributes-list' function returns an incorrect
`workarea' entry on macOS.

Concretely, I have a laptop with an external monitor connected. The
external monitor is placed above to the left.

The `display-monitor-attributes-list' function returns the following
(abbreviated):

    (((geometry 0 0 1728 1117) (workarea 0 38 1728 1079) ...
     ((geometry -2560 -723 2560 1440) (workarea -2560 -638 2560 1330) ...))

The first member in the list describes the laptop monitor (the primary
monitor), the second the external monitor.

The first two numbers, `X' and `Y', in each entry describe the position of
the top left corner of the area, relative to the top left corner of the
primary monitor.

The number that I think is incorrect is the `Y' of the workarea of the
external monitor, which is "-638". It indicates that there is a (723-638 =
85 pixel area on top of the screen which is outside the work area.)

However, in reality, there is a 25 pixel menu bar which should be outside
the work area. The 85 probably comes from the macOS dock, which is placed
in the lower part of the screen.

The height field correctly includes both the menu bar and the dock.

I've tested this on Emacs 29.4 and 30.0.93 on macOS 15.1.

    -- Anders Lindgren (Long time Emacs contributor and former NS
maintainer)