diff options
| author | Po Lu | 2022-04-12 13:27:56 +0800 |
|---|---|---|
| committer | Po Lu | 2022-04-12 13:27:56 +0800 |
| commit | e2b64f8999f79a5820ba00d2987885d7dda492d5 (patch) | |
| tree | 7a9293de6190364bba375074d3d0044aae3bb489 /src | |
| parent | b15d9fcebbafc583906a5896dc73dacd0814544c (diff) | |
| download | emacs-e2b64f8999f79a5820ba00d2987885d7dda492d5.tar.gz emacs-e2b64f8999f79a5820ba00d2987885d7dda492d5.zip | |
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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/callproc.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/callproc.c b/src/callproc.c index 0922e10f01d..dd162f36a6c 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -85,6 +85,10 @@ extern char **environ; | |||
| 85 | #include "nsterm.h" | 85 | #include "nsterm.h" |
| 86 | #endif | 86 | #endif |
| 87 | 87 | ||
| 88 | #ifdef HAVE_PGTK | ||
| 89 | #include "pgtkterm.h" | ||
| 90 | #endif | ||
| 91 | |||
| 88 | /* Pattern used by call-process-region to make temp files. */ | 92 | /* Pattern used by call-process-region to make temp files. */ |
| 89 | static Lisp_Object Vtemp_file_name_pattern; | 93 | static Lisp_Object Vtemp_file_name_pattern; |
| 90 | 94 | ||
| @@ -1687,6 +1691,7 @@ getenv_internal (const char *var, ptrdiff_t varlen, char **value, | |||
| 1687 | /* For DISPLAY try to get the values from the frame or the initial env. */ | 1691 | /* For DISPLAY try to get the values from the frame or the initial env. */ |
| 1688 | if (strcmp (var, "DISPLAY") == 0) | 1692 | if (strcmp (var, "DISPLAY") == 0) |
| 1689 | { | 1693 | { |
| 1694 | #ifndef HAVE_PGTK | ||
| 1690 | Lisp_Object display | 1695 | Lisp_Object display |
| 1691 | = Fframe_parameter (NILP (frame) ? selected_frame : frame, Qdisplay); | 1696 | = Fframe_parameter (NILP (frame) ? selected_frame : frame, Qdisplay); |
| 1692 | if (STRINGP (display)) | 1697 | if (STRINGP (display)) |
| @@ -1695,6 +1700,7 @@ getenv_internal (const char *var, ptrdiff_t varlen, char **value, | |||
| 1695 | *valuelen = SBYTES (display); | 1700 | *valuelen = SBYTES (display); |
| 1696 | return 1; | 1701 | return 1; |
| 1697 | } | 1702 | } |
| 1703 | #endif | ||
| 1698 | /* If still not found, Look for DISPLAY in Vinitial_environment. */ | 1704 | /* If still not found, Look for DISPLAY in Vinitial_environment. */ |
| 1699 | if (getenv_internal_1 (var, varlen, value, valuelen, | 1705 | if (getenv_internal_1 (var, varlen, value, valuelen, |
| 1700 | Vinitial_environment)) | 1706 | Vinitial_environment)) |
| @@ -1812,6 +1818,18 @@ make_environment_block (Lisp_Object current_dir) | |||
| 1812 | if (NILP (display)) | 1818 | if (NILP (display)) |
| 1813 | { | 1819 | { |
| 1814 | Lisp_Object tmp = Fframe_parameter (selected_frame, Qdisplay); | 1820 | Lisp_Object tmp = Fframe_parameter (selected_frame, Qdisplay); |
| 1821 | |||
| 1822 | #ifdef HAVE_PGTK | ||
| 1823 | /* The only time GDK actually returns correct information is | ||
| 1824 | when it's running under X Windows. DISPLAY shouldn't be | ||
| 1825 | set to a Wayland display either, since that's an X specific | ||
| 1826 | variable. */ | ||
| 1827 | if (FRAME_WINDOW_P (SELECTED_FRAME ()) | ||
| 1828 | && strcmp (G_OBJECT_TYPE_NAME (FRAME_X_DISPLAY (SELECTED_FRAME ())), | ||
| 1829 | "GdkX11Display")) | ||
| 1830 | tmp = Qnil; | ||
| 1831 | #endif | ||
| 1832 | |||
| 1815 | if (!STRINGP (tmp) && CONSP (Vinitial_environment)) | 1833 | if (!STRINGP (tmp) && CONSP (Vinitial_environment)) |
| 1816 | /* If still not found, Look for DISPLAY in Vinitial_environment. */ | 1834 | /* If still not found, Look for DISPLAY in Vinitial_environment. */ |
| 1817 | tmp = Fgetenv_internal (build_string ("DISPLAY"), | 1835 | tmp = Fgetenv_internal (build_string ("DISPLAY"), |