aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2024-04-24 11:42:48 +0800
committerPo Lu2024-04-24 11:42:48 +0800
commitd3d1be8ae56efe29e4a721c5dd4e1fa973cf9d5a (patch)
treef443cb0d7b45bc867f820cc70966be7280a1c03d
parentd8d4fd8c6dbe11542432fccdc31701da9f686460 (diff)
downloademacs-d3d1be8ae56efe29e4a721c5dd4e1fa973cf9d5a.tar.gz
emacs-d3d1be8ae56efe29e4a721c5dd4e1fa973cf9d5a.zip
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.
-rw-r--r--lisp/touch-screen.el11
-rw-r--r--lisp/wid-edit.el15
-rw-r--r--src/androidfns.c11
-rw-r--r--src/image.c15
4 files changed, 42 insertions, 10 deletions
diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el
index 037386112d3..52a36712c44 100644
--- a/lisp/touch-screen.el
+++ b/lisp/touch-screen.el
@@ -351,7 +351,8 @@ word around EVENT; otherwise, set point to the location of EVENT."
351 touch-screen-word-select-bounds nil) 351 touch-screen-word-select-bounds nil)
352 (push-mark point) 352 (push-mark point)
353 (goto-char point) 353 (goto-char point)
354 (activate-mark)) 354 (activate-mark)
355 (setq deactivate-mark nil))
355 ;; Start word selection by trying to obtain the position 356 ;; Start word selection by trying to obtain the position
356 ;; around point. 357 ;; around point.
357 (let ((word-start nil) 358 (let ((word-start nil)
@@ -381,7 +382,8 @@ word around EVENT; otherwise, set point to the location of EVENT."
381 touch-screen-word-select-initial-word nil) 382 touch-screen-word-select-initial-word nil)
382 (push-mark point) 383 (push-mark point)
383 (goto-char point) 384 (goto-char point)
384 (activate-mark)) 385 (activate-mark)
386 (setq deactivate-mark nil))
385 ;; Otherwise, select the word. Move point to either the 387 ;; Otherwise, select the word. Move point to either the
386 ;; end or the start of the word, depending on which is 388 ;; end or the start of the word, depending on which is
387 ;; closer to EVENT. 389 ;; closer to EVENT.
@@ -420,10 +422,12 @@ word around EVENT; otherwise, set point to the location of EVENT."
420 (progn 422 (progn
421 (push-mark word-start) 423 (push-mark word-start)
422 (activate-mark) 424 (activate-mark)
425 (setq deactivate-mark nil)
423 (goto-char word-end)) 426 (goto-char word-end))
424 (progn 427 (progn
425 (push-mark word-end) 428 (push-mark word-end)
426 (activate-mark) 429 (activate-mark)
430 (setq deactivate-mark nil)
427 (goto-char word-start))) 431 (goto-char word-start)))
428 ;; Record the bounds of the selected word. 432 ;; Record the bounds of the selected word.
429 (setq touch-screen-word-select-bounds 433 (setq touch-screen-word-select-bounds
@@ -837,7 +841,8 @@ area."
837 ;; Display a preview of the line now around 841 ;; Display a preview of the line now around
838 ;; point if requested by the user. 842 ;; point if requested by the user.
839 (when touch-screen-preview-select 843 (when touch-screen-preview-select
840 (touch-screen-preview-select)))))))))))))) 844 (touch-screen-preview-select)))))))))))
845 (setq deactivate-mark nil))))
841 846
842(defun touch-screen-restart-drag (event) 847(defun touch-screen-restart-drag (event)
843 "Restart dragging to select text. 848 "Restart dragging to select text.
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index dc481d4d0a5..2d82fbe7c89 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -141,12 +141,21 @@ This exists as a variable so it can be set locally in certain buffers.")
141 :background "dim gray" 141 :background "dim gray"
142 :box (:line-width (1 . -1) :color "gray46") 142 :box (:line-width (1 . -1) :color "gray46")
143 :extend t) 143 :extend t)
144 ;; Monochrome displays.
145 (((background light))
146 :background "white"
147 :box (:line-width (1 . -1) :color "black")
148 :extend t)
149 (((background dark))
150 :background "black"
151 :box (:line-width (1 . -1) :color "white")
152 :extend t)
144 (t 153 (t
145 :slant italic 154 :slant italic
146 :extend t)) 155 :extend t))
147 "Face used for editable fields." 156 "Face used for editable fields."
148 :group 'widget-faces 157 :group 'widget-faces
149 :version "28.1") 158 :version "30.1")
150 159
151(defface widget-single-line-field '((((type tty)) 160(defface widget-single-line-field '((((type tty))
152 :background "green3" 161 :background "green3"
@@ -157,6 +166,10 @@ This exists as a variable so it can be set locally in certain buffers.")
157 (((class grayscale color) 166 (((class grayscale color)
158 (background dark)) 167 (background dark))
159 :background "dim gray") 168 :background "dim gray")
169 ;; Monochrome displays.
170 (((background light))
171 :stipple "gray3"
172 :extend t)
160 (t 173 (t
161 :slant italic)) 174 :slant italic))
162 "Face used for editable fields spanning only a single line." 175 "Face used for editable fields spanning only a single line."
diff --git a/src/androidfns.c b/src/androidfns.c
index b6df7ae0677..df425e5779e 100644
--- a/src/androidfns.c
+++ b/src/androidfns.c
@@ -1202,7 +1202,10 @@ DEFUN ("xw-display-color-p", Fxw_display_color_p,
1202 doc: /* SKIP: real doc in xfns.c. */) 1202 doc: /* SKIP: real doc in xfns.c. */)
1203 (Lisp_Object terminal) 1203 (Lisp_Object terminal)
1204{ 1204{
1205 return Qt; 1205 struct android_display_info *dpyinfo;
1206
1207 dpyinfo = check_android_display_info (terminal);
1208 return dpyinfo->n_planes > 8 ? Qt : Qnil;
1206} 1209}
1207 1210
1208DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, 1211DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p,
@@ -1210,7 +1213,11 @@ DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p,
1210 doc: /* SKIP: real doc in xfns.c. */) 1213 doc: /* SKIP: real doc in xfns.c. */)
1211 (Lisp_Object terminal) 1214 (Lisp_Object terminal)
1212{ 1215{
1213 return Qnil; 1216 struct android_display_info *dpyinfo;
1217
1218 dpyinfo = check_android_display_info (terminal);
1219 return (dpyinfo->n_planes > 1 && dpyinfo->n_planes <= 8
1220 ? Qt : Qnil);
1214} 1221}
1215 1222
1216DEFUN ("x-display-pixel-width", Fx_display_pixel_width, 1223DEFUN ("x-display-pixel-width", Fx_display_pixel_width,
diff --git a/src/image.c b/src/image.c
index d1faadee968..74249b8d465 100644
--- a/src/image.c
+++ b/src/image.c
@@ -957,10 +957,17 @@ image_create_bitmap_from_file (struct frame *f, Lisp_Object file)
957 } 957 }
958 } 958 }
959 959
960 /* Search bitmap-file-path for the file, if appropriate. */ 960 /* Search bitmap-file-path for the file, if appropriate. If no file
961 if (openp (Vx_bitmap_file_path, file, Qnil, &found, 961 extension or directory is specified and no file by this name
962 make_fixnum (R_OK), false, false, NULL) 962 exists, append the extension ".xbm" and retry. */
963 < 0) 963 if ((openp (Vx_bitmap_file_path, file, Qnil, &found,
964 make_fixnum (R_OK), false, false, NULL) < 0)
965 && (NILP (Fequal (Ffile_name_nondirectory (file), file))
966 || strrchr (SSDATA (file), '.')
967 || (openp (Vx_bitmap_file_path,
968 CALLN (Fconcat, file, build_string (".xbm")),
969 Qnil, &found, make_fixnum (R_OK), false, false,
970 NULL) < 0)))
964 return -1; 971 return -1;
965 972
966 if (!STRINGP (image_find_image_fd (file, &fd)) 973 if (!STRINGP (image_find_image_fd (file, &fd))