1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Miscellaneous fixes for Android port

* lisp/touch-screen.el (touch-screen-hold, touch-screen-drag):
Clear deactivate-mark if the mark is activated to prevent undue
deactivation after completion.

* lisp/wid-edit.el (widget-field, widget-single-line-field):
Insert specifications suitable for monochrome displays.

* src/androidfns.c (Fxw_display_color_p, Fx_display_grayscale_p):
Report color and/or grayscale properly.

* src/image.c (image_create_bitmap_from_file)
[HAVE_ANDROID]: If a file with no extension cannot be located,
append .xbm and retry.
This commit is contained in:
Po Lu 2024-04-24 11:42:48 +08:00
parent d8d4fd8c6d
commit d3d1be8ae5
4 changed files with 42 additions and 10 deletions

View file

@ -351,7 +351,8 @@ word around EVENT; otherwise, set point to the location of EVENT."
touch-screen-word-select-bounds nil)
(push-mark point)
(goto-char point)
(activate-mark))
(activate-mark)
(setq deactivate-mark nil))
;; Start word selection by trying to obtain the position
;; around point.
(let ((word-start nil)
@ -381,7 +382,8 @@ word around EVENT; otherwise, set point to the location of EVENT."
touch-screen-word-select-initial-word nil)
(push-mark point)
(goto-char point)
(activate-mark))
(activate-mark)
(setq deactivate-mark nil))
;; Otherwise, select the word. Move point to either the
;; end or the start of the word, depending on which is
;; closer to EVENT.
@ -420,10 +422,12 @@ word around EVENT; otherwise, set point to the location of EVENT."
(progn
(push-mark word-start)
(activate-mark)
(setq deactivate-mark nil)
(goto-char word-end))
(progn
(push-mark word-end)
(activate-mark)
(setq deactivate-mark nil)
(goto-char word-start)))
;; Record the bounds of the selected word.
(setq touch-screen-word-select-bounds
@ -837,7 +841,8 @@ area."
;; Display a preview of the line now around
;; point if requested by the user.
(when touch-screen-preview-select
(touch-screen-preview-select))))))))))))))
(touch-screen-preview-select)))))))))))
(setq deactivate-mark nil))))
(defun touch-screen-restart-drag (event)
"Restart dragging to select text.

View file

@ -141,12 +141,21 @@ This exists as a variable so it can be set locally in certain buffers.")
:background "dim gray"
:box (:line-width (1 . -1) :color "gray46")
:extend t)
;; Monochrome displays.
(((background light))
:background "white"
:box (:line-width (1 . -1) :color "black")
:extend t)
(((background dark))
:background "black"
:box (:line-width (1 . -1) :color "white")
:extend t)
(t
:slant italic
:extend t))
"Face used for editable fields."
:group 'widget-faces
:version "28.1")
:version "30.1")
(defface widget-single-line-field '((((type tty))
:background "green3"
@ -157,6 +166,10 @@ This exists as a variable so it can be set locally in certain buffers.")
(((class grayscale color)
(background dark))
:background "dim gray")
;; Monochrome displays.
(((background light))
:stipple "gray3"
:extend t)
(t
:slant italic))
"Face used for editable fields spanning only a single line."

View file

@ -1202,7 +1202,10 @@ DEFUN ("xw-display-color-p", Fxw_display_color_p,
doc: /* SKIP: real doc in xfns.c. */)
(Lisp_Object terminal)
{
return Qt;
struct android_display_info *dpyinfo;
dpyinfo = check_android_display_info (terminal);
return dpyinfo->n_planes > 8 ? Qt : Qnil;
}
DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p,
@ -1210,7 +1213,11 @@ DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p,
doc: /* SKIP: real doc in xfns.c. */)
(Lisp_Object terminal)
{
return Qnil;
struct android_display_info *dpyinfo;
dpyinfo = check_android_display_info (terminal);
return (dpyinfo->n_planes > 1 && dpyinfo->n_planes <= 8
? Qt : Qnil);
}
DEFUN ("x-display-pixel-width", Fx_display_pixel_width,

View file

@ -957,10 +957,17 @@ image_create_bitmap_from_file (struct frame *f, Lisp_Object file)
}
}
/* Search bitmap-file-path for the file, if appropriate. */
if (openp (Vx_bitmap_file_path, file, Qnil, &found,
make_fixnum (R_OK), false, false, NULL)
< 0)
/* Search bitmap-file-path for the file, if appropriate. If no file
extension or directory is specified and no file by this name
exists, append the extension ".xbm" and retry. */
if ((openp (Vx_bitmap_file_path, file, Qnil, &found,
make_fixnum (R_OK), false, false, NULL) < 0)
&& (NILP (Fequal (Ffile_name_nondirectory (file), file))
|| strrchr (SSDATA (file), '.')
|| (openp (Vx_bitmap_file_path,
CALLN (Fconcat, file, build_string (".xbm")),
Qnil, &found, make_fixnum (R_OK), false, false,
NULL) < 0)))
return -1;
if (!STRINGP (image_find_image_fd (file, &fd))