Subject: bug#65509: closed (Re: bug#65509: [PATCH] Use correct env var when opening frames with freedesktop menu entries)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 15 Sep 2023 11:35:02 +0000

Your bug report

#65509: [PATCH] Use correct env var when opening frames with freedesktop menu entries

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
65509: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65509
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#65509: [PATCH] Use correct env var when opening frames with freedesktop menu entries
From: Eli Zaretskii <[email-masked]>
To: Po Lu <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked]
Date: Fri, 15 Sep 2023 14:34:29 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Po Lu <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Fri, 15 Sep 2023 15:44:02 +0800
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > Why is it not safe?
> 
> Because there was previously no problem with the X build under Emacs 29,
> and using --reuse-frame there would chance introducing one.

OK, installed on emacs-29 and closing the bug.

Thanks.

Subject: [PATCH] Use correct env var when opening frames with freedesktop menu entries
From: Davide Masserut <[email-masked]>
To: [email-masked]
Date: Thu, 24 Aug 2023 20:32:47 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

When Emacs is built with PGTK, frames opened with the 
emacsclient.desktop entry are opened as X11 windows instead of 
Wayland.

This patch adds a sed command to the Makefile that replaces the 
environment variable "$DISPLAY" with "$WAYLAND_DISPLAY" when built 
with PGTK.

In GNU Emacs 30.0.50 (build 32, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.17.8) of 2023-08-24 built on T480s
Repository revision: 3907c884f03cf5f2a09696bda015b1060c7111ba
Repository branch: master
System Description: Arch Linux

Configured using:
 'configure -C --prefix /home/davide/.local --with-pgtk
 --with-native-compilation --enable-link-time-optimization
 --enable-locallisppath=/usr/share/emacs/site-lisp/
 'CFLAGS=-march=native -O2''
>From c4f516e30c72fbc88838f2ad52730d5e26f8f358 Mon Sep 17 00:00:00 2001
From: Davide Masserut <[email-masked]>
Date: Thu, 24 Aug 2023 18:33:39 +0200
Subject: [PATCH] Use correct env var when opening frames with freedesktop menu
 entries

Avoid opening X11 frames with emacsclient.desktop or
emacsclient-mail.desktop when built with PGTK.

* Makefile.in (install-etc): Replace DISPLAY with WAYLAND_DISPLAY when
built with PGTK.
---
 Makefile.in | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Makefile.in b/Makefile.in
index fdd9353e254..6a08e1a7b18 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -843,6 +843,9 @@ EMACS_ICON=
 ifeq (${USE_STARTUP_NOTIFICATION},no)
 USE_STARTUP_NOTIFICATION_SED_CMD=-e "/^StartupNotify=true$$/d"
 endif
+ifeq ($(HAVE_PGTK),yes)
+USE_WAYLAND_DISPLAY_SED_CMD=-e "/--display=/ s/DISPLAY/WAYLAND_DISPLAY/"
+endif
 install-etc:
 	umask 022; ${MKDIR_P} "$(DESTDIR)${desktopdir}"
 	tmp=etc/emacs.tmpdesktop; rm -f $${tmp}; \
@@ -857,6 +860,7 @@ install-etc:
 	sed -e "/^Exec=/ s|emacsclient|${bindir}/$${client_name}|" \
 	  -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
 	  $(USE_STARTUP_NOTIFICATION_SED_CMD) \
+	  $(USE_WAYLAND_DISPLAY_SED_CMD) \
 	  ${srcdir}/etc/emacsclient.desktop > $${tmp}; \
 	${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/$${client_name}.desktop"; \
 	rm -f $${tmp}
@@ -870,6 +874,7 @@ install-etc:
 	client_name=`echo emacsclient | sed '$(TRANSFORM)'`${EXEEXT}; \
 	sed -e "/^Exec=/ s|emacsclient|${bindir}/$${client_name}|" \
 	  -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
+	  $(USE_WAYLAND_DISPLAY_SED_CMD) \
 	  ${srcdir}/etc/emacsclient-mail.desktop > $${tmp}; \
 	${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/$${client_name}-mail.desktop"; \
 	rm -f $${tmp}
-- 
2.42.0