[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master e2b64f8999: Fix some DISPLAY variable related bugs on PGTK
From: |
Po Lu |
Subject: |
master e2b64f8999: Fix some DISPLAY variable related bugs on PGTK |
Date: |
Tue, 12 Apr 2022 01:28:55 -0400 (EDT) |
branch: master
commit e2b64f8999f79a5820ba00d2987885d7dda492d5
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Fix some DISPLAY variable related bugs on PGTK
* src/callproc.c (getenv_internal, make_environment_block):
Don't set DISPLAY on non-X GDK backends. (bug#54844)
---
src/callproc.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/callproc.c b/src/callproc.c
index 0922e10f01..dd162f36a6 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -85,6 +85,10 @@ extern char **environ;
#include "nsterm.h"
#endif
+#ifdef HAVE_PGTK
+#include "pgtkterm.h"
+#endif
+
/* Pattern used by call-process-region to make temp files. */
static Lisp_Object Vtemp_file_name_pattern;
@@ -1687,6 +1691,7 @@ getenv_internal (const char *var, ptrdiff_t varlen, char
**value,
/* For DISPLAY try to get the values from the frame or the initial env. */
if (strcmp (var, "DISPLAY") == 0)
{
+#ifndef HAVE_PGTK
Lisp_Object display
= Fframe_parameter (NILP (frame) ? selected_frame : frame, Qdisplay);
if (STRINGP (display))
@@ -1695,6 +1700,7 @@ getenv_internal (const char *var, ptrdiff_t varlen, char
**value,
*valuelen = SBYTES (display);
return 1;
}
+#endif
/* If still not found, Look for DISPLAY in Vinitial_environment. */
if (getenv_internal_1 (var, varlen, value, valuelen,
Vinitial_environment))
@@ -1812,6 +1818,18 @@ make_environment_block (Lisp_Object current_dir)
if (NILP (display))
{
Lisp_Object tmp = Fframe_parameter (selected_frame, Qdisplay);
+
+#ifdef HAVE_PGTK
+ /* The only time GDK actually returns correct information is
+ when it's running under X Windows. DISPLAY shouldn't be
+ set to a Wayland display either, since that's an X specific
+ variable. */
+ if (FRAME_WINDOW_P (SELECTED_FRAME ())
+ && strcmp (G_OBJECT_TYPE_NAME (FRAME_X_DISPLAY (SELECTED_FRAME ())),
+ "GdkX11Display"))
+ tmp = Qnil;
+#endif
+
if (!STRINGP (tmp) && CONSP (Vinitial_environment))
/* If still not found, Look for DISPLAY in Vinitial_environment. */
tmp = Fgetenv_internal (build_string ("DISPLAY"),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master e2b64f8999: Fix some DISPLAY variable related bugs on PGTK,
Po Lu <=