Subject: Re: bug#65009: 29.1; should emacsclient check BROADWAY_DISPLAY as well as WAYLAND_DISPLAY and DISPLAY?

From: "Trent W. Buck" <[email-masked]>
Date: Thu, 3 Aug 2023 04:12:48 +1000

On Wed 02 Aug 2023 21:06:09 +0800, Po Lu wrote:
> > But "emacsclient --create-frame" won't work until/unless it checks
> > $BROADWAY_DISPLAY, right?
> 
> Correct.

I did some testing.
It appears to Just Work for basic usage (single display server).

I put some screenshots here: https://imgur.com/a/RSfScXt
I've also attached a single before/after pair.

One thing that really surprised me: quitting emacs (e.g. via M-x kill-emacs) causes broadwayd to crash!
This is not the case for gtk3-demo, so it might be a weirdness in emacs.

I also tested if GTK3 apps can display in gtk4-broadwayd, and
if GTK4 apps can display in [gtk3]-broadwayd.  It seems they cannot.

> > If the general consensus is "too hard; WONTFIX", I am OK with that.
> > This is something I want a couple of times a year, not every single
> > day.
>
> If such a fix only serves the interests of a few users of WSL, then yes.
> But we still receive occasional reports of frustration with
> Emacsclient's display detection from Wayland users on GNU/Linux, so this
> problem will have to be tackled.
>
> However, I'm not willing to settle for replicating GDK's own display
> selection mechanism using the names of a few environment variables that
> simply coincide with those used by common GDK configurations.  Going
> down that route would be incredibly fragile, and make Emacs even more
> subject to GDK's petty whims.

I think your argument is reasonable and sensible.

> Perhaps, for the time being, PGTK builds should forgo checking for a
> display in Emacsclient, and simply use whatever display connection was
> last opened.
>
> Comments?

For my personal use I think Emacs's current behaviour is adequate.
(i.e. I think this bug ticket can be closed.)

The Debian people seem to be OK with shipping a per-build emacsclient
(i.e. emacsclient moves from "emacs-bin-common" to "emacs-<variant>" deb).
That means the existing "#ifdef pgtk then check $WAYLAND_DISPLAY" will be OK.
At least for most users, most of the time.

I'm really excited that I finally have pgtk through my normal distro channels! It's cool! :-)