From: Po Lu Date: Tue, 18 Jul 2023 05:24:36 +0000 (+0800) Subject: Update Android port X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=eaf13bc739c37ad0eff12c95e1cba44ead47e102;p=emacs.git Update Android port * lisp/touch-screen.el (touch-screen-hold) (touch-screen-handle-point-up): Don't select inactive minibuffer windows. (touch-screen-handle-point-update): Improve detection of left and right edges. --- diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el index 5606f752042..cb9bfa06b7d 100644 --- a/lisp/touch-screen.el +++ b/lisp/touch-screen.el @@ -262,10 +262,17 @@ Ding and select the window at EVENT, then activate the mark. If word around EVENT; otherwise, set point to the location of EVENT." (interactive "e") (let* ((posn (cadr event)) - (point (posn-point posn))) - (when point + (point (posn-point posn)) + (window (posn-window posn))) + (when (and point + ;; Make sure WINDOW is not an inactive minibuffer + ;; window. + (or (not (eq window + (minibuffer-window + (window-frame window)))) + (minibuffer-window-active-p window))) (beep) - (select-window (posn-window posn)) + (select-window window) (if (or (not touch-screen-word-select) (when-let* ((char (char-after point)) (class (char-syntax char))) @@ -544,12 +551,13 @@ then move point to the position of POINT." (cond ((null what) (let* ((posn (cdr point)) (last-posn (nth 2 touch-screen-current-tool)) + (original-posn (nth 4 touch-screen-current-tool)) ;; Now get the position of X and Y relative to ;; WINDOW. (relative-xy (touch-screen-relative-xy posn window)) - (col (and (eq (posn-area posn) 'text-area) - (car (posn-col-row posn + (col (and (posn-area original-posn) + (car (posn-col-row original-posn (posn-window posn))))) ;; Don't start horizontal scrolling if the touch ;; point originated within two columns of the window @@ -560,14 +568,12 @@ then move point to the position of POINT." (< (car col) (- (window-width window) 2)))) (diff-x (- (car last-posn) (car relative-xy))) (diff-y (- (cdr last-posn) (cdr relative-xy)))) - ;; Decide whether or not to start scrolling. Make the - ;; hscrolling threshold slightly larger than the vertical - ;; scrolling threshold, to compensate better for - ;; Android-style gesture navigation. - (when (or (> diff-y 10) (and diff-x-eligible - (> diff-x 20)) - (< diff-y -10) (and diff-x-eligible - (< diff-x -20))) + (when (or (> diff-y 10) + (and diff-x-eligible + (> diff-x (frame-char-width))) + (< diff-y -10) + (and diff-x-eligible + (< diff-x (frame-char-width)))) (setcar (nthcdr 3 touch-screen-current-tool) 'scroll) (setcar (nthcdr 2 touch-screen-current-tool) @@ -678,8 +684,12 @@ is not read-only." (when (windowp (posn-window posn)) (setq point (posn-point posn) window (posn-window posn)) - ;; Select the window that was tapped. - (select-window window) + ;; Select the window that was tapped given that it isn't + ;; an inactive minibuffer window. + (when (or (not (eq window) + (minibuffer-window (window-frame window))) + (minibuffer-window-active-p window)) + (select-window window)) ;; Now simulate a mouse click there. If there is a link ;; or a button, use mouse-2 to push it. (let* ((event (list (if (or (mouse-on-link-p posn)