From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: feature/android a496509ced 1/2: Update Android port Date: Wed, 16 Aug 2023 08:12:25 -0400 Message-ID: References: <167413804086.19235.17391196197706660128@vcs2.savannah.gnu.org> <20230119142043.05B19C00613@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39314"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 16 14:13:22 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qWFOr-000A1m-Ex for ged-emacs-devel@m.gmane-mx.org; Wed, 16 Aug 2023 14:13:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWFO6-0006o6-B9; Wed, 16 Aug 2023 08:12:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWFO4-0006nc-E3 for emacs-devel@gnu.org; Wed, 16 Aug 2023 08:12:32 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWFO1-0002EC-OQ for emacs-devel@gnu.org; Wed, 16 Aug 2023 08:12:32 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A6FD4806F8; Wed, 16 Aug 2023 08:12:27 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1692187946; bh=mt0v9NbcRRvpvqU7EYmShI7dEW5A40mUy5TOWjVIaBA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=lhvroexBTVdBCMPqjsxBzTMji1sQBjZ1eTlkwKZyHjA+GMQ5VwjkYGKvsSK6mMJRI upndMzBCBd9rrJWHRFEU0k713xfUOscBLkhcEABfnUo1Lo4B7hmzdpEUuwcbaPzN1L DSy8S41wPCE+C4ntFe0QsOtjMa6C8exh7hWYrOZzSJYPn7//PElK6TPa+ImT/Mw/Oy FzltYdjYJRvkzvDNHEGmoLYZ/Eyivrk8nFZJIYrekOQz9LbfwFz1lNUp1Rh/TtXPKN h5AQraJro3nK+CsNcmXvfSU5R9sTgO1O8iRFxaaPF3Z3c92XGaveYh4ub5obZUGxEC bQuKkAvXP7HWg== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 33142802CE; Wed, 16 Aug 2023 08:12:26 -0400 (EDT) Original-Received: from pastel (unknown [45.72.228.154]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 101EC1201A6; Wed, 16 Aug 2023 08:12:26 -0400 (EDT) In-Reply-To: <20230119142043.05B19C00613@vcs2.savannah.gnu.org> (Po Lu via Mailing list for Emacs changes's message of "Thu, 19 Jan 2023 09:20:42 -0500 (EST)") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308814 Archived-At: Hi Po Lu, Po Lu via Mailing list for Emacs changes [2023-01-19 09:20:42] wrote: > branch: feature/android > commit a496509cedb17109d0e6297a74e2ff8ed526333c > Author: Po Lu > Commit: Po Lu > > Update Android port [...] > * lisp/subr.el (event-start): > (event-end): Handle touchscreen events. > * lisp/touch-screen.el (touch-screen-handle-timeout): > (touch-screen-handle-point-update): > (touch-screen-handle-point-up): > (touch-screen-track-tap): > (touch-screen-track-drag): > (touch-screen-drag-mode-line-1): > (touch-screen-drag-mode-line): New functions. > ([mode-line touchscreen-begin]): > ([bottom-divider touchscreen-begin]): Bind new events. > > * lisp/wid-edit.el (widget-event-point): > (widget-keymap): > (widget-event-start): > (widget-button--check-and-call-button): > (widget-button-click): Improve touchscreen support. [...] > diff --git a/lisp/subr.el b/lisp/subr.el > index f909b63aab..345816dbd2 100644 > --- a/lisp/subr.el > +++ b/lisp/subr.el > @@ -1636,7 +1636,13 @@ nil or (STRING . POSITION)'. > `posn-timestamp': The time the event occurred, in milliseconds. > > For more information, see Info node `(elisp)Click Events'." > - (or (and (consp event) (nth 1 event)) > + (or (and (consp event) > + ;; Ignore touchscreen events. They store the posn in a > + ;; different format, and can have multiple posns. > + (not (memq (car event) '(touchscreen-begin > + touchscreen-update > + touchscreen-end))) > + (nth 1 event)) > (event--posn-at-point))) > > (defun event-end (event) > @@ -1644,7 +1650,11 @@ For more information, see Info node `(elisp)Click Events'." > EVENT should be a click, drag, or key press event. > > See `event-start' for a description of the value returned." > - (or (and (consp event) (nth (if (consp (nth 2 event)) 2 1) event)) > + (or (and (consp event) > + (not (memq (car event) '(touchscreen-begin > + touchscreen-update > + touchscreen-end))) > + (nth (if (consp (nth 2 event)) 2 1) event)) > (event--posn-at-point))) > > (defsubst event-click-count (event) [...] > diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el > index 60bd2baa6f..4c52d82798 100644 > --- a/lisp/wid-edit.el > +++ b/lisp/wid-edit.el > @@ -65,8 +65,11 @@ > ;;; Compatibility. > > (defun widget-event-point (event) > - "Character position of the end of event if that exists, or nil." > - (posn-point (event-end event))) > + "Character position of the end of event if that exists, or nil. > +EVENT can either be a mouse event or a touch screen event." > + (if (eq (car-safe event) 'touchscreen-begin) > + (posn-point (cdadr event)) > + (posn-point (event-end event)))) > > (defun widget-button-release-event-p (event) > "Non-nil if EVENT is a mouse-button-release event object." [...] > @@ -1072,8 +1076,18 @@ Note that such modes will need to require wid-edit.") > "If non-nil, `widget-button-click' moves point to a button after invoking it. > If nil, point returns to its original position after invoking a button.") > > +(defun widget-event-start (event) > + "Return the start of EVENT. > +If EVENT is not a touchscreen event, simply return its > +`event-start'. Otherwise, it is a touchscreen event, so return > +the posn of its touchpoint." > + (if (eq (car event) 'touchscreen-begin) > + (cdadr event) > + (event-start event))) Could you explain why for touchscreen events you made `event-end` and `event-start` return "posn-at-point" (which seems positively useless), forcing you in turn to add ad-hoc handling in `widget-event-point` and to introduce a new `widget-event-start`? I understand that touchscreen events may have multiple posns, but it seems that making `event-end` and `event-start` do what `widget-event-point` and `widget-event-start` do would be better than what we have now, no? Stefan