GNU bug report logs - #76051
29.4; Incorrect workarea entry in display-monitor-attributes-list on macOS

Previous Next

Package: emacs;

Reported by: Anders Lindgren <andlind <at> gmail.com>

Date: Tue, 4 Feb 2025 13:43:02 UTC

Severity: normal

Tags: confirmed, patch

Merged with 76691

Found in versions 29.4, 30.1, 31.0.50

Done: Alan Third <alan <at> idiocy.org>

To reply to this bug, email your comments to 76051 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#76051; Package emacs. (Tue, 04 Feb 2025 13:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Anders Lindgren <andlind <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 04 Feb 2025 13:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Anders Lindgren <andlind <at> gmail.com>
To: Emacs bug reports and feature requests <bug-gnu-emacs <at> gnu.org>
Subject: 29.4;
 Incorrect workarea entry in display-monitor-attributes-list on macOS
Date: Tue, 4 Feb 2025 14:42:07 +0100
[Message part 1 (text/plain, inline)]
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)
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76051; Package emacs. (Sat, 08 Feb 2025 11:07:02 GMT) Full text and rfc822 format available.

Message #8 received at 76051 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Anders Lindgren <andlind <at> gmail.com>, Po Lu <luangruo <at> yahoo.com>,
 Alan Third <alan <at> idiocy.org>
Cc: 76051 <at> debbugs.gnu.org
Subject: Re: bug#76051: 29.4;
 Incorrect workarea entry in display-monitor-attributes-list on macOS
Date: Sat, 08 Feb 2025 13:05:30 +0200
> From: Anders Lindgren <andlind <at> gmail.com>
> Date: Tue, 4 Feb 2025 14:42:07 +0100
> 
> 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.

Thanks.  Maybe Po Lu and Alan (CC'ed) could help here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76051; Package emacs. (Mon, 26 May 2025 19:35:02 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Anders Lindgren <andlind <at> gmail.com>
Cc: Emacs bug reports and feature requests <bug-gnu-emacs <at> gnu.org>
Subject: Re: 29.4; Incorrect workarea entry in
 display-monitor-attributes-list on macOS
Date: Mon, 26 May 2025 20:34:25 +0100
[Message part 1 (text/plain, inline)]
On Tue, Feb 04, 2025 at 02:42:07PM +0100, Anders Lindgren wrote:
> Hi!

Hi Anders,

> 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.

I'm pretty sure the arithmetic was wrong, and it was treating external
monitors differently from the primary screen for some reason I
couldn't work out.

Can you check if the attached looks right to you? I can't check as I
don't have an external monitor here.
-- 
Alan Third
[0001-Fix-NS-port-screen-geometry-report-bug-76051.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76051; Package emacs. (Mon, 26 May 2025 19:40:02 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Alan Third <alan <at> idiocy.org>, Anders Lindgren <andlind <at> gmail.com>, 
 Emacs bug reports and feature requests <bug-gnu-emacs <at> gnu.org>
Cc: 76051 <at> debbugs.gnu.org
Subject: Re: bug#76051: 29.4;
 Incorrect workarea entry in display-monitor-attributes-list on macOS
Date: Mon, 26 May 2025 15:38:46 -0400
[Message part 1 (text/plain, inline)]
On Mon, May 26, 2025 at 3:35 PM Alan Third <alan <at> idiocy.org> wrote:

> On Tue, Feb 04, 2025 at 02:42:07PM +0100, Anders Lindgren wrote:
> > Hi!
>
> Hi Anders,
>
> > 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.
>
> I'm pretty sure the arithmetic was wrong, and it was treating external
> monitors differently from the primary screen for some reason I
> couldn't work out.
>
> Can you check if the attached looks right to you? I can't check as I
> don't have an external monitor here.
>

Also see the following bug which has a working patch:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76691
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76051; Package emacs. (Mon, 26 May 2025 19:40:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76051; Package emacs. (Mon, 26 May 2025 20:24:01 GMT) Full text and rfc822 format available.

Message #20 received at 76051 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Ship Mints <shipmints <at> gmail.com>
Cc: Emacs bug reports and feature requests <bug-gnu-emacs <at> gnu.org>,
 76051 <at> debbugs.gnu.org, Anders Lindgren <andlind <at> gmail.com>
Subject: Re: bug#76051: 29.4; Incorrect workarea entry in
 display-monitor-attributes-list on macOS
Date: Mon, 26 May 2025 21:23:45 +0100
On Mon, May 26, 2025 at 03:38:46PM -0400, Ship Mints wrote:
> On Mon, May 26, 2025 at 3:35 PM Alan Third <alan <at> idiocy.org> wrote:
> 
> > I'm pretty sure the arithmetic was wrong, and it was treating external
> > monitors differently from the primary screen for some reason I
> > couldn't work out.
> >
> > Can you check if the attached looks right to you? I can't check as I
> > don't have an external monitor here.
> >
> 
> Also see the following bug which has a working patch:
> 
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76691

Sorry, I think I'm being a bit dim but I can't see any patch there
that fixes this particular problem.
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76051; Package emacs. (Mon, 26 May 2025 20:25:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76051; Package emacs. (Mon, 26 May 2025 20:29:02 GMT) Full text and rfc822 format available.

Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Alan Third <alan <at> idiocy.org>, Ship Mints <shipmints <at> gmail.com>, 
 Anders Lindgren <andlind <at> gmail.com>, 
 Emacs bug reports and feature requests <bug-gnu-emacs <at> gnu.org>,
 76051 <at> debbugs.gnu.org
Subject: Re: bug#76051: 29.4;
 Incorrect workarea entry in display-monitor-attributes-list on macOS
Date: Mon, 26 May 2025 16:28:22 -0400
[Message part 1 (text/plain, inline)]
On Mon, May 26, 2025 at 4:23 PM Alan Third <alan <at> idiocy.org> wrote:

> On Mon, May 26, 2025 at 03:38:46PM -0400, Ship Mints wrote:
> > On Mon, May 26, 2025 at 3:35 PM Alan Third <alan <at> idiocy.org> wrote:
> >
> > > I'm pretty sure the arithmetic was wrong, and it was treating external
> > > monitors differently from the primary screen for some reason I
> > > couldn't work out.
> > >
> > > Can you check if the attached looks right to you? I can't check as I
> > > don't have an external monitor here.
> > >
> >
> > Also see the following bug which has a working patch:
> >
> > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76691
>
> Sorry, I think I'm being a bit dim but I can't see any patch there
> that fixes this particular problem.
>

Hi, Alan,

I'm now not at my desk but perhaps if the 76691 patch doesn't solve this,
but it solves the bigger problem that the monitor attributes are wrong,
maybe combine them while you're at it?

-Stephane
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76051; Package emacs. (Mon, 26 May 2025 20:29:03 GMT) Full text and rfc822 format available.

Merged 76051 76691. Request was from Alan Third <alan <at> idiocy.org> to control <at> debbugs.gnu.org. (Mon, 26 May 2025 21:18:02 GMT) Full text and rfc822 format available.

Reply sent to Alan Third <alan <at> idiocy.org>:
You have taken responsibility. (Mon, 02 Jun 2025 20:18:03 GMT) Full text and rfc822 format available.

Notification sent to Anders Lindgren <andlind <at> gmail.com>:
bug acknowledged by developer. (Mon, 02 Jun 2025 20:18:03 GMT) Full text and rfc822 format available.

Message #36 received at 76051-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Anders Lindgren <andlind <at> gmail.com>
Cc: 76051-done <at> debbugs.gnu.org
Subject: Re: 29.4; Incorrect workarea entry in
 display-monitor-attributes-list on macOS
Date: Mon, 2 Jun 2025 21:16:53 +0100
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




Reply sent to Alan Third <alan <at> idiocy.org>:
You have taken responsibility. (Mon, 02 Jun 2025 20:18:03 GMT) Full text and rfc822 format available.

Notification sent to Ruiyang Wu <ywwry66 <at> gmail.com>:
bug acknowledged by developer. (Mon, 02 Jun 2025 20:18:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.