emacs-diffs
[Top][All Lists]
Advanced

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

feature/android 2df3f89014a: Correctly translate touchscreen-up events o


From: Po Lu
Subject: feature/android 2df3f89014a: Correctly translate touchscreen-up events outside a frame
Date: Fri, 21 Jul 2023 03:21:03 -0400 (EDT)

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

    Correctly translate touchscreen-up events outside a frame
    
    * lisp/touch-screen.el (touch-screen-translate-touch): Check if
    a prefix is specified separately from prefix being non-nil.
    Accept `nil' as an imaginary prefix key.
    (function-key-map): Register translation functions on the tab
    bar, tab lines and internal border.
---
 lisp/touch-screen.el | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el
index 4f930704869..687722f4792 100644
--- a/lisp/touch-screen.el
+++ b/lisp/touch-screen.el
@@ -1271,7 +1271,11 @@ where POSN is the position of the mouse click, either 
`mouse-2'
 if POSN is on a link or a button, or `mouse-1' otherwise."
   (unwind-protect
       ;; Save the virtual function key if this is a mode line event.
-      (let* ((prefix (and (> (length current-key-remap-sequence) 1)
+      (let* ((prefix-specified
+              ;; Virtual prefix keys can be nil for events that fall
+              ;; outside a frame or within its internal border.
+              (> (length current-key-remap-sequence) 1))
+             (prefix (and prefix-specified
                           (aref current-key-remap-sequence 0)))
              (touch-screen-translate-prompt prompt)
              (event (catch 'input-event
@@ -1279,14 +1283,14 @@ if POSN is on a link or a button, or `mouse-1' 
otherwise."
                       ;; `current-key-remap-sequence'.
                       (touch-screen-handle-touch
                        (aref current-key-remap-sequence
-                             (if prefix 1 0))
+                             (if prefix-specified 1 0))
                        prefix)
                       ;; Next, continue reading input events.
                       (while t
                         (let ((event1 (read-event)))
                           ;; If event1 is a virtual function key, make
                           ;; it the new prefix.
-                          (if (memq event1 '(mode-line tab-line
+                          (if (memq event1 '(mode-line tab-line nil
                                              header-line tool-bar tab-bar
                                              left-fringe right-fringe
                                              left-margin right-margin
@@ -1387,6 +1391,21 @@ if POSN is on a link or a button, or `mouse-1' 
otherwise."
 (define-key function-key-map [tool-bar touchscreen-end]
             #'touch-screen-translate-touch)
 
+(define-key function-key-map [tab-bar touchscreen-begin]
+            #'touch-screen-translate-touch)
+(define-key function-key-map [tab-bar touchscreen-end]
+            #'touch-screen-translate-touch)
+
+(define-key function-key-map [tab-line touchscreen-begin]
+            #'touch-screen-translate-touch)
+(define-key function-key-map [tab-line touchscreen-end]
+            #'touch-screen-translate-touch)
+
+(define-key function-key-map [nil touchscreen-begin]
+            #'touch-screen-translate-touch)
+(define-key function-key-map [nil touchscreen-end]
+            #'touch-screen-translate-touch)
+
 
 ;; Exports.  These functions are intended for use externally.
 



reply via email to

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