GNU bug report logs - #71912
30.0.50; Inaccurate window-absolute-pixel-position Values on macOS After Sleep and During Fullscreen Mode

Previous Next

Package: emacs;

Reported by: Jones Stephen <happyojones <at> gmail.com>

Date: Wed, 3 Jul 2024 07:37:01 UTC

Severity: normal

Found in version 30.0.50

Fixed in version 30.1

Done: Gerd Möllmann <gerd.moellmann <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: 71912 <at> debbugs.gnu.org
Cc: Jones Stephen <happyojones <at> gmail.com>
Subject: [Gerd Möllmann] Re: bug#71912: 30.0.50; Inaccurate
 window-absolute-pixel-position Values on macOS After Sleep and During
 Fullscreen Mode
Date: Sun, 11 Aug 2024 08:49:13 +0200
[Message part 1 (text/plain, inline)]
Forwarded to bug list to keep it informed.

-------------------- Start of forwarded message --------------------
From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Jones Stephen <happyojones <at> gmail.com>
Subject: Re: bug#71912: 30.0.50; Inaccurate window-absolute-pixel-position
 Values on macOS After Sleep and During Fullscreen Mode
Date: Sun, 11 Aug 2024 08:41:49 +0200

[Message part 2 (text/plain, inline)]
Jones Stephen <happyojones <at> gmail.com> writes:

> Thank you for the recent patch. I wanted to let you know that after
> using the latest version of Emacs, I found that the fullscreen issue
> has been resolved, which is great news—thank you for that!
>
> However, I’m still encountering an issue with the frame position after
> the system wakes from sleep. Here’s how to reproduce it:
>
> 1. Open Emacs.
> 2. Use a window management tool like Rectangle to position Emacs on one side of the screen.
> 3. Put macOS to sleep.
> 4. Wait for a while, approximately 30 minutes.
> 5. Wake up macOS, enter the login password, and then focus back on Emacs.
>
> At this point, the frame position seems to be incorrect.

I can reproduce this here.

> Interestingly, when I use Rectangle to move Emacs to the other side of
> the screen, the position issue is resolved.
>
> I believe this could be related to missing a system wake notification.
> Perhaps adding something like:
>
> ```swift
> NotificationCenter.default.addObserver(
>     self,
>     selector: #selector(systemDidWake),
>     name: NSWorkspace.didWakeNotification,
>     object: nil
> )
> ```
>
> and calling `adjustEmacsFrameRect` in the callback could address this
> issue. Alternatively, calling `adjustEmacsFrameRect` whenever
> `windowDidBecomeKey` is triggered might also work.
>

Indeed, that seems to work, although I find it strage that something
like that is necessary. But what do I know.

Could you please try the attached patch?

[0001-macOS-Wrong-frame-rectangle-after-wake-bug-71912.patch (text/x-patch, attachment)]
[Message part 4 (text/plain, inline)]
-------------------- End of forwarded message --------------------

This bug report was last modified 346 days ago.

Previous Next


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