unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "Trent W. Buck" <trentbuck@gmail.com>
Cc: 65009@debbugs.gnu.org
Subject: bug#65009: 29.1; should emacsclient check BROADWAY_DISPLAY as well as WAYLAND_DISPLAY and DISPLAY?
Date: Wed, 02 Aug 2023 21:06:09 +0800	[thread overview]
Message-ID: <875y5xd266.fsf@yahoo.com> (raw)
In-Reply-To: <874jlhepqc.fsf@gmail.com> (Trent W. Buck's message of "Wed, 02 Aug 2023 19:51:55 +1000")

"Trent W. Buck" <trentbuck@gmail.com> writes:

> I'm writing this from Emacs 28.2 still, but this is about pgtk 29.1.
> I haven't actually tested pgtk myself yet (sorry!)
>
> The good folks of #debian-emacs noticed that while emacsclient doesn't
> link to any GUI libraries, it does check GUI environment variables.
>
>     https://sources.debian.org/src/emacs/1:29.1+1-2/lib-src/emacsclient.c/?hl=1703#L631-L636
>
>     631  #ifdef HAVE_PGTK
>     632        display = egetenv ("WAYLAND_DISPLAY");
>     633        alt_display = egetenv ("DISPLAY");
>     634  #else
>     635        display = egetenv ("DISPLAY");
>     636  #endif
>
> This (maybe) causes weirdness when Debian builds several versions of
> /bin/emacs, but a single shared version of /bin/emacsclient.

Debian should packge Emacsclient within their Emacs packages themselves,
since its behavior differs between different configurations.  If that's
not practical, Debian should at least strive to install Emacsclient for
each installed Emacs configuration under a unique name.

> But THIS bug is about what happens if you're running emacs inside the
> browser, using GTK's built-in HTML5 backend:
>
>     # Start the display (a.k.a. web server)
>     broadwayd :0 &
>
>     # Connect from a client (could be a different container)
>     firefox http://127.0.0.1:8080
>
>     # start some GUI apps
>     GDK_BACKEND=broadway BROADWAY_DISPLAY=:0 gtk3-demo &
>     GDK_BACKEND=broadway BROADWAY_DISPLAY=:0 gnome-terminal -- emacs -nw &
>     GDK_BACKEND=broadway BROADWAY_DISPLAY=:0 virt-manager &
>     GDK_BACKEND=broadway BROADWAY_DISPLAY=:0 emacs &
>
> AIUI pGTK makes Emacs a fully native GTK app and this Just Works.

Yes.  BTW, the `P' in ``PGTK'' should be capitalized.

> But "emacsclient --create-frame" won't work until/unless it checks
> $BROADWAY_DISPLAY, right?

Correct.

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

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?





  reply	other threads:[~2023-08-02 13:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02  9:51 bug#65009: 29.1; should emacsclient check BROADWAY_DISPLAY as well as WAYLAND_DISPLAY and DISPLAY? Trent W. Buck
2023-08-02 13:06 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-08-02 18:12   ` Trent W. Buck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875y5xd266.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=65009@debbugs.gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=trentbuck@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).