Subject: Re: bug#58245: 29.0.50; other-frame is broken in EXWM

From: Po Lu <[email-masked]>
Date: Sun, 02 Oct 2022 22:24:52 +0800

Lars Ingebrigtsen <[email-masked]> writes:

>> 3924fbd025 is not buggy; EXWM enables support for _NET_ACTIVE_WINDOW,
>> which Emacs expects to be implemented correctly:
>
> It's a regression, and should be fixed on the Emacs side.

The previous code was causing problems for me, namely C-x 5 o not
working on the GNOME Flashback session (which I have been trying to move
to, large memory leaks upon taking screenshots in GNOME Shell being the
last straw.)

This is because the previous code had two problems: SetInputFocus called
with CurrentTime changed the last-focus-change-time to the current X
server time, which is later than the time specified in the
_NET_ACTIVE_WINDOW message.  So, when Metacity tried to set the input
focus in response to the _NET_ACTIVE_WINDOW message, it failed, as the
timestamp specified in the _NET_ACTIVE_WINDOW became out of date.

As a result, the workspace of the frame being switched to was not made
current by the window manager.

We cannot possibly make Emacs stop working with a correctly written and
widely used window manager in favor of broken window managers,
especially those that mess with internal details of Emacs' X
communication.  Emacs does not guarantee that it will always interact
with the X server in the same fashion, and any external program making
assumptions there is in uncharted territory.  The problem should be
fixed in EXWM; in the meantime, Jack can do:

  (setq x-no-window-manager t)

which will make Emacs skip communicating with the "window manager"
(which is actually Emacs itself; I'm surprised that doesn't lead to
hangs elsewhere.)