mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-25 19:11:56 +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
|
/* The depth of the bitmap. This is not actually used, just defined
|
||||||
in order to be consistent with X. */
|
in order to be consistent with X. */
|
||||||
public int depth, width, height;
|
public final int depth, width, height;
|
||||||
|
|
||||||
/* The bitmap itself. */
|
/* The bitmap itself. */
|
||||||
public Bitmap bitmap;
|
public Bitmap bitmap;
|
||||||
@ -44,7 +44,7 @@ public final class EmacsPixmap extends EmacsHandleObject
|
|||||||
|
|
||||||
/* Whether or not GC should be explicitly triggered upon
|
/* Whether or not GC should be explicitly triggered upon
|
||||||
release. */
|
release. */
|
||||||
private boolean needCollect;
|
private final boolean needCollect;
|
||||||
|
|
||||||
/* ID used to determine whether or not the GC clip rects
|
/* ID used to determine whether or not the GC clip rects
|
||||||
changed. */
|
changed. */
|
||||||
@ -77,6 +77,10 @@ public final class EmacsPixmap extends EmacsHandleObject
|
|||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.depth = depth;
|
this.depth = depth;
|
||||||
|
|
||||||
|
/* The immutable bitmap constructor is only leveraged to create
|
||||||
|
small fringe bitmaps. */
|
||||||
|
this.needCollect = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public
|
public
|
||||||
|
@ -618,6 +618,7 @@ decode_options (int argc, char **argv)
|
|||||||
display in DISPLAY (if any). */
|
display in DISPLAY (if any). */
|
||||||
if (create_frame && !tty && !display)
|
if (create_frame && !tty && !display)
|
||||||
{
|
{
|
||||||
|
#ifndef HAVE_ANDROID
|
||||||
/* Set these here so we use a default_display only when the user
|
/* Set these here so we use a default_display only when the user
|
||||||
didn't give us an explicit display. */
|
didn't give us an explicit display. */
|
||||||
#if defined (NS_IMPL_COCOA)
|
#if defined (NS_IMPL_COCOA)
|
||||||
@ -626,16 +627,22 @@ decode_options (int argc, char **argv)
|
|||||||
alt_display = "w32";
|
alt_display = "w32";
|
||||||
#elif defined (HAVE_HAIKU)
|
#elif defined (HAVE_HAIKU)
|
||||||
alt_display = "be";
|
alt_display = "be";
|
||||||
#elif defined (HAVE_ANDROID)
|
#endif /* NS_IMPL_COCOA */
|
||||||
alt_display = "android";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_PGTK
|
#ifdef HAVE_PGTK
|
||||||
display = egetenv ("WAYLAND_DISPLAY");
|
display = egetenv ("WAYLAND_DISPLAY");
|
||||||
alt_display = egetenv ("DISPLAY");
|
alt_display = egetenv ("DISPLAY");
|
||||||
#else
|
#else /* !HAVE_PGTK */
|
||||||
display = egetenv ("DISPLAY");
|
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)
|
if (!display)
|
||||||
|
@ -914,6 +914,11 @@ If ARGS are omitted, the default is to pass
|
|||||||
;; (setenv "WAYLAND_DISPLAY" dpy)
|
;; (setenv "WAYLAND_DISPLAY" dpy)
|
||||||
)
|
)
|
||||||
(setenv "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
|
(t
|
||||||
(setenv "DISPLAY" dpy)))))
|
(setenv "DISPLAY" dpy)))))
|
||||||
(if (functionp function)
|
(if (functionp function)
|
||||||
|
@ -1735,6 +1735,10 @@ getenv_internal (const char *var, ptrdiff_t varlen, char **value,
|
|||||||
}
|
}
|
||||||
#endif
|
#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. */
|
/* For DISPLAY try to get the values from the frame or the initial env. */
|
||||||
if (strcmp (var, "DISPLAY") == 0)
|
if (strcmp (var, "DISPLAY") == 0)
|
||||||
{
|
{
|
||||||
@ -1747,12 +1751,13 @@ getenv_internal (const char *var, ptrdiff_t varlen, char **value,
|
|||||||
*valuelen = SBYTES (display);
|
*valuelen = SBYTES (display);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* !HAVE_PGTK */
|
||||||
/* If still not found, Look for DISPLAY in Vinitial_environment. */
|
/* If still not found, Look for DISPLAY in Vinitial_environment. */
|
||||||
if (getenv_internal_1 (var, varlen, value, valuelen,
|
if (getenv_internal_1 (var, varlen, value, valuelen,
|
||||||
Vinitial_environment))
|
Vinitial_environment))
|
||||||
return *value ? 1 : 0;
|
return *value ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
#endif /* !HAVE_ANDROID */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1845,7 +1850,9 @@ make_environment_block (Lisp_Object current_dir)
|
|||||||
register char **new_env;
|
register char **new_env;
|
||||||
char **p, **q;
|
char **p, **q;
|
||||||
register int new_length;
|
register int new_length;
|
||||||
|
#ifndef HAVE_ANDROID
|
||||||
Lisp_Object display = Qnil;
|
Lisp_Object display = Qnil;
|
||||||
|
#endif /* !HAVE_ANDROID */
|
||||||
|
|
||||||
new_length = 0;
|
new_length = 0;
|
||||||
|
|
||||||
@ -1853,14 +1860,20 @@ make_environment_block (Lisp_Object current_dir)
|
|||||||
CONSP (tem) && STRINGP (XCAR (tem));
|
CONSP (tem) && STRINGP (XCAR (tem));
|
||||||
tem = XCDR (tem))
|
tem = XCDR (tem))
|
||||||
{
|
{
|
||||||
|
#ifndef HAVE_ANDROID
|
||||||
if (strncmp (SSDATA (XCAR (tem)), "DISPLAY", 7) == 0
|
if (strncmp (SSDATA (XCAR (tem)), "DISPLAY", 7) == 0
|
||||||
&& (SDATA (XCAR (tem)) [7] == '\0'
|
&& (SDATA (XCAR (tem)) [7] == '\0'
|
||||||
|| SDATA (XCAR (tem)) [7] == '='))
|
|| SDATA (XCAR (tem)) [7] == '='))
|
||||||
/* DISPLAY is specified in process-environment. */
|
/* DISPLAY is specified in process-environment. */
|
||||||
display = Qt;
|
display = Qt;
|
||||||
|
#endif /* !HAVE_ANDROID */
|
||||||
new_length++;
|
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 not provided yet, use the frame's DISPLAY. */
|
||||||
if (NILP (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 ())),
|
&& strcmp (G_OBJECT_TYPE_NAME (FRAME_X_DISPLAY (SELECTED_FRAME ())),
|
||||||
"GdkX11Display"))
|
"GdkX11Display"))
|
||||||
tmp = Qnil;
|
tmp = Qnil;
|
||||||
#endif
|
#endif /* HAVE_PGTK */
|
||||||
|
|
||||||
if (!STRINGP (tmp) && CONSP (Vinitial_environment))
|
if (!STRINGP (tmp) && CONSP (Vinitial_environment))
|
||||||
/* If still not found, Look for DISPLAY in 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++;
|
new_length++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* !HAVE_ANDROID */
|
||||||
|
|
||||||
/* new_length + 2 to include PWD and terminating 0. */
|
/* new_length + 2 to include PWD and terminating 0. */
|
||||||
env = new_env = xnmalloc (new_length + 2, sizeof *env);
|
env = new_env = xnmalloc (new_length + 2, sizeof *env);
|
||||||
@ -1896,6 +1910,7 @@ make_environment_block (Lisp_Object current_dir)
|
|||||||
if (egetenv ("PWD"))
|
if (egetenv ("PWD"))
|
||||||
*new_env++ = pwd_var;
|
*new_env++ = pwd_var;
|
||||||
|
|
||||||
|
#ifndef HAVE_ANDROID
|
||||||
if (STRINGP (display))
|
if (STRINGP (display))
|
||||||
{
|
{
|
||||||
char *vdata = xmalloc (sizeof "DISPLAY=" + SBYTES (display));
|
char *vdata = xmalloc (sizeof "DISPLAY=" + SBYTES (display));
|
||||||
@ -1903,6 +1918,7 @@ make_environment_block (Lisp_Object current_dir)
|
|||||||
lispstpcpy (stpcpy (vdata, "DISPLAY="), display);
|
lispstpcpy (stpcpy (vdata, "DISPLAY="), display);
|
||||||
new_env = add_env (env, new_env, vdata);
|
new_env = add_env (env, new_env, vdata);
|
||||||
}
|
}
|
||||||
|
#endif /* !HAVE_ANDROID */
|
||||||
|
|
||||||
/* Overrides. */
|
/* Overrides. */
|
||||||
for (tem = Vprocess_environment;
|
for (tem = Vprocess_environment;
|
||||||
|
Loading…
Reference in New Issue
Block a user