aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2023-06-26 09:11:48 +0800
committerPo Lu2023-06-26 09:11:48 +0800
commitc3fadfd10f353dcc8bdb0f4958a3e9fb7c4589bb (patch)
treef7a0189178eb4553ad131fc6db147c69f01f3785
parent259bec95de1f2786c0e642ba5b9efb4a750bc432 (diff)
downloademacs-c3fadfd10f353dcc8bdb0f4958a3e9fb7c4589bb.tar.gz
emacs-c3fadfd10f353dcc8bdb0f4958a3e9fb7c4589bb.zip
Update Android port
* lisp/calc/calc.el (calc-mode, calc): Make sure the on-screen keyboard is not hidden when a Calc buffer is created or a Calc Trail window is being created for the first time. * lisp/touch-screen.el (touch-screen-window-selection-changed): Take touch-screen-display-keyboard in to account. * src/sfnt.c (sfnt_decompose_compound_glyph) (sfnt_interpret_compound_glyph_1): Reset `defer_offsets' before processing each component. (sfnt_lerp_half): Avoid undefined shift of negative value. (sfnt_compute_tuple_scale): Pacify compiler warning.
-rw-r--r--lisp/calc/calc.el96
-rw-r--r--lisp/touch-screen.el7
-rw-r--r--src/sfnt.c27
3 files changed, 75 insertions, 55 deletions
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index a1545edba19..c0e68ceab0c 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -1357,7 +1357,10 @@ Notations: 3.14e6 3.14 * 10^6
1357 (calc-set-mode-line) 1357 (calc-set-mode-line)
1358 (calc-check-defines) 1358 (calc-check-defines)
1359 (if calc-buffer-list (setq calc-stack (copy-sequence calc-stack))) 1359 (if calc-buffer-list (setq calc-stack (copy-sequence calc-stack)))
1360 (add-to-list 'calc-buffer-list (current-buffer) t)) 1360 (add-to-list 'calc-buffer-list (current-buffer) t)
1361 ;; While Calc buffers are read only, the on screen keyboard should
1362 ;; be displayed in order to accept user input.
1363 (setq-local touch-screen-display-keyboard t))
1361 1364
1362(defvar calc-check-defines 'calc-check-defines) ; Suitable for run-hooks. 1365(defvar calc-check-defines 'calc-check-defines) ; Suitable for run-hooks.
1363(defun calc-check-defines () 1366(defun calc-check-defines ()
@@ -1451,49 +1454,54 @@ See `window-dedicated-p' for what that means."
1451 (calc-grab-region (region-beginning) (region-end) nil) 1454 (calc-grab-region (region-beginning) (region-end) nil)
1452 (when (= (prefix-numeric-value arg) -2) 1455 (when (= (prefix-numeric-value arg) -2)
1453 (calc-keypad)))) 1456 (calc-keypad))))
1454 (when (get-buffer-window "*Calc Keypad*") 1457 ;; If the selected window changes here, Emacs may think that the
1455 (calc-keypad) 1458 ;; selected window is read only, and no on screen keyboard should
1456 (set-buffer (window-buffer))) 1459 ;; be displayed. Make sure that any active on screen keyboard is
1457 (if (derived-mode-p 'calc-mode) 1460 ;; not hidden by accident.
1458 (calc-quit) 1461 (let ((touch-screen-display-buffer t))
1459 (calc-create-buffer) 1462 (when (get-buffer-window "*Calc Keypad*")
1460 (setq calc-was-keypad-mode nil) 1463 (calc-keypad)
1461 (if (or (eq full-display t) 1464 (set-buffer (window-buffer)))
1462 (and (null full-display) calc-full-mode)) 1465 (if (derived-mode-p 'calc-mode)
1463 (switch-to-buffer (current-buffer) t) 1466 (calc-quit)
1464 (if (get-buffer-window (current-buffer)) 1467 (calc-create-buffer)
1465 (select-window (get-buffer-window (current-buffer))) 1468 (setq calc-was-keypad-mode nil)
1466 (if calc-window-hook 1469 (if (or (eq full-display t)
1467 (run-hooks 'calc-window-hook) 1470 (and (null full-display) calc-full-mode))
1468 (let ((w (get-largest-window))) 1471 (switch-to-buffer (current-buffer) t)
1469 (if (and pop-up-windows 1472 (if (get-buffer-window (current-buffer))
1470 (> (window-height w) 1473 (select-window (get-buffer-window (current-buffer)))
1471 (+ window-min-height calc-window-height 2))) 1474 (if calc-window-hook
1472 (progn 1475 (run-hooks 'calc-window-hook)
1473 (setq w (split-window w 1476 (let ((w (get-largest-window)))
1474 (- (window-height w) 1477 (if (and pop-up-windows
1475 calc-window-height 2) 1478 (> (window-height w)
1476 nil)) 1479 (+ window-min-height calc-window-height 2)))
1477 (set-window-buffer w (current-buffer)) 1480 (progn
1478 (select-window w)) 1481 (setq w (split-window w
1479 (pop-to-buffer (current-buffer))))))) 1482 (- (window-height w)
1480 (with-current-buffer (calc-trail-buffer) 1483 calc-window-height 2)
1481 (and calc-display-trail 1484 nil))
1482 (calc-trail-display 1 t))) 1485 (set-window-buffer w (current-buffer))
1483 (message (substitute-command-keys 1486 (select-window w))
1484 (concat "Welcome to the GNU Emacs Calculator! \\<calc-mode-map>" 1487 (pop-to-buffer (current-buffer)))))))
1485 "Press \\[calc-help] or \\[calc-help-prefix] for help, \\[calc-quit] to quit"))) 1488 (with-current-buffer (calc-trail-buffer)
1486 (run-hooks 'calc-start-hook) 1489 (and calc-display-trail
1487 (and (windowp full-display) 1490 (calc-trail-display 1 t)))
1488 (window-point full-display) 1491 (message (substitute-command-keys
1489 (select-window full-display)) 1492 (concat "Welcome to the GNU Emacs Calculator! \\<calc-mode-map>"
1490 (and calc-make-windows-dedicated 1493 "Press \\[calc-help] or \\[calc-help-prefix] for help, \\[calc-quit] to quit")))
1491 (set-window-dedicated-p nil t)) 1494 (run-hooks 'calc-start-hook)
1492 (calc-check-defines) 1495 (and (windowp full-display)
1493 (when (and calc-said-hello interactive) 1496 (window-point full-display)
1494 (sit-for 2) 1497 (select-window full-display))
1495 (message "")) 1498 (and calc-make-windows-dedicated
1496 (setq calc-said-hello t)))) 1499 (set-window-dedicated-p nil t))
1500 (calc-check-defines)
1501 (when (and calc-said-hello interactive)
1502 (sit-for 2)
1503 (message ""))
1504 (setq calc-said-hello t)))))
1497 1505
1498;;;###autoload 1506;;;###autoload
1499(defun full-calc (&optional interactive) 1507(defun full-calc (&optional interactive)
diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el
index ba55374d090..242ea4fcd9b 100644
--- a/lisp/touch-screen.el
+++ b/lisp/touch-screen.el
@@ -373,8 +373,11 @@ If point is now on read only text, hide the on screen keyboard.
373Otherwise, cancel any timer that is supposed to hide the keyboard 373Otherwise, cancel any timer that is supposed to hide the keyboard
374in response to the minibuffer being closed." 374in response to the minibuffer being closed."
375 (with-selected-frame frame 375 (with-selected-frame frame
376 (if (or buffer-read-only 376 (if (and (or buffer-read-only
377 (get-text-property (point) 'read-only)) 377 (get-text-property (point) 'read-only))
378 ;; Don't hide the on-screen keyboard if it's always
379 ;; supposed to be displayed.
380 (not touch-screen-display-keyboard))
378 (frame-toggle-on-screen-keyboard (selected-frame) t) 381 (frame-toggle-on-screen-keyboard (selected-frame) t)
379 ;; Prevent hiding the minibuffer from hiding the on screen 382 ;; Prevent hiding the minibuffer from hiding the on screen
380 ;; keyboard. 383 ;; keyboard.
diff --git a/src/sfnt.c b/src/sfnt.c
index 7ef56a47469..b803ada8955 100644
--- a/src/sfnt.c
+++ b/src/sfnt.c
@@ -2672,9 +2672,6 @@ sfnt_decompose_compound_glyph (struct sfnt_glyph *glyph,
2672 if (recursion_count > 16) 2672 if (recursion_count > 16)
2673 return 1; 2673 return 1;
2674 2674
2675 /* Don't defer offsets. */
2676 defer_offsets = false;
2677
2678 for (j = 0; j < glyph->compound->num_components; ++j) 2675 for (j = 0; j < glyph->compound->num_components; ++j)
2679 { 2676 {
2680 /* Look up the associated subglyph. */ 2677 /* Look up the associated subglyph. */
@@ -2685,6 +2682,12 @@ sfnt_decompose_compound_glyph (struct sfnt_glyph *glyph,
2685 if (!subglyph) 2682 if (!subglyph)
2686 return 1; 2683 return 1;
2687 2684
2685 /* Don't defer offsets. This variable is set if the component
2686 glyph is a compound glyph that is anchored to a previously
2687 decomposed point, and needs its coordinates adjusted after
2688 decomposition completes. */
2689 defer_offsets = false;
2690
2688 /* Record the size of the point array before expansion. This 2691 /* Record the size of the point array before expansion. This
2689 will be the base to apply to all points coming from this 2692 will be the base to apply to all points coming from this
2690 subglyph. */ 2693 subglyph. */
@@ -2922,8 +2925,8 @@ static void
2922sfnt_lerp_half (struct sfnt_point *control1, struct sfnt_point *control2, 2925sfnt_lerp_half (struct sfnt_point *control1, struct sfnt_point *control2,
2923 struct sfnt_point *result) 2926 struct sfnt_point *result)
2924{ 2927{
2925 result->x = control1->x + ((control2->x - control1->x) >> 1); 2928 result->x = control1->x + ((control2->x - control1->x) / 2);
2926 result->y = control1->y + ((control2->y - control1->y) >> 1); 2929 result->y = control1->y + ((control2->y - control1->y) / 2);
2927} 2930}
2928 2931
2929/* Decompose contour data inside X, Y and FLAGS, between the indices 2932/* Decompose contour data inside X, Y and FLAGS, between the indices
@@ -11624,9 +11627,6 @@ sfnt_interpret_compound_glyph_1 (struct sfnt_glyph *glyph,
11624 if (recursion_count > 16) 11627 if (recursion_count > 16)
11625 return "Overly deep recursion in compound glyph data"; 11628 return "Overly deep recursion in compound glyph data";
11626 11629
11627 /* Don't defer offsets. */
11628 defer_offsets = false;
11629
11630 /* Pacify -Wmaybe-uninitialized. */ 11630 /* Pacify -Wmaybe-uninitialized. */
11631 point = point2 = 0; 11631 point = point2 = 0;
11632 11632
@@ -11640,6 +11640,12 @@ sfnt_interpret_compound_glyph_1 (struct sfnt_glyph *glyph,
11640 if (!subglyph) 11640 if (!subglyph)
11641 return "Failed to obtain component glyph"; 11641 return "Failed to obtain component glyph";
11642 11642
11643 /* Don't defer offsets. This variable is set if the component
11644 glyph is a compound glyph that is anchored to a previously
11645 decomposed point, and needs its coordinates adjusted after
11646 decomposition completes. */
11647 defer_offsets = false;
11648
11643 /* Record the size of the point array before expansion. This 11649 /* Record the size of the point array before expansion. This
11644 will be the base to apply to all points coming from this 11650 will be the base to apply to all points coming from this
11645 subglyph. */ 11651 subglyph. */
@@ -13783,7 +13789,7 @@ sfnt_compute_tuple_scale (struct sfnt_blend *blend, bool intermediate_p,
13783 sfnt_f2dot14 *intermediate_end) 13789 sfnt_f2dot14 *intermediate_end)
13784{ 13790{
13785 int i; 13791 int i;
13786 sfnt_fixed coord, start, end; 13792 sfnt_fixed coord, start UNINIT, end UNINIT;
13787 sfnt_fixed scale; 13793 sfnt_fixed scale;
13788 13794
13789 /* scale is initially 1.0. */ 13795 /* scale is initially 1.0. */
@@ -13794,6 +13800,9 @@ sfnt_compute_tuple_scale (struct sfnt_blend *blend, bool intermediate_p,
13794 /* Load values for this axis, scaled up to sfnt_fixed. */ 13800 /* Load values for this axis, scaled up to sfnt_fixed. */
13795 coord = coords[i] * 4; 13801 coord = coords[i] * 4;
13796 13802
13803 /* GCC warns about start and end being used when uninitialized,
13804 but they are used only if intermediate_p. */
13805
13797 if (intermediate_p) 13806 if (intermediate_p)
13798 { 13807 {
13799 start = intermediate_start[i] * 4; 13808 start = intermediate_start[i] * 4;