emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android c3fadfd10f3: Update Android port


From: Po Lu
Subject: feature/android c3fadfd10f3: Update Android port
Date: Sun, 25 Jun 2023 21:12:06 -0400 (EDT)

branch: feature/android
commit c3fadfd10f353dcc8bdb0f4958a3e9fb7c4589bb
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 lisp/calc/calc.el    | 96 ++++++++++++++++++++++++++++------------------------
 lisp/touch-screen.el |  7 ++--
 src/sfnt.c           | 27 ++++++++++-----
 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
   (calc-set-mode-line)
   (calc-check-defines)
   (if calc-buffer-list (setq calc-stack (copy-sequence calc-stack)))
-  (add-to-list 'calc-buffer-list (current-buffer) t))
+  (add-to-list 'calc-buffer-list (current-buffer) t)
+  ;; While Calc buffers are read only, the on screen keyboard should
+  ;; be displayed in order to accept user input.
+  (setq-local touch-screen-display-keyboard t))
 
 (defvar calc-check-defines 'calc-check-defines)  ; Suitable for run-hooks.
 (defun calc-check-defines ()
@@ -1451,49 +1454,54 @@ See `window-dedicated-p' for what that means."
            (calc-grab-region (region-beginning) (region-end) nil)
          (when (= (prefix-numeric-value arg) -2)
            (calc-keypad))))
-    (when (get-buffer-window "*Calc Keypad*")
-      (calc-keypad)
-      (set-buffer (window-buffer)))
-    (if (derived-mode-p 'calc-mode)
-       (calc-quit)
-      (calc-create-buffer)
-      (setq calc-was-keypad-mode nil)
-      (if (or (eq full-display t)
-              (and (null full-display) calc-full-mode))
-          (switch-to-buffer (current-buffer) t)
-        (if (get-buffer-window (current-buffer))
-            (select-window (get-buffer-window (current-buffer)))
-          (if calc-window-hook
-              (run-hooks 'calc-window-hook)
-            (let ((w (get-largest-window)))
-              (if (and pop-up-windows
-                       (> (window-height w)
-                          (+ window-min-height calc-window-height 2)))
-                  (progn
-                    (setq w (split-window w
-                                          (- (window-height w)
-                                             calc-window-height 2)
-                                          nil))
-                    (set-window-buffer w (current-buffer))
-                    (select-window w))
-                (pop-to-buffer (current-buffer)))))))
-      (with-current-buffer (calc-trail-buffer)
-        (and calc-display-trail
-             (calc-trail-display 1 t)))
-      (message (substitute-command-keys
-                (concat "Welcome to the GNU Emacs Calculator!  
\\<calc-mode-map>"
-                        "Press \\[calc-help] or \\[calc-help-prefix] for help, 
\\[calc-quit] to quit")))
-      (run-hooks 'calc-start-hook)
-      (and (windowp full-display)
-           (window-point full-display)
-           (select-window full-display))
-      (and calc-make-windows-dedicated
-           (set-window-dedicated-p nil t))
-      (calc-check-defines)
-      (when (and calc-said-hello interactive)
-        (sit-for 2)
-        (message ""))
-      (setq calc-said-hello t))))
+    ;; If the selected window changes here, Emacs may think that the
+    ;; selected window is read only, and no on screen keyboard should
+    ;; be displayed.  Make sure that any active on screen keyboard is
+    ;; not hidden by accident.
+    (let ((touch-screen-display-buffer t))
+      (when (get-buffer-window "*Calc Keypad*")
+        (calc-keypad)
+        (set-buffer (window-buffer)))
+      (if (derived-mode-p 'calc-mode)
+         (calc-quit)
+        (calc-create-buffer)
+        (setq calc-was-keypad-mode nil)
+        (if (or (eq full-display t)
+                (and (null full-display) calc-full-mode))
+            (switch-to-buffer (current-buffer) t)
+          (if (get-buffer-window (current-buffer))
+              (select-window (get-buffer-window (current-buffer)))
+            (if calc-window-hook
+                (run-hooks 'calc-window-hook)
+              (let ((w (get-largest-window)))
+                (if (and pop-up-windows
+                         (> (window-height w)
+                            (+ window-min-height calc-window-height 2)))
+                    (progn
+                      (setq w (split-window w
+                                            (- (window-height w)
+                                               calc-window-height 2)
+                                            nil))
+                      (set-window-buffer w (current-buffer))
+                      (select-window w))
+                  (pop-to-buffer (current-buffer)))))))
+        (with-current-buffer (calc-trail-buffer)
+          (and calc-display-trail
+               (calc-trail-display 1 t)))
+        (message (substitute-command-keys
+                  (concat "Welcome to the GNU Emacs Calculator!  
\\<calc-mode-map>"
+                          "Press \\[calc-help] or \\[calc-help-prefix] for 
help, \\[calc-quit] to quit")))
+        (run-hooks 'calc-start-hook)
+        (and (windowp full-display)
+             (window-point full-display)
+             (select-window full-display))
+        (and calc-make-windows-dedicated
+             (set-window-dedicated-p nil t))
+        (calc-check-defines)
+        (when (and calc-said-hello interactive)
+          (sit-for 2)
+          (message ""))
+        (setq calc-said-hello t)))))
 
 ;;;###autoload
 (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.
 Otherwise, cancel any timer that is supposed to hide the keyboard
 in response to the minibuffer being closed."
   (with-selected-frame frame
-    (if (or buffer-read-only
-            (get-text-property (point) 'read-only))
+    (if (and (or buffer-read-only
+                 (get-text-property (point) 'read-only))
+             ;; Don't hide the on-screen keyboard if it's always
+             ;; supposed to be displayed.
+             (not touch-screen-display-keyboard))
         (frame-toggle-on-screen-keyboard (selected-frame) t)
       ;; Prevent hiding the minibuffer from hiding the on screen
       ;; 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,
   if (recursion_count > 16)
     return 1;
 
-  /* Don't defer offsets.  */
-  defer_offsets = false;
-
   for (j = 0; j < glyph->compound->num_components; ++j)
     {
       /* Look up the associated subglyph.  */
@@ -2685,6 +2682,12 @@ sfnt_decompose_compound_glyph (struct sfnt_glyph *glyph,
       if (!subglyph)
        return 1;
 
+      /* Don't defer offsets.  This variable is set if the component
+        glyph is a compound glyph that is anchored to a previously
+        decomposed point, and needs its coordinates adjusted after
+        decomposition completes.  */
+      defer_offsets = false;
+
       /* Record the size of the point array before expansion.  This
         will be the base to apply to all points coming from this
         subglyph.  */
@@ -2922,8 +2925,8 @@ static void
 sfnt_lerp_half (struct sfnt_point *control1, struct sfnt_point *control2,
                struct sfnt_point *result)
 {
-  result->x = control1->x + ((control2->x - control1->x) >> 1);
-  result->y = control1->y + ((control2->y - control1->y) >> 1);
+  result->x = control1->x + ((control2->x - control1->x) / 2);
+  result->y = control1->y + ((control2->y - control1->y) / 2);
 }
 
 /* Decompose contour data inside X, Y and FLAGS, between the indices
@@ -11624,9 +11627,6 @@ sfnt_interpret_compound_glyph_1 (struct sfnt_glyph 
*glyph,
   if (recursion_count > 16)
     return "Overly deep recursion in compound glyph data";
 
-  /* Don't defer offsets.  */
-  defer_offsets = false;
-
   /* Pacify -Wmaybe-uninitialized.  */
   point = point2 = 0;
 
@@ -11640,6 +11640,12 @@ sfnt_interpret_compound_glyph_1 (struct sfnt_glyph 
*glyph,
       if (!subglyph)
        return "Failed to obtain component glyph";
 
+      /* Don't defer offsets.  This variable is set if the component
+        glyph is a compound glyph that is anchored to a previously
+        decomposed point, and needs its coordinates adjusted after
+        decomposition completes.  */
+      defer_offsets = false;
+
       /* Record the size of the point array before expansion.  This
         will be the base to apply to all points coming from this
         subglyph.  */
@@ -13783,7 +13789,7 @@ sfnt_compute_tuple_scale (struct sfnt_blend *blend, 
bool intermediate_p,
                          sfnt_f2dot14 *intermediate_end)
 {
   int i;
-  sfnt_fixed coord, start, end;
+  sfnt_fixed coord, start UNINIT, end UNINIT;
   sfnt_fixed scale;
 
   /* scale is initially 1.0.  */
@@ -13794,6 +13800,9 @@ sfnt_compute_tuple_scale (struct sfnt_blend *blend, 
bool intermediate_p,
       /* Load values for this axis, scaled up to sfnt_fixed.  */
       coord = coords[i] * 4;
 
+      /* GCC warns about start and end being used when uninitialized,
+        but they are used only if intermediate_p.  */
+
       if (intermediate_p)
        {
          start = intermediate_start[i] * 4;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]