mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-11 16:08:13 +00:00
Properly run emacsclient under Android if DISPLAY is set
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap): Make dimensions final, since they are never changed after the constructor. * lib-src/emacsclient.c (decode_options): If --display is not provided, always set display to `android' even if DISPLAY is provided. * lisp/net/browse-url.el (browse-url): Cease setting DISPLAY under Android. * src/callproc.c (getenv_internal, make_environment_block): Don't afford DISPLAY special treatment under Android.
This commit is contained in:
parent
03ac16ece4
commit
aa872f2540
@ -34,7 +34,7 @@ public final class EmacsPixmap extends EmacsHandleObject
|
||||
{
|
||||
/* The depth of the bitmap. This is not actually used, just defined
|
||||
in order to be consistent with X. */
|
||||
public int depth, width, height;
|
||||
public final int depth, width, height;
|
||||
|
||||
/* The bitmap itself. */
|
||||
public Bitmap bitmap;
|
||||
@ -44,7 +44,7 @@ public final class EmacsPixmap extends EmacsHandleObject
|
||||
|
||||
/* Whether or not GC should be explicitly triggered upon
|
||||
release. */
|
||||
private boolean needCollect;
|
||||
private final boolean needCollect;
|
||||
|
||||
/* ID used to determine whether or not the GC clip rects
|
||||
changed. */
|
||||
@ -77,6 +77,10 @@ public final class EmacsPixmap extends EmacsHandleObject
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.depth = depth;
|
||||
|
||||
/* The immutable bitmap constructor is only leveraged to create
|
||||
small fringe bitmaps. */
|
||||
this.needCollect = false;
|
||||
}
|
||||
|
||||
public
|
||||
|
@ -618,6 +618,7 @@ decode_options (int argc, char **argv)
|
||||
display in DISPLAY (if any). */
|
||||
if (create_frame && !tty && !display)
|
||||
{
|
||||
#ifndef HAVE_ANDROID
|
||||
/* Set these here so we use a default_display only when the user
|
||||
didn't give us an explicit display. */
|
||||
#if defined (NS_IMPL_COCOA)
|
||||
@ -626,16 +627,22 @@ decode_options (int argc, char **argv)
|
||||
alt_display = "w32";
|
||||
#elif defined (HAVE_HAIKU)
|
||||
alt_display = "be";
|
||||
#elif defined (HAVE_ANDROID)
|
||||
alt_display = "android";
|
||||
#endif
|
||||
#endif /* NS_IMPL_COCOA */
|
||||
|
||||
#ifdef HAVE_PGTK
|
||||
display = egetenv ("WAYLAND_DISPLAY");
|
||||
alt_display = egetenv ("DISPLAY");
|
||||
#else
|
||||
#else /* !HAVE_PGTK */
|
||||
display = egetenv ("DISPLAY");
|
||||
#endif
|
||||
#endif /* HAVE_PGTK */
|
||||
#else /* HAVE_ANDROID */
|
||||
/* Disregard the DISPLAY environment variable under Android.
|
||||
Several terminal emulator programs furnish their own X
|
||||
servers and set DISPLAY, but an Android build is incapable of
|
||||
displaying X frames. */
|
||||
alt_display = NULL;
|
||||
display = "android";
|
||||
#endif /* !HAVE_ANDROID */
|
||||
}
|
||||
|
||||
if (!display)
|
||||
|
@ -914,6 +914,11 @@ If ARGS are omitted, the default is to pass
|
||||
;; (setenv "WAYLAND_DISPLAY" dpy)
|
||||
)
|
||||
(setenv "DISPLAY" dpy)))
|
||||
((featurep 'android)
|
||||
;; Avoid modifying the DISPLAY environment variable here,
|
||||
;; which interferes with any X server the user may have
|
||||
;; expressly set.
|
||||
nil)
|
||||
(t
|
||||
(setenv "DISPLAY" dpy)))))
|
||||
(if (functionp function)
|
||||
|
@ -1735,6 +1735,10 @@ getenv_internal (const char *var, ptrdiff_t varlen, char **value,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Setting DISPLAY under Android hinders attempts to display other
|
||||
programs within X servers that are available for Android. */
|
||||
|
||||
#ifndef HAVE_ANDROID
|
||||
/* For DISPLAY try to get the values from the frame or the initial env. */
|
||||
if (strcmp (var, "DISPLAY") == 0)
|
||||
{
|
||||
@ -1747,12 +1751,13 @@ getenv_internal (const char *var, ptrdiff_t varlen, char **value,
|
||||
*valuelen = SBYTES (display);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#endif /* !HAVE_PGTK */
|
||||
/* If still not found, Look for DISPLAY in Vinitial_environment. */
|
||||
if (getenv_internal_1 (var, varlen, value, valuelen,
|
||||
Vinitial_environment))
|
||||
return *value ? 1 : 0;
|
||||
}
|
||||
#endif /* !HAVE_ANDROID */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1845,7 +1850,9 @@ make_environment_block (Lisp_Object current_dir)
|
||||
register char **new_env;
|
||||
char **p, **q;
|
||||
register int new_length;
|
||||
#ifndef HAVE_ANDROID
|
||||
Lisp_Object display = Qnil;
|
||||
#endif /* !HAVE_ANDROID */
|
||||
|
||||
new_length = 0;
|
||||
|
||||
@ -1853,14 +1860,20 @@ make_environment_block (Lisp_Object current_dir)
|
||||
CONSP (tem) && STRINGP (XCAR (tem));
|
||||
tem = XCDR (tem))
|
||||
{
|
||||
#ifndef HAVE_ANDROID
|
||||
if (strncmp (SSDATA (XCAR (tem)), "DISPLAY", 7) == 0
|
||||
&& (SDATA (XCAR (tem)) [7] == '\0'
|
||||
|| SDATA (XCAR (tem)) [7] == '='))
|
||||
/* DISPLAY is specified in process-environment. */
|
||||
display = Qt;
|
||||
#endif /* !HAVE_ANDROID */
|
||||
new_length++;
|
||||
}
|
||||
|
||||
/* Setting DISPLAY under Android hinders attempts to display other
|
||||
programs within X servers that are available for Android. */
|
||||
|
||||
#ifndef HAVE_ANDROID
|
||||
/* If not provided yet, use the frame's DISPLAY. */
|
||||
if (NILP (display))
|
||||
{
|
||||
@ -1875,7 +1888,7 @@ make_environment_block (Lisp_Object current_dir)
|
||||
&& strcmp (G_OBJECT_TYPE_NAME (FRAME_X_DISPLAY (SELECTED_FRAME ())),
|
||||
"GdkX11Display"))
|
||||
tmp = Qnil;
|
||||
#endif
|
||||
#endif /* HAVE_PGTK */
|
||||
|
||||
if (!STRINGP (tmp) && CONSP (Vinitial_environment))
|
||||
/* If still not found, Look for DISPLAY in Vinitial_environment. */
|
||||
@ -1887,6 +1900,7 @@ make_environment_block (Lisp_Object current_dir)
|
||||
new_length++;
|
||||
}
|
||||
}
|
||||
#endif /* !HAVE_ANDROID */
|
||||
|
||||
/* new_length + 2 to include PWD and terminating 0. */
|
||||
env = new_env = xnmalloc (new_length + 2, sizeof *env);
|
||||
@ -1896,6 +1910,7 @@ make_environment_block (Lisp_Object current_dir)
|
||||
if (egetenv ("PWD"))
|
||||
*new_env++ = pwd_var;
|
||||
|
||||
#ifndef HAVE_ANDROID
|
||||
if (STRINGP (display))
|
||||
{
|
||||
char *vdata = xmalloc (sizeof "DISPLAY=" + SBYTES (display));
|
||||
@ -1903,6 +1918,7 @@ make_environment_block (Lisp_Object current_dir)
|
||||
lispstpcpy (stpcpy (vdata, "DISPLAY="), display);
|
||||
new_env = add_env (env, new_env, vdata);
|
||||
}
|
||||
#endif /* !HAVE_ANDROID */
|
||||
|
||||
/* Overrides. */
|
||||
for (tem = Vprocess_environment;
|
||||
|
Loading…
Reference in New Issue
Block a user