Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
;;; touch-screen.el --- touch screen support for X and Android -*- lexical-binding: t; -*-
|
|
|
|
|
|
2024-01-02 02:30:05 +00:00
|
|
|
|
;; Copyright (C) 2023-2024 Free Software Foundation, Inc.
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
|
|
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
|
|
|
|
;; Package: emacs
|
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; This file provides code to recognize simple touch screen gestures.
|
2024-08-03 00:14:52 +00:00
|
|
|
|
;; It is used on X, PGTK, Android, and MS-Windows, currently the only
|
|
|
|
|
;; systems where Emacs supports touch input.
|
2023-07-16 12:10:18 +00:00
|
|
|
|
;;
|
2023-07-20 01:22:41 +00:00
|
|
|
|
;; See (elisp)Touchscreen Events for a description of the details of
|
|
|
|
|
;; touch events.
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(defvar touch-screen-current-tool nil
|
|
|
|
|
"The touch point currently being tracked, or nil.
|
2024-07-20 03:28:47 +00:00
|
|
|
|
If non-nil, this is a list of ten elements, which might be
|
|
|
|
|
accessed as follows:
|
|
|
|
|
|
|
|
|
|
(nth 0 touch-screen-current-tool)
|
|
|
|
|
The ID of the touch point being tracked.
|
|
|
|
|
|
|
|
|
|
(nth 1 touch-screen-current-tool)
|
|
|
|
|
The window where the touch sequence being monitored commenced.
|
|
|
|
|
|
|
|
|
|
(nth 2 touch-screen-current-tool)
|
|
|
|
|
A cons holding the last registered position of the touch
|
|
|
|
|
point, relative to that window.
|
|
|
|
|
|
|
|
|
|
(nth 3 touch-screen-current-tool)
|
|
|
|
|
A field holding a symbol identifying the gesture being
|
|
|
|
|
observed while tracking the said touch point.
|
|
|
|
|
|
|
|
|
|
(nth 4 touch-screen-current-tool)
|
|
|
|
|
The initial position of the touchpoint.
|
|
|
|
|
|
|
|
|
|
(nth 5 touch-screen-current-tool)
|
|
|
|
|
(nth 6 touch-screen-current-tool)
|
|
|
|
|
(nth 7 touch-screen-current-tool)
|
|
|
|
|
(nth 8 touch-screen-current-tool)
|
|
|
|
|
A further four fields to used store data while tracking the
|
|
|
|
|
touch point.
|
|
|
|
|
|
|
|
|
|
(nth 9 touch-screen-current-tool)
|
|
|
|
|
The last known position of the touch point.
|
2023-11-15 12:58:46 +00:00
|
|
|
|
|
2023-07-20 01:22:41 +00:00
|
|
|
|
See `touch-screen-handle-point-update' and
|
2023-07-21 04:23:08 +00:00
|
|
|
|
`touch-screen-handle-point-up' for the meanings of the fourth
|
2023-11-15 12:58:46 +00:00
|
|
|
|
element.
|
|
|
|
|
|
|
|
|
|
The third and last elements differ in that the former is not
|
|
|
|
|
modified until after a gesture is recognized in reaction to an
|
|
|
|
|
update, whereas the latter is updated upon each apposite
|
|
|
|
|
`touchscreen-update' event.")
|
|
|
|
|
|
|
|
|
|
(defvar touch-screen-aux-tool nil
|
|
|
|
|
"The ancillary tool being tracked, or nil.
|
2023-11-16 03:29:58 +00:00
|
|
|
|
If non-nil, this is a vector of ten elements: the ID of the
|
2023-11-15 12:58:46 +00:00
|
|
|
|
touch point being tracked, the window where the touch began, a
|
|
|
|
|
cons holding the initial position of the touch point, and the
|
|
|
|
|
last known position of the touch point, all in the same format as
|
|
|
|
|
in `touch-screen-current-tool', the distance in pixels between
|
2023-12-10 12:22:04 +00:00
|
|
|
|
the current tool and the aforementioned initial position, the
|
2023-11-15 12:58:46 +00:00
|
|
|
|
center of the line formed between those two points, the ratio
|
|
|
|
|
between the present distance between both tools and the aforesaid
|
2023-11-16 03:29:58 +00:00
|
|
|
|
initial distance when a pinch gesture was last sent, and three
|
|
|
|
|
elements into which commands can save data particular to a tool.
|
2023-11-15 12:58:46 +00:00
|
|
|
|
|
|
|
|
|
The ancillary tool is a second tool whose movement is interpreted
|
|
|
|
|
in unison with that of the current tool to recognize gestures
|
|
|
|
|
comprising the motion of both such as \"pinch\" gestures, in
|
|
|
|
|
which the text scale is adjusted in proportion to the distance
|
|
|
|
|
between both tools.")
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
|
Update Android port
* .gitignore: Don't ignore verbose.mk.android.
* doc/emacs/Makefile.in (EMACSSOURCES): Add android.texi and
input.texi.
* doc/emacs/android.texi (Android): Document support for the
on-screen keyboard.
(Android Startup): Document how to start Emacs with -Q on
Android.
(Android Environment): Document how Emacs works around the
system ``task killer''. Document changes to frame deletion
behavior.
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices, On-Screen
Keyboards): Document how to use Emacs with virtual keyboards.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to `touch-screen-track-drag'.
* doc/lispref/frames.texi (Frames, On-Screen Keyboards): New
node.
* java/AndroidManifest.xml.in: Add settings activity and
appropriate OSK adjustment mode.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Allow
creating Emacs with -Q.
(onDestroy): Don't remove if killed by the system.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
Fix context menus again.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Make all
event sending functions return long.
* java/org/gnu/emacs/EmacsPreferencesActivity.java
(EmacsPreferencesActivity): New class.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(onStartCommand, onCreate, startEmacsService): Start as a
foreground service if necessary to bypass system restrictions.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsThread.java (EmacsThread, run):
* java/org/gnu/emacs/EmacsView.java (EmacsView, onLayout)
(onDetachedFromWindow):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, viewLayout):
Implement frame resize synchronization..
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager, removeWindowConsumer): Adjust
accordingly for changes to frame deletion behavior.
* lisp/frame.el (android-toggle-on-screen-keyboard)
(frame-toggle-on-screen-keyboard): New function.
* lisp/minibuffer.el (minibuffer-setup-on-screen-keyboard)
(minibuffer-exit-on-screen-keyboard): New functions.
(minibuffer-setup-hook, minibuffer-exit-hook): Add new functions
to hooks.
* lisp/touch-screen.el (touch-screen-relative-xy): Accept new
value of window `frame'. Return frame coordinates in that case.
(touch-screen-set-point-commands): New variable.
(touch-screen-handle-point-up): Respect that variable.
(touch-screen-track-drag): Return `no-drag' where appropriate.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line):
Refactor to use `no-drag'.
* src/android.c (struct android_emacs_window): New methods.
Make all event sending functions return the event serial.
(android_toggle_on_screen_keyboard, android_window_updated): New
functions.
* src/android.h: Update prototypes.
* src/androidfns.c (Fandroid_toggle_on_screen_keyboard)
(syms_of_androidfns): New function.
* src/androidgui.h (struct android_any_event)
(struct android_key_event, struct android_configure_event)
(struct android_focus_event, struct android_window_action_event)
(struct android_crossing_event, struct android_motion_event)
(struct android_button_event, struct android_touch_event)
(struct android_wheel_event, struct android_iconify_event)
(struct android_menu_event): Add `serial' fields.
* src/androidterm.c (handle_one_android_event)
(android_frame_up_to_date):
* src/androidterm.h (struct android_output): Implement frame
resize synchronization.
2023-01-20 11:06:32 +00:00
|
|
|
|
(defvar touch-screen-set-point-commands '(mouse-set-point)
|
|
|
|
|
"List of commands known to set the point.
|
|
|
|
|
This is used to determine whether or not to display the on-screen
|
|
|
|
|
keyboard after a mouse command is executed in response to a
|
|
|
|
|
`touchscreen-end' event.")
|
|
|
|
|
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
(defvar touch-screen-current-timer nil
|
|
|
|
|
"Timer used to track long-presses.
|
|
|
|
|
This is always cleared upon any significant state change.")
|
|
|
|
|
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(defvar touch-screen-translate-prompt nil
|
|
|
|
|
"Prompt given to the touch screen translation function.
|
|
|
|
|
If non-nil, the touch screen key event translation machinery
|
|
|
|
|
is being called from `read-sequence' or some similar function.")
|
|
|
|
|
|
2023-10-24 13:12:32 +00:00
|
|
|
|
(defgroup touch-screen nil
|
|
|
|
|
"Interact with Emacs from touch screen devices."
|
|
|
|
|
:group 'mouse
|
2024-02-08 05:20:28 +00:00
|
|
|
|
:version "30.1")
|
2023-10-24 13:12:32 +00:00
|
|
|
|
|
2023-02-18 15:09:30 +00:00
|
|
|
|
(defcustom touch-screen-display-keyboard nil
|
|
|
|
|
"If non-nil, always display the on screen keyboard.
|
|
|
|
|
A buffer local value means to always display the on screen
|
|
|
|
|
keyboard when the buffer is selected."
|
|
|
|
|
:type 'boolean
|
2023-10-24 13:12:32 +00:00
|
|
|
|
:group 'touch-screen
|
2023-02-18 15:09:30 +00:00
|
|
|
|
:version "30.1")
|
|
|
|
|
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
(defcustom touch-screen-delay 0.7
|
|
|
|
|
"Delay in seconds before Emacs considers a touch to be a long-press."
|
|
|
|
|
:type 'number
|
2023-10-24 13:12:32 +00:00
|
|
|
|
:group 'touch-screen
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
:version "30.1")
|
|
|
|
|
|
2023-01-21 13:46:32 +00:00
|
|
|
|
(defcustom touch-screen-precision-scroll nil
|
|
|
|
|
"Whether or not to use precision scrolling for touch screens.
|
|
|
|
|
See `pixel-scroll-precision-mode' for more details."
|
|
|
|
|
:type 'boolean
|
2023-10-24 13:12:32 +00:00
|
|
|
|
:group 'touch-screen
|
2023-01-21 13:46:32 +00:00
|
|
|
|
:version "30.1")
|
|
|
|
|
|
2023-07-17 01:46:37 +00:00
|
|
|
|
(defcustom touch-screen-word-select nil
|
|
|
|
|
"Whether or not to select whole words while dragging to select.
|
|
|
|
|
If non-nil, long-press events (see `touch-screen-delay') followed
|
|
|
|
|
by dragging will try to select entire words."
|
|
|
|
|
:type 'boolean
|
2023-10-24 13:12:32 +00:00
|
|
|
|
:group 'touch-screen
|
2023-07-17 01:46:37 +00:00
|
|
|
|
:version "30.1")
|
|
|
|
|
|
2023-07-19 04:46:02 +00:00
|
|
|
|
(defcustom touch-screen-extend-selection nil
|
|
|
|
|
"If non-nil, restart drag-to-select upon a tap on point or mark.
|
|
|
|
|
When enabled, tapping on the character containing the point or
|
|
|
|
|
mark will resume dragging where it left off while the region is
|
|
|
|
|
active."
|
|
|
|
|
:type 'boolean
|
2023-10-24 13:12:32 +00:00
|
|
|
|
:group 'touch-screen
|
2023-07-19 04:46:02 +00:00
|
|
|
|
:version "30.1")
|
|
|
|
|
|
2023-07-21 04:23:08 +00:00
|
|
|
|
(defcustom touch-screen-preview-select nil
|
|
|
|
|
"If non-nil, display a preview while selecting text.
|
|
|
|
|
When enabled, a preview of the visible line within the window
|
|
|
|
|
will be displayed in the echo area while dragging combined with
|
|
|
|
|
an indication of the position of point within that line."
|
|
|
|
|
:type 'boolean
|
2023-10-24 13:12:32 +00:00
|
|
|
|
:group 'touch-screen
|
|
|
|
|
:version "30.1")
|
|
|
|
|
|
|
|
|
|
(defcustom touch-screen-enable-hscroll t
|
|
|
|
|
"If non-nil, hscroll can be changed from the touch screen.
|
|
|
|
|
When enabled, tapping on a window and dragging your finger left
|
|
|
|
|
or right will scroll that window horizontally."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'touch-screen
|
2023-07-21 04:23:08 +00:00
|
|
|
|
:version "30.1")
|
|
|
|
|
|
2023-07-17 01:46:37 +00:00
|
|
|
|
(defvar-local touch-screen-word-select-bounds nil
|
|
|
|
|
"The start and end positions of the word last selected.
|
|
|
|
|
Normally a cons of those two positions or nil if no word was
|
|
|
|
|
selected.")
|
|
|
|
|
|
|
|
|
|
(defvar-local touch-screen-word-select-initial-word nil
|
|
|
|
|
"The start and end positions of the first word to be selected.
|
|
|
|
|
Used in an attempt to keep this word selected during later
|
|
|
|
|
dragging.")
|
|
|
|
|
|
2024-05-01 07:57:29 +00:00
|
|
|
|
;; Should this variable be documented?
|
|
|
|
|
(defvar-local touch-screen-keyboard-function nil
|
|
|
|
|
"Function that decides whether to display the on screen keyboard.
|
2024-07-03 09:05:24 +00:00
|
|
|
|
If set, this function is called with point set to the position
|
|
|
|
|
of the tap involved when a command listed in
|
|
|
|
|
`touch-screen-set-point-commands' is about to be invoked in
|
|
|
|
|
response to a tap, the current buffer, or the text beneath
|
|
|
|
|
point (in the case of an `inhibit-read-only' text property), is
|
|
|
|
|
not read only, and `touch-screen-display-keyboard' is nil, and
|
|
|
|
|
should return non-nil if it is appropriate to display the
|
|
|
|
|
on-screen keyboard afterwards.")
|
|
|
|
|
|
|
|
|
|
(defvar touch-screen-simple-mouse-conversion nil
|
|
|
|
|
"Whether to unconditionally enable simple mouse event translation.
|
|
|
|
|
If non-nil, touch screen event conversion will always proceed as
|
|
|
|
|
though a command was bound to `down-mouse-1' at the position of
|
|
|
|
|
the initial tap. That is to say, taps, mouse motion, and
|
|
|
|
|
touchpoint removals will be unconditionally converted into
|
|
|
|
|
mouse-down, mouse motion, mouse drag, and mouse button events.")
|
2024-05-01 07:57:29 +00:00
|
|
|
|
|
2023-07-16 07:30:01 +00:00
|
|
|
|
|
|
|
|
|
|
2023-07-17 01:46:37 +00:00
|
|
|
|
;;; Scroll gesture.
|
2023-07-16 07:30:01 +00:00
|
|
|
|
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
(defun touch-screen-relative-xy (posn window)
|
|
|
|
|
"Return the coordinates of POSN, a mouse position list.
|
|
|
|
|
However, return the coordinates relative to WINDOW.
|
|
|
|
|
|
|
|
|
|
If (posn-window posn) is the same as window, simply return the
|
|
|
|
|
coordinates in POSN. Otherwise, convert them to the frame, and
|
Update Android port
* .gitignore: Don't ignore verbose.mk.android.
* doc/emacs/Makefile.in (EMACSSOURCES): Add android.texi and
input.texi.
* doc/emacs/android.texi (Android): Document support for the
on-screen keyboard.
(Android Startup): Document how to start Emacs with -Q on
Android.
(Android Environment): Document how Emacs works around the
system ``task killer''. Document changes to frame deletion
behavior.
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices, On-Screen
Keyboards): Document how to use Emacs with virtual keyboards.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to `touch-screen-track-drag'.
* doc/lispref/frames.texi (Frames, On-Screen Keyboards): New
node.
* java/AndroidManifest.xml.in: Add settings activity and
appropriate OSK adjustment mode.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Allow
creating Emacs with -Q.
(onDestroy): Don't remove if killed by the system.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
Fix context menus again.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Make all
event sending functions return long.
* java/org/gnu/emacs/EmacsPreferencesActivity.java
(EmacsPreferencesActivity): New class.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(onStartCommand, onCreate, startEmacsService): Start as a
foreground service if necessary to bypass system restrictions.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsThread.java (EmacsThread, run):
* java/org/gnu/emacs/EmacsView.java (EmacsView, onLayout)
(onDetachedFromWindow):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, viewLayout):
Implement frame resize synchronization..
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager, removeWindowConsumer): Adjust
accordingly for changes to frame deletion behavior.
* lisp/frame.el (android-toggle-on-screen-keyboard)
(frame-toggle-on-screen-keyboard): New function.
* lisp/minibuffer.el (minibuffer-setup-on-screen-keyboard)
(minibuffer-exit-on-screen-keyboard): New functions.
(minibuffer-setup-hook, minibuffer-exit-hook): Add new functions
to hooks.
* lisp/touch-screen.el (touch-screen-relative-xy): Accept new
value of window `frame'. Return frame coordinates in that case.
(touch-screen-set-point-commands): New variable.
(touch-screen-handle-point-up): Respect that variable.
(touch-screen-track-drag): Return `no-drag' where appropriate.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line):
Refactor to use `no-drag'.
* src/android.c (struct android_emacs_window): New methods.
Make all event sending functions return the event serial.
(android_toggle_on_screen_keyboard, android_window_updated): New
functions.
* src/android.h: Update prototypes.
* src/androidfns.c (Fandroid_toggle_on_screen_keyboard)
(syms_of_androidfns): New function.
* src/androidgui.h (struct android_any_event)
(struct android_key_event, struct android_configure_event)
(struct android_focus_event, struct android_window_action_event)
(struct android_crossing_event, struct android_motion_event)
(struct android_button_event, struct android_touch_event)
(struct android_wheel_event, struct android_iconify_event)
(struct android_menu_event): Add `serial' fields.
* src/androidterm.c (handle_one_android_event)
(android_frame_up_to_date):
* src/androidterm.h (struct android_output): Implement frame
resize synchronization.
2023-01-20 11:06:32 +00:00
|
|
|
|
then back again.
|
|
|
|
|
|
|
|
|
|
If WINDOW is the symbol `frame', simply convert the coordinates
|
|
|
|
|
to the frame that they belong in."
|
|
|
|
|
(if (or (eq (posn-window posn) window)
|
|
|
|
|
(and (eq window 'frame)
|
|
|
|
|
(framep (posn-window posn))))
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
(posn-x-y posn)
|
|
|
|
|
(let ((xy (posn-x-y posn))
|
Update Android port
* .gitignore: Don't ignore verbose.mk.android.
* doc/emacs/Makefile.in (EMACSSOURCES): Add android.texi and
input.texi.
* doc/emacs/android.texi (Android): Document support for the
on-screen keyboard.
(Android Startup): Document how to start Emacs with -Q on
Android.
(Android Environment): Document how Emacs works around the
system ``task killer''. Document changes to frame deletion
behavior.
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices, On-Screen
Keyboards): Document how to use Emacs with virtual keyboards.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to `touch-screen-track-drag'.
* doc/lispref/frames.texi (Frames, On-Screen Keyboards): New
node.
* java/AndroidManifest.xml.in: Add settings activity and
appropriate OSK adjustment mode.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Allow
creating Emacs with -Q.
(onDestroy): Don't remove if killed by the system.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
Fix context menus again.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Make all
event sending functions return long.
* java/org/gnu/emacs/EmacsPreferencesActivity.java
(EmacsPreferencesActivity): New class.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(onStartCommand, onCreate, startEmacsService): Start as a
foreground service if necessary to bypass system restrictions.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsThread.java (EmacsThread, run):
* java/org/gnu/emacs/EmacsView.java (EmacsView, onLayout)
(onDetachedFromWindow):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, viewLayout):
Implement frame resize synchronization..
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager, removeWindowConsumer): Adjust
accordingly for changes to frame deletion behavior.
* lisp/frame.el (android-toggle-on-screen-keyboard)
(frame-toggle-on-screen-keyboard): New function.
* lisp/minibuffer.el (minibuffer-setup-on-screen-keyboard)
(minibuffer-exit-on-screen-keyboard): New functions.
(minibuffer-setup-hook, minibuffer-exit-hook): Add new functions
to hooks.
* lisp/touch-screen.el (touch-screen-relative-xy): Accept new
value of window `frame'. Return frame coordinates in that case.
(touch-screen-set-point-commands): New variable.
(touch-screen-handle-point-up): Respect that variable.
(touch-screen-track-drag): Return `no-drag' where appropriate.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line):
Refactor to use `no-drag'.
* src/android.c (struct android_emacs_window): New methods.
Make all event sending functions return the event serial.
(android_toggle_on_screen_keyboard, android_window_updated): New
functions.
* src/android.h: Update prototypes.
* src/androidfns.c (Fandroid_toggle_on_screen_keyboard)
(syms_of_androidfns): New function.
* src/androidgui.h (struct android_any_event)
(struct android_key_event, struct android_configure_event)
(struct android_focus_event, struct android_window_action_event)
(struct android_crossing_event, struct android_motion_event)
(struct android_button_event, struct android_touch_event)
(struct android_wheel_event, struct android_iconify_event)
(struct android_menu_event): Add `serial' fields.
* src/androidterm.c (handle_one_android_event)
(android_frame_up_to_date):
* src/androidterm.h (struct android_output): Implement frame
resize synchronization.
2023-01-20 11:06:32 +00:00
|
|
|
|
(edges (and (windowp window)
|
|
|
|
|
(window-inside-pixel-edges window))))
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
;; Make the X and Y positions frame relative.
|
|
|
|
|
(when (windowp (posn-window posn))
|
|
|
|
|
(let ((edges (window-inside-pixel-edges
|
|
|
|
|
(posn-window posn))))
|
|
|
|
|
(setq xy (cons (+ (car xy) (car edges))
|
|
|
|
|
(+ (cdr xy) (cadr edges))))))
|
Update Android port
* .gitignore: Don't ignore verbose.mk.android.
* doc/emacs/Makefile.in (EMACSSOURCES): Add android.texi and
input.texi.
* doc/emacs/android.texi (Android): Document support for the
on-screen keyboard.
(Android Startup): Document how to start Emacs with -Q on
Android.
(Android Environment): Document how Emacs works around the
system ``task killer''. Document changes to frame deletion
behavior.
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices, On-Screen
Keyboards): Document how to use Emacs with virtual keyboards.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to `touch-screen-track-drag'.
* doc/lispref/frames.texi (Frames, On-Screen Keyboards): New
node.
* java/AndroidManifest.xml.in: Add settings activity and
appropriate OSK adjustment mode.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Allow
creating Emacs with -Q.
(onDestroy): Don't remove if killed by the system.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
Fix context menus again.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Make all
event sending functions return long.
* java/org/gnu/emacs/EmacsPreferencesActivity.java
(EmacsPreferencesActivity): New class.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(onStartCommand, onCreate, startEmacsService): Start as a
foreground service if necessary to bypass system restrictions.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsThread.java (EmacsThread, run):
* java/org/gnu/emacs/EmacsView.java (EmacsView, onLayout)
(onDetachedFromWindow):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, viewLayout):
Implement frame resize synchronization..
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager, removeWindowConsumer): Adjust
accordingly for changes to frame deletion behavior.
* lisp/frame.el (android-toggle-on-screen-keyboard)
(frame-toggle-on-screen-keyboard): New function.
* lisp/minibuffer.el (minibuffer-setup-on-screen-keyboard)
(minibuffer-exit-on-screen-keyboard): New functions.
(minibuffer-setup-hook, minibuffer-exit-hook): Add new functions
to hooks.
* lisp/touch-screen.el (touch-screen-relative-xy): Accept new
value of window `frame'. Return frame coordinates in that case.
(touch-screen-set-point-commands): New variable.
(touch-screen-handle-point-up): Respect that variable.
(touch-screen-track-drag): Return `no-drag' where appropriate.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line):
Refactor to use `no-drag'.
* src/android.c (struct android_emacs_window): New methods.
Make all event sending functions return the event serial.
(android_toggle_on_screen_keyboard, android_window_updated): New
functions.
* src/android.h: Update prototypes.
* src/androidfns.c (Fandroid_toggle_on_screen_keyboard)
(syms_of_androidfns): New function.
* src/androidgui.h (struct android_any_event)
(struct android_key_event, struct android_configure_event)
(struct android_focus_event, struct android_window_action_event)
(struct android_crossing_event, struct android_motion_event)
(struct android_button_event, struct android_touch_event)
(struct android_wheel_event, struct android_iconify_event)
(struct android_menu_event): Add `serial' fields.
* src/androidterm.c (handle_one_android_event)
(android_frame_up_to_date):
* src/androidterm.h (struct android_output): Implement frame
resize synchronization.
2023-01-20 11:06:32 +00:00
|
|
|
|
(if (eq window 'frame)
|
|
|
|
|
xy
|
|
|
|
|
;; Make the X and Y positions window relative again.
|
|
|
|
|
(cons (- (car xy) (car edges))
|
|
|
|
|
(- (cdr xy) (cadr edges)))))))
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
|
|
|
|
|
(defun touch-screen-handle-scroll (dx dy)
|
2023-01-28 06:29:51 +00:00
|
|
|
|
"Scroll the display assuming that a touch point has moved by DX and DY.
|
|
|
|
|
Perform vertical scrolling by DY, using `pixel-scroll-precision'
|
|
|
|
|
if `touch-screen-precision-scroll' is enabled. Next, perform
|
|
|
|
|
horizontal scrolling according to the movement in DX."
|
2023-02-05 15:02:14 +00:00
|
|
|
|
;; Perform vertical scrolling first. Do not ding at buffer limits.
|
|
|
|
|
;; Show a message instead.
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(if touch-screen-precision-scroll
|
2023-05-31 05:47:08 +00:00
|
|
|
|
(progn
|
|
|
|
|
(if (> dy 0)
|
|
|
|
|
(pixel-scroll-precision-scroll-down-page dy)
|
|
|
|
|
(pixel-scroll-precision-scroll-up-page (- dy)))
|
|
|
|
|
;; Now set `lines-vscrolled' to an value that will result
|
|
|
|
|
;; in hscroll being disabled if dy looks as if a
|
|
|
|
|
;; significant amount of scrolling is about to take
|
|
|
|
|
;; Otherwise, horizontal scrolling may then interfere with
|
|
|
|
|
;; precision scrolling.
|
|
|
|
|
(when (> (abs dy) 10)
|
|
|
|
|
(setcar (nthcdr 7 touch-screen-current-tool) 10)))
|
2023-02-05 15:02:14 +00:00
|
|
|
|
;; Start conventional scrolling. First, determine the
|
|
|
|
|
;; direction in which the scrolling is taking place. Load the
|
|
|
|
|
;; accumulator value.
|
|
|
|
|
(let ((accumulator (or (nth 5 touch-screen-current-tool) 0))
|
|
|
|
|
(window (cadr touch-screen-current-tool))
|
|
|
|
|
(lines-vscrolled (or (nth 7 touch-screen-current-tool) 0)))
|
|
|
|
|
(setq accumulator (+ accumulator dy)) ; Add dy.
|
|
|
|
|
;; Figure out how much it has scrolled and how much remains
|
|
|
|
|
;; on the top or bottom of the window.
|
|
|
|
|
(while (catch 'again
|
|
|
|
|
(let* ((line-height (window-default-line-height window)))
|
|
|
|
|
(if (and (< accumulator 0)
|
|
|
|
|
(>= (- accumulator) line-height))
|
|
|
|
|
(progn
|
|
|
|
|
(setq accumulator (+ accumulator line-height))
|
|
|
|
|
(scroll-down 1)
|
|
|
|
|
(setq lines-vscrolled (1+ lines-vscrolled))
|
|
|
|
|
(when (not (zerop accumulator))
|
|
|
|
|
;; If there is still an outstanding
|
|
|
|
|
;; amount to scroll, do this again.
|
|
|
|
|
(throw 'again t)))
|
|
|
|
|
(when (and (> accumulator 0)
|
|
|
|
|
(>= accumulator line-height))
|
|
|
|
|
(setq accumulator (- accumulator line-height))
|
|
|
|
|
(scroll-up 1)
|
|
|
|
|
(setq lines-vscrolled (1+ lines-vscrolled))
|
|
|
|
|
(when (not (zerop accumulator))
|
|
|
|
|
;; If there is still an outstanding amount
|
|
|
|
|
;; to scroll, do this again.
|
|
|
|
|
(throw 'again t)))))
|
|
|
|
|
;; Scrolling is done. Move the accumulator back to
|
|
|
|
|
;; touch-screen-current-tool and break out of the
|
|
|
|
|
;; loop.
|
|
|
|
|
(setcar (nthcdr 5 touch-screen-current-tool) accumulator)
|
|
|
|
|
(setcar (nthcdr 7 touch-screen-current-tool)
|
|
|
|
|
lines-vscrolled)
|
|
|
|
|
nil))))
|
|
|
|
|
(beginning-of-buffer
|
|
|
|
|
(message (error-message-string '(beginning-of-buffer))))
|
|
|
|
|
(end-of-buffer
|
|
|
|
|
(message (error-message-string '(end-of-buffer)))))
|
2023-01-28 06:29:51 +00:00
|
|
|
|
|
|
|
|
|
;; Perform horizontal scrolling by DX, as this does not signal at
|
|
|
|
|
;; the beginning of the buffer.
|
|
|
|
|
(let ((accumulator (or (nth 6 touch-screen-current-tool) 0))
|
|
|
|
|
(window (cadr touch-screen-current-tool))
|
|
|
|
|
(lines-vscrolled (or (nth 7 touch-screen-current-tool) 0))
|
|
|
|
|
(lines-hscrolled (or (nth 8 touch-screen-current-tool) 0)))
|
2023-11-16 13:07:01 +00:00
|
|
|
|
(setq accumulator (+ accumulator dx)) ; Add dx.
|
2023-01-28 06:29:51 +00:00
|
|
|
|
;; Figure out how much it has scrolled and how much remains on the
|
|
|
|
|
;; left or right of the window. If a line has already been
|
|
|
|
|
;; vscrolled but no hscrolling has happened, don't hscroll, as
|
|
|
|
|
;; otherwise it is too easy to hscroll by accident.
|
|
|
|
|
(if (or (> lines-hscrolled 0)
|
|
|
|
|
(< lines-vscrolled 1))
|
|
|
|
|
(while (catch 'again
|
|
|
|
|
(let* ((column-width (frame-char-width (window-frame window))))
|
|
|
|
|
(if (and (< accumulator 0)
|
|
|
|
|
(>= (- accumulator) column-width))
|
|
|
|
|
(progn
|
|
|
|
|
(setq accumulator (+ accumulator column-width))
|
2023-10-24 13:12:32 +00:00
|
|
|
|
;; Maintain both hscroll counters even when
|
|
|
|
|
;; it's disabled to prevent unintentional or
|
|
|
|
|
;; patently horizontal gestures from
|
|
|
|
|
;; scrolling the window vertically.
|
|
|
|
|
(when touch-screen-enable-hscroll
|
|
|
|
|
(scroll-right 1))
|
2023-01-28 06:29:51 +00:00
|
|
|
|
(setq lines-hscrolled (1+ lines-hscrolled))
|
|
|
|
|
(when (not (zerop accumulator))
|
2023-07-20 04:48:37 +00:00
|
|
|
|
;; If there is still an outstanding amount
|
|
|
|
|
;; to scroll, do this again.
|
2023-01-28 06:29:51 +00:00
|
|
|
|
(throw 'again t)))
|
|
|
|
|
(when (and (> accumulator 0)
|
|
|
|
|
(>= accumulator column-width))
|
|
|
|
|
(setq accumulator (- accumulator column-width))
|
2023-10-24 13:12:32 +00:00
|
|
|
|
(when touch-screen-enable-hscroll
|
|
|
|
|
(scroll-left 1))
|
2023-01-28 06:29:51 +00:00
|
|
|
|
(setq lines-hscrolled (1+ lines-hscrolled))
|
2023-01-21 13:46:32 +00:00
|
|
|
|
(when (not (zerop accumulator))
|
|
|
|
|
;; If there is still an outstanding amount to
|
|
|
|
|
;; scroll, do this again.
|
|
|
|
|
(throw 'again t)))))
|
2023-01-28 06:29:51 +00:00
|
|
|
|
;; Scrolling is done. Move the accumulator back to
|
2023-07-20 04:48:37 +00:00
|
|
|
|
;; touch-screen-current-tool and break out of the
|
|
|
|
|
;; loop.
|
2023-01-28 06:29:51 +00:00
|
|
|
|
(setcar (nthcdr 6 touch-screen-current-tool) accumulator)
|
|
|
|
|
(setcar (nthcdr 8 touch-screen-current-tool) lines-hscrolled)
|
|
|
|
|
nil)))))
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(defun touch-screen-scroll (event)
|
|
|
|
|
"Scroll the window within EVENT, a `touchscreen-scroll' event.
|
|
|
|
|
If `touch-screen-precision-scroll', scroll the window vertically
|
|
|
|
|
by the number of pixels specified within that event. Else,
|
|
|
|
|
scroll the window by one line for every
|
|
|
|
|
`window-default-line-height' pixels worth of movement.
|
|
|
|
|
|
|
|
|
|
If EVENT also specifies horizontal motion and no significant
|
|
|
|
|
amount of vertical scrolling has taken place, also scroll the
|
|
|
|
|
window horizontally in conjunction with the number of pixels in
|
|
|
|
|
the event."
|
|
|
|
|
(interactive "e")
|
|
|
|
|
(let ((window (nth 1 event))
|
|
|
|
|
(dx (nth 2 event))
|
|
|
|
|
(dy (nth 3 event)))
|
|
|
|
|
(with-selected-window window
|
|
|
|
|
(touch-screen-handle-scroll dx dy))))
|
|
|
|
|
|
|
|
|
|
(global-set-key [touchscreen-scroll] #'touch-screen-scroll)
|
|
|
|
|
|
2023-07-17 01:46:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Drag-to-select gesture.
|
|
|
|
|
|
2023-12-07 05:14:51 +00:00
|
|
|
|
;;;###autoload
|
2023-07-16 09:29:58 +00:00
|
|
|
|
(defun touch-screen-hold (event)
|
|
|
|
|
"Handle a long press EVENT.
|
2023-07-17 01:46:37 +00:00
|
|
|
|
Ding and select the window at EVENT, then activate the mark. If
|
|
|
|
|
`touch-screen-word-select' is enabled, try to select the whole
|
|
|
|
|
word around EVENT; otherwise, set point to the location of EVENT."
|
2023-07-16 09:29:58 +00:00
|
|
|
|
(interactive "e")
|
|
|
|
|
(let* ((posn (cadr event))
|
2023-07-18 05:24:36 +00:00
|
|
|
|
(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)))
|
2023-07-16 09:29:58 +00:00
|
|
|
|
(beep)
|
2023-07-18 05:24:36 +00:00
|
|
|
|
(select-window window)
|
2023-07-17 01:46:37 +00:00
|
|
|
|
(if (or (not touch-screen-word-select)
|
|
|
|
|
(when-let* ((char (char-after point))
|
|
|
|
|
(class (char-syntax char)))
|
|
|
|
|
;; Don't select words if point isn't inside a word
|
|
|
|
|
;; constituent or similar.
|
|
|
|
|
(not (or (eq class ?w) (eq class ?_)))))
|
|
|
|
|
(progn
|
|
|
|
|
;; Set the mark and activate it.
|
|
|
|
|
(setq touch-screen-word-select-initial-word nil
|
|
|
|
|
touch-screen-word-select-bounds nil)
|
|
|
|
|
(push-mark point)
|
|
|
|
|
(goto-char point)
|
2024-04-24 03:42:48 +00:00
|
|
|
|
(activate-mark)
|
|
|
|
|
(setq deactivate-mark nil))
|
2023-07-17 01:46:37 +00:00
|
|
|
|
;; Start word selection by trying to obtain the position
|
|
|
|
|
;; around point.
|
|
|
|
|
(let ((word-start nil)
|
|
|
|
|
(word-end nil))
|
|
|
|
|
(unless (posn-object posn)
|
|
|
|
|
;; If there's an object under POSN avoid trying to
|
|
|
|
|
;; ascertain the bounds of the word surrounding it.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char point)
|
|
|
|
|
(forward-word-strictly)
|
|
|
|
|
;; Set word-end to ZV if there is no word after this
|
|
|
|
|
;; one.
|
|
|
|
|
(setq word-end (point))
|
|
|
|
|
;; Now try to move backwards. Set word-start to BEGV if
|
|
|
|
|
;; this word is there.
|
|
|
|
|
(backward-word-strictly)
|
|
|
|
|
(setq word-start (point))))
|
|
|
|
|
;; Check if word-start and word-end are identical, if there
|
|
|
|
|
;; is an object under POSN, or if point is looking at or
|
|
|
|
|
;; outside a word.
|
|
|
|
|
(if (or (eq word-start word-end)
|
|
|
|
|
(>= word-start point))
|
|
|
|
|
(progn
|
|
|
|
|
;; If so, clear the bounds and set and activate the
|
|
|
|
|
;; mark.
|
2023-07-20 04:48:37 +00:00
|
|
|
|
(setq touch-screen-word-select-bounds nil
|
|
|
|
|
touch-screen-word-select-initial-word nil)
|
2023-07-17 01:46:37 +00:00
|
|
|
|
(push-mark point)
|
|
|
|
|
(goto-char point)
|
2024-04-24 03:42:48 +00:00
|
|
|
|
(activate-mark)
|
|
|
|
|
(setq deactivate-mark nil))
|
2023-07-17 01:46:37 +00:00
|
|
|
|
;; Otherwise, select the word. Move point to either the
|
|
|
|
|
;; end or the start of the word, depending on which is
|
|
|
|
|
;; closer to EVENT.
|
|
|
|
|
(let ((diff-beg (- point word-start))
|
|
|
|
|
(diff-end (- word-end point))
|
|
|
|
|
use-end)
|
|
|
|
|
(if (> diff-beg diff-end)
|
|
|
|
|
;; Set the point to the end of the word.
|
|
|
|
|
(setq use-end t)
|
|
|
|
|
(if (< diff-end diff-beg)
|
|
|
|
|
(setq use-end nil)
|
|
|
|
|
;; POINT is in the middle of the word. Use its
|
|
|
|
|
;; window coordinates to establish whether or not it
|
|
|
|
|
;; is closer to the start of the word or to the end
|
|
|
|
|
;; of the word.
|
|
|
|
|
(let ((posn-beg (posn-at-point word-start))
|
|
|
|
|
(posn-end (posn-at-point word-end)))
|
|
|
|
|
;; Give up if there's an object at either of those
|
|
|
|
|
;; positions, or they're not on the same row.
|
|
|
|
|
;; If one of the positions isn't visible, use the
|
|
|
|
|
;; window end.
|
|
|
|
|
(if (and posn-beg posn-end
|
|
|
|
|
(not (posn-object posn-beg))
|
|
|
|
|
(not (posn-object posn-end))
|
|
|
|
|
(eq (cdr (posn-col-row posn-beg))
|
|
|
|
|
(cdr (posn-col-row posn-end))))
|
|
|
|
|
(setq use-end nil)
|
|
|
|
|
;; Compare the pixel positions.
|
|
|
|
|
(setq point (car (posn-x-y posn))
|
|
|
|
|
diff-beg (- point (car (posn-x-y posn-beg)))
|
|
|
|
|
diff-end (- (car (posn-x-y posn-end)) point))
|
|
|
|
|
;; Now determine whether or not point should be
|
|
|
|
|
;; moved to the end.
|
|
|
|
|
(setq use-end (>= diff-beg diff-end))))))
|
|
|
|
|
(if use-end
|
|
|
|
|
(progn
|
|
|
|
|
(push-mark word-start)
|
|
|
|
|
(activate-mark)
|
2024-04-24 03:42:48 +00:00
|
|
|
|
(setq deactivate-mark nil)
|
2023-07-17 01:46:37 +00:00
|
|
|
|
(goto-char word-end))
|
|
|
|
|
(progn
|
|
|
|
|
(push-mark word-end)
|
|
|
|
|
(activate-mark)
|
2024-04-24 03:42:48 +00:00
|
|
|
|
(setq deactivate-mark nil)
|
2023-07-17 01:46:37 +00:00
|
|
|
|
(goto-char word-start)))
|
|
|
|
|
;; Record the bounds of the selected word.
|
|
|
|
|
(setq touch-screen-word-select-bounds
|
|
|
|
|
(cons word-start word-end)
|
|
|
|
|
;; Save this for the benefit of touch-screen-drag.
|
|
|
|
|
touch-screen-word-select-initial-word
|
|
|
|
|
(cons word-start word-end)))))))))
|
2023-07-16 09:29:58 +00:00
|
|
|
|
|
2023-07-21 04:23:08 +00:00
|
|
|
|
(defun touch-screen-preview-select ()
|
|
|
|
|
"Display a preview of the line around point in the echo area.
|
|
|
|
|
Unless the minibuffer is an active or the current line is
|
|
|
|
|
excessively tall, display an indication of the position of point
|
|
|
|
|
and the contents of the visible line around it within the echo
|
|
|
|
|
area.
|
|
|
|
|
|
|
|
|
|
If the selected window is hscrolled or lines may be truncated,
|
|
|
|
|
attempt to find the extents of the text between column 0 and the
|
|
|
|
|
right most column of the window using `posn-at-x-y'."
|
|
|
|
|
(interactive)
|
|
|
|
|
;; First, establish that the minibuffer isn't active and the line
|
|
|
|
|
;; isn't taller than two times the frame character height.
|
|
|
|
|
(unless (or (> (minibuffer-depth) 0)
|
|
|
|
|
;; The code below doesn't adapt well to buffers
|
|
|
|
|
;; containing long lines.
|
|
|
|
|
(long-line-optimizations-p)
|
|
|
|
|
(let ((window-line-height (window-line-height))
|
|
|
|
|
(maximum-height (* 2 (frame-char-height))))
|
2023-07-21 06:22:54 +00:00
|
|
|
|
(unless window-line-height
|
|
|
|
|
;; `window-line-height' isn't available.
|
|
|
|
|
;; Redisplay first and try to ascertain the height
|
|
|
|
|
;; of the line again.
|
|
|
|
|
(redisplay t)
|
|
|
|
|
(setq window-line-height (window-line-height)))
|
|
|
|
|
;; `window-line-height' might still be unavailable.
|
|
|
|
|
(and window-line-height
|
|
|
|
|
(> (car window-line-height)
|
|
|
|
|
maximum-height))))
|
|
|
|
|
(catch 'hscrolled-away
|
|
|
|
|
(let ((beg nil) end string y)
|
|
|
|
|
;; Detect whether or not the window is hscrolled. If it
|
|
|
|
|
;; is, set beg to the location of the first column
|
|
|
|
|
;; instead.
|
|
|
|
|
(when (> (window-hscroll) 0)
|
|
|
|
|
(setq y (+ (or (cdr (posn-x-y (posn-at-point)))
|
|
|
|
|
(throw 'hscrolled-away t))
|
|
|
|
|
(window-header-line-height)
|
|
|
|
|
(window-tab-line-height)))
|
|
|
|
|
(let* ((posn (posn-at-x-y 0 y))
|
|
|
|
|
(point (posn-point posn)))
|
|
|
|
|
(setq beg point)))
|
|
|
|
|
;; Check if lines are being truncated; if so, use the
|
|
|
|
|
;; character at the end of the window as the end of the
|
|
|
|
|
;; text to be displayed, as the visual line may extend
|
|
|
|
|
;; past the window.
|
|
|
|
|
(when (or truncate-lines beg) ; truncate-lines or hscroll.
|
|
|
|
|
(setq y (or y (+ (or (cdr (posn-x-y (posn-at-point)))
|
|
|
|
|
(throw 'hscrolled-away t))
|
|
|
|
|
(window-header-line-height)
|
|
|
|
|
(window-tab-line-height))))
|
|
|
|
|
(let* ((posn (posn-at-x-y (1- (window-width nil t)) y))
|
|
|
|
|
(point (posn-point posn)))
|
|
|
|
|
(setq end point)))
|
|
|
|
|
;; Now find the rest of the visual line.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(unless beg
|
|
|
|
|
(beginning-of-visual-line)
|
|
|
|
|
(setq beg (point)))
|
|
|
|
|
(unless end
|
|
|
|
|
(end-of-visual-line)
|
|
|
|
|
(setq end (point))))
|
|
|
|
|
;; Obtain a substring containing the beginning of the
|
|
|
|
|
;; visual line and the end.
|
|
|
|
|
(setq string (buffer-substring beg end))
|
|
|
|
|
;; Hack `invisible' properties within the new string.
|
|
|
|
|
;; Look for each change of the property that is a variable
|
|
|
|
|
;; name and replace it with its actual value according to
|
|
|
|
|
;; `buffer-invisibility-spec'.
|
|
|
|
|
(when (listp buffer-invisibility-spec)
|
|
|
|
|
(let ((index 0)
|
|
|
|
|
(property (get-text-property 0
|
|
|
|
|
'invisible
|
|
|
|
|
string))
|
|
|
|
|
index1 invisible)
|
|
|
|
|
(while index
|
|
|
|
|
;; Find the end of this text property.
|
|
|
|
|
(setq index1 (next-single-property-change index
|
|
|
|
|
'invisible
|
|
|
|
|
string))
|
|
|
|
|
;; Replace the property with whether or not it is
|
|
|
|
|
;; non-nil.
|
|
|
|
|
(when property
|
|
|
|
|
(setq invisible nil)
|
|
|
|
|
(catch 'invisible
|
|
|
|
|
(dolist (spec buffer-invisibility-spec)
|
|
|
|
|
;; Process one element of the buffer
|
|
|
|
|
;; invisibility specification.
|
|
|
|
|
(if (consp spec)
|
|
|
|
|
(when (eq (cdr spec) 't)
|
|
|
|
|
;; (ATOM . t) makes N invisible if N is
|
|
|
|
|
;; equal to ATOM or a list containing
|
|
|
|
|
;; ATOM.
|
|
|
|
|
(when (or (eq (car spec) property)
|
|
|
|
|
(and (listp spec)
|
|
|
|
|
(memq (car spec) invisible)))
|
|
|
|
|
(throw 'invisible (setq invisible t))))
|
|
|
|
|
;; Otherwise, N is invisible if SPEC is
|
|
|
|
|
;; equal to N.
|
|
|
|
|
(when (eq spec property)
|
|
|
|
|
(throw 'invisible (setq invisible t))))))
|
|
|
|
|
(put-text-property index (or index1
|
|
|
|
|
(- end beg))
|
|
|
|
|
'invisible invisible string))
|
|
|
|
|
;; Set index to that of the next text property and
|
|
|
|
|
;; continue.
|
|
|
|
|
(setq index index1
|
|
|
|
|
property (and index1
|
|
|
|
|
(get-text-property index1
|
|
|
|
|
'invisible
|
|
|
|
|
string))))))
|
|
|
|
|
(let ((resize-mini-windows t) difference width
|
|
|
|
|
(message-log-max nil))
|
|
|
|
|
;; Find the offset of point from beg and display a cursor
|
|
|
|
|
;; below.
|
|
|
|
|
(setq difference (- (point) beg)
|
|
|
|
|
width (string-pixel-width
|
|
|
|
|
(substring string 0 difference)))
|
|
|
|
|
(message "%s\n%s^" string
|
|
|
|
|
(propertize " "
|
|
|
|
|
'display (list 'space
|
|
|
|
|
:width (list width)))))
|
|
|
|
|
nil))))
|
2023-07-21 04:23:08 +00:00
|
|
|
|
|
2023-07-16 09:29:58 +00:00
|
|
|
|
(defun touch-screen-drag (event)
|
|
|
|
|
"Handle a drag EVENT by setting the region to its new point.
|
2023-07-17 01:46:37 +00:00
|
|
|
|
If `touch-screen-word-select' and EVENT lies outside the last
|
|
|
|
|
word that was selected, select the word that now contains POINT.
|
|
|
|
|
Scroll the window if EVENT's coordinates are outside its text
|
|
|
|
|
area."
|
2023-07-16 09:29:58 +00:00
|
|
|
|
(interactive "e")
|
|
|
|
|
(let* ((posn (cadr event)) ; Position of the tool.
|
2023-07-17 01:46:37 +00:00
|
|
|
|
(point (posn-point posn)) ; Point of the event.
|
2023-07-21 06:22:54 +00:00
|
|
|
|
;; Window where the tap originated.
|
2023-07-21 04:23:08 +00:00
|
|
|
|
(window (nth 1 touch-screen-current-tool))
|
2023-07-21 06:22:54 +00:00
|
|
|
|
;; The currently selected window. Used to redisplay within
|
|
|
|
|
;; the correct window while scrolling.
|
|
|
|
|
(old-window (selected-window))
|
2023-07-22 12:09:54 +00:00
|
|
|
|
;; Whether or not text should be selected word-by-word.
|
|
|
|
|
(word-select touch-screen-word-select)
|
|
|
|
|
;; Cons containing the confines of the word initially
|
|
|
|
|
;; selected when the touchpoint was first held down.
|
|
|
|
|
(initial touch-screen-word-select-initial-word)
|
2023-07-21 04:23:08 +00:00
|
|
|
|
initial-point)
|
2023-07-16 09:29:58 +00:00
|
|
|
|
;; Keep dragging.
|
|
|
|
|
(with-selected-window window
|
2023-07-21 06:22:54 +00:00
|
|
|
|
;; Figure out what character to go to. If this posn is in the
|
|
|
|
|
;; window, go to (posn-point posn). If not, then go to the line
|
|
|
|
|
;; before either window start or window end.
|
2023-07-21 04:23:08 +00:00
|
|
|
|
(setq initial-point (point))
|
2023-07-21 06:22:54 +00:00
|
|
|
|
(when (or (not point)
|
|
|
|
|
(not (eq point initial-point)))
|
|
|
|
|
(if (and (eq (posn-window posn) window)
|
|
|
|
|
point
|
|
|
|
|
;; point must be visible in the window. If it isn't,
|
|
|
|
|
;; the window must be scrolled.
|
|
|
|
|
(pos-visible-in-window-p point))
|
|
|
|
|
(let* ((bounds touch-screen-word-select-bounds)
|
|
|
|
|
(maybe-select-word (or (not touch-screen-word-select)
|
|
|
|
|
(or (not bounds)
|
|
|
|
|
(> point (cdr bounds))
|
|
|
|
|
(< point (car bounds))))))
|
2023-07-22 12:09:54 +00:00
|
|
|
|
(if (and word-select
|
2023-07-21 06:22:54 +00:00
|
|
|
|
;; point is now outside the last word selected.
|
|
|
|
|
maybe-select-word
|
|
|
|
|
(not (posn-object posn))
|
|
|
|
|
(when-let* ((char (char-after point))
|
|
|
|
|
(class (char-syntax char)))
|
|
|
|
|
;; Don't select words if point isn't inside a
|
|
|
|
|
;; word constituent or similar.
|
|
|
|
|
(or (eq class ?w) (eq class ?_))))
|
|
|
|
|
;; Determine the confines of the word containing
|
|
|
|
|
;; POINT.
|
|
|
|
|
(let (word-start word-end)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char point)
|
|
|
|
|
(forward-word-strictly)
|
|
|
|
|
;; Set word-end to ZV if there is no word after
|
|
|
|
|
;; this one.
|
|
|
|
|
(setq word-end (point))
|
|
|
|
|
;; Now try to move backwards. Set word-start to
|
|
|
|
|
;; BEGV if this word is there.
|
|
|
|
|
(backward-word-strictly)
|
|
|
|
|
(setq word-start (point)))
|
|
|
|
|
(let ((mark (mark)))
|
|
|
|
|
;; Extend the region to cover either word-end or
|
|
|
|
|
;; word-start; whether to goto word-end or
|
|
|
|
|
;; word-start is subject to the position of the
|
|
|
|
|
;; mark relative to point.
|
|
|
|
|
(if (< word-start mark)
|
|
|
|
|
;; The start of the word is behind mark.
|
|
|
|
|
;; Extend the region towards the start.
|
|
|
|
|
(goto-char word-start)
|
|
|
|
|
;; Else, go to the end of the word.
|
|
|
|
|
(goto-char word-end))
|
|
|
|
|
;; If point is less than mark, which is is less
|
|
|
|
|
;; than the end of the word that was originally
|
|
|
|
|
;; selected, try to keep it selected by moving
|
|
|
|
|
;; mark there.
|
|
|
|
|
(when (and initial (<= (point) mark)
|
|
|
|
|
(< mark (cdr initial)))
|
|
|
|
|
(set-mark (cdr initial)))
|
|
|
|
|
;; Do the opposite when the converse is true.
|
|
|
|
|
(when (and initial (>= (point) mark)
|
|
|
|
|
(> mark (car initial)))
|
|
|
|
|
(set-mark (car initial))))
|
|
|
|
|
(if bounds
|
|
|
|
|
(progn (setcar bounds word-start)
|
|
|
|
|
(setcdr bounds word-end))
|
|
|
|
|
(setq touch-screen-word-select-bounds
|
|
|
|
|
(cons word-start word-end))))
|
|
|
|
|
(when maybe-select-word
|
|
|
|
|
(goto-char (posn-point posn))
|
|
|
|
|
(when initial
|
2023-07-17 04:58:29 +00:00
|
|
|
|
;; If point is less than mark, which is is less
|
|
|
|
|
;; than the end of the word that was originally
|
|
|
|
|
;; selected, try to keep it selected by moving
|
|
|
|
|
;; mark there.
|
2023-07-21 06:22:54 +00:00
|
|
|
|
(when (and (<= (point) (mark))
|
|
|
|
|
(< (mark) (cdr initial)))
|
2023-07-17 04:58:29 +00:00
|
|
|
|
(set-mark (cdr initial)))
|
|
|
|
|
;; Do the opposite when the converse is true.
|
2023-07-21 06:22:54 +00:00
|
|
|
|
(when (and (>= (point) (mark))
|
|
|
|
|
(> (mark) (car initial)))
|
2023-07-17 04:58:29 +00:00
|
|
|
|
(set-mark (car initial))))
|
2023-07-21 06:22:54 +00:00
|
|
|
|
(setq touch-screen-word-select-bounds nil)))
|
|
|
|
|
;; Finally, display a preview of the line around point
|
|
|
|
|
;; if requested by the user.
|
|
|
|
|
(when (and touch-screen-preview-select
|
|
|
|
|
(not (eq (point) initial-point)))
|
|
|
|
|
(touch-screen-preview-select)))
|
|
|
|
|
;; POSN is outside the window. Scroll accordingly.
|
|
|
|
|
(let* ((relative-xy
|
|
|
|
|
(touch-screen-relative-xy posn window))
|
|
|
|
|
(xy (posn-x-y posn))
|
|
|
|
|
;; The height of the window's text area.
|
|
|
|
|
(body-height (window-body-height nil t))
|
|
|
|
|
;; This is used to find the character closest to
|
|
|
|
|
;; POSN's column at the bottom of the window.
|
|
|
|
|
(height (- body-height
|
|
|
|
|
;; Use the last row of the window, not its
|
|
|
|
|
;; last pixel.
|
|
|
|
|
(frame-char-height)))
|
|
|
|
|
(midpoint (/ body-height 2))
|
|
|
|
|
(scroll-conservatively 101))
|
2023-07-17 04:58:29 +00:00
|
|
|
|
(cond
|
2023-07-21 06:22:54 +00:00
|
|
|
|
((< (cdr relative-xy) midpoint)
|
|
|
|
|
;; POSN is before half the window, yet POINT does not
|
|
|
|
|
;; exist or is not completely visible within. Scroll
|
|
|
|
|
;; downwards.
|
2023-07-17 04:58:29 +00:00
|
|
|
|
(ignore-errors
|
2023-07-21 06:22:54 +00:00
|
|
|
|
;; Scroll down by a single line.
|
|
|
|
|
(scroll-down 1)
|
|
|
|
|
;; After scrolling, look up the new posn at EVENT's
|
|
|
|
|
;; column and go there.
|
|
|
|
|
(setq posn (posn-at-x-y (car xy) 0)
|
|
|
|
|
point (posn-point posn))
|
|
|
|
|
(if point
|
|
|
|
|
(goto-char point)
|
|
|
|
|
;; If there's no buffer position at that column, go
|
|
|
|
|
;; to the window start.
|
|
|
|
|
(goto-char (window-start)))
|
2023-07-22 12:09:54 +00:00
|
|
|
|
;; If word selection is enabled, now try to keep the
|
|
|
|
|
;; initially selected word within the active region.
|
|
|
|
|
(when word-select
|
|
|
|
|
(when initial
|
|
|
|
|
;; If point is less than mark, which is is less
|
|
|
|
|
;; than the end of the word that was originally
|
|
|
|
|
;; selected, try to keep it selected by moving
|
|
|
|
|
;; mark there.
|
|
|
|
|
(when (and (<= (point) (mark))
|
|
|
|
|
(< (mark) (cdr initial)))
|
|
|
|
|
(set-mark (cdr initial)))
|
|
|
|
|
;; Do the opposite when the converse is true.
|
|
|
|
|
(when (and (>= (point) (mark))
|
|
|
|
|
(> (mark) (car initial)))
|
|
|
|
|
(set-mark (car initial))))
|
|
|
|
|
(setq touch-screen-word-select-bounds nil))
|
2023-07-21 06:22:54 +00:00
|
|
|
|
;; Display a preview of the line now around point if
|
|
|
|
|
;; requested by the user.
|
|
|
|
|
(when touch-screen-preview-select
|
|
|
|
|
(touch-screen-preview-select))
|
|
|
|
|
;; Select old-window, so that redisplay doesn't
|
|
|
|
|
;; display WINDOW as selected if it isn't already.
|
|
|
|
|
(with-selected-window old-window
|
|
|
|
|
;; Now repeat this every `mouse-scroll-delay' until
|
|
|
|
|
;; input becomes available, but scroll down a few
|
|
|
|
|
;; more lines.
|
|
|
|
|
(while (sit-for mouse-scroll-delay)
|
|
|
|
|
;; Select WINDOW again.
|
|
|
|
|
(with-selected-window window
|
|
|
|
|
;; Keep scrolling down until input becomes
|
|
|
|
|
;; available.
|
|
|
|
|
(scroll-down 4)
|
|
|
|
|
;; After scrolling, look up the new posn at
|
|
|
|
|
;; EVENT's column and go there.
|
|
|
|
|
(setq posn (posn-at-x-y (car xy) 0)
|
|
|
|
|
point (posn-point posn))
|
|
|
|
|
(if point
|
|
|
|
|
(goto-char point)
|
|
|
|
|
;; If there's no buffer position at that
|
|
|
|
|
;; column, go to the window start.
|
|
|
|
|
(goto-char (window-start)))
|
2023-07-22 12:09:54 +00:00
|
|
|
|
;; If word selection is enabled, now try to keep
|
|
|
|
|
;; the initially selected word within the active
|
|
|
|
|
;; region.
|
|
|
|
|
(when word-select
|
|
|
|
|
(when initial
|
|
|
|
|
;; If point is less than mark, which is is
|
|
|
|
|
;; less than the end of the word that was
|
|
|
|
|
;; originally selected, try to keep it
|
|
|
|
|
;; selected by moving mark there.
|
|
|
|
|
(when (and (<= (point) (mark))
|
|
|
|
|
(< (mark) (cdr initial)))
|
|
|
|
|
(set-mark (cdr initial)))
|
|
|
|
|
;; Do the opposite when the converse is true.
|
|
|
|
|
(when (and (>= (point) (mark))
|
|
|
|
|
(> (mark) (car initial)))
|
|
|
|
|
(set-mark (car initial))))
|
|
|
|
|
(setq touch-screen-word-select-bounds nil))
|
2023-07-21 06:22:54 +00:00
|
|
|
|
;; Display a preview of the line now around
|
|
|
|
|
;; point if requested by the user.
|
|
|
|
|
(when touch-screen-preview-select
|
|
|
|
|
(touch-screen-preview-select))))))
|
|
|
|
|
(setq touch-screen-word-select-bounds nil))
|
|
|
|
|
((>= (cdr relative-xy) midpoint)
|
|
|
|
|
;; Default to scrolling upwards even if POSN is still
|
|
|
|
|
;; within the confines of the window. If POINT is
|
|
|
|
|
;; partially visible, and the branch above hasn't been
|
|
|
|
|
;; taken it must be somewhere at the bottom of the
|
|
|
|
|
;; window, so scroll downwards.
|
2023-07-17 04:58:29 +00:00
|
|
|
|
(ignore-errors
|
2023-07-21 06:22:54 +00:00
|
|
|
|
;; Scroll up by a single line.
|
|
|
|
|
(scroll-up 1)
|
|
|
|
|
;; After scrolling, look up the new posn at EVENT's
|
|
|
|
|
;; column and go there.
|
|
|
|
|
(setq posn (posn-at-x-y (car xy) height)
|
|
|
|
|
point (posn-point posn))
|
|
|
|
|
(if point
|
|
|
|
|
(goto-char point)
|
|
|
|
|
;; If there's no buffer position at that column, go
|
|
|
|
|
;; to the window start.
|
|
|
|
|
(goto-char (window-end nil t)))
|
2023-07-22 12:09:54 +00:00
|
|
|
|
;; If word selection is enabled, now try to keep
|
|
|
|
|
;; the initially selected word within the active
|
|
|
|
|
;; region.
|
|
|
|
|
(when word-select
|
|
|
|
|
(when initial
|
|
|
|
|
;; If point is less than mark, which is is less
|
|
|
|
|
;; than the end of the word that was originally
|
|
|
|
|
;; selected, try to keep it selected by moving
|
|
|
|
|
;; mark there.
|
|
|
|
|
(when (and (<= (point) (mark))
|
|
|
|
|
(< (mark) (cdr initial)))
|
|
|
|
|
(set-mark (cdr initial)))
|
|
|
|
|
;; Do the opposite when the converse is true.
|
|
|
|
|
(when (and (>= (point) (mark))
|
|
|
|
|
(> (mark) (car initial)))
|
|
|
|
|
(set-mark (car initial))))
|
|
|
|
|
(setq touch-screen-word-select-bounds nil))
|
2023-07-21 06:22:54 +00:00
|
|
|
|
;; Display a preview of the line now around point if
|
|
|
|
|
;; requested by the user.
|
|
|
|
|
(when touch-screen-preview-select
|
|
|
|
|
(touch-screen-preview-select))
|
|
|
|
|
;; Select old-window, so that redisplay doesn't
|
|
|
|
|
;; display WINDOW as selected if it isn't already.
|
|
|
|
|
(with-selected-window old-window
|
|
|
|
|
;; Now repeat this every `mouse-scroll-delay' until
|
|
|
|
|
;; input becomes available, but scroll down a few
|
|
|
|
|
;; more lines.
|
|
|
|
|
(while (sit-for mouse-scroll-delay)
|
|
|
|
|
;; Select WINDOW again.
|
|
|
|
|
(with-selected-window window
|
|
|
|
|
;; Keep scrolling down until input becomes
|
|
|
|
|
;; available.
|
|
|
|
|
(scroll-up 4)
|
|
|
|
|
;; After scrolling, look up the new posn at
|
|
|
|
|
;; EVENT's column and go there.
|
|
|
|
|
(setq posn (posn-at-x-y (car xy) height)
|
|
|
|
|
point (posn-point posn))
|
|
|
|
|
(if point
|
|
|
|
|
(goto-char point)
|
|
|
|
|
;; If there's no buffer position at that
|
|
|
|
|
;; column, go to the window start.
|
|
|
|
|
(goto-char (window-end nil t)))
|
2023-07-22 12:09:54 +00:00
|
|
|
|
;; If word selection is enabled, now try to keep
|
|
|
|
|
;; the initially selected word within the active
|
|
|
|
|
;; region.
|
|
|
|
|
(when word-select
|
|
|
|
|
(when initial
|
|
|
|
|
;; If point is less than mark, which is is less
|
|
|
|
|
;; than the end of the word that was originally
|
|
|
|
|
;; selected, try to keep it selected by moving
|
|
|
|
|
;; mark there.
|
|
|
|
|
(when (and (<= (point) (mark))
|
|
|
|
|
(< (mark) (cdr initial)))
|
|
|
|
|
(set-mark (cdr initial)))
|
|
|
|
|
;; Do the opposite when the converse is true.
|
|
|
|
|
(when (and (>= (point) (mark))
|
|
|
|
|
(> (mark) (car initial)))
|
|
|
|
|
(set-mark (car initial))))
|
|
|
|
|
(setq touch-screen-word-select-bounds nil))
|
2023-07-21 06:22:54 +00:00
|
|
|
|
;; Display a preview of the line now around
|
|
|
|
|
;; point if requested by the user.
|
|
|
|
|
(when touch-screen-preview-select
|
2024-04-24 03:42:48 +00:00
|
|
|
|
(touch-screen-preview-select)))))))))))
|
|
|
|
|
(setq deactivate-mark nil))))
|
2023-07-16 09:29:58 +00:00
|
|
|
|
|
2023-07-19 04:46:02 +00:00
|
|
|
|
(defun touch-screen-restart-drag (event)
|
|
|
|
|
"Restart dragging to select text.
|
|
|
|
|
Set point to the location of EVENT within its window while
|
|
|
|
|
keeping the bounds of the region intact, and set up state for
|
|
|
|
|
`touch-screen-drag'."
|
|
|
|
|
(interactive "e")
|
|
|
|
|
(let* ((posn (event-start event))
|
|
|
|
|
(window (posn-window posn))
|
|
|
|
|
(point (posn-point posn)))
|
|
|
|
|
(with-selected-window window
|
|
|
|
|
(let ((current-point (point))
|
|
|
|
|
(current-mark (mark)))
|
|
|
|
|
;; Ensure that mark and point haven't changed since EVENT was
|
|
|
|
|
;; generated, and the region is still active.
|
|
|
|
|
(when (or (eq point current-point)
|
|
|
|
|
(eq point current-mark)
|
|
|
|
|
(region-active-p))
|
|
|
|
|
(when (eq point current-mark)
|
|
|
|
|
;; Exchange point and mark.
|
|
|
|
|
(exchange-point-and-mark))
|
|
|
|
|
;; Clear the state necessary to set up dragging. Don't try
|
|
|
|
|
;; to select entire words immediately after dragging starts,
|
|
|
|
|
;; to allow for fine grained selection inside a word.
|
|
|
|
|
(setq touch-screen-word-select-bounds nil
|
|
|
|
|
touch-screen-word-select-initial-word nil))))))
|
|
|
|
|
|
2023-07-16 09:29:58 +00:00
|
|
|
|
(global-set-key [touchscreen-hold] #'touch-screen-hold)
|
|
|
|
|
(global-set-key [touchscreen-drag] #'touch-screen-drag)
|
2023-07-19 04:46:02 +00:00
|
|
|
|
(global-set-key [touchscreen-restart-drag] #'touch-screen-restart-drag)
|
2023-07-16 09:29:58 +00:00
|
|
|
|
|
2023-07-17 01:46:37 +00:00
|
|
|
|
|
|
|
|
|
|
2023-11-15 12:58:46 +00:00
|
|
|
|
;; Pinch gesture.
|
|
|
|
|
|
|
|
|
|
(defvar text-scale-mode)
|
|
|
|
|
(defvar text-scale-mode-amount)
|
|
|
|
|
(defvar text-scale-mode-step)
|
|
|
|
|
|
|
|
|
|
(defun touch-screen-scroll-point-to-y (target-point target-y)
|
|
|
|
|
"Move the row surrounding TARGET-POINT to TARGET-Y.
|
|
|
|
|
Scroll the current window such that the position of TARGET-POINT
|
|
|
|
|
within it on the Y axis approaches TARGET-Y."
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(let* ((last-point (point))
|
|
|
|
|
(current-y (cadr (pos-visible-in-window-p target-point
|
|
|
|
|
nil t)))
|
|
|
|
|
(direction (if (if current-y
|
|
|
|
|
(< target-y current-y)
|
|
|
|
|
(< (window-start) target-point))
|
|
|
|
|
-1 1)))
|
|
|
|
|
(while (< 0 (* direction (if current-y
|
|
|
|
|
(- target-y current-y)
|
|
|
|
|
(- (window-start) target-point))))
|
|
|
|
|
(scroll-down direction)
|
|
|
|
|
(setq last-point (point))
|
|
|
|
|
(setq current-y (cadr (pos-visible-in-window-p target-point nil t))))
|
|
|
|
|
(unless (and (< direction 0) current-y)
|
|
|
|
|
(scroll-up direction)
|
|
|
|
|
(goto-char last-point)))
|
|
|
|
|
;; Ignore BOB and EOB.
|
|
|
|
|
((beginning-of-buffer end-of-buffer) nil)))
|
|
|
|
|
|
|
|
|
|
(defun touch-screen-pinch (event)
|
|
|
|
|
"Scroll the window in the touchscreen-pinch event EVENT.
|
|
|
|
|
Pan the display by the pan deltas in EVENT, and adjust the
|
|
|
|
|
text scale by the ratio therein."
|
|
|
|
|
(interactive "e")
|
|
|
|
|
(require 'face-remap)
|
|
|
|
|
(let* ((posn (cadr event))
|
|
|
|
|
(window (posn-window posn))
|
2023-11-16 03:29:58 +00:00
|
|
|
|
(scale (nth 2 event))
|
2023-11-17 03:36:58 +00:00
|
|
|
|
(ratio-diff (nth 5 event))
|
|
|
|
|
current-scale start-scale)
|
2023-11-16 03:29:58 +00:00
|
|
|
|
(when (windowp window)
|
|
|
|
|
(with-selected-window window
|
2023-11-17 03:36:58 +00:00
|
|
|
|
(setq current-scale (if text-scale-mode
|
|
|
|
|
text-scale-mode-amount
|
|
|
|
|
0)
|
|
|
|
|
start-scale (or (aref touch-screen-aux-tool 7)
|
|
|
|
|
(aset touch-screen-aux-tool 7
|
|
|
|
|
current-scale)))
|
2023-11-16 03:29:58 +00:00
|
|
|
|
;; Set the text scale.
|
2024-05-30 13:31:18 +00:00
|
|
|
|
(text-scale-set (floor (+ (round (log scale text-scale-mode-step))
|
|
|
|
|
start-scale)))
|
2023-11-16 03:29:58 +00:00
|
|
|
|
;; Subsequently move the row which was at the centrum to its Y
|
|
|
|
|
;; position.
|
|
|
|
|
(if (and (not (eq current-scale
|
2023-11-15 12:58:46 +00:00
|
|
|
|
text-scale-mode-amount))
|
2023-11-17 03:16:23 +00:00
|
|
|
|
(posn-point posn)
|
|
|
|
|
(cdr (posn-x-y posn)))
|
2023-11-16 03:29:58 +00:00
|
|
|
|
(touch-screen-scroll-point-to-y (posn-point posn)
|
|
|
|
|
(cdr (posn-x-y posn)))
|
|
|
|
|
;; Rather than scroll POSN's point to its old row, scroll the
|
|
|
|
|
;; display by the Y axis deltas within EVENT.
|
|
|
|
|
(let ((height (window-default-line-height))
|
|
|
|
|
(y-accumulator (or (aref touch-screen-aux-tool 8) 0)))
|
|
|
|
|
(setq y-accumulator (+ y-accumulator (nth 4 event)))
|
|
|
|
|
(when (or (> y-accumulator height)
|
|
|
|
|
(< y-accumulator (- height)))
|
|
|
|
|
(ignore-errors
|
|
|
|
|
(if (> y-accumulator 0)
|
|
|
|
|
(scroll-down 1)
|
|
|
|
|
(scroll-up 1)))
|
|
|
|
|
(setq y-accumulator 0))
|
|
|
|
|
(aset touch-screen-aux-tool 8 y-accumulator))
|
|
|
|
|
;; Likewise for the X axis deltas.
|
|
|
|
|
(let ((width (frame-char-width))
|
|
|
|
|
(x-accumulator (or (aref touch-screen-aux-tool 9) 0)))
|
|
|
|
|
(setq x-accumulator (+ x-accumulator (nth 3 event)))
|
|
|
|
|
(when (or (> x-accumulator width)
|
|
|
|
|
(< x-accumulator (- width)))
|
|
|
|
|
;; Do not hscroll if the ratio has shrunk, for that is
|
|
|
|
|
;; generally attended by the centerpoint moving left,
|
|
|
|
|
;; and Emacs can hscroll left even when no lines are
|
|
|
|
|
;; truncated.
|
|
|
|
|
(unless (and (< x-accumulator 0)
|
2023-11-16 09:38:53 +00:00
|
|
|
|
(< ratio-diff 0))
|
2023-11-16 03:29:58 +00:00
|
|
|
|
(if (> x-accumulator 0)
|
|
|
|
|
(scroll-right 1)
|
|
|
|
|
(scroll-left 1)))
|
|
|
|
|
(setq x-accumulator 0))
|
|
|
|
|
(aset touch-screen-aux-tool 9 x-accumulator)))))))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
|
|
|
|
|
(define-key global-map [touchscreen-pinch] #'touch-screen-pinch)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-07-17 01:46:37 +00:00
|
|
|
|
;; Touch screen event translation. The code here translates raw touch
|
|
|
|
|
;; screen events into `touchscreen-scroll' events and mouse events in
|
|
|
|
|
;; a ``DWIM'' fashion, consulting the keymaps at the position of the
|
|
|
|
|
;; mouse event to determine the best course of action, while also
|
|
|
|
|
;; recognizing drag-to-select and other gestures.
|
|
|
|
|
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
(defun touch-screen-handle-timeout (arg)
|
|
|
|
|
"Start the touch screen timeout or handle it depending on ARG.
|
|
|
|
|
When ARG is nil, start the `touch-screen-current-timer' to go off
|
|
|
|
|
in `touch-screen-delay' seconds, and call this function with ARG
|
|
|
|
|
t.
|
|
|
|
|
|
2023-07-16 09:29:58 +00:00
|
|
|
|
When ARG is t, set the fourth element of
|
|
|
|
|
`touch-screen-current-tool' to `held', and generate a
|
|
|
|
|
`touchscreen-hold' event at the original position of that tool."
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
(if (not arg)
|
|
|
|
|
;; Cancel the touch screen long-press timer, if it is still
|
|
|
|
|
;; there by any chance.
|
|
|
|
|
(progn
|
|
|
|
|
(when touch-screen-current-timer
|
|
|
|
|
(cancel-timer touch-screen-current-timer))
|
|
|
|
|
(setq touch-screen-current-timer
|
|
|
|
|
(run-at-time touch-screen-delay nil
|
|
|
|
|
#'touch-screen-handle-timeout
|
|
|
|
|
t)))
|
|
|
|
|
;; Set touch-screen-current-timer to nil.
|
|
|
|
|
(setq touch-screen-current-timer nil)
|
|
|
|
|
(when touch-screen-current-tool
|
|
|
|
|
;; Set the state to `held'.
|
|
|
|
|
(setcar (nthcdr 3 touch-screen-current-tool) 'held)
|
2023-07-16 09:29:58 +00:00
|
|
|
|
;; Generate an input event at the original position of the mark.
|
|
|
|
|
;; This assumes that the timer is running within
|
|
|
|
|
;; `touch-screen-translate-touch'.
|
|
|
|
|
(let ((posn (nth 4 touch-screen-current-tool)))
|
|
|
|
|
(throw 'input-event (list 'touchscreen-hold posn))))))
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
|
2024-07-20 03:28:47 +00:00
|
|
|
|
(declare-function remember-mouse-glyph "xdisp.c")
|
|
|
|
|
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
(defun touch-screen-handle-point-update (point)
|
|
|
|
|
"Notice that the touch point POINT has changed position.
|
2023-07-16 07:30:01 +00:00
|
|
|
|
Perform the editing operations or throw to the input translation
|
|
|
|
|
function with an input event tied to any gesture that is
|
|
|
|
|
recognized.
|
|
|
|
|
|
2023-11-15 12:58:46 +00:00
|
|
|
|
Update the tenth element of `touch-screen-current-tool' with
|
|
|
|
|
POINT relative to the window it was placed on. Update the third
|
|
|
|
|
element in like fashion, once sufficient motion has accumulated
|
|
|
|
|
that an event is generated.
|
|
|
|
|
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
POINT must be the touch point currently being tracked as
|
|
|
|
|
`touch-screen-current-tool'.
|
|
|
|
|
|
|
|
|
|
If the fourth element of `touch-screen-current-tool' is nil, then
|
2023-11-16 13:07:01 +00:00
|
|
|
|
the touch has just begun. In a related case, if it is
|
|
|
|
|
`ancillary-tool', then the ancillary tool has been removed and
|
|
|
|
|
gesture translation must be resumed. Determine how much POINT
|
|
|
|
|
has moved. If POINT has moved upwards or downwards by a
|
|
|
|
|
significant amount, then set the fourth element to `scroll'.
|
|
|
|
|
Then, generate a `touchscreen-scroll' event with the window that
|
|
|
|
|
POINT was initially placed upon, and pixel deltas describing how
|
|
|
|
|
much point has moved relative to its previous position in the X
|
|
|
|
|
and Y axes.
|
2023-07-16 07:30:01 +00:00
|
|
|
|
|
2024-01-21 14:28:06 +00:00
|
|
|
|
If the fourth element of `touch-screen-current-tool' is `scroll',
|
2023-07-16 07:30:01 +00:00
|
|
|
|
then generate a `touchscreen-scroll' event with the window that
|
2023-11-15 12:58:46 +00:00
|
|
|
|
POINT was initially placed upon, and pixel deltas describing how
|
2023-07-16 07:30:01 +00:00
|
|
|
|
much point has moved relative to its previous position in the X
|
|
|
|
|
and Y axes.
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
|
2023-07-16 07:30:01 +00:00
|
|
|
|
If the fourth element of `touch-screen-current-tool' is
|
|
|
|
|
`mouse-drag' and `track-mouse' is non-nil, then generate a
|
|
|
|
|
`mouse-movement' event with the position of POINT.
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
|
|
|
|
|
If the fourth element of `touch-screen-current-tool' is `held',
|
|
|
|
|
then the touch has been held down for some time. If motion
|
2023-07-19 04:46:02 +00:00
|
|
|
|
happens, set the field to `drag'. Then, generate a
|
|
|
|
|
`touchscreen-drag' event.
|
|
|
|
|
|
|
|
|
|
If the fourth element of `touch-screen-current-tool' is
|
|
|
|
|
`restart-drag', set the field to `drag' and generate a
|
|
|
|
|
`touchscreen-drag'.
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
|
|
|
|
|
If the fourth element of `touch-screen-current-tool' is `drag',
|
Update Android port
* .gitignore: Add new files.
* INSTALL.android: Explain how to build Emacs for ancient
versions of Android.
* admin/merge-gnulib (GNULIB_MODULES): Add getdelim.
* build-aux/config.guess (timestamp, version):
* build-aux/config.sub (timestamp, version): Autoupdate.
* configure.ac (BUILD_DETAILS, ANDROID_MIN_SDK):
(ANDROID_STUBIFY): Allow specifying CFLAGS via ANDROID_CFLAGS.
Add new configure tests for Android API version when not
explicitly specified.
* doc/emacs/android.texi (Android): Add reference to ``Other
Input Devices''.
(Android File System): Remove restrictions on directory-files on
the assets directory.
* doc/emacs/emacs.texi (Top): Add Other Input Devices to menu.
* doc/emacs/input.texi (Other Input Devices): New node.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen input events.
* doc/lispref/frames.texi (Pop-Up Menus): Likewise.
* etc/NEWS: Announce changes.
* java/Makefile.in: Use lib-src/asset-directory-tool to generate
an `directory-tree' file placed in /assets.
* java/debug.sh: Large adjustments to support Android 2.2 and
later.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
* java/org/gnu/emacs/EmacsCopyArea.java (perform):
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog):
* java/org/gnu/emacs/EmacsDrawLine.java (perform):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsDrawable.java (EmacsDrawable):
* java/org/gnu/emacs/EmacsFillPolygon.java (perform):
* java/org/gnu/emacs/EmacsFillRectangle.java (perform):
* java/org/gnu/emacs/EmacsGC.java (EmacsGC):
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap):
(destroyHandle):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (draw): Avoid
redundant canvas saves and restores.
* java/org/gnu/emacs/EmacsService.java (run):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
(handleDirtyBitmap):
* java/org/gnu/emacs/EmacsWindow.java (changeWindowBackground)
(EmacsWindow): Make compatible with Android 2.2 and later.
* lib-src/Makefile.in (DONT_INSTALL): Add asset-directory-tool
on Android.:(asset-directory-tool{EXEEXT}): New target.
* lib-src/asset-directory-tool.c (struct directory_tree, xmalloc)
(main_1, main_2, main): New file.
* lib, m4: Merge from gnulib. This will be reverted before
merging to master.
* lisp/button.el (button-map):
(push-button):
* lisp/frame.el (display-popup-menus-p): Improve touchscreen
support.
* 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.
* src/alloc.c (make_lisp_symbol): Avoid ICE on Android NDK GCC.
(mark_pinned_symbols): Likewise.
* src/android.c (struct android_emacs_window): New struct.
(window_class): New variable.
(android_run_select_thread): Add workaround for Android platform
bug.
(android_extract_long, android_scan_directory_tree): New
functions.
(android_file_access_p): Use those functions instead.
(android_init_emacs_window): New function.
(android_init_emacs_gc_class): Update signature of `markDirty'.
(android_change_gc, android_set_clip_rectangles): Tell the GC
whether or not clip rects were dirtied.
(android_swap_buffers): Do not look up method every time.
(struct android_dir): Adjust for new directory tree lookup.
(android_opendir, android_readdir, android_closedir): Likewise.
(android_four_corners_bilinear): Fix coding style.
(android_ftruncate): New function.
* src/android.h: Update prototypes. Replace ftruncate with
android_ftruncate when necessary.
* src/androidterm.c (handle_one_android_event): Pacify GCC. Fix
touch screen tool bar bug.
* src/emacs.c (using_utf8): Fix compilation error.
* src/fileio.c (Ffile_system_info): Return Qnil when fsusage.o
is not built.
* src/filelock.c (BOOT_TIME_FILE): Fix definition for Android.
* src/frame.c (Fx_parse_geometry): Fix uninitialized variable
uses.
* src/keyboard.c (lispy_function_keys): Fix `back'.
* src/menu.c (x_popup_menu_1): Handle touch screen events.
(Fx_popup_menu): Document changes.
* src/sfnt.c (main): Improve tests.
* src/sfntfont-android.c (sfntfont_android_put_glyphs): Fix
minor problem.
(init_sfntfont_android): Check for
HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL.
* src/sfntfont.c (struct sfnt_font_desc): New fields `adstyle'
and `languages'.
(sfnt_parse_style): Append tokens to adstyle.
(sfnt_parse_languages): New function.
(sfnt_enum_font_1): Parse supported languages and adstyle.
(sfntfont_list_1): Handle new fields.
(sfntfont_text_extents): Fix uninitialized variable use.
(syms_of_sfntfont, mark_sfntfont): Adjust accordingly.
2023-01-19 14:19:06 +00:00
|
|
|
|
then move point to the position of POINT."
|
2023-11-15 12:58:46 +00:00
|
|
|
|
(let* ((window (nth 1 touch-screen-current-tool))
|
|
|
|
|
(what (nth 3 touch-screen-current-tool))
|
|
|
|
|
(posn (cdr point))
|
|
|
|
|
;; Now get the position of X and Y relative to WINDOW.
|
2024-07-20 03:28:47 +00:00
|
|
|
|
(relative-xy (touch-screen-relative-xy posn window)))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
;; Update the 10th field of the tool list with RELATIVE-XY.
|
|
|
|
|
(setcar (nthcdr 9 touch-screen-current-tool) relative-xy)
|
2023-11-16 13:07:01 +00:00
|
|
|
|
(cond ((or (null what)
|
|
|
|
|
(eq what 'ancillary-tool))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
(let* ((last-posn (nth 2 touch-screen-current-tool))
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
(diff-x (- (car last-posn) (car relative-xy)))
|
|
|
|
|
(diff-y (- (cdr last-posn) (cdr relative-xy))))
|
2023-07-18 05:24:36 +00:00
|
|
|
|
(when (or (> diff-y 10)
|
2023-11-17 03:36:58 +00:00
|
|
|
|
(> diff-x (frame-char-width))
|
2023-07-18 05:24:36 +00:00
|
|
|
|
(< diff-y -10)
|
2023-11-17 03:36:58 +00:00
|
|
|
|
(< diff-x (- (frame-char-width))))
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
(setcar (nthcdr 3 touch-screen-current-tool)
|
|
|
|
|
'scroll)
|
|
|
|
|
(setcar (nthcdr 2 touch-screen-current-tool)
|
|
|
|
|
relative-xy)
|
|
|
|
|
;; Cancel the touch screen long-press timer, if it is
|
|
|
|
|
;; still there by any chance.
|
|
|
|
|
(when touch-screen-current-timer
|
|
|
|
|
(cancel-timer touch-screen-current-timer)
|
2023-07-16 09:29:58 +00:00
|
|
|
|
(setq touch-screen-current-timer nil))
|
|
|
|
|
;; Generate a `touchscreen-scroll' event with `diff-x'
|
|
|
|
|
;; and `diff-y'.
|
|
|
|
|
(throw 'input-event
|
|
|
|
|
(list 'touchscreen-scroll
|
|
|
|
|
window diff-x diff-y)))))
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
((eq what 'scroll)
|
|
|
|
|
;; Cancel the touch screen long-press timer, if it is still
|
|
|
|
|
;; there by any chance.
|
|
|
|
|
(when touch-screen-current-timer
|
|
|
|
|
(cancel-timer touch-screen-current-timer)
|
|
|
|
|
(setq touch-screen-current-timer nil))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
(let* ((last-posn (nth 2 touch-screen-current-tool))
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
(diff-x (- (car last-posn) (car relative-xy)))
|
|
|
|
|
(diff-y (- (cdr last-posn) (cdr relative-xy))))
|
|
|
|
|
(setcar (nthcdr 3 touch-screen-current-tool)
|
|
|
|
|
'scroll)
|
|
|
|
|
(setcar (nthcdr 2 touch-screen-current-tool)
|
|
|
|
|
relative-xy)
|
|
|
|
|
(unless (and (zerop diff-x) (zerop diff-y))
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(throw 'input-event
|
|
|
|
|
;; Generate a `touchscreen-scroll' event with
|
|
|
|
|
;; `diff-x' and `diff-y'.
|
|
|
|
|
(list 'touchscreen-scroll
|
|
|
|
|
window diff-x diff-y)))))
|
|
|
|
|
((eq what 'mouse-drag)
|
|
|
|
|
;; There was a `down-mouse-1' event bound at the starting
|
|
|
|
|
;; point of the event. Generate a mouse-motion event if
|
|
|
|
|
;; mouse movement is being tracked.
|
|
|
|
|
(when track-mouse
|
2024-07-20 03:28:47 +00:00
|
|
|
|
(let ((mouse-rect (nth 5 touch-screen-current-tool))
|
|
|
|
|
(edges (window-inside-pixel-edges window)))
|
|
|
|
|
;; If fine-grained tracking is enabled, disregard the
|
|
|
|
|
;; mouse rect. Apply the same criteria as
|
|
|
|
|
;; `remember_mouse_glyph', which see.
|
|
|
|
|
(if (or mouse-fine-grained-tracking
|
|
|
|
|
window-resize-pixelwise)
|
|
|
|
|
(throw 'input-event (list 'mouse-movement posn))
|
|
|
|
|
;; Otherwise, generate an event only if POINT falls
|
|
|
|
|
;; outside the extents of the mouse rect, and record
|
|
|
|
|
;; the extents of the glyph beneath point as the next
|
|
|
|
|
;; mouse rect.
|
|
|
|
|
(let ((point relative-xy)
|
|
|
|
|
(frame-offsets (if (framep window)
|
|
|
|
|
'(0 . 0)
|
|
|
|
|
(cons (car edges) (cadr edges)))))
|
|
|
|
|
(when (or (not mouse-rect)
|
|
|
|
|
(< (car point) (- (car mouse-rect)
|
|
|
|
|
(car frame-offsets)))
|
|
|
|
|
(> (car point) (+ (- (car mouse-rect) 1
|
|
|
|
|
(car frame-offsets))
|
|
|
|
|
(caddr mouse-rect)))
|
|
|
|
|
(< (cdr point) (- (cadr mouse-rect)
|
|
|
|
|
(cdr frame-offsets)))
|
|
|
|
|
(> (cdr point) (+ (- (cadr mouse-rect) 1
|
|
|
|
|
(cdr frame-offsets))
|
|
|
|
|
(cadddr mouse-rect))))
|
|
|
|
|
;; Record the extents of this glyph.
|
|
|
|
|
(setcar (nthcdr 5 touch-screen-current-tool)
|
|
|
|
|
(remember-mouse-glyph (or (and (framep window) window)
|
|
|
|
|
(window-frame window))
|
|
|
|
|
(+ (car point)
|
|
|
|
|
(car frame-offsets))
|
|
|
|
|
(+ (cdr point)
|
|
|
|
|
(cdr frame-offsets))))
|
|
|
|
|
;; Generate the movement.
|
|
|
|
|
(throw 'input-event (list 'mouse-movement posn))))))))
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
((eq what 'held)
|
2023-07-16 09:29:58 +00:00
|
|
|
|
(let* ((posn (cdr point)))
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
;; Now start dragging.
|
|
|
|
|
(setcar (nthcdr 3 touch-screen-current-tool)
|
|
|
|
|
'drag)
|
2023-07-17 01:46:37 +00:00
|
|
|
|
;; Generate a (touchscreen-drag POSN) event.
|
|
|
|
|
;; `touchscreen-hold' was generated when the timeout
|
|
|
|
|
;; fired.
|
2023-07-16 09:29:58 +00:00
|
|
|
|
(throw 'input-event (list 'touchscreen-drag posn))))
|
2023-07-19 04:46:02 +00:00
|
|
|
|
((eq what 'restart-drag)
|
|
|
|
|
(let* ((posn (cdr point)))
|
|
|
|
|
;; Now start dragging.
|
|
|
|
|
(setcar (nthcdr 3 touch-screen-current-tool)
|
|
|
|
|
'drag)
|
|
|
|
|
;; Generate a (touchscreen-drag POSN) event.
|
|
|
|
|
;; `touchscreen-restart-drag' was generated when the
|
|
|
|
|
;; timeout fired.
|
|
|
|
|
(throw 'input-event (list 'touchscreen-drag posn))))
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
((eq what 'drag)
|
|
|
|
|
(let* ((posn (cdr point)))
|
2023-07-16 09:29:58 +00:00
|
|
|
|
;; Generate a (touchscreen-drag POSN) event.
|
|
|
|
|
(throw 'input-event (list 'touchscreen-drag posn)))))))
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
|
2023-11-15 12:58:46 +00:00
|
|
|
|
(defsubst touch-screen-distance (pos1 pos2)
|
|
|
|
|
"Compute the distance in pixels between POS1 and POS2.
|
|
|
|
|
Each is a coordinate whose car and cdr are respectively its X and
|
|
|
|
|
Y values."
|
|
|
|
|
(let ((v1 (- (cdr pos2) (cdr pos1)))
|
|
|
|
|
(v2 (- (car pos2) (car pos1))))
|
|
|
|
|
(abs (sqrt (+ (* v1 v1) (* v2 v2))))))
|
|
|
|
|
|
|
|
|
|
(defsubst touch-screen-centrum (pos1 pos2)
|
|
|
|
|
"Compute the center of a line between the points POS1 and POS2.
|
|
|
|
|
Each, and value, is a coordinate whose car and cdr are
|
|
|
|
|
respectively its X and Y values."
|
|
|
|
|
(let ((v1 (+ (cdr pos2) (cdr pos1)))
|
|
|
|
|
(v2 (+ (car pos2) (car pos1))))
|
|
|
|
|
(cons (/ v2 2) (/ v1 2))))
|
|
|
|
|
|
|
|
|
|
(defun touch-screen-handle-aux-point-update (point number)
|
|
|
|
|
"Notice that a point being observed has moved.
|
|
|
|
|
Register motion from either the current or ancillary tool while
|
|
|
|
|
an ancillary tool is present.
|
|
|
|
|
|
|
|
|
|
POINT must be the cdr of an element of a `touchscreen-update'
|
|
|
|
|
event's list of touch points. NUMBER must be its touch ID.
|
|
|
|
|
|
|
|
|
|
Calculate the distance between POINT's position and that of the
|
|
|
|
|
other tool (which is to say the ancillary tool of POINT is the
|
|
|
|
|
current tool, and vice versa). Compare this distance to that
|
|
|
|
|
between both points at the time they were placed on the screen,
|
|
|
|
|
and signal a pinch event to adjust the text scale and scroll the
|
|
|
|
|
window by the factor so derived. Such events are lists formed as
|
|
|
|
|
so illustrated:
|
|
|
|
|
|
2023-11-16 03:29:58 +00:00
|
|
|
|
(touchscreen-pinch CENTRUM RATIO PAN-X PAN-Y RATIO-DIFF)
|
2023-11-15 12:58:46 +00:00
|
|
|
|
|
|
|
|
|
in which CENTRUM is a posn representing the midpoint of a line
|
2023-11-16 03:29:58 +00:00
|
|
|
|
between the present locations of both tools, RATIO is the said
|
|
|
|
|
factor, PAN-X is the number of pixels on the X axis that centrum
|
|
|
|
|
has moved since the last event, PAN-Y is that on the Y axis, and
|
|
|
|
|
RATIO-DIFF is the difference between RATIO and the ratio in the
|
|
|
|
|
last such event."
|
2023-11-15 12:58:46 +00:00
|
|
|
|
(let (this-point-position
|
|
|
|
|
other-point-position
|
|
|
|
|
(window (cadr touch-screen-current-tool)))
|
|
|
|
|
(when (windowp window)
|
|
|
|
|
(if (eq number (aref touch-screen-aux-tool 0))
|
|
|
|
|
(progn
|
|
|
|
|
;; The point pressed is the ancillary tool. Set
|
|
|
|
|
;; other-point-position to that of the current tool.
|
|
|
|
|
(setq other-point-position (nth 9 touch-screen-current-tool))
|
|
|
|
|
;; Update the position within touch-screen-aux-tool.
|
|
|
|
|
(aset touch-screen-aux-tool 3
|
|
|
|
|
(setq this-point-position
|
|
|
|
|
(touch-screen-relative-xy point window))))
|
|
|
|
|
(setq other-point-position (aref touch-screen-aux-tool 3))
|
|
|
|
|
(setcar (nthcdr 2 touch-screen-current-tool)
|
|
|
|
|
(setq this-point-position
|
|
|
|
|
(touch-screen-relative-xy point window)))
|
|
|
|
|
(setcar (nthcdr 9 touch-screen-current-tool)
|
|
|
|
|
this-point-position))
|
|
|
|
|
;; Now compute, and take the absolute of, this distance.
|
|
|
|
|
(let ((distance (touch-screen-distance this-point-position
|
|
|
|
|
other-point-position))
|
|
|
|
|
(centrum (touch-screen-centrum this-point-position
|
|
|
|
|
other-point-position))
|
|
|
|
|
(initial-distance (aref touch-screen-aux-tool 4))
|
|
|
|
|
(initial-centrum (aref touch-screen-aux-tool 5)))
|
|
|
|
|
(let* ((ratio (/ distance initial-distance))
|
2024-06-08 06:25:22 +00:00
|
|
|
|
(ratio-diff (- ratio (aref touch-screen-aux-tool 6))))
|
|
|
|
|
;; Update the internal record of its position and generate an
|
|
|
|
|
;; event.
|
|
|
|
|
(aset touch-screen-aux-tool 5 centrum)
|
|
|
|
|
(aset touch-screen-aux-tool 6 ratio)
|
|
|
|
|
(throw 'input-event
|
|
|
|
|
(list 'touchscreen-pinch
|
|
|
|
|
(if (or (<= (car centrum) 0)
|
|
|
|
|
(<= (cdr centrum) 0))
|
|
|
|
|
(list window nil centrum nil nil
|
|
|
|
|
nil nil nil nil nil)
|
|
|
|
|
(let ((posn (posn-at-x-y (car centrum)
|
|
|
|
|
(cdr centrum)
|
|
|
|
|
window)))
|
|
|
|
|
(if (eq (posn-window posn)
|
|
|
|
|
window)
|
|
|
|
|
posn
|
|
|
|
|
;; Return a placeholder outside the window
|
|
|
|
|
;; if the centrum has moved beyond the
|
|
|
|
|
;; confines of the window where the gesture
|
|
|
|
|
;; commenced.
|
2023-11-22 03:10:13 +00:00
|
|
|
|
(list window nil centrum nil nil
|
2024-06-08 06:25:22 +00:00
|
|
|
|
nil nil nil nil nil))))
|
|
|
|
|
ratio
|
|
|
|
|
(- (car centrum)
|
|
|
|
|
(car initial-centrum))
|
|
|
|
|
(- (cdr centrum)
|
|
|
|
|
(cdr initial-centrum))
|
|
|
|
|
ratio-diff)))))))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
|
2023-02-08 14:40:10 +00:00
|
|
|
|
(defun touch-screen-window-selection-changed (frame)
|
|
|
|
|
"Notice that FRAME's selected window has changed.
|
2023-07-21 13:23:35 +00:00
|
|
|
|
Cancel any timer that is supposed to hide the keyboard in
|
|
|
|
|
response to the minibuffer being closed."
|
2023-02-08 14:40:10 +00:00
|
|
|
|
(with-selected-frame frame
|
2023-07-21 13:23:35 +00:00
|
|
|
|
(unless (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))
|
2023-02-08 14:40:10 +00:00
|
|
|
|
;; Prevent hiding the minibuffer from hiding the on screen
|
|
|
|
|
;; keyboard.
|
|
|
|
|
(when minibuffer-on-screen-keyboard-timer
|
|
|
|
|
(cancel-timer minibuffer-on-screen-keyboard-timer)
|
|
|
|
|
(setq minibuffer-on-screen-keyboard-timer nil)))))
|
|
|
|
|
|
2024-04-09 02:37:47 +00:00
|
|
|
|
(defun touch-screen-handle-point-up (point prefix canceled)
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
"Notice that POINT has been removed from the screen.
|
|
|
|
|
POINT should be the point currently tracked as
|
|
|
|
|
`touch-screen-current-tool'.
|
2023-07-16 07:30:01 +00:00
|
|
|
|
PREFIX should be a virtual function key used to look up key
|
|
|
|
|
bindings.
|
2024-04-09 02:37:47 +00:00
|
|
|
|
CANCELED should indicate whether the touch point was removed by
|
|
|
|
|
window-system intervention rather than user action.
|
2023-07-16 07:30:01 +00:00
|
|
|
|
|
2023-11-15 12:58:46 +00:00
|
|
|
|
If an ancillary touch point is being observed, transfer touch
|
|
|
|
|
information from `touch-screen-aux-tool' to
|
2024-04-09 02:37:47 +00:00
|
|
|
|
`touch-screen-current-tool' and set the former to nil, thereby
|
|
|
|
|
resuming gesture recognition with that tool replacing the tool
|
|
|
|
|
removed.
|
2023-11-15 12:58:46 +00:00
|
|
|
|
|
|
|
|
|
Otherwise:
|
|
|
|
|
|
2023-07-19 06:42:02 +00:00
|
|
|
|
If the fourth element of `touch-screen-current-tool' is nil or
|
|
|
|
|
`restart-drag', move point to the position of POINT, selecting
|
|
|
|
|
the window under POINT as well, and deactivate the mark; if there
|
|
|
|
|
is a button or link at POINT, call the command bound to `mouse-2'
|
|
|
|
|
there. Otherwise, call the command bound to `mouse-1'.
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
|
2023-07-16 07:30:01 +00:00
|
|
|
|
If the fourth element of `touch-screen-current-tool' is
|
|
|
|
|
`mouse-drag', then generate either a `mouse-1' or a
|
|
|
|
|
`drag-mouse-1' event depending on how far the position of POINT
|
|
|
|
|
is from the starting point of the touch.
|
Update Android port
* .gitignore: Don't ignore verbose.mk.android.
* doc/emacs/Makefile.in (EMACSSOURCES): Add android.texi and
input.texi.
* doc/emacs/android.texi (Android): Document support for the
on-screen keyboard.
(Android Startup): Document how to start Emacs with -Q on
Android.
(Android Environment): Document how Emacs works around the
system ``task killer''. Document changes to frame deletion
behavior.
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices, On-Screen
Keyboards): Document how to use Emacs with virtual keyboards.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to `touch-screen-track-drag'.
* doc/lispref/frames.texi (Frames, On-Screen Keyboards): New
node.
* java/AndroidManifest.xml.in: Add settings activity and
appropriate OSK adjustment mode.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Allow
creating Emacs with -Q.
(onDestroy): Don't remove if killed by the system.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
Fix context menus again.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Make all
event sending functions return long.
* java/org/gnu/emacs/EmacsPreferencesActivity.java
(EmacsPreferencesActivity): New class.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(onStartCommand, onCreate, startEmacsService): Start as a
foreground service if necessary to bypass system restrictions.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsThread.java (EmacsThread, run):
* java/org/gnu/emacs/EmacsView.java (EmacsView, onLayout)
(onDetachedFromWindow):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, viewLayout):
Implement frame resize synchronization..
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager, removeWindowConsumer): Adjust
accordingly for changes to frame deletion behavior.
* lisp/frame.el (android-toggle-on-screen-keyboard)
(frame-toggle-on-screen-keyboard): New function.
* lisp/minibuffer.el (minibuffer-setup-on-screen-keyboard)
(minibuffer-exit-on-screen-keyboard): New functions.
(minibuffer-setup-hook, minibuffer-exit-hook): Add new functions
to hooks.
* lisp/touch-screen.el (touch-screen-relative-xy): Accept new
value of window `frame'. Return frame coordinates in that case.
(touch-screen-set-point-commands): New variable.
(touch-screen-handle-point-up): Respect that variable.
(touch-screen-track-drag): Return `no-drag' where appropriate.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line):
Refactor to use `no-drag'.
* src/android.c (struct android_emacs_window): New methods.
Make all event sending functions return the event serial.
(android_toggle_on_screen_keyboard, android_window_updated): New
functions.
* src/android.h: Update prototypes.
* src/androidfns.c (Fandroid_toggle_on_screen_keyboard)
(syms_of_androidfns): New function.
* src/androidgui.h (struct android_any_event)
(struct android_key_event, struct android_configure_event)
(struct android_focus_event, struct android_window_action_event)
(struct android_crossing_event, struct android_motion_event)
(struct android_button_event, struct android_touch_event)
(struct android_wheel_event, struct android_iconify_event)
(struct android_menu_event): Add `serial' fields.
* src/androidterm.c (handle_one_android_event)
(android_frame_up_to_date):
* src/androidterm.h (struct android_output): Implement frame
resize synchronization.
2023-01-20 11:06:32 +00:00
|
|
|
|
|
2023-07-17 05:58:32 +00:00
|
|
|
|
If the fourth element of `touch-screen-current-tool' is
|
|
|
|
|
`mouse-1-menu', then generate a `down-mouse-1' event at the
|
|
|
|
|
original position of the tool to display its bound keymap as a
|
|
|
|
|
menu.
|
|
|
|
|
|
2023-09-02 01:28:50 +00:00
|
|
|
|
If the fourth element of `touch-screen-current-tool' is `drag' or
|
|
|
|
|
`held', the region is active, and the tool's initial window's
|
|
|
|
|
selected buffer isn't read-only, display the on screen keyboard.
|
2023-09-01 06:50:28 +00:00
|
|
|
|
|
Update Android port
* .gitignore: Don't ignore verbose.mk.android.
* doc/emacs/Makefile.in (EMACSSOURCES): Add android.texi and
input.texi.
* doc/emacs/android.texi (Android): Document support for the
on-screen keyboard.
(Android Startup): Document how to start Emacs with -Q on
Android.
(Android Environment): Document how Emacs works around the
system ``task killer''. Document changes to frame deletion
behavior.
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices, On-Screen
Keyboards): Document how to use Emacs with virtual keyboards.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to `touch-screen-track-drag'.
* doc/lispref/frames.texi (Frames, On-Screen Keyboards): New
node.
* java/AndroidManifest.xml.in: Add settings activity and
appropriate OSK adjustment mode.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Allow
creating Emacs with -Q.
(onDestroy): Don't remove if killed by the system.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
Fix context menus again.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Make all
event sending functions return long.
* java/org/gnu/emacs/EmacsPreferencesActivity.java
(EmacsPreferencesActivity): New class.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(onStartCommand, onCreate, startEmacsService): Start as a
foreground service if necessary to bypass system restrictions.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsThread.java (EmacsThread, run):
* java/org/gnu/emacs/EmacsView.java (EmacsView, onLayout)
(onDetachedFromWindow):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, viewLayout):
Implement frame resize synchronization..
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager, removeWindowConsumer): Adjust
accordingly for changes to frame deletion behavior.
* lisp/frame.el (android-toggle-on-screen-keyboard)
(frame-toggle-on-screen-keyboard): New function.
* lisp/minibuffer.el (minibuffer-setup-on-screen-keyboard)
(minibuffer-exit-on-screen-keyboard): New functions.
(minibuffer-setup-hook, minibuffer-exit-hook): Add new functions
to hooks.
* lisp/touch-screen.el (touch-screen-relative-xy): Accept new
value of window `frame'. Return frame coordinates in that case.
(touch-screen-set-point-commands): New variable.
(touch-screen-handle-point-up): Respect that variable.
(touch-screen-track-drag): Return `no-drag' where appropriate.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line):
Refactor to use `no-drag'.
* src/android.c (struct android_emacs_window): New methods.
Make all event sending functions return the event serial.
(android_toggle_on_screen_keyboard, android_window_updated): New
functions.
* src/android.h: Update prototypes.
* src/androidfns.c (Fandroid_toggle_on_screen_keyboard)
(syms_of_androidfns): New function.
* src/androidgui.h (struct android_any_event)
(struct android_key_event, struct android_configure_event)
(struct android_focus_event, struct android_window_action_event)
(struct android_crossing_event, struct android_motion_event)
(struct android_button_event, struct android_touch_event)
(struct android_wheel_event, struct android_iconify_event)
(struct android_menu_event): Add `serial' fields.
* src/androidterm.c (handle_one_android_event)
(android_frame_up_to_date):
* src/androidterm.h (struct android_output): Implement frame
resize synchronization.
2023-01-20 11:06:32 +00:00
|
|
|
|
If the command being executed is listed in
|
|
|
|
|
`touch-screen-set-point-commands' also display the on-screen
|
|
|
|
|
keyboard if the current buffer and the character at the new point
|
|
|
|
|
is not read-only."
|
2023-11-15 12:58:46 +00:00
|
|
|
|
(if touch-screen-aux-tool
|
|
|
|
|
(progn
|
2023-11-16 13:07:01 +00:00
|
|
|
|
(let ((point-no (aref touch-screen-aux-tool 0))
|
|
|
|
|
(relative-xy (aref touch-screen-aux-tool 3)))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
;; Replace the current position of touch-screen-current-tool
|
2023-11-16 13:07:01 +00:00
|
|
|
|
;; with relative-xy and its number with point-no, but leave
|
|
|
|
|
;; other information (such as its starting position) intact:
|
|
|
|
|
;; this touchpoint is meant to continue the gesture
|
|
|
|
|
;; interrupted by the removal of the last, not to commence a
|
|
|
|
|
;; new one.
|
2023-11-15 12:58:46 +00:00
|
|
|
|
(setcar touch-screen-current-tool point-no)
|
|
|
|
|
(setcar (nthcdr 2 touch-screen-current-tool)
|
2023-11-16 13:07:01 +00:00
|
|
|
|
relative-xy)
|
2023-11-15 12:58:46 +00:00
|
|
|
|
(setcar (nthcdr 9 touch-screen-current-tool)
|
2023-11-16 13:07:01 +00:00
|
|
|
|
relative-xy))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
(setq touch-screen-aux-tool nil))
|
|
|
|
|
(let ((what (nth 3 touch-screen-current-tool))
|
|
|
|
|
(posn (cdr point)) window point)
|
|
|
|
|
(cond ((or (null what)
|
|
|
|
|
;; If dragging has been restarted but the touch point
|
|
|
|
|
;; hasn't been moved, translate the sequence into a
|
|
|
|
|
;; regular mouse click.
|
|
|
|
|
(eq what 'restart-drag))
|
2024-04-09 02:37:47 +00:00
|
|
|
|
;; Don't attempt to execute commands bound to mouse events
|
|
|
|
|
;; if the touch sequence has been canceled.
|
|
|
|
|
(unless canceled
|
|
|
|
|
(when (windowp (posn-window posn))
|
|
|
|
|
(setq point (posn-point posn)
|
|
|
|
|
window (posn-window posn))
|
|
|
|
|
;; 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)
|
Adapt eww to touch screens, mice and text conversion
* doc/emacs/input.texi (On-Screen Keyboards): Update conditions
for displaying the virtual keyboard when t-s-d-k is enabled.
* etc/NEWS (Announce): Document changes.
* lisp/net/eww.el (eww-check-text-conversion): New function.
(eww-mode): Install it as a local post-command-hook.
(eww-submit-map, eww-submit-file, eww-checkbox-map): Bind
suitable commands to mouse-2.
(eww-form-submit, eww-form-checkbox, eww-form-file)
(eww-tag-select): Disguise inserted forms as buttons, that touch
event translation may prefer their bindings to mouse-2 over
mouse-1.
(eww-form-text, eww-tag-textarea): Insert field properties as
well.
(eww-select-file, eww-toggle-checkbox, eww-submit): New argument
EVENT, to whose position point is set.
* lisp/touch-screen.el (touch-screen-handle-point-up): Trivial
adjustments to the criteria for selecting mouse commands and
displaying the on screen keyboard.
2024-04-29 12:01:59 +00:00
|
|
|
|
(and point
|
|
|
|
|
(get-char-property
|
|
|
|
|
point 'button)))
|
2024-04-09 02:37:47 +00:00
|
|
|
|
'mouse-2
|
|
|
|
|
'mouse-1)
|
|
|
|
|
posn))
|
|
|
|
|
;; Look for the command bound to this event.
|
|
|
|
|
(command (key-binding (if prefix
|
|
|
|
|
(vector prefix
|
|
|
|
|
(car event))
|
|
|
|
|
(vector (car event)))
|
|
|
|
|
t nil posn)))
|
|
|
|
|
(deactivate-mark)
|
|
|
|
|
(when point
|
|
|
|
|
;; This is necessary for following links.
|
|
|
|
|
(goto-char point))
|
|
|
|
|
;; Figure out if the on screen keyboard needs to be
|
|
|
|
|
;; displayed.
|
|
|
|
|
(when command
|
Adapt eww to touch screens, mice and text conversion
* doc/emacs/input.texi (On-Screen Keyboards): Update conditions
for displaying the virtual keyboard when t-s-d-k is enabled.
* etc/NEWS (Announce): Document changes.
* lisp/net/eww.el (eww-check-text-conversion): New function.
(eww-mode): Install it as a local post-command-hook.
(eww-submit-map, eww-submit-file, eww-checkbox-map): Bind
suitable commands to mouse-2.
(eww-form-submit, eww-form-checkbox, eww-form-file)
(eww-tag-select): Disguise inserted forms as buttons, that touch
event translation may prefer their bindings to mouse-2 over
mouse-1.
(eww-form-text, eww-tag-textarea): Insert field properties as
well.
(eww-select-file, eww-toggle-checkbox, eww-submit): New argument
EVENT, to whose position point is set.
* lisp/touch-screen.el (touch-screen-handle-point-up): Trivial
adjustments to the criteria for selecting mouse commands and
displaying the on screen keyboard.
2024-04-29 12:01:59 +00:00
|
|
|
|
(if (or (memq command touch-screen-set-point-commands)
|
|
|
|
|
;; Users of packages that redefine
|
2024-04-29 12:32:12 +00:00
|
|
|
|
;; `mouse-set-point', or other commands
|
Adapt eww to touch screens, mice and text conversion
* doc/emacs/input.texi (On-Screen Keyboards): Update conditions
for displaying the virtual keyboard when t-s-d-k is enabled.
* etc/NEWS (Announce): Document changes.
* lisp/net/eww.el (eww-check-text-conversion): New function.
(eww-mode): Install it as a local post-command-hook.
(eww-submit-map, eww-submit-file, eww-checkbox-map): Bind
suitable commands to mouse-2.
(eww-form-submit, eww-form-checkbox, eww-form-file)
(eww-tag-select): Disguise inserted forms as buttons, that touch
event translation may prefer their bindings to mouse-2 over
mouse-1.
(eww-form-text, eww-tag-textarea): Insert field properties as
well.
(eww-select-file, eww-toggle-checkbox, eww-submit): New argument
EVENT, to whose position point is set.
* lisp/touch-screen.el (touch-screen-handle-point-up): Trivial
adjustments to the criteria for selecting mouse commands and
displaying the on screen keyboard.
2024-04-29 12:01:59 +00:00
|
|
|
|
;; recognized as defining the point, should
|
|
|
|
|
;; not find the on screen keyboard
|
2024-04-29 12:32:12 +00:00
|
|
|
|
;; inaccessible even with
|
|
|
|
|
;; `touch-screen-display-keyboard' enabled.
|
Adapt eww to touch screens, mice and text conversion
* doc/emacs/input.texi (On-Screen Keyboards): Update conditions
for displaying the virtual keyboard when t-s-d-k is enabled.
* etc/NEWS (Announce): Document changes.
* lisp/net/eww.el (eww-check-text-conversion): New function.
(eww-mode): Install it as a local post-command-hook.
(eww-submit-map, eww-submit-file, eww-checkbox-map): Bind
suitable commands to mouse-2.
(eww-form-submit, eww-form-checkbox, eww-form-file)
(eww-tag-select): Disguise inserted forms as buttons, that touch
event translation may prefer their bindings to mouse-2 over
mouse-1.
(eww-form-text, eww-tag-textarea): Insert field properties as
well.
(eww-select-file, eww-toggle-checkbox, eww-submit): New argument
EVENT, to whose position point is set.
* lisp/touch-screen.el (touch-screen-handle-point-up): Trivial
adjustments to the criteria for selecting mouse commands and
displaying the on screen keyboard.
2024-04-29 12:01:59 +00:00
|
|
|
|
touch-screen-display-keyboard)
|
2024-04-09 02:37:47 +00:00
|
|
|
|
(if touch-screen-translate-prompt
|
|
|
|
|
;; Forgo displaying the virtual keyboard
|
2024-04-29 12:32:12 +00:00
|
|
|
|
;; should `touch-screen-translate-prompt' be
|
2024-04-09 02:37:47 +00:00
|
|
|
|
;; set, for then the key won't be delivered
|
|
|
|
|
;; to the command loop, but rather to a
|
2024-04-29 12:32:12 +00:00
|
|
|
|
;; caller of `read-key-sequence' such as
|
|
|
|
|
;; `describe-key'.
|
2024-04-09 02:37:47 +00:00
|
|
|
|
(throw 'input-event event)
|
2024-05-01 07:57:29 +00:00
|
|
|
|
(if (or touch-screen-display-keyboard
|
|
|
|
|
(and (or (not buffer-read-only)
|
|
|
|
|
inhibit-read-only
|
|
|
|
|
;; Display the on screen
|
|
|
|
|
;; keyboard even if just the
|
|
|
|
|
;; text under point is not
|
|
|
|
|
;; read-only.
|
|
|
|
|
(get-text-property
|
|
|
|
|
point 'inhibit-read-only))
|
|
|
|
|
;; If the major mode has defined
|
|
|
|
|
;; bespoke criteria for
|
|
|
|
|
;; displaying the on screen
|
|
|
|
|
;; keyboard, consult it here.
|
|
|
|
|
(or (not touch-screen-keyboard-function)
|
|
|
|
|
(funcall
|
|
|
|
|
touch-screen-keyboard-function))))
|
2024-04-09 02:37:47 +00:00
|
|
|
|
;; Once the on-screen keyboard has been
|
|
|
|
|
;; opened, add
|
|
|
|
|
;; `touch-screen-window-selection-changed'
|
|
|
|
|
;; as a window selection change function
|
|
|
|
|
;; This then prevents it from being
|
|
|
|
|
;; hidden after exiting the minibuffer.
|
|
|
|
|
(progn
|
|
|
|
|
(add-hook
|
|
|
|
|
'window-selection-change-functions
|
|
|
|
|
#'touch-screen-window-selection-changed)
|
|
|
|
|
(frame-toggle-on-screen-keyboard
|
|
|
|
|
(selected-frame) nil))
|
|
|
|
|
;; Otherwise, hide the on screen keyboard
|
|
|
|
|
;; now.
|
|
|
|
|
(frame-toggle-on-screen-keyboard (selected-frame)
|
|
|
|
|
t))
|
|
|
|
|
;; But if it's being called from `describe-key'
|
|
|
|
|
;; or some such, return it as a key sequence.
|
|
|
|
|
(throw 'input-event event)))
|
|
|
|
|
;; If not, return the event.
|
|
|
|
|
(throw 'input-event event))))))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
((eq what 'mouse-drag)
|
|
|
|
|
;; Generate a corresponding `mouse-1' event.
|
2024-04-09 02:37:47 +00:00
|
|
|
|
;; Alternatively, quit if the touch sequence was canceled.
|
|
|
|
|
(if canceled
|
|
|
|
|
(keyboard-quit)
|
|
|
|
|
(let* ((new-window (posn-window posn))
|
|
|
|
|
(new-point (posn-point posn))
|
|
|
|
|
(old-posn (nth 4 touch-screen-current-tool))
|
|
|
|
|
(old-window (posn-window posn))
|
2024-07-03 09:05:24 +00:00
|
|
|
|
(old-point (posn-point posn))
|
|
|
|
|
(new-relative-xy (touch-screen-relative-xy
|
|
|
|
|
posn new-window))
|
|
|
|
|
(old-relative-xy (touch-screen-relative-xy
|
|
|
|
|
old-posn new-window)))
|
2024-04-09 02:37:47 +00:00
|
|
|
|
(throw 'input-event
|
2024-07-03 09:05:24 +00:00
|
|
|
|
;; If the position of the touch point has
|
|
|
|
|
;; changed, or it has moved significantly, as
|
|
|
|
|
;; measured by reference to double-click-fuzz...
|
|
|
|
|
(if (or (let ((xdiff (- (car new-relative-xy)
|
|
|
|
|
(car old-relative-xy)))
|
|
|
|
|
(ydiff (- (cdr new-relative-xy)
|
|
|
|
|
(cdr old-relative-xy))))
|
|
|
|
|
(and (>= (abs xdiff) double-click-fuzz)
|
|
|
|
|
(>= (abs ydiff) double-click-fuzz)))
|
|
|
|
|
(not (eq old-window new-window))
|
|
|
|
|
(not (eq old-point new-point)))
|
|
|
|
|
;; ... generate a drag-mouse-1 event...
|
|
|
|
|
(list 'drag-mouse-1 old-posn posn)
|
|
|
|
|
;; ... otherwise, generate a mouse-1 event.
|
|
|
|
|
(list 'mouse-1 posn))))))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
((eq what 'mouse-1-menu)
|
|
|
|
|
;; Generate a `down-mouse-1' event at the position the tap
|
2024-04-09 02:37:47 +00:00
|
|
|
|
;; took place, unless the touch sequence was canceled.
|
|
|
|
|
(unless canceled
|
|
|
|
|
(throw 'input-event
|
|
|
|
|
(list 'down-mouse-1
|
|
|
|
|
(nth 4 touch-screen-current-tool)))))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
((or (eq what 'drag)
|
|
|
|
|
;; Merely initiating a drag is sufficient to select a
|
|
|
|
|
;; word if word selection is enabled.
|
|
|
|
|
(eq what 'held))
|
2024-04-09 02:37:47 +00:00
|
|
|
|
(unless canceled
|
|
|
|
|
;; Display the on screen keyboard if the region is now
|
|
|
|
|
;; active. Check this within the window where the tool
|
|
|
|
|
;; was first place.
|
|
|
|
|
(setq window (nth 1 touch-screen-current-tool))
|
|
|
|
|
(when window
|
|
|
|
|
(with-selected-window window
|
|
|
|
|
(when (and (region-active-p)
|
|
|
|
|
(not buffer-read-only))
|
|
|
|
|
;; Once the on-screen keyboard has been opened, add
|
|
|
|
|
;; `touch-screen-window-selection-changed' as a
|
|
|
|
|
;; window selection change function. This then
|
|
|
|
|
;; prevents it from being hidden after exiting the
|
|
|
|
|
;; minibuffer.
|
|
|
|
|
(progn
|
|
|
|
|
(add-hook 'window-selection-change-functions
|
|
|
|
|
#'touch-screen-window-selection-changed)
|
|
|
|
|
(frame-toggle-on-screen-keyboard (selected-frame)
|
|
|
|
|
nil)))))))))))
|
2023-07-16 07:30:01 +00:00
|
|
|
|
|
|
|
|
|
(defun touch-screen-handle-touch (event prefix &optional interactive)
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
"Handle a single touch EVENT, and perform associated actions.
|
2023-07-16 07:30:01 +00:00
|
|
|
|
EVENT can either be a `touchscreen-begin', `touchscreen-update' or
|
|
|
|
|
`touchscreen-end' event.
|
|
|
|
|
PREFIX is either nil, or a symbol specifying a virtual function
|
|
|
|
|
key to apply to EVENT.
|
|
|
|
|
|
|
|
|
|
If INTERACTIVE, execute the command associated with any event
|
|
|
|
|
generated instead of throwing `input-event'. Otherwise, throw
|
|
|
|
|
`input-event' with a single input event if that event should take
|
|
|
|
|
the place of EVENT within the key sequence being translated, or
|
2024-07-18 07:44:28 +00:00
|
|
|
|
nil if all tools have been released.
|
2023-11-24 02:39:49 +00:00
|
|
|
|
|
2024-07-18 07:44:28 +00:00
|
|
|
|
Set `touch-screen-events-received' to t to indicate that touch
|
2023-11-24 02:39:49 +00:00
|
|
|
|
screen events have been received, and thus by extension require
|
|
|
|
|
functions undertaking event management themselves to call
|
|
|
|
|
`read-key' rather than `read-event'."
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(interactive "e\ni\np")
|
2023-11-24 02:39:49 +00:00
|
|
|
|
(unless touch-screen-events-received
|
|
|
|
|
(setq touch-screen-events-received t))
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(if interactive
|
|
|
|
|
;; Called interactively (probably from wid-edit.el.)
|
|
|
|
|
;; Add any event generated to `unread-command-events'.
|
2023-07-17 06:28:20 +00:00
|
|
|
|
(let ((event1
|
|
|
|
|
(let ((current-key-remap-sequence (vector event)))
|
|
|
|
|
(touch-screen-translate-touch nil))))
|
|
|
|
|
(when (vectorp event1)
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(setq unread-command-events
|
|
|
|
|
(nconc unread-command-events
|
2023-07-17 06:28:20 +00:00
|
|
|
|
(nreverse (append event1 nil))))))
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(cond
|
|
|
|
|
((eq (car event) 'touchscreen-begin)
|
|
|
|
|
;; A tool was just pressed against the screen. Figure out the
|
|
|
|
|
;; window where it is and make it the tool being tracked on the
|
|
|
|
|
;; window.
|
|
|
|
|
(let* ((touchpoint (caadr event))
|
|
|
|
|
(position (cdadr event))
|
|
|
|
|
(window (posn-window position))
|
2023-07-17 05:58:32 +00:00
|
|
|
|
(point (posn-point position))
|
2023-07-19 04:46:02 +00:00
|
|
|
|
binding tool-list)
|
2023-07-16 07:30:01 +00:00
|
|
|
|
;; Cancel the touch screen timer, if it is still there by any
|
|
|
|
|
;; chance.
|
|
|
|
|
(when touch-screen-current-timer
|
|
|
|
|
(cancel-timer touch-screen-current-timer)
|
|
|
|
|
(setq touch-screen-current-timer nil))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
;; If a tool already exists...
|
2023-11-24 02:39:49 +00:00
|
|
|
|
(if (and touch-screen-current-tool
|
|
|
|
|
;; ..and the number of this tool is at variance with
|
|
|
|
|
;; that of the current tool: if a `touchscreen-end'
|
|
|
|
|
;; event is delivered that is somehow withheld from
|
|
|
|
|
;; this function and the system does not assign
|
|
|
|
|
;; monotonically increasing touch point identifiers,
|
|
|
|
|
;; then the ancillary tool will be set to a tool
|
|
|
|
|
;; bearing the same number as the current tool, and
|
|
|
|
|
;; consequently the mechanism for detecting
|
|
|
|
|
;; erroneously retained touch points upon the
|
|
|
|
|
;; registration of `touchscreen-update' events will
|
|
|
|
|
;; not be activated.
|
|
|
|
|
(not (eq touchpoint (car touch-screen-current-tool))))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
;; Then record this tool as the ``auxiliary tool''.
|
|
|
|
|
;; Updates to the auxiliary tool are considered in unison
|
|
|
|
|
;; with those to the current tool; the distance between
|
|
|
|
|
;; both tools is measured and compared with that when the
|
|
|
|
|
;; auxiliary tool was first pressed, then interpreted as a
|
|
|
|
|
;; scale by which to adjust text within the current tool's
|
|
|
|
|
;; window.
|
2023-11-22 03:10:13 +00:00
|
|
|
|
(when (eq (if (framep window) window (window-frame window))
|
|
|
|
|
;; Verify that the new tool was placed on the
|
|
|
|
|
;; same frame the current tool has, so as not to
|
|
|
|
|
;; consider events distributed across distinct
|
|
|
|
|
;; frames components of a single gesture.
|
|
|
|
|
(window-frame (nth 1 touch-screen-current-tool)))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
;; Set touch-screen-aux-tool as is proper. Mind that
|
|
|
|
|
;; the last field is always relative to the current
|
|
|
|
|
;; tool's window.
|
|
|
|
|
(let* ((window (nth 1 touch-screen-current-tool))
|
|
|
|
|
(relative-x-y (touch-screen-relative-xy position
|
|
|
|
|
window))
|
|
|
|
|
(initial-pos (nth 4 touch-screen-current-tool))
|
|
|
|
|
(initial-x-y (touch-screen-relative-xy initial-pos
|
|
|
|
|
window))
|
|
|
|
|
computed-distance computed-centrum)
|
|
|
|
|
;; Calculate the distance and centrum from this point
|
|
|
|
|
;; to the initial position of the current tool.
|
|
|
|
|
(setq computed-distance (touch-screen-distance relative-x-y
|
|
|
|
|
initial-x-y)
|
|
|
|
|
computed-centrum (touch-screen-centrum relative-x-y
|
|
|
|
|
initial-x-y))
|
|
|
|
|
;; If computed-distance is zero, ignore this tap.
|
|
|
|
|
(unless (zerop computed-distance)
|
|
|
|
|
(setq touch-screen-aux-tool (vector touchpoint window
|
|
|
|
|
position relative-x-y
|
|
|
|
|
computed-distance
|
|
|
|
|
computed-centrum
|
2023-11-16 03:29:58 +00:00
|
|
|
|
1.0 nil nil nil)))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
;; When an auxiliary tool is pressed, any gesture
|
|
|
|
|
;; previously in progress must be terminated, so long
|
|
|
|
|
;; as it represents a gesture recognized from the
|
|
|
|
|
;; current tool's motion rather than ones detected by
|
|
|
|
|
;; this function from circumstances surrounding its
|
|
|
|
|
;; first press, such as the presence of a menu or
|
|
|
|
|
;; down-mouse-1 button beneath its first press.
|
|
|
|
|
(unless (memq (nth 3 touch-screen-current-tool)
|
|
|
|
|
'(mouse-drag mouse-1-menu))
|
2023-11-16 13:07:01 +00:00
|
|
|
|
;; Set the what field to the symbol `ancillary-tool'
|
|
|
|
|
;; rather than nil, that mouse events may not be
|
|
|
|
|
;; generated if no gesture is subsequently
|
|
|
|
|
;; recognized; this, among others, prevents
|
|
|
|
|
;; undesirable point movement (through the execution
|
|
|
|
|
;; of `mouse-set-point') after both points are
|
|
|
|
|
;; released without any gesture being detected.
|
|
|
|
|
(setcar (nthcdr 3 touch-screen-current-tool)
|
|
|
|
|
'ancillary-tool))))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
;; Replace any previously ongoing gesture. If POSITION has no
|
|
|
|
|
;; window or position, make it nil instead.
|
|
|
|
|
(setq tool-list (and (windowp window)
|
|
|
|
|
(list touchpoint window
|
|
|
|
|
(posn-x-y position)
|
|
|
|
|
nil position
|
|
|
|
|
nil nil nil nil
|
|
|
|
|
(posn-x-y position)))
|
|
|
|
|
touch-screen-current-tool tool-list)
|
|
|
|
|
;; Select the window underneath the event as the checks below
|
|
|
|
|
;; will look up keymaps and markers inside its buffer.
|
|
|
|
|
(save-selected-window
|
|
|
|
|
;; Check if `touch-screen-extend-selection' is enabled,
|
|
|
|
|
;; the tap lies on the point or the mark, and the region
|
|
|
|
|
;; is active. If that's the case, set the fourth element
|
|
|
|
|
;; of `touch-screen-current-tool' to `restart-drag', then
|
|
|
|
|
;; generate a `touchscreen-restart-drag' event.
|
|
|
|
|
(when tool-list
|
|
|
|
|
;; tool-list is always non-nil where the selected window
|
|
|
|
|
;; matters.
|
|
|
|
|
(select-window window)
|
|
|
|
|
(when (and touch-screen-extend-selection
|
|
|
|
|
(or (eq point (point))
|
|
|
|
|
(eq point (mark)))
|
|
|
|
|
(region-active-p)
|
|
|
|
|
;; Only restart drag-to-select if the tap
|
|
|
|
|
;; falls on the same row as the selection.
|
|
|
|
|
;; This prevents dragging from starting if
|
|
|
|
|
;; the tap is below the last window line with
|
|
|
|
|
;; text and `point' is at ZV, as the user
|
|
|
|
|
;; most likely meant to scroll the window
|
|
|
|
|
;; instead.
|
|
|
|
|
(when-let* ((posn-point (posn-at-point point))
|
|
|
|
|
(posn-row (cdr
|
|
|
|
|
(posn-col-row posn-point))))
|
|
|
|
|
(eq (cdr (posn-col-row position)) posn-row)))
|
|
|
|
|
;; Indicate that a drag is about to restart.
|
|
|
|
|
(setcar (nthcdr 3 tool-list) 'restart-drag)
|
|
|
|
|
;; Generate the `restart-drag' event.
|
|
|
|
|
(throw 'input-event (list 'touchscreen-restart-drag
|
|
|
|
|
position))))
|
2024-07-03 09:05:24 +00:00
|
|
|
|
;; Determine whether there is a command bound to
|
|
|
|
|
;; `down-mouse-1' at the position of the tap and that
|
|
|
|
|
;; command is not a command whose functionality is replaced
|
|
|
|
|
;; by the long-press mechanism. If so, set the fourth
|
|
|
|
|
;; element of `touch-screen-current-tool' to `mouse-drag'
|
|
|
|
|
;; and generate an emulated `mouse-1' event. Likewise if
|
|
|
|
|
;; touch event translation is being invoked by a caller of
|
|
|
|
|
;; `read-key' that expects unprocessed mouse input,
|
2023-11-15 12:58:46 +00:00
|
|
|
|
;;
|
2024-07-03 09:05:24 +00:00
|
|
|
|
;; If the command in question is a keymap, set that element
|
|
|
|
|
;; to `mouse-1-menu' instead of `mouse-drag', and don't
|
|
|
|
|
;; generate a `down-mouse-1' event immediately, but wait for
|
|
|
|
|
;; the touch point to be released, so that the menu bar may
|
|
|
|
|
;; not be displayed before the user has released the touch
|
|
|
|
|
;; point and the window system is ready to display a menu.
|
2023-11-15 12:58:46 +00:00
|
|
|
|
(if (and tool-list
|
2024-07-03 09:05:24 +00:00
|
|
|
|
(or (and (setq binding
|
|
|
|
|
(key-binding (if prefix
|
|
|
|
|
(vector prefix
|
|
|
|
|
'down-mouse-1)
|
|
|
|
|
[down-mouse-1])
|
|
|
|
|
t nil position))
|
|
|
|
|
(not (and (symbolp binding)
|
|
|
|
|
(get binding 'ignored-mouse-command))))
|
|
|
|
|
touch-screen-simple-mouse-conversion))
|
|
|
|
|
(if (and (not touch-screen-simple-mouse-conversion)
|
|
|
|
|
(or (keymapp binding)
|
|
|
|
|
(and (symbolp binding)
|
|
|
|
|
(get binding 'mouse-1-menu-command))))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
;; binding is a keymap, or a command that does
|
|
|
|
|
;; almost the same thing. If a `mouse-1' event is
|
|
|
|
|
;; generated after the keyboard command loop
|
|
|
|
|
;; displays it as a menu, that event could cause
|
|
|
|
|
;; unwanted commands to be run. Set what to
|
|
|
|
|
;; `mouse-1-menu' instead and wait for the up
|
|
|
|
|
;; event to display the menu.
|
|
|
|
|
(setcar (nthcdr 3 tool-list) 'mouse-1-menu)
|
2024-07-23 12:44:06 +00:00
|
|
|
|
(progn
|
|
|
|
|
(setcar (nthcdr 3 tool-list) 'mouse-drag)
|
|
|
|
|
;; Record the extents of the glyph beneath this
|
|
|
|
|
;; touch point to avoid generating extraneous events
|
|
|
|
|
;; when it next moves.
|
|
|
|
|
(setcar
|
|
|
|
|
(nthcdr 5 touch-screen-current-tool)
|
|
|
|
|
(let* ((edges (window-inside-pixel-edges window))
|
|
|
|
|
(point (posn-x-y position))
|
|
|
|
|
(frame-offsets (if (framep window)
|
|
|
|
|
'(0 . 0)
|
|
|
|
|
(cons (car edges)
|
|
|
|
|
(cadr edges)))))
|
|
|
|
|
(remember-mouse-glyph (or (and (framep window) window)
|
|
|
|
|
(window-frame window))
|
|
|
|
|
(+ (car point)
|
|
|
|
|
(car frame-offsets))
|
|
|
|
|
(+ (cdr point)
|
|
|
|
|
(cdr frame-offsets)))))
|
|
|
|
|
(throw 'input-event (list 'down-mouse-1 position))))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
(and point
|
|
|
|
|
;; Start the long-press timer.
|
|
|
|
|
(touch-screen-handle-timeout nil)))))))
|
2023-07-16 07:30:01 +00:00
|
|
|
|
((eq (car event) 'touchscreen-update)
|
2023-07-18 04:16:05 +00:00
|
|
|
|
(unless touch-screen-current-tool
|
|
|
|
|
;; If a stray touchscreen-update event arrives (most likely
|
|
|
|
|
;; from the menu bar), stop translating this sequence.
|
|
|
|
|
(throw 'input-event nil))
|
2023-07-16 07:30:01 +00:00
|
|
|
|
;; The positions of tools currently pressed against the screen
|
|
|
|
|
;; have changed. If there is a tool being tracked as part of a
|
|
|
|
|
;; gesture, look it up in the list of tools.
|
Mark if-let and when-let obsolete
* lisp/subr.el (if-let*, when-let*, if-let, when-let): Mark
if-let and when-let obsolete (bug#73853 and elsewhere). Move
docstring text around so that if-let* and when-let* descriptions
no longer refer to if-let and when-let.
* etc/NEWS: Announce the change.
* admin/admin.el (reminder-for-release-blocking-bugs):
* doc/misc/erc.texi (display-buffer):
* lisp/ansi-color.el (ansi-color-apply)
(ansi-color--face-vec-face):
* lisp/ansi-osc.el (ansi-osc-apply-on-region)
(ansi-osc-hyperlink):
* lisp/arc-mode.el (archive-goto-file)
(archive-next-file-displayer):
* lisp/auth-source-pass.el (auth-source-pass-search)
(auth-source-pass--parse-data)
(auth-source-pass--find-match-many):
* lisp/autorevert.el (auto-revert-notify-rm-watch):
* lisp/buff-menu.el (Buffer-menu-unmark-all-buffers)
(Buffer-menu-group-by-root):
* lisp/calendar/parse-time.el (parse-iso8601-time-string):
* lisp/cedet/pulse.el (pulse-tick):
* lisp/comint.el (comint--fontify-input-ppss-flush-indirect)
(comint--intersect-regions):
* lisp/completion-preview.el (completion-preview--try-table)
(completion-preview--capf-wrapper, completion-preview--update):
* lisp/cus-edit.el (setopt--set)
(custom-dirlocals-maybe-update-cons, custom-dirlocals-validate):
* lisp/custom.el (load-theme):
* lisp/descr-text.el (describe-char):
* lisp/desktop.el (desktop--emacs-pid-running-p):
* lisp/dired-x.el (menu):
* lisp/dired.el (dired-font-lock-keywords)
(dired-insert-directory, dired--insert-disk-space, dired-mode):
* lisp/dnd.el (dnd-handle-multiple-urls):
* lisp/dom.el (dom-remove-attribute):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
* lisp/emacs-lisp/bytecomp.el (bytecomp--custom-declare):
* lisp/emacs-lisp/comp-common.el (comp-function-type-spec):
* lisp/emacs-lisp/comp-cstr.el (comp--all-classes)
(comp-cstr-set-range-for-arithm, comp--cstr-union-1-no-mem)
(comp-cstr-intersection-no-mem, comp-cstr-fixnum-p)
(comp-cstr-type-p):
* lisp/emacs-lisp/comp-run.el (comp-subr-trampoline-install)
(native--compile-async):
* lisp/emacs-lisp/comp.el (comp--get-function-cstr)
(comp--function-pure-p, comp--intern-func-in-ctxt)
(comp--addr-to-bb-name, comp--emit-assume, comp--maybe-add-vmvar)
(comp--add-call-cstr, comp--compute-dominator-tree)
(comp--dom-tree-walker, comp--ssa-rename)
(comp--function-call-maybe-fold, comp--fwprop-call)
(comp--call-optim-func):
* lisp/emacs-lisp/edebug.el (edebug-global-prefix)
(edebug-remove-instrumentation):
* lisp/emacs-lisp/eieio.el (initialize-instance):
* lisp/emacs-lisp/ert-x.el (ert-resource-directory):
* lisp/emacs-lisp/ert.el (ert--expand-should-1)
(ert-test-location, ert-write-junit-test-report)
(ert-test--erts-test):
* lisp/emacs-lisp/icons.el (icon-complete-spec, icon-string)
(icons--create):
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p):
* lisp/emacs-lisp/loaddefs-gen.el
(loaddefs-generate--make-autoload)
(loaddefs-generate--parse-file):
* lisp/emacs-lisp/multisession.el
(multisession-edit-mode--revert, multisession-edit-value):
* lisp/emacs-lisp/package-vc.el (package-vc--read-archive-data)
(package-vc--version, package-vc--clone):
* lisp/emacs-lisp/package.el (package--reload-previously-loaded):
* lisp/emacs-lisp/pp.el (pp--insert-lisp):
* lisp/emacs-lisp/subr-x.el (add-display-text-property):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print):
* lisp/emacs-lisp/timer.el (run-at-time):
* lisp/emacs-lisp/vtable.el (vtable-goto-table)
(vtable-goto-column, vtable-update-object, vtable--insert-line)
(vtable--compute-widths, vtable--make-keymap):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/epa-file.el (epa-file-insert-file-contents):
* lisp/epa.el (epa-show-key):
* lisp/erc/erc-backend.el (erc--split-line, erc--conceal-prompt)
(PRIVMSG, erc--get-isupport-entry):
* lisp/erc/erc-button.el (erc-button-add-nickname-buttons)
(erc--button-next):
* lisp/erc/erc-common.el (erc--find-group):
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static)
(erc-fill--wrap-escape-hidden-speaker)
(erc-fill--wrap-unmerge-on-date-stamp)
(erc-fill--wrap-massage-initial-message-post-clear)
(erc-fill-wrap, erc-fill--wrap-rejigger-region):
* lisp/erc/erc-goodies.el (erc--scrolltobottom-all)
(erc--keep-place-indicator-on-window-buffer-change)
(keep-place-indicator, erc--keep-place-indicator-adjust-on-clear)
(erc-keep-place-move, erc--command-indicator-display):
* lisp/erc/erc-ibuffer.el (erc-members):
* lisp/erc/erc-join.el (erc-join--remove-requested-channel)
(erc-autojoin--join):
* lisp/erc/erc-networks.el
(erc-networks--id-qualifying-init-parts, erc-networks--id-reload)
(erc-networks--id-ensure-comparable)
(erc-networks--reclaim-orphaned-target-buffers)
(erc-networks--server-select):
* lisp/erc/erc-nicks.el (erc-nicks-invert)
(erc-nicks--redirect-face-widget-link, erc-nicks--highlight)
(erc-nicks--highlight-button)
(erc-nicks--list-faces-help-button-action, erc-nicks-list-faces)
(erc-nicks-refresh, erc-nicks--colors-from-faces)
(erc-nicks--track-prioritize)
(erc-nicks--remember-face-for-track):
* lisp/erc/erc-notify.el (querypoll, erc--querypoll-get-next)
(erc--querypoll-on-352, erc--querypoll-send):
* lisp/erc/erc-sasl.el (erc-sasl--read-password):
* lisp/erc/erc-services.el
(erc-services-issue-ghost-and-retry-nick):
* lisp/erc/erc-speedbar.el (erc-speedbar--ensure, nickbar)
(erc-speedbar-toggle-nicknames-window-lock)
(erc-speedbar--compose-nicks-face):
* lisp/erc/erc-stamp.el (erc-stamp--recover-on-reconnect)
(erc-stamp-prefix-log-filter, erc--conceal-prompt)
(erc--insert-timestamp-left, erc-insert-timestamp-right)
(erc-stamp--defer-date-insertion-on-post-modify)
(erc-insert-timestamp-left-and-right)
(erc-stamp--redo-right-stamp-post-clear)
(erc-stamp--reset-on-clear, erc-stamp--dedupe-date-stamps):
* lisp/erc/erc-status-sidebar.el (bufbar)
(erc-status-sidebar-prefer-target-as-name)
(erc-status-sidebar-default-allsort, erc-status-sidebar-click):
* lisp/erc/erc-track.el (erc-track--shortened-names-get)
(erc-track--setup, erc-track--select-mode-line-face)
(erc-track-modified-channels, erc-track--collect-faces-in)
(erc-track--switch-buffer, erc-track--replace-killed-buffer):
* lisp/erc/erc-truncate.el (erc-truncate--setup)
(erc-truncate-buffer):
* lisp/erc/erc.el (erc--ensure-query-member)
(erc--ensure-query-members, erc--remove-channel-users-but)
(erc--cusr-change-status, erc--find-mode, erc--update-modules)
(erc-log-irc-protocol, erc--refresh-prompt)
(erc--restore-important-text-props)
(erc--order-text-properties-from-hash, erc-send-input-line)
(erc-cmd-IGNORE, erc--unignore-user, erc-cmd-QUERY)
(erc-cmd-BANLIST, erc--speakerize-nick)
(erc--format-speaker-input-message, erc-channel-receive-names)
(erc-send-current-line, erc-format-target-and/or-network)
(erc-kill-buffer-function, erc-restore-text-properties)
(erc--get-eq-comparable-cmd):
* lisp/eshell/em-alias.el (eshell-maybe-replace-by-alias--which)
(eshell-maybe-replace-by-alias):
* lisp/eshell/em-glob.el (eshell-glob-convert):
* lisp/eshell/em-pred.el (eshell-pred-user-or-group)
(eshell-pred-file-time, eshell-pred-file-type)
(eshell-pred-file-mode, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-prompt.el (eshell-forward-paragraph)
(eshell-next-prompt):
* lisp/eshell/esh-arg.el (eshell-resolve-current-argument):
* lisp/eshell/esh-cmd.el (eshell-do-eval, eshell/which)
(eshell-plain-command--which, eshell-plain-command):
* lisp/eshell/esh-io.el (eshell-duplicate-handles)
(eshell-protect-handles, eshell-get-target, eshell-close-target):
* lisp/eshell/esh-proc.el (eshell-sentinel):
* lisp/eshell/esh-var.el (eshell-parse-variable-ref)
(eshell-get-variable, eshell-set-variable):
* lisp/faces.el (face-at-point):
* lisp/ffap.el (ffap-in-project):
* lisp/filenotify.el (file-notify--rm-descriptor):
* lisp/files-x.el (read-dir-locals-file)
(connection-local-update-profile-variables)
(connection-local-value):
* lisp/files.el (file-remote-p, abbreviate-file-name)
(set-auto-mode, hack-local-variables)
(revert-buffer-restore-read-only):
* lisp/find-dired.el (find-dired-sort-by-filename):
* lisp/font-lock.el (font-lock--filter-keywords):
* lisp/gnus/gnus-art.el (article-emojize-symbols):
* lisp/gnus/gnus-int.el (gnus-close-server):
* lisp/gnus/gnus-search.el (gnus-search-transform)
(gnus-search-indexed-parse-output, gnus-search-server-to-engine):
* lisp/gnus/gnus-sum.el (gnus-collect-urls, gnus-shorten-url):
* lisp/gnus/gnus.el (gnus-check-backend-function):
* lisp/gnus/message.el (message-send-mail):
* lisp/gnus/mml.el (mml-generate-mime, mml-insert-mime-headers):
* lisp/gnus/nnatom.el (nnatom--read-feed, nnatom--read-article)
(nnatom--read-article-or-group-authors, nnatom--read-publish)
(nnatom--read-update, nnatom--read-links):
* lisp/gnus/nnfeed.el (nnfeed--read-server, nnfeed--write-server)
(nnfeed--parse-feed, nnfeed--group-data, nnfeed-retrieve-article)
(nnfeed-retrieve-headers, nnfeed--print-part)
(nnfeed-request-article, nnfeed-request-group)
(nnfeed-request-list, nnfeed--group-description)
(nnfeed-request-group-description)
(nnfeed-request-list-newsgroups, nnfeed-request-rename-group):
* lisp/gnus/nnmh.el (nnmh-update-gnus-unreads):
* lisp/help-fns.el (help-find-source)
(help-fns--insert-menu-bindings, help-fns--mention-first-release)
(help-fns--mention-shortdoc-groups)
(help-fns--customize-variable-version)
(help-fns--face-custom-version-info, describe-mode):
* lisp/help-mode.el (help-make-xrefs):
* lisp/help.el (help-key-description, help--describe-command):
* lisp/hfy-cmap.el (htmlfontify-load-rgb-file):
* lisp/ibuf-ext.el (ibuffer-jump-to-filter-group)
(ibuffer-kill-filter-group, ibuffer-kill-line)
(ibuffer-save-filter-groups, ibuffer-save-filters, filename)
(basename, file-extension, ibuffer-diff-buffer-with-file-1)
(ibuffer-mark-by-file-name-regexp)
(ibuffer-mark-by-content-regexp):
* lisp/ibuf-macs.el (ibuffer-aif, ibuffer-awhen):
* lisp/ibuffer.el (ibuffer-mouse-toggle-mark)
(ibuffer-toggle-marks, ibuffer-mark-interactive)
(ibuffer-compile-format, process, ibuffer-map-lines):
* lisp/image.el (image--compute-map)
(image--compute-original-map):
* lisp/image/exif.el (exif-parse-buffer):
* lisp/image/image-converter.el (image-convert-p, image-convert)
(image-converter--find-converter):
* lisp/image/image-dired-util.el
(image-dired-file-name-at-point):
* lisp/image/image-dired.el (image-dired-track-original-file)
(image-dired--on-file-in-dired-buffer)
(image-dired--with-thumbnail-buffer)
(image-dired-jump-original-dired-buffer)
(image-dired--slideshow-step, image-dired-display-image):
* lisp/image/wallpaper.el (wallpaper--init-action-kill)
(wallpaper--find-setter, wallpaper--find-command)
(wallpaper--find-command-args, wallpaper--x-monitor-name):
* lisp/info-look.el (info-lookup-interactive-arguments)
(info-complete)::(:mode):
* lisp/info.el (info-pop-to-buffer, Info-read-node-name-1):
* lisp/international/emoji.el (emoji--adjust-displayable-1)
(emoji--add-recent):
* lisp/jsonrpc.el (jsonrpc--call-deferred)
(jsonrpc--process-sentinel, jsonrpc--remove):
* lisp/keymap.el (keymap-local-lookup):
* lisp/mail/emacsbug.el (report-emacs-bug-hook)
(submit-emacs-patch):
* lisp/mail/ietf-drums.el (ietf-drums-parse-addresses):
* lisp/mail/mailclient.el (mailclient-send-it):
* lisp/mail/rfc6068.el (rfc6068-parse-mailto-url):
* lisp/mail/undigest.el (rmail-digest-parse-mixed-mime):
* lisp/minibuffer.el (completion-metadata-get)
(completions--after-change)
(minibuffer-visible-completions--filter):
* lisp/net/browse-url.el (browse-url-url-at-point)
(browse-url-file-url, browse-url-emacs):
* lisp/net/dbus.el (dbus-byte-array-to-string)
(dbus-monitor-goto-serial):
* lisp/net/dictionary.el (dictionary-search):
* lisp/net/eww.el (eww--download-directory)
(eww-auto-rename-buffer, eww-open-in-new-buffer, eww-submit)
(eww-follow-link, eww-read-alternate-url)
(eww-copy-alternate-url):
* lisp/net/goto-addr.el (goto-address-at-point):
* lisp/net/mailcap.el (mailcap-mime-info):
* lisp/net/rcirc.el (rcirc, rcirc-connect, rcirc-send-string)
(rcirc-kill-buffer-hook, rcirc-print, rcirc-when)
(rcirc-color-attributes, rcirc-handler-NICK)
(rcirc-handler-TAGMSG, rcirc-handler-BATCH):
* lisp/net/shr.el (shr-descend, shr-adaptive-fill-function)
(shr-correct-dom-case, shr-tag-a):
* lisp/net/sieve.el (sieve-manage-quit):
* lisp/outline.el (outline-cycle-buffer):
* lisp/pcmpl-git.el (pcmpl-git--tracked-file-predicate):
* lisp/proced.el (proced-auto-update-timer):
* lisp/progmodes/bug-reference.el
(bug-reference-try-setup-from-vc):
* lisp/progmodes/c-ts-common.el (c-ts-common--fill-paragraph):
* lisp/progmodes/c-ts-mode.el (c-ts-mode--preproc-offset)
(c-ts-mode--anchor-prev-sibling, c-ts-mode-indent-defun):
* lisp/progmodes/compile.el (compilation-error-properties)
(compilation-find-file-1):
* lisp/progmodes/eglot.el (eglot--check-object)
(eglot--read-server, eglot-upgrade-eglot)
(eglot-handle-notification, eglot--CompletionParams)
(eglot-completion-at-point, eglot--sig-info)
(eglot-register-capability):
* lisp/progmodes/elisp-mode.el
(emacs-lisp-native-compile-and-load)
(elisp-eldoc-var-docstring-with-value):
* lisp/progmodes/erts-mode.el (erts-mode--goto-start-of-test):
* lisp/progmodes/flymake.el (flymake--update-eol-overlays)
(flymake-eldoc-function):
* lisp/progmodes/gdb-mi.el (gdb-breakpoints-list-handler-custom)
(gdb-frame-handler):
* lisp/progmodes/go-ts-mode.el (go-ts-mode-docstring)
(go-ts-mode--comment-on-previous-line-p)
(go-ts-mode--get-test-regexp-at-point)
(go-ts-mode-test-this-file):
* lisp/progmodes/grep.el (lgrep, rgrep-default-command)
(grep-file-at-point):
* lisp/progmodes/perl-mode.el (perl--end-of-format-p):
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--anchor-prev-sibling, php-ts-mode--indent-defun):
* lisp/progmodes/project.el (project--other-place-command)
(project--find-default-from, project--transplant-file-name)
(project-prefixed-buffer-name, project--remove-from-project-list)
(project-prompt-project-name, project-remember-projects-under)
(project--switch-project-command)
(project-uniquify-dirname-transform, project-mode-line-format):
* lisp/progmodes/python.el
(python-font-lock-keywords-maximum-decoration)
(python--treesit-fontify-union-types)
(python-shell-get-process-name, python-shell-restart)
(python-shell-completion-at-point, python-ffap-module-path)
(python-util-comint-end-of-output-p, python--import-sources)
(python-add-import, python-remove-import, python-fix-imports):
* lisp/progmodes/xref.el (xref--add-log-current-defun):
* lisp/repeat.el (repeat-echo-message-string):
* lisp/saveplace.el (save-place-dired-hook):
* lisp/server.el (server-save-buffers-kill-terminal):
* lisp/shadowfile.el (shadow-make-fullname)
(shadow-contract-file-name, shadow-define-literal-group):
* lisp/shell.el (shell-highlight-undef-mode):
* lisp/simple.el (command-completion-using-modes-p)
(command-execute, file-user-uid, file-group-gid)
(first-completion, last-completion, switch-to-completions):
* lisp/startup.el (startup--load-user-init-file):
* lisp/tab-line.el (tab-line-tabs-buffer-group-by-project):
* lisp/tar-mode.el (tar-goto-file, tar-next-file-displayer):
* lisp/term/android-win.el (android-encode-select-string)
(gui-backend-set-selection):
* lisp/term/haiku-win.el (haiku-dnd-convert-string)
(haiku-select-encode-xstring, haiku-select-encode-utf-8-string):
* lisp/textmodes/emacs-news-mode.el (emacs-news--buttonize):
* lisp/textmodes/ispell.el (ispell-completion-at-point):
* lisp/textmodes/sgml-mode.el (sgml-validate)
(html-mode--complete-at-point):
* lisp/textmodes/tex-mode.el (tex-recenter-output-buffer)
(xref-backend-references):
* lisp/thingatpt.el (thing-at-point-file-at-point)
(thing-at-point-face-at-point):
* lisp/thread.el (thread-list--get-status):
* lisp/time.el (world-clock-copy-time-as-kill, world-clock):
* lisp/touch-screen.el (touch-screen-handle-touch):
* lisp/treesit.el (treesit-language-at, treesit-node-at)
(treesit-node-on, treesit-buffer-root-node)
(treesit-node-field-name, treesit-local-parsers-at)
(treesit-local-parsers-on, treesit--cleanup-local-range-overlays)
(treesit-font-lock-recompute-features)
(treesit-font-lock-fontify-region, treesit-transpose-sexps)
(treesit-add-log-current-defun, treesit-major-mode-setup)
(treesit--explorer-refresh, treesit-install-language-grammar):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/vc/smerge-mode.el (smerge-diff):
* lisp/vc/vc-dir.el (vc-dir):
* lisp/vc/vc-dispatcher.el (vc-do-async-command):
* lisp/vc/vc-git.el (vc-git-dir--branch-headers)
(vc-git-dir--stash-headers, vc-git--log-edit-summary-check)
(vc-git-stash-list):
* lisp/vc/vc.el (vc-responsible-backend, vc-buffer-sync-fileset)
(vc-clone):
* lisp/visual-wrap.el (visual-wrap--apply-to-line):
* lisp/wid-edit.el (widget-text)
(widget-editable-list-insert-before):
* lisp/window-tool-bar.el
(window-tool-bar--keymap-entry-to-string):
* lisp/window.el (display-buffer, display-buffer-full-frame)
(window-point-context-set, window-point-context-use)
(window-point-context-use-default-function):
* lisp/xdg.el (xdg-current-desktop):
* lisp/xwidget.el (xwidget-webkit-callback):
* lisp/yank-media.el (yank-media--get-selection)
(yank-media-types):
* test/lisp/comint-tests.el
(comint-tests/test-password-function):
* test/lisp/completion-preview-tests.el
(completion-preview-tests--capf):
* test/lisp/cus-edit-tests.el (with-cus-edit-test):
* test/lisp/erc/erc-scenarios-base-local-modules.el
(-phony-sblm-):
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify):
* test/lisp/erc/erc-services-tests.el
(erc-services-tests--asp-parse-entry):
* test/lisp/erc/erc-tests.el (erc-modules--internal-property)
(erc--find-mode, erc-tests--update-modules):
* test/lisp/erc/resources/erc-d/erc-d-i.el
(erc-d-i--parse-message):
* test/lisp/erc/resources/erc-d/erc-d-t.el
(erc-d-t-kill-related-buffers, erc-d-t-with-cleanup):
* test/lisp/erc/resources/erc-d/erc-d-tests.el
(erc-d-i--parse-message--irc-parser-tests):
* test/lisp/erc/resources/erc-d/erc-d-u.el
(erc-d-u--read-exchange-slowly):
* test/lisp/erc/resources/erc-d/erc-d.el (erc-d--expire)
(erc-d--finalize-done, erc-d--command-handle-all):
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common-with-cleanup):
* test/lisp/erc/resources/erc-tests-common.el
(erc-tests--common-display-message)
(erc-tests-common-create-subprocess):
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug25058):
* test/lisp/international/mule-tests.el
(mule-cmds-tests--ucs-names-missing-names):
* test/lisp/progmodes/python-tests.el
(python-tests-get-shell-interpreter)
(python-tests--get-interpreter-info):
* test/lisp/progmodes/ruby-ts-mode-tests.el
(ruby-ts-resource-file):
* test/lisp/replace-tests.el (replace-tests-with-undo):
* test/src/emacs-tests.el (emacs-tests--seccomp-debug):
* test/src/process-tests.el (process-tests--emacs-command)
(process-tests--emacs-binary, process-tests--dump-file):
* test/src/treesit-tests.el (treesit--ert-test-defun-navigation):
Replace use of the now-obsolete if-let and when-let.
2024-10-24 08:50:07 +00:00
|
|
|
|
(if-let* ((new-point (assq (car touch-screen-current-tool)
|
|
|
|
|
(cadr event))))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
(if touch-screen-aux-tool
|
|
|
|
|
(touch-screen-handle-aux-point-update (cdr new-point)
|
|
|
|
|
(car new-point))
|
2023-11-22 03:10:13 +00:00
|
|
|
|
(touch-screen-handle-point-update new-point))
|
|
|
|
|
;; If the current tool exists no longer, a touchscreen-end
|
|
|
|
|
;; event is certain to have been disregarded. So that
|
|
|
|
|
;; touchscreen gesture translation might continue as usual
|
|
|
|
|
;; after this aberration to the normal flow of events, delete
|
|
|
|
|
;; the current tool now.
|
|
|
|
|
(when touch-screen-current-timer
|
|
|
|
|
;; Cancel the touch screen long-press timer, if it is still
|
|
|
|
|
;; there by any chance.
|
|
|
|
|
(cancel-timer touch-screen-current-timer)
|
|
|
|
|
(setq touch-screen-current-timer nil))
|
|
|
|
|
;; Don't call `touch-screen-handle-point-up' when terminating
|
|
|
|
|
;; translation abnormally.
|
|
|
|
|
(setq touch-screen-current-tool nil
|
|
|
|
|
;; Delete the ancillary tool while at it.
|
|
|
|
|
touch-screen-aux-tool nil)
|
|
|
|
|
(message "Current touch screen tool vanished!"))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
;; Check for updates to any ancillary point being monitored.
|
|
|
|
|
(when touch-screen-aux-tool
|
|
|
|
|
(let ((new-point (assq (aref touch-screen-aux-tool 0)
|
|
|
|
|
(cadr event))))
|
|
|
|
|
(when new-point
|
|
|
|
|
(touch-screen-handle-aux-point-update (cdr new-point)
|
|
|
|
|
(car new-point))))))
|
2023-07-16 07:30:01 +00:00
|
|
|
|
((eq (car event) 'touchscreen-end)
|
|
|
|
|
;; A tool has been removed from the screen. If it is the tool
|
|
|
|
|
;; currently being tracked, clear `touch-screen-current-tool'.
|
|
|
|
|
(when (eq (caadr event) (car touch-screen-current-tool))
|
2023-07-17 01:46:37 +00:00
|
|
|
|
;; Cancel the touch screen long-press timer, if it is still
|
|
|
|
|
;; there by any chance.
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(when touch-screen-current-timer
|
|
|
|
|
(cancel-timer touch-screen-current-timer)
|
|
|
|
|
(setq touch-screen-current-timer nil))
|
2023-11-22 03:25:23 +00:00
|
|
|
|
(let ((old-aux-tool touch-screen-aux-tool))
|
|
|
|
|
(unwind-protect
|
2024-04-09 02:37:47 +00:00
|
|
|
|
(touch-screen-handle-point-up (cadr event) prefix
|
|
|
|
|
(caddr event))
|
2023-11-22 03:25:23 +00:00
|
|
|
|
;; If an ancillary tool is present the function call above
|
2024-04-09 02:37:47 +00:00
|
|
|
|
;; will simply transfer information from it into the current
|
|
|
|
|
;; tool list, rendering the new current tool, until such
|
|
|
|
|
;; time as it too is released.
|
2023-11-22 03:25:23 +00:00
|
|
|
|
(when (not (and old-aux-tool (not touch-screen-aux-tool)))
|
|
|
|
|
;; Make sure the tool list is cleared even if
|
|
|
|
|
;; `touch-screen-handle-point-up' throws.
|
|
|
|
|
(setq touch-screen-current-tool nil)))))
|
2023-11-15 12:58:46 +00:00
|
|
|
|
;; If it is rather the ancillary tool, delete its vector. No
|
|
|
|
|
;; further action is required, for the next update received will
|
|
|
|
|
;; resume regular gesture recognition.
|
|
|
|
|
;;
|
2023-11-16 13:07:01 +00:00
|
|
|
|
;; The what field in touch-screen-current-tool is set to a
|
|
|
|
|
;; signal value when the ancillary tool is pressed, so gesture
|
|
|
|
|
;; recognition will commence with a clean slate, save for when
|
|
|
|
|
;; the first touch landed atop a menu or some other area
|
|
|
|
|
;; down-mouse-1 was bound.
|
2023-11-15 12:58:46 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Gesture recognition will be inhibited in that case, so that
|
2023-11-16 13:07:01 +00:00
|
|
|
|
;; mouse menu or mouse motion events are generated in its place
|
|
|
|
|
;; as they would be were no ancillary tool ever pressed.
|
2023-11-15 12:58:46 +00:00
|
|
|
|
(when (and touch-screen-aux-tool
|
|
|
|
|
(eq (caadr event) (aref touch-screen-aux-tool 0)))
|
|
|
|
|
(setq touch-screen-aux-tool nil))
|
2023-07-16 07:30:01 +00:00
|
|
|
|
;; Throw to the key translation function.
|
|
|
|
|
(throw 'input-event nil)))))
|
|
|
|
|
|
|
|
|
|
;; Mark `mouse-drag-region' as ignored for the purposes of mouse click
|
|
|
|
|
;; emulation.
|
|
|
|
|
|
|
|
|
|
(put 'mouse-drag-region 'ignored-mouse-command t)
|
|
|
|
|
|
2024-06-17 04:11:25 +00:00
|
|
|
|
;;;###autoload
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(defun touch-screen-translate-touch (prompt)
|
|
|
|
|
"Translate touch screen events into a sequence of mouse events.
|
|
|
|
|
PROMPT is the prompt string given to `read-key-sequence', or nil
|
|
|
|
|
if this function is being called from the keyboard command loop.
|
|
|
|
|
Value is a new key sequence.
|
|
|
|
|
|
|
|
|
|
Read the touch screen event within `current-key-remap-sequence'
|
|
|
|
|
and give it to `touch-screen-handle-touch'. Return any key
|
|
|
|
|
sequence signaled.
|
|
|
|
|
|
|
|
|
|
If `touch-screen-handle-touch' does not signal for an event to be
|
|
|
|
|
returned after the last element of the key sequence is read,
|
|
|
|
|
continue reading touch screen events until
|
|
|
|
|
`touch-screen-handle-touch' signals. Return a sequence
|
|
|
|
|
consisting of the first event encountered that is not a touch
|
|
|
|
|
screen event.
|
|
|
|
|
|
|
|
|
|
In addition to non-touchscreen events read, key sequences
|
|
|
|
|
returned may contain any one of the following events:
|
|
|
|
|
|
|
|
|
|
(touchscreen-scroll WINDOW DX DY)
|
|
|
|
|
|
|
|
|
|
where WINDOW specifies a window to scroll, and DX and DY are
|
|
|
|
|
integers describing how many pixels to be scrolled horizontally
|
2023-07-16 12:10:18 +00:00
|
|
|
|
and vertically,
|
|
|
|
|
|
|
|
|
|
(touchscreen-hold POSN)
|
|
|
|
|
(touchscreen-drag POSN)
|
|
|
|
|
|
|
|
|
|
where POSN is the position of the long-press or touchpoint
|
|
|
|
|
motion,
|
2023-07-16 07:30:01 +00:00
|
|
|
|
|
2023-07-19 04:46:02 +00:00
|
|
|
|
(touchscreen-restart-drag POSN)
|
|
|
|
|
|
|
|
|
|
where POSN is the position of the tap,
|
|
|
|
|
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(down-mouse-1 POSN)
|
|
|
|
|
(drag-mouse-1 POSN)
|
|
|
|
|
|
2023-07-16 12:10:18 +00:00
|
|
|
|
where POSN is the position of the mouse button press or click,
|
2023-07-16 07:30:01 +00:00
|
|
|
|
|
|
|
|
|
(mouse-1 POSN)
|
|
|
|
|
(mouse-2 POSN)
|
|
|
|
|
|
|
|
|
|
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."
|
2023-07-16 09:29:58 +00:00
|
|
|
|
(unwind-protect
|
2023-07-16 07:30:01 +00:00
|
|
|
|
;; Save the virtual function key if this is a mode line event.
|
2023-07-21 07:20:45 +00:00
|
|
|
|
(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
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(aref current-key-remap-sequence 0)))
|
|
|
|
|
(touch-screen-translate-prompt prompt)
|
|
|
|
|
(event (catch 'input-event
|
|
|
|
|
;; First, process the one event already within
|
|
|
|
|
;; `current-key-remap-sequence'.
|
|
|
|
|
(touch-screen-handle-touch
|
|
|
|
|
(aref current-key-remap-sequence
|
2023-07-21 07:20:45 +00:00
|
|
|
|
(if prefix-specified 1 0))
|
2023-07-16 07:30:01 +00:00
|
|
|
|
prefix)
|
|
|
|
|
;; Next, continue reading input events.
|
|
|
|
|
(while t
|
|
|
|
|
(let ((event1 (read-event)))
|
|
|
|
|
;; If event1 is a virtual function key, make
|
|
|
|
|
;; it the new prefix.
|
2023-07-21 07:20:45 +00:00
|
|
|
|
(if (memq event1 '(mode-line tab-line nil
|
2023-07-22 02:45:36 +00:00
|
|
|
|
vertical-line
|
2023-07-16 07:30:01 +00:00
|
|
|
|
header-line tool-bar tab-bar
|
|
|
|
|
left-fringe right-fringe
|
|
|
|
|
left-margin right-margin
|
|
|
|
|
right-divider bottom-divider))
|
|
|
|
|
(setq prefix event1)
|
2023-07-17 01:46:37 +00:00
|
|
|
|
;; If event1 is not a touch screen event,
|
|
|
|
|
;; return it.
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(if (not (memq (car-safe event1)
|
|
|
|
|
'(touchscreen-begin
|
|
|
|
|
touchscreen-end
|
|
|
|
|
touchscreen-update)))
|
|
|
|
|
(throw 'input-event event1)
|
|
|
|
|
;; Process this event as well.
|
|
|
|
|
(touch-screen-handle-touch event1 prefix))))))))
|
|
|
|
|
;; Return a key sequence consisting of event
|
|
|
|
|
;; or an empty vector if it is nil, meaning that
|
|
|
|
|
;; no key events have been translated.
|
|
|
|
|
(if event (or (and prefix (consp event)
|
2023-07-17 04:58:29 +00:00
|
|
|
|
;; Only generate virtual function keys for
|
2024-06-01 13:27:51 +00:00
|
|
|
|
;; mouse events...
|
2023-07-17 04:58:29 +00:00
|
|
|
|
(memq (car event)
|
|
|
|
|
'(down-mouse-1 mouse-1
|
|
|
|
|
mouse-2 mouse-movement))
|
2024-06-01 13:27:51 +00:00
|
|
|
|
;; .. and provided that Emacs has never
|
|
|
|
|
;; previously encountered an event of this
|
|
|
|
|
;; description, so that its `event-kind'
|
|
|
|
|
;; property has yet to be initialized and
|
|
|
|
|
;; keyboard.c will not understand whether and
|
|
|
|
|
;; how to append a function key prefix.
|
|
|
|
|
(null (get (car event) 'event-kind))
|
2023-07-17 01:46:37 +00:00
|
|
|
|
;; If this is a mode line event, then
|
|
|
|
|
;; generate the appropriate function key.
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(vector prefix event))
|
|
|
|
|
(vector event))
|
2023-07-16 09:29:58 +00:00
|
|
|
|
""))
|
|
|
|
|
;; Cancel the touch screen long-press timer, if it is still there
|
|
|
|
|
;; by any chance. If the timer is to operate correctly, it must
|
|
|
|
|
;; fire within the catch block above.
|
|
|
|
|
(when touch-screen-current-timer
|
|
|
|
|
(cancel-timer touch-screen-current-timer)
|
|
|
|
|
(setq touch-screen-current-timer nil))))
|
2023-07-16 07:30:01 +00:00
|
|
|
|
|
|
|
|
|
(define-key function-key-map [touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [touchscreen-update]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
|
|
|
|
|
(define-key function-key-map [mode-line touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [mode-line touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
|
2023-07-17 01:46:37 +00:00
|
|
|
|
;; These are used to translate events sent from the internal border or
|
|
|
|
|
;; from outside the frame.
|
2023-07-16 12:10:18 +00:00
|
|
|
|
|
|
|
|
|
(define-key function-key-map [nil touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [nil touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
|
2023-07-16 07:30:01 +00:00
|
|
|
|
(define-key function-key-map [header-line touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [header-line touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
|
|
|
|
|
(define-key function-key-map [bottom-divider touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [bottom-divider touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
|
|
|
|
|
(define-key function-key-map [right-divider touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [right-divider touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
|
|
|
|
|
(define-key function-key-map [right-divider touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [right-divider touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
|
|
|
|
|
(define-key function-key-map [left-fringe touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [left-fringe touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
|
|
|
|
|
(define-key function-key-map [right-fringe touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [right-fringe touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
|
|
|
|
|
(define-key function-key-map [left-margin touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [left-margin touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
|
|
|
|
|
(define-key function-key-map [right-margin touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [right-margin touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
|
2023-07-17 04:58:29 +00:00
|
|
|
|
(define-key function-key-map [tool-bar touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [tool-bar touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
|
2023-07-21 07:20:45 +00:00
|
|
|
|
(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)
|
|
|
|
|
|
2023-07-22 02:45:36 +00:00
|
|
|
|
(define-key function-key-map [vertical-line touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [vertical-line touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
|
2023-07-21 07:20:45 +00:00
|
|
|
|
(define-key function-key-map [nil touchscreen-begin]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
(define-key function-key-map [nil touchscreen-end]
|
|
|
|
|
#'touch-screen-translate-touch)
|
|
|
|
|
|
Update Android port
* .gitignore: Add new files.
* INSTALL.android: Explain how to build Emacs for ancient
versions of Android.
* admin/merge-gnulib (GNULIB_MODULES): Add getdelim.
* build-aux/config.guess (timestamp, version):
* build-aux/config.sub (timestamp, version): Autoupdate.
* configure.ac (BUILD_DETAILS, ANDROID_MIN_SDK):
(ANDROID_STUBIFY): Allow specifying CFLAGS via ANDROID_CFLAGS.
Add new configure tests for Android API version when not
explicitly specified.
* doc/emacs/android.texi (Android): Add reference to ``Other
Input Devices''.
(Android File System): Remove restrictions on directory-files on
the assets directory.
* doc/emacs/emacs.texi (Top): Add Other Input Devices to menu.
* doc/emacs/input.texi (Other Input Devices): New node.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen input events.
* doc/lispref/frames.texi (Pop-Up Menus): Likewise.
* etc/NEWS: Announce changes.
* java/Makefile.in: Use lib-src/asset-directory-tool to generate
an `directory-tree' file placed in /assets.
* java/debug.sh: Large adjustments to support Android 2.2 and
later.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
* java/org/gnu/emacs/EmacsCopyArea.java (perform):
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog):
* java/org/gnu/emacs/EmacsDrawLine.java (perform):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsDrawable.java (EmacsDrawable):
* java/org/gnu/emacs/EmacsFillPolygon.java (perform):
* java/org/gnu/emacs/EmacsFillRectangle.java (perform):
* java/org/gnu/emacs/EmacsGC.java (EmacsGC):
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap):
(destroyHandle):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (draw): Avoid
redundant canvas saves and restores.
* java/org/gnu/emacs/EmacsService.java (run):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
(handleDirtyBitmap):
* java/org/gnu/emacs/EmacsWindow.java (changeWindowBackground)
(EmacsWindow): Make compatible with Android 2.2 and later.
* lib-src/Makefile.in (DONT_INSTALL): Add asset-directory-tool
on Android.:(asset-directory-tool{EXEEXT}): New target.
* lib-src/asset-directory-tool.c (struct directory_tree, xmalloc)
(main_1, main_2, main): New file.
* lib, m4: Merge from gnulib. This will be reverted before
merging to master.
* lisp/button.el (button-map):
(push-button):
* lisp/frame.el (display-popup-menus-p): Improve touchscreen
support.
* 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.
* src/alloc.c (make_lisp_symbol): Avoid ICE on Android NDK GCC.
(mark_pinned_symbols): Likewise.
* src/android.c (struct android_emacs_window): New struct.
(window_class): New variable.
(android_run_select_thread): Add workaround for Android platform
bug.
(android_extract_long, android_scan_directory_tree): New
functions.
(android_file_access_p): Use those functions instead.
(android_init_emacs_window): New function.
(android_init_emacs_gc_class): Update signature of `markDirty'.
(android_change_gc, android_set_clip_rectangles): Tell the GC
whether or not clip rects were dirtied.
(android_swap_buffers): Do not look up method every time.
(struct android_dir): Adjust for new directory tree lookup.
(android_opendir, android_readdir, android_closedir): Likewise.
(android_four_corners_bilinear): Fix coding style.
(android_ftruncate): New function.
* src/android.h: Update prototypes. Replace ftruncate with
android_ftruncate when necessary.
* src/androidterm.c (handle_one_android_event): Pacify GCC. Fix
touch screen tool bar bug.
* src/emacs.c (using_utf8): Fix compilation error.
* src/fileio.c (Ffile_system_info): Return Qnil when fsusage.o
is not built.
* src/filelock.c (BOOT_TIME_FILE): Fix definition for Android.
* src/frame.c (Fx_parse_geometry): Fix uninitialized variable
uses.
* src/keyboard.c (lispy_function_keys): Fix `back'.
* src/menu.c (x_popup_menu_1): Handle touch screen events.
(Fx_popup_menu): Document changes.
* src/sfnt.c (main): Improve tests.
* src/sfntfont-android.c (sfntfont_android_put_glyphs): Fix
minor problem.
(init_sfntfont_android): Check for
HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL.
* src/sfntfont.c (struct sfnt_font_desc): New fields `adstyle'
and `languages'.
(sfnt_parse_style): Append tokens to adstyle.
(sfnt_parse_languages): New function.
(sfnt_enum_font_1): Parse supported languages and adstyle.
(sfntfont_list_1): Handle new fields.
(sfntfont_text_extents): Fix uninitialized variable use.
(syms_of_sfntfont, mark_sfntfont): Adjust accordingly.
2023-01-19 14:19:06 +00:00
|
|
|
|
|
|
|
|
|
;; Exports. These functions are intended for use externally.
|
|
|
|
|
|
2023-12-06 02:34:41 +00:00
|
|
|
|
;;;###autoload
|
2023-11-11 10:03:33 +00:00
|
|
|
|
(defun touch-screen-track-tap (event &optional update data threshold)
|
Update Android port
* .gitignore: Add new files.
* INSTALL.android: Explain how to build Emacs for ancient
versions of Android.
* admin/merge-gnulib (GNULIB_MODULES): Add getdelim.
* build-aux/config.guess (timestamp, version):
* build-aux/config.sub (timestamp, version): Autoupdate.
* configure.ac (BUILD_DETAILS, ANDROID_MIN_SDK):
(ANDROID_STUBIFY): Allow specifying CFLAGS via ANDROID_CFLAGS.
Add new configure tests for Android API version when not
explicitly specified.
* doc/emacs/android.texi (Android): Add reference to ``Other
Input Devices''.
(Android File System): Remove restrictions on directory-files on
the assets directory.
* doc/emacs/emacs.texi (Top): Add Other Input Devices to menu.
* doc/emacs/input.texi (Other Input Devices): New node.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen input events.
* doc/lispref/frames.texi (Pop-Up Menus): Likewise.
* etc/NEWS: Announce changes.
* java/Makefile.in: Use lib-src/asset-directory-tool to generate
an `directory-tree' file placed in /assets.
* java/debug.sh: Large adjustments to support Android 2.2 and
later.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
* java/org/gnu/emacs/EmacsCopyArea.java (perform):
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog):
* java/org/gnu/emacs/EmacsDrawLine.java (perform):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsDrawable.java (EmacsDrawable):
* java/org/gnu/emacs/EmacsFillPolygon.java (perform):
* java/org/gnu/emacs/EmacsFillRectangle.java (perform):
* java/org/gnu/emacs/EmacsGC.java (EmacsGC):
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap):
(destroyHandle):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (draw): Avoid
redundant canvas saves and restores.
* java/org/gnu/emacs/EmacsService.java (run):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
(handleDirtyBitmap):
* java/org/gnu/emacs/EmacsWindow.java (changeWindowBackground)
(EmacsWindow): Make compatible with Android 2.2 and later.
* lib-src/Makefile.in (DONT_INSTALL): Add asset-directory-tool
on Android.:(asset-directory-tool{EXEEXT}): New target.
* lib-src/asset-directory-tool.c (struct directory_tree, xmalloc)
(main_1, main_2, main): New file.
* lib, m4: Merge from gnulib. This will be reverted before
merging to master.
* lisp/button.el (button-map):
(push-button):
* lisp/frame.el (display-popup-menus-p): Improve touchscreen
support.
* 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.
* src/alloc.c (make_lisp_symbol): Avoid ICE on Android NDK GCC.
(mark_pinned_symbols): Likewise.
* src/android.c (struct android_emacs_window): New struct.
(window_class): New variable.
(android_run_select_thread): Add workaround for Android platform
bug.
(android_extract_long, android_scan_directory_tree): New
functions.
(android_file_access_p): Use those functions instead.
(android_init_emacs_window): New function.
(android_init_emacs_gc_class): Update signature of `markDirty'.
(android_change_gc, android_set_clip_rectangles): Tell the GC
whether or not clip rects were dirtied.
(android_swap_buffers): Do not look up method every time.
(struct android_dir): Adjust for new directory tree lookup.
(android_opendir, android_readdir, android_closedir): Likewise.
(android_four_corners_bilinear): Fix coding style.
(android_ftruncate): New function.
* src/android.h: Update prototypes. Replace ftruncate with
android_ftruncate when necessary.
* src/androidterm.c (handle_one_android_event): Pacify GCC. Fix
touch screen tool bar bug.
* src/emacs.c (using_utf8): Fix compilation error.
* src/fileio.c (Ffile_system_info): Return Qnil when fsusage.o
is not built.
* src/filelock.c (BOOT_TIME_FILE): Fix definition for Android.
* src/frame.c (Fx_parse_geometry): Fix uninitialized variable
uses.
* src/keyboard.c (lispy_function_keys): Fix `back'.
* src/menu.c (x_popup_menu_1): Handle touch screen events.
(Fx_popup_menu): Document changes.
* src/sfnt.c (main): Improve tests.
* src/sfntfont-android.c (sfntfont_android_put_glyphs): Fix
minor problem.
(init_sfntfont_android): Check for
HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL.
* src/sfntfont.c (struct sfnt_font_desc): New fields `adstyle'
and `languages'.
(sfnt_parse_style): Append tokens to adstyle.
(sfnt_parse_languages): New function.
(sfnt_enum_font_1): Parse supported languages and adstyle.
(sfntfont_list_1): Handle new fields.
(sfntfont_text_extents): Fix uninitialized variable use.
(syms_of_sfntfont, mark_sfntfont): Adjust accordingly.
2023-01-19 14:19:06 +00:00
|
|
|
|
"Track a single tap starting from EVENT.
|
|
|
|
|
EVENT should be a `touchscreen-begin' event.
|
|
|
|
|
|
|
|
|
|
Read touch screen events until a `touchscreen-end' event is
|
|
|
|
|
received with the same ID as in EVENT. If UPDATE is non-nil and
|
|
|
|
|
a `touchscreen-update' event is received in the mean time and
|
|
|
|
|
contains a touch point with the same ID as in EVENT, call UPDATE
|
|
|
|
|
with that event and DATA.
|
|
|
|
|
|
2023-11-11 10:03:33 +00:00
|
|
|
|
If THRESHOLD is non-nil, enforce a threshold of movement that is
|
2023-11-11 10:05:35 +00:00
|
|
|
|
either itself or 10 pixels when it is not a number. If the
|
2023-12-10 12:22:04 +00:00
|
|
|
|
aforementioned touch point moves beyond that threshold on any
|
2023-11-11 10:05:35 +00:00
|
|
|
|
axis, return nil immediately, and further resume mouse event
|
|
|
|
|
translation for the touch point at hand.
|
2023-11-11 10:03:33 +00:00
|
|
|
|
|
Update Android port
* .gitignore: Add new files.
* INSTALL.android: Explain how to build Emacs for ancient
versions of Android.
* admin/merge-gnulib (GNULIB_MODULES): Add getdelim.
* build-aux/config.guess (timestamp, version):
* build-aux/config.sub (timestamp, version): Autoupdate.
* configure.ac (BUILD_DETAILS, ANDROID_MIN_SDK):
(ANDROID_STUBIFY): Allow specifying CFLAGS via ANDROID_CFLAGS.
Add new configure tests for Android API version when not
explicitly specified.
* doc/emacs/android.texi (Android): Add reference to ``Other
Input Devices''.
(Android File System): Remove restrictions on directory-files on
the assets directory.
* doc/emacs/emacs.texi (Top): Add Other Input Devices to menu.
* doc/emacs/input.texi (Other Input Devices): New node.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen input events.
* doc/lispref/frames.texi (Pop-Up Menus): Likewise.
* etc/NEWS: Announce changes.
* java/Makefile.in: Use lib-src/asset-directory-tool to generate
an `directory-tree' file placed in /assets.
* java/debug.sh: Large adjustments to support Android 2.2 and
later.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
* java/org/gnu/emacs/EmacsCopyArea.java (perform):
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog):
* java/org/gnu/emacs/EmacsDrawLine.java (perform):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsDrawable.java (EmacsDrawable):
* java/org/gnu/emacs/EmacsFillPolygon.java (perform):
* java/org/gnu/emacs/EmacsFillRectangle.java (perform):
* java/org/gnu/emacs/EmacsGC.java (EmacsGC):
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap):
(destroyHandle):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (draw): Avoid
redundant canvas saves and restores.
* java/org/gnu/emacs/EmacsService.java (run):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
(handleDirtyBitmap):
* java/org/gnu/emacs/EmacsWindow.java (changeWindowBackground)
(EmacsWindow): Make compatible with Android 2.2 and later.
* lib-src/Makefile.in (DONT_INSTALL): Add asset-directory-tool
on Android.:(asset-directory-tool{EXEEXT}): New target.
* lib-src/asset-directory-tool.c (struct directory_tree, xmalloc)
(main_1, main_2, main): New file.
* lib, m4: Merge from gnulib. This will be reverted before
merging to master.
* lisp/button.el (button-map):
(push-button):
* lisp/frame.el (display-popup-menus-p): Improve touchscreen
support.
* 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.
* src/alloc.c (make_lisp_symbol): Avoid ICE on Android NDK GCC.
(mark_pinned_symbols): Likewise.
* src/android.c (struct android_emacs_window): New struct.
(window_class): New variable.
(android_run_select_thread): Add workaround for Android platform
bug.
(android_extract_long, android_scan_directory_tree): New
functions.
(android_file_access_p): Use those functions instead.
(android_init_emacs_window): New function.
(android_init_emacs_gc_class): Update signature of `markDirty'.
(android_change_gc, android_set_clip_rectangles): Tell the GC
whether or not clip rects were dirtied.
(android_swap_buffers): Do not look up method every time.
(struct android_dir): Adjust for new directory tree lookup.
(android_opendir, android_readdir, android_closedir): Likewise.
(android_four_corners_bilinear): Fix coding style.
(android_ftruncate): New function.
* src/android.h: Update prototypes. Replace ftruncate with
android_ftruncate when necessary.
* src/androidterm.c (handle_one_android_event): Pacify GCC. Fix
touch screen tool bar bug.
* src/emacs.c (using_utf8): Fix compilation error.
* src/fileio.c (Ffile_system_info): Return Qnil when fsusage.o
is not built.
* src/filelock.c (BOOT_TIME_FILE): Fix definition for Android.
* src/frame.c (Fx_parse_geometry): Fix uninitialized variable
uses.
* src/keyboard.c (lispy_function_keys): Fix `back'.
* src/menu.c (x_popup_menu_1): Handle touch screen events.
(Fx_popup_menu): Document changes.
* src/sfnt.c (main): Improve tests.
* src/sfntfont-android.c (sfntfont_android_put_glyphs): Fix
minor problem.
(init_sfntfont_android): Check for
HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL.
* src/sfntfont.c (struct sfnt_font_desc): New fields `adstyle'
and `languages'.
(sfnt_parse_style): Append tokens to adstyle.
(sfnt_parse_languages): New function.
(sfnt_enum_font_1): Parse supported languages and adstyle.
(sfntfont_list_1): Handle new fields.
(sfntfont_text_extents): Fix uninitialized variable use.
(syms_of_sfntfont, mark_sfntfont): Adjust accordingly.
2023-01-19 14:19:06 +00:00
|
|
|
|
Return nil immediately if any other kind of event is received;
|
|
|
|
|
otherwise, return t once the `touchscreen-end' event arrives."
|
2023-11-11 10:03:33 +00:00
|
|
|
|
(let ((disable-inhibit-text-conversion t)
|
|
|
|
|
(threshold (and threshold (or (and (numberp threshold)
|
|
|
|
|
threshold)
|
|
|
|
|
10)))
|
|
|
|
|
(original-x-y (posn-x-y (cdadr event)))
|
|
|
|
|
(original-window (posn-window (cdadr event))))
|
2023-03-15 01:46:01 +00:00
|
|
|
|
(catch 'finish
|
|
|
|
|
(while t
|
2023-11-11 10:03:33 +00:00
|
|
|
|
(let ((new-event (read-event nil))
|
|
|
|
|
touch-point)
|
2023-03-15 01:46:01 +00:00
|
|
|
|
(cond
|
|
|
|
|
((eq (car-safe new-event) 'touchscreen-update)
|
2023-11-11 10:03:33 +00:00
|
|
|
|
(when (setq touch-point (assq (caadr event) (cadr new-event)))
|
|
|
|
|
(when update
|
|
|
|
|
(funcall update new-event data))
|
|
|
|
|
(when threshold
|
|
|
|
|
(setq touch-point (cdr touch-point))
|
|
|
|
|
;; Detect the touch point moving past the threshold.
|
|
|
|
|
(let* ((x-y (touch-screen-relative-xy touch-point
|
|
|
|
|
original-window))
|
|
|
|
|
(x (car x-y)) (y (cdr x-y)))
|
|
|
|
|
(when (or (> (abs (- x (car original-x-y))) threshold)
|
|
|
|
|
(> (abs (- y (cdr original-x-y))) threshold))
|
|
|
|
|
;; Resume normal touch-screen to mouse event
|
|
|
|
|
;; translation for this touch sequence by
|
|
|
|
|
;; supplying both the event starting it and the
|
|
|
|
|
;; motion event that overstepped the threshold to
|
|
|
|
|
;; touch-screen-handle-touch.
|
|
|
|
|
(touch-screen-handle-touch event nil t)
|
|
|
|
|
(touch-screen-handle-touch new-event nil t)
|
|
|
|
|
(throw 'finish nil))))))
|
2023-03-15 01:46:01 +00:00
|
|
|
|
((eq (car-safe new-event) 'touchscreen-end)
|
|
|
|
|
(throw 'finish
|
|
|
|
|
;; Now determine whether or not the `touchscreen-end'
|
|
|
|
|
;; event has the same ID as EVENT. If it doesn't,
|
|
|
|
|
;; then this is another touch, so return nil.
|
|
|
|
|
(eq (caadr event) (caadr new-event))))
|
|
|
|
|
(t (throw 'finish nil))))))))
|
Update Android port
* .gitignore: Add new files.
* INSTALL.android: Explain how to build Emacs for ancient
versions of Android.
* admin/merge-gnulib (GNULIB_MODULES): Add getdelim.
* build-aux/config.guess (timestamp, version):
* build-aux/config.sub (timestamp, version): Autoupdate.
* configure.ac (BUILD_DETAILS, ANDROID_MIN_SDK):
(ANDROID_STUBIFY): Allow specifying CFLAGS via ANDROID_CFLAGS.
Add new configure tests for Android API version when not
explicitly specified.
* doc/emacs/android.texi (Android): Add reference to ``Other
Input Devices''.
(Android File System): Remove restrictions on directory-files on
the assets directory.
* doc/emacs/emacs.texi (Top): Add Other Input Devices to menu.
* doc/emacs/input.texi (Other Input Devices): New node.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen input events.
* doc/lispref/frames.texi (Pop-Up Menus): Likewise.
* etc/NEWS: Announce changes.
* java/Makefile.in: Use lib-src/asset-directory-tool to generate
an `directory-tree' file placed in /assets.
* java/debug.sh: Large adjustments to support Android 2.2 and
later.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
* java/org/gnu/emacs/EmacsCopyArea.java (perform):
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog):
* java/org/gnu/emacs/EmacsDrawLine.java (perform):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsDrawable.java (EmacsDrawable):
* java/org/gnu/emacs/EmacsFillPolygon.java (perform):
* java/org/gnu/emacs/EmacsFillRectangle.java (perform):
* java/org/gnu/emacs/EmacsGC.java (EmacsGC):
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap):
(destroyHandle):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (draw): Avoid
redundant canvas saves and restores.
* java/org/gnu/emacs/EmacsService.java (run):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
(handleDirtyBitmap):
* java/org/gnu/emacs/EmacsWindow.java (changeWindowBackground)
(EmacsWindow): Make compatible with Android 2.2 and later.
* lib-src/Makefile.in (DONT_INSTALL): Add asset-directory-tool
on Android.:(asset-directory-tool{EXEEXT}): New target.
* lib-src/asset-directory-tool.c (struct directory_tree, xmalloc)
(main_1, main_2, main): New file.
* lib, m4: Merge from gnulib. This will be reverted before
merging to master.
* lisp/button.el (button-map):
(push-button):
* lisp/frame.el (display-popup-menus-p): Improve touchscreen
support.
* 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.
* src/alloc.c (make_lisp_symbol): Avoid ICE on Android NDK GCC.
(mark_pinned_symbols): Likewise.
* src/android.c (struct android_emacs_window): New struct.
(window_class): New variable.
(android_run_select_thread): Add workaround for Android platform
bug.
(android_extract_long, android_scan_directory_tree): New
functions.
(android_file_access_p): Use those functions instead.
(android_init_emacs_window): New function.
(android_init_emacs_gc_class): Update signature of `markDirty'.
(android_change_gc, android_set_clip_rectangles): Tell the GC
whether or not clip rects were dirtied.
(android_swap_buffers): Do not look up method every time.
(struct android_dir): Adjust for new directory tree lookup.
(android_opendir, android_readdir, android_closedir): Likewise.
(android_four_corners_bilinear): Fix coding style.
(android_ftruncate): New function.
* src/android.h: Update prototypes. Replace ftruncate with
android_ftruncate when necessary.
* src/androidterm.c (handle_one_android_event): Pacify GCC. Fix
touch screen tool bar bug.
* src/emacs.c (using_utf8): Fix compilation error.
* src/fileio.c (Ffile_system_info): Return Qnil when fsusage.o
is not built.
* src/filelock.c (BOOT_TIME_FILE): Fix definition for Android.
* src/frame.c (Fx_parse_geometry): Fix uninitialized variable
uses.
* src/keyboard.c (lispy_function_keys): Fix `back'.
* src/menu.c (x_popup_menu_1): Handle touch screen events.
(Fx_popup_menu): Document changes.
* src/sfnt.c (main): Improve tests.
* src/sfntfont-android.c (sfntfont_android_put_glyphs): Fix
minor problem.
(init_sfntfont_android): Check for
HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL.
* src/sfntfont.c (struct sfnt_font_desc): New fields `adstyle'
and `languages'.
(sfnt_parse_style): Append tokens to adstyle.
(sfnt_parse_languages): New function.
(sfnt_enum_font_1): Parse supported languages and adstyle.
(sfntfont_list_1): Handle new fields.
(sfntfont_text_extents): Fix uninitialized variable use.
(syms_of_sfntfont, mark_sfntfont): Adjust accordingly.
2023-01-19 14:19:06 +00:00
|
|
|
|
|
2023-12-06 02:34:41 +00:00
|
|
|
|
;;;###autoload
|
Update Android port
* .gitignore: Add new files.
* INSTALL.android: Explain how to build Emacs for ancient
versions of Android.
* admin/merge-gnulib (GNULIB_MODULES): Add getdelim.
* build-aux/config.guess (timestamp, version):
* build-aux/config.sub (timestamp, version): Autoupdate.
* configure.ac (BUILD_DETAILS, ANDROID_MIN_SDK):
(ANDROID_STUBIFY): Allow specifying CFLAGS via ANDROID_CFLAGS.
Add new configure tests for Android API version when not
explicitly specified.
* doc/emacs/android.texi (Android): Add reference to ``Other
Input Devices''.
(Android File System): Remove restrictions on directory-files on
the assets directory.
* doc/emacs/emacs.texi (Top): Add Other Input Devices to menu.
* doc/emacs/input.texi (Other Input Devices): New node.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen input events.
* doc/lispref/frames.texi (Pop-Up Menus): Likewise.
* etc/NEWS: Announce changes.
* java/Makefile.in: Use lib-src/asset-directory-tool to generate
an `directory-tree' file placed in /assets.
* java/debug.sh: Large adjustments to support Android 2.2 and
later.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
* java/org/gnu/emacs/EmacsCopyArea.java (perform):
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog):
* java/org/gnu/emacs/EmacsDrawLine.java (perform):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsDrawable.java (EmacsDrawable):
* java/org/gnu/emacs/EmacsFillPolygon.java (perform):
* java/org/gnu/emacs/EmacsFillRectangle.java (perform):
* java/org/gnu/emacs/EmacsGC.java (EmacsGC):
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap):
(destroyHandle):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (draw): Avoid
redundant canvas saves and restores.
* java/org/gnu/emacs/EmacsService.java (run):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
(handleDirtyBitmap):
* java/org/gnu/emacs/EmacsWindow.java (changeWindowBackground)
(EmacsWindow): Make compatible with Android 2.2 and later.
* lib-src/Makefile.in (DONT_INSTALL): Add asset-directory-tool
on Android.:(asset-directory-tool{EXEEXT}): New target.
* lib-src/asset-directory-tool.c (struct directory_tree, xmalloc)
(main_1, main_2, main): New file.
* lib, m4: Merge from gnulib. This will be reverted before
merging to master.
* lisp/button.el (button-map):
(push-button):
* lisp/frame.el (display-popup-menus-p): Improve touchscreen
support.
* 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.
* src/alloc.c (make_lisp_symbol): Avoid ICE on Android NDK GCC.
(mark_pinned_symbols): Likewise.
* src/android.c (struct android_emacs_window): New struct.
(window_class): New variable.
(android_run_select_thread): Add workaround for Android platform
bug.
(android_extract_long, android_scan_directory_tree): New
functions.
(android_file_access_p): Use those functions instead.
(android_init_emacs_window): New function.
(android_init_emacs_gc_class): Update signature of `markDirty'.
(android_change_gc, android_set_clip_rectangles): Tell the GC
whether or not clip rects were dirtied.
(android_swap_buffers): Do not look up method every time.
(struct android_dir): Adjust for new directory tree lookup.
(android_opendir, android_readdir, android_closedir): Likewise.
(android_four_corners_bilinear): Fix coding style.
(android_ftruncate): New function.
* src/android.h: Update prototypes. Replace ftruncate with
android_ftruncate when necessary.
* src/androidterm.c (handle_one_android_event): Pacify GCC. Fix
touch screen tool bar bug.
* src/emacs.c (using_utf8): Fix compilation error.
* src/fileio.c (Ffile_system_info): Return Qnil when fsusage.o
is not built.
* src/filelock.c (BOOT_TIME_FILE): Fix definition for Android.
* src/frame.c (Fx_parse_geometry): Fix uninitialized variable
uses.
* src/keyboard.c (lispy_function_keys): Fix `back'.
* src/menu.c (x_popup_menu_1): Handle touch screen events.
(Fx_popup_menu): Document changes.
* src/sfnt.c (main): Improve tests.
* src/sfntfont-android.c (sfntfont_android_put_glyphs): Fix
minor problem.
(init_sfntfont_android): Check for
HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL.
* src/sfntfont.c (struct sfnt_font_desc): New fields `adstyle'
and `languages'.
(sfnt_parse_style): Append tokens to adstyle.
(sfnt_parse_languages): New function.
(sfnt_enum_font_1): Parse supported languages and adstyle.
(sfntfont_list_1): Handle new fields.
(sfntfont_text_extents): Fix uninitialized variable use.
(syms_of_sfntfont, mark_sfntfont): Adjust accordingly.
2023-01-19 14:19:06 +00:00
|
|
|
|
(defun touch-screen-track-drag (event update &optional data)
|
|
|
|
|
"Track a single drag starting from EVENT.
|
2023-05-16 07:54:50 +00:00
|
|
|
|
EVENT should be a `touchscreen-begin' event.
|
Update Android port
* .gitignore: Add new files.
* INSTALL.android: Explain how to build Emacs for ancient
versions of Android.
* admin/merge-gnulib (GNULIB_MODULES): Add getdelim.
* build-aux/config.guess (timestamp, version):
* build-aux/config.sub (timestamp, version): Autoupdate.
* configure.ac (BUILD_DETAILS, ANDROID_MIN_SDK):
(ANDROID_STUBIFY): Allow specifying CFLAGS via ANDROID_CFLAGS.
Add new configure tests for Android API version when not
explicitly specified.
* doc/emacs/android.texi (Android): Add reference to ``Other
Input Devices''.
(Android File System): Remove restrictions on directory-files on
the assets directory.
* doc/emacs/emacs.texi (Top): Add Other Input Devices to menu.
* doc/emacs/input.texi (Other Input Devices): New node.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen input events.
* doc/lispref/frames.texi (Pop-Up Menus): Likewise.
* etc/NEWS: Announce changes.
* java/Makefile.in: Use lib-src/asset-directory-tool to generate
an `directory-tree' file placed in /assets.
* java/debug.sh: Large adjustments to support Android 2.2 and
later.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
* java/org/gnu/emacs/EmacsCopyArea.java (perform):
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog):
* java/org/gnu/emacs/EmacsDrawLine.java (perform):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsDrawable.java (EmacsDrawable):
* java/org/gnu/emacs/EmacsFillPolygon.java (perform):
* java/org/gnu/emacs/EmacsFillRectangle.java (perform):
* java/org/gnu/emacs/EmacsGC.java (EmacsGC):
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap):
(destroyHandle):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (draw): Avoid
redundant canvas saves and restores.
* java/org/gnu/emacs/EmacsService.java (run):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
(handleDirtyBitmap):
* java/org/gnu/emacs/EmacsWindow.java (changeWindowBackground)
(EmacsWindow): Make compatible with Android 2.2 and later.
* lib-src/Makefile.in (DONT_INSTALL): Add asset-directory-tool
on Android.:(asset-directory-tool{EXEEXT}): New target.
* lib-src/asset-directory-tool.c (struct directory_tree, xmalloc)
(main_1, main_2, main): New file.
* lib, m4: Merge from gnulib. This will be reverted before
merging to master.
* lisp/button.el (button-map):
(push-button):
* lisp/frame.el (display-popup-menus-p): Improve touchscreen
support.
* 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.
* src/alloc.c (make_lisp_symbol): Avoid ICE on Android NDK GCC.
(mark_pinned_symbols): Likewise.
* src/android.c (struct android_emacs_window): New struct.
(window_class): New variable.
(android_run_select_thread): Add workaround for Android platform
bug.
(android_extract_long, android_scan_directory_tree): New
functions.
(android_file_access_p): Use those functions instead.
(android_init_emacs_window): New function.
(android_init_emacs_gc_class): Update signature of `markDirty'.
(android_change_gc, android_set_clip_rectangles): Tell the GC
whether or not clip rects were dirtied.
(android_swap_buffers): Do not look up method every time.
(struct android_dir): Adjust for new directory tree lookup.
(android_opendir, android_readdir, android_closedir): Likewise.
(android_four_corners_bilinear): Fix coding style.
(android_ftruncate): New function.
* src/android.h: Update prototypes. Replace ftruncate with
android_ftruncate when necessary.
* src/androidterm.c (handle_one_android_event): Pacify GCC. Fix
touch screen tool bar bug.
* src/emacs.c (using_utf8): Fix compilation error.
* src/fileio.c (Ffile_system_info): Return Qnil when fsusage.o
is not built.
* src/filelock.c (BOOT_TIME_FILE): Fix definition for Android.
* src/frame.c (Fx_parse_geometry): Fix uninitialized variable
uses.
* src/keyboard.c (lispy_function_keys): Fix `back'.
* src/menu.c (x_popup_menu_1): Handle touch screen events.
(Fx_popup_menu): Document changes.
* src/sfnt.c (main): Improve tests.
* src/sfntfont-android.c (sfntfont_android_put_glyphs): Fix
minor problem.
(init_sfntfont_android): Check for
HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL.
* src/sfntfont.c (struct sfnt_font_desc): New fields `adstyle'
and `languages'.
(sfnt_parse_style): Append tokens to adstyle.
(sfnt_parse_languages): New function.
(sfnt_enum_font_1): Parse supported languages and adstyle.
(sfntfont_list_1): Handle new fields.
(sfntfont_text_extents): Fix uninitialized variable use.
(syms_of_sfntfont, mark_sfntfont): Adjust accordingly.
2023-01-19 14:19:06 +00:00
|
|
|
|
|
|
|
|
|
Read touch screen events until a `touchscreen-end' event is
|
|
|
|
|
received with the same ID as in EVENT. For each
|
|
|
|
|
`touchscreen-update' event received in the mean time containing a
|
|
|
|
|
touch point with the same ID as in EVENT, call UPDATE with the
|
2023-01-21 13:46:32 +00:00
|
|
|
|
touch point in event and DATA, once the touch point has moved
|
|
|
|
|
significantly by at least 5 pixels from where it was in EVENT.
|
Update Android port
* .gitignore: Add new files.
* INSTALL.android: Explain how to build Emacs for ancient
versions of Android.
* admin/merge-gnulib (GNULIB_MODULES): Add getdelim.
* build-aux/config.guess (timestamp, version):
* build-aux/config.sub (timestamp, version): Autoupdate.
* configure.ac (BUILD_DETAILS, ANDROID_MIN_SDK):
(ANDROID_STUBIFY): Allow specifying CFLAGS via ANDROID_CFLAGS.
Add new configure tests for Android API version when not
explicitly specified.
* doc/emacs/android.texi (Android): Add reference to ``Other
Input Devices''.
(Android File System): Remove restrictions on directory-files on
the assets directory.
* doc/emacs/emacs.texi (Top): Add Other Input Devices to menu.
* doc/emacs/input.texi (Other Input Devices): New node.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen input events.
* doc/lispref/frames.texi (Pop-Up Menus): Likewise.
* etc/NEWS: Announce changes.
* java/Makefile.in: Use lib-src/asset-directory-tool to generate
an `directory-tree' file placed in /assets.
* java/debug.sh: Large adjustments to support Android 2.2 and
later.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
* java/org/gnu/emacs/EmacsCopyArea.java (perform):
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog):
* java/org/gnu/emacs/EmacsDrawLine.java (perform):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsDrawable.java (EmacsDrawable):
* java/org/gnu/emacs/EmacsFillPolygon.java (perform):
* java/org/gnu/emacs/EmacsFillRectangle.java (perform):
* java/org/gnu/emacs/EmacsGC.java (EmacsGC):
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap):
(destroyHandle):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (draw): Avoid
redundant canvas saves and restores.
* java/org/gnu/emacs/EmacsService.java (run):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
(handleDirtyBitmap):
* java/org/gnu/emacs/EmacsWindow.java (changeWindowBackground)
(EmacsWindow): Make compatible with Android 2.2 and later.
* lib-src/Makefile.in (DONT_INSTALL): Add asset-directory-tool
on Android.:(asset-directory-tool{EXEEXT}): New target.
* lib-src/asset-directory-tool.c (struct directory_tree, xmalloc)
(main_1, main_2, main): New file.
* lib, m4: Merge from gnulib. This will be reverted before
merging to master.
* lisp/button.el (button-map):
(push-button):
* lisp/frame.el (display-popup-menus-p): Improve touchscreen
support.
* 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.
* src/alloc.c (make_lisp_symbol): Avoid ICE on Android NDK GCC.
(mark_pinned_symbols): Likewise.
* src/android.c (struct android_emacs_window): New struct.
(window_class): New variable.
(android_run_select_thread): Add workaround for Android platform
bug.
(android_extract_long, android_scan_directory_tree): New
functions.
(android_file_access_p): Use those functions instead.
(android_init_emacs_window): New function.
(android_init_emacs_gc_class): Update signature of `markDirty'.
(android_change_gc, android_set_clip_rectangles): Tell the GC
whether or not clip rects were dirtied.
(android_swap_buffers): Do not look up method every time.
(struct android_dir): Adjust for new directory tree lookup.
(android_opendir, android_readdir, android_closedir): Likewise.
(android_four_corners_bilinear): Fix coding style.
(android_ftruncate): New function.
* src/android.h: Update prototypes. Replace ftruncate with
android_ftruncate when necessary.
* src/androidterm.c (handle_one_android_event): Pacify GCC. Fix
touch screen tool bar bug.
* src/emacs.c (using_utf8): Fix compilation error.
* src/fileio.c (Ffile_system_info): Return Qnil when fsusage.o
is not built.
* src/filelock.c (BOOT_TIME_FILE): Fix definition for Android.
* src/frame.c (Fx_parse_geometry): Fix uninitialized variable
uses.
* src/keyboard.c (lispy_function_keys): Fix `back'.
* src/menu.c (x_popup_menu_1): Handle touch screen events.
(Fx_popup_menu): Document changes.
* src/sfnt.c (main): Improve tests.
* src/sfntfont-android.c (sfntfont_android_put_glyphs): Fix
minor problem.
(init_sfntfont_android): Check for
HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL.
* src/sfntfont.c (struct sfnt_font_desc): New fields `adstyle'
and `languages'.
(sfnt_parse_style): Append tokens to adstyle.
(sfnt_parse_languages): New function.
(sfnt_enum_font_1): Parse supported languages and adstyle.
(sfntfont_list_1): Handle new fields.
(sfntfont_text_extents): Fix uninitialized variable use.
(syms_of_sfntfont, mark_sfntfont): Adjust accordingly.
2023-01-19 14:19:06 +00:00
|
|
|
|
|
|
|
|
|
Return nil immediately if any other kind of event is received;
|
Update Android port
* .gitignore: Don't ignore verbose.mk.android.
* doc/emacs/Makefile.in (EMACSSOURCES): Add android.texi and
input.texi.
* doc/emacs/android.texi (Android): Document support for the
on-screen keyboard.
(Android Startup): Document how to start Emacs with -Q on
Android.
(Android Environment): Document how Emacs works around the
system ``task killer''. Document changes to frame deletion
behavior.
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices, On-Screen
Keyboards): Document how to use Emacs with virtual keyboards.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to `touch-screen-track-drag'.
* doc/lispref/frames.texi (Frames, On-Screen Keyboards): New
node.
* java/AndroidManifest.xml.in: Add settings activity and
appropriate OSK adjustment mode.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Allow
creating Emacs with -Q.
(onDestroy): Don't remove if killed by the system.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
Fix context menus again.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Make all
event sending functions return long.
* java/org/gnu/emacs/EmacsPreferencesActivity.java
(EmacsPreferencesActivity): New class.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(onStartCommand, onCreate, startEmacsService): Start as a
foreground service if necessary to bypass system restrictions.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsThread.java (EmacsThread, run):
* java/org/gnu/emacs/EmacsView.java (EmacsView, onLayout)
(onDetachedFromWindow):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, viewLayout):
Implement frame resize synchronization..
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager, removeWindowConsumer): Adjust
accordingly for changes to frame deletion behavior.
* lisp/frame.el (android-toggle-on-screen-keyboard)
(frame-toggle-on-screen-keyboard): New function.
* lisp/minibuffer.el (minibuffer-setup-on-screen-keyboard)
(minibuffer-exit-on-screen-keyboard): New functions.
(minibuffer-setup-hook, minibuffer-exit-hook): Add new functions
to hooks.
* lisp/touch-screen.el (touch-screen-relative-xy): Accept new
value of window `frame'. Return frame coordinates in that case.
(touch-screen-set-point-commands): New variable.
(touch-screen-handle-point-up): Respect that variable.
(touch-screen-track-drag): Return `no-drag' where appropriate.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line):
Refactor to use `no-drag'.
* src/android.c (struct android_emacs_window): New methods.
Make all event sending functions return the event serial.
(android_toggle_on_screen_keyboard, android_window_updated): New
functions.
* src/android.h: Update prototypes.
* src/androidfns.c (Fandroid_toggle_on_screen_keyboard)
(syms_of_androidfns): New function.
* src/androidgui.h (struct android_any_event)
(struct android_key_event, struct android_configure_event)
(struct android_focus_event, struct android_window_action_event)
(struct android_crossing_event, struct android_motion_event)
(struct android_button_event, struct android_touch_event)
(struct android_wheel_event, struct android_iconify_event)
(struct android_menu_event): Add `serial' fields.
* src/androidterm.c (handle_one_android_event)
(android_frame_up_to_date):
* src/androidterm.h (struct android_output): Implement frame
resize synchronization.
2023-01-20 11:06:32 +00:00
|
|
|
|
otherwise, return either t or `no-drag' once the
|
|
|
|
|
`touchscreen-end' event arrives; return `no-drag' returned if the
|
|
|
|
|
touch point in EVENT did not move significantly, and t otherwise."
|
|
|
|
|
(let ((return-value 'no-drag)
|
|
|
|
|
(start-xy (touch-screen-relative-xy (cdadr event)
|
2023-03-15 01:46:01 +00:00
|
|
|
|
'frame))
|
|
|
|
|
(disable-inhibit-text-conversion t))
|
Update Android port
* .gitignore: Don't ignore verbose.mk.android.
* doc/emacs/Makefile.in (EMACSSOURCES): Add android.texi and
input.texi.
* doc/emacs/android.texi (Android): Document support for the
on-screen keyboard.
(Android Startup): Document how to start Emacs with -Q on
Android.
(Android Environment): Document how Emacs works around the
system ``task killer''. Document changes to frame deletion
behavior.
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices, On-Screen
Keyboards): Document how to use Emacs with virtual keyboards.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to `touch-screen-track-drag'.
* doc/lispref/frames.texi (Frames, On-Screen Keyboards): New
node.
* java/AndroidManifest.xml.in: Add settings activity and
appropriate OSK adjustment mode.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Allow
creating Emacs with -Q.
(onDestroy): Don't remove if killed by the system.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
Fix context menus again.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Make all
event sending functions return long.
* java/org/gnu/emacs/EmacsPreferencesActivity.java
(EmacsPreferencesActivity): New class.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(onStartCommand, onCreate, startEmacsService): Start as a
foreground service if necessary to bypass system restrictions.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsThread.java (EmacsThread, run):
* java/org/gnu/emacs/EmacsView.java (EmacsView, onLayout)
(onDetachedFromWindow):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, viewLayout):
Implement frame resize synchronization..
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager, removeWindowConsumer): Adjust
accordingly for changes to frame deletion behavior.
* lisp/frame.el (android-toggle-on-screen-keyboard)
(frame-toggle-on-screen-keyboard): New function.
* lisp/minibuffer.el (minibuffer-setup-on-screen-keyboard)
(minibuffer-exit-on-screen-keyboard): New functions.
(minibuffer-setup-hook, minibuffer-exit-hook): Add new functions
to hooks.
* lisp/touch-screen.el (touch-screen-relative-xy): Accept new
value of window `frame'. Return frame coordinates in that case.
(touch-screen-set-point-commands): New variable.
(touch-screen-handle-point-up): Respect that variable.
(touch-screen-track-drag): Return `no-drag' where appropriate.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line):
Refactor to use `no-drag'.
* src/android.c (struct android_emacs_window): New methods.
Make all event sending functions return the event serial.
(android_toggle_on_screen_keyboard, android_window_updated): New
functions.
* src/android.h: Update prototypes.
* src/androidfns.c (Fandroid_toggle_on_screen_keyboard)
(syms_of_androidfns): New function.
* src/androidgui.h (struct android_any_event)
(struct android_key_event, struct android_configure_event)
(struct android_focus_event, struct android_window_action_event)
(struct android_crossing_event, struct android_motion_event)
(struct android_button_event, struct android_touch_event)
(struct android_wheel_event, struct android_iconify_event)
(struct android_menu_event): Add `serial' fields.
* src/androidterm.c (handle_one_android_event)
(android_frame_up_to_date):
* src/androidterm.h (struct android_output): Implement frame
resize synchronization.
2023-01-20 11:06:32 +00:00
|
|
|
|
(catch 'finish
|
|
|
|
|
(while t
|
2023-01-21 13:46:32 +00:00
|
|
|
|
(let ((new-event (read-event nil)))
|
Update Android port
* .gitignore: Don't ignore verbose.mk.android.
* doc/emacs/Makefile.in (EMACSSOURCES): Add android.texi and
input.texi.
* doc/emacs/android.texi (Android): Document support for the
on-screen keyboard.
(Android Startup): Document how to start Emacs with -Q on
Android.
(Android Environment): Document how Emacs works around the
system ``task killer''. Document changes to frame deletion
behavior.
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices, On-Screen
Keyboards): Document how to use Emacs with virtual keyboards.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to `touch-screen-track-drag'.
* doc/lispref/frames.texi (Frames, On-Screen Keyboards): New
node.
* java/AndroidManifest.xml.in: Add settings activity and
appropriate OSK adjustment mode.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Allow
creating Emacs with -Q.
(onDestroy): Don't remove if killed by the system.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
Fix context menus again.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Make all
event sending functions return long.
* java/org/gnu/emacs/EmacsPreferencesActivity.java
(EmacsPreferencesActivity): New class.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(onStartCommand, onCreate, startEmacsService): Start as a
foreground service if necessary to bypass system restrictions.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsThread.java (EmacsThread, run):
* java/org/gnu/emacs/EmacsView.java (EmacsView, onLayout)
(onDetachedFromWindow):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, viewLayout):
Implement frame resize synchronization..
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager, removeWindowConsumer): Adjust
accordingly for changes to frame deletion behavior.
* lisp/frame.el (android-toggle-on-screen-keyboard)
(frame-toggle-on-screen-keyboard): New function.
* lisp/minibuffer.el (minibuffer-setup-on-screen-keyboard)
(minibuffer-exit-on-screen-keyboard): New functions.
(minibuffer-setup-hook, minibuffer-exit-hook): Add new functions
to hooks.
* lisp/touch-screen.el (touch-screen-relative-xy): Accept new
value of window `frame'. Return frame coordinates in that case.
(touch-screen-set-point-commands): New variable.
(touch-screen-handle-point-up): Respect that variable.
(touch-screen-track-drag): Return `no-drag' where appropriate.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line):
Refactor to use `no-drag'.
* src/android.c (struct android_emacs_window): New methods.
Make all event sending functions return the event serial.
(android_toggle_on_screen_keyboard, android_window_updated): New
functions.
* src/android.h: Update prototypes.
* src/androidfns.c (Fandroid_toggle_on_screen_keyboard)
(syms_of_androidfns): New function.
* src/androidgui.h (struct android_any_event)
(struct android_key_event, struct android_configure_event)
(struct android_focus_event, struct android_window_action_event)
(struct android_crossing_event, struct android_motion_event)
(struct android_button_event, struct android_touch_event)
(struct android_wheel_event, struct android_iconify_event)
(struct android_menu_event): Add `serial' fields.
* src/androidterm.c (handle_one_android_event)
(android_frame_up_to_date):
* src/androidterm.h (struct android_output): Implement frame
resize synchronization.
2023-01-20 11:06:32 +00:00
|
|
|
|
(cond
|
|
|
|
|
((eq (car-safe new-event) 'touchscreen-update)
|
|
|
|
|
(when-let* ((tool (assq (caadr event) (nth 1 new-event)))
|
|
|
|
|
(xy (touch-screen-relative-xy (cdr tool) 'frame)))
|
|
|
|
|
(when (or (> (- (car xy) (car start-xy)) 5)
|
|
|
|
|
(< (- (car xy) (car start-xy)) -5)
|
|
|
|
|
(> (- (cdr xy) (cdr start-xy)) 5)
|
|
|
|
|
(< (- (cdr xy) (cdr start-xy)) -5))
|
|
|
|
|
(setq return-value t))
|
2023-01-21 13:46:32 +00:00
|
|
|
|
(when (and update tool (eq return-value t))
|
Update Android port
* .gitignore: Don't ignore verbose.mk.android.
* doc/emacs/Makefile.in (EMACSSOURCES): Add android.texi and
input.texi.
* doc/emacs/android.texi (Android): Document support for the
on-screen keyboard.
(Android Startup): Document how to start Emacs with -Q on
Android.
(Android Environment): Document how Emacs works around the
system ``task killer''. Document changes to frame deletion
behavior.
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices, On-Screen
Keyboards): Document how to use Emacs with virtual keyboards.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to `touch-screen-track-drag'.
* doc/lispref/frames.texi (Frames, On-Screen Keyboards): New
node.
* java/AndroidManifest.xml.in: Add settings activity and
appropriate OSK adjustment mode.
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Allow
creating Emacs with -Q.
(onDestroy): Don't remove if killed by the system.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
Fix context menus again.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Make all
event sending functions return long.
* java/org/gnu/emacs/EmacsPreferencesActivity.java
(EmacsPreferencesActivity): New class.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(onStartCommand, onCreate, startEmacsService): Start as a
foreground service if necessary to bypass system restrictions.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsThread.java (EmacsThread, run):
* java/org/gnu/emacs/EmacsView.java (EmacsView, onLayout)
(onDetachedFromWindow):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, viewLayout):
Implement frame resize synchronization..
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager, removeWindowConsumer): Adjust
accordingly for changes to frame deletion behavior.
* lisp/frame.el (android-toggle-on-screen-keyboard)
(frame-toggle-on-screen-keyboard): New function.
* lisp/minibuffer.el (minibuffer-setup-on-screen-keyboard)
(minibuffer-exit-on-screen-keyboard): New functions.
(minibuffer-setup-hook, minibuffer-exit-hook): Add new functions
to hooks.
* lisp/touch-screen.el (touch-screen-relative-xy): Accept new
value of window `frame'. Return frame coordinates in that case.
(touch-screen-set-point-commands): New variable.
(touch-screen-handle-point-up): Respect that variable.
(touch-screen-track-drag): Return `no-drag' where appropriate.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line):
Refactor to use `no-drag'.
* src/android.c (struct android_emacs_window): New methods.
Make all event sending functions return the event serial.
(android_toggle_on_screen_keyboard, android_window_updated): New
functions.
* src/android.h: Update prototypes.
* src/androidfns.c (Fandroid_toggle_on_screen_keyboard)
(syms_of_androidfns): New function.
* src/androidgui.h (struct android_any_event)
(struct android_key_event, struct android_configure_event)
(struct android_focus_event, struct android_window_action_event)
(struct android_crossing_event, struct android_motion_event)
(struct android_button_event, struct android_touch_event)
(struct android_wheel_event, struct android_iconify_event)
(struct android_menu_event): Add `serial' fields.
* src/androidterm.c (handle_one_android_event)
(android_frame_up_to_date):
* src/androidterm.h (struct android_output): Implement frame
resize synchronization.
2023-01-20 11:06:32 +00:00
|
|
|
|
(funcall update new-event data))))
|
|
|
|
|
((eq (car-safe new-event) 'touchscreen-end)
|
|
|
|
|
(throw 'finish
|
|
|
|
|
;; Now determine whether or not the `touchscreen-end'
|
|
|
|
|
;; event has the same ID as EVENT. If it doesn't,
|
|
|
|
|
;; then this is another touch, so return nil.
|
|
|
|
|
(and (eq (caadr event) (caadr new-event))
|
|
|
|
|
return-value)))
|
|
|
|
|
(t (throw 'finish nil))))))))
|
Update Android port
* .gitignore: Add new files.
* INSTALL.android: Explain how to build Emacs for ancient
versions of Android.
* admin/merge-gnulib (GNULIB_MODULES): Add getdelim.
* build-aux/config.guess (timestamp, version):
* build-aux/config.sub (timestamp, version): Autoupdate.
* configure.ac (BUILD_DETAILS, ANDROID_MIN_SDK):
(ANDROID_STUBIFY): Allow specifying CFLAGS via ANDROID_CFLAGS.
Add new configure tests for Android API version when not
explicitly specified.
* doc/emacs/android.texi (Android): Add reference to ``Other
Input Devices''.
(Android File System): Remove restrictions on directory-files on
the assets directory.
* doc/emacs/emacs.texi (Top): Add Other Input Devices to menu.
* doc/emacs/input.texi (Other Input Devices): New node.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen input events.
* doc/lispref/frames.texi (Pop-Up Menus): Likewise.
* etc/NEWS: Announce changes.
* java/Makefile.in: Use lib-src/asset-directory-tool to generate
an `directory-tree' file placed in /assets.
* java/debug.sh: Large adjustments to support Android 2.2 and
later.
* java/org/gnu/emacs/EmacsContextMenu.java (inflateMenuItems):
* java/org/gnu/emacs/EmacsCopyArea.java (perform):
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog):
* java/org/gnu/emacs/EmacsDrawLine.java (perform):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsDrawable.java (EmacsDrawable):
* java/org/gnu/emacs/EmacsFillPolygon.java (perform):
* java/org/gnu/emacs/EmacsFillRectangle.java (perform):
* java/org/gnu/emacs/EmacsGC.java (EmacsGC):
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap):
(destroyHandle):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (draw): Avoid
redundant canvas saves and restores.
* java/org/gnu/emacs/EmacsService.java (run):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
(handleDirtyBitmap):
* java/org/gnu/emacs/EmacsWindow.java (changeWindowBackground)
(EmacsWindow): Make compatible with Android 2.2 and later.
* lib-src/Makefile.in (DONT_INSTALL): Add asset-directory-tool
on Android.:(asset-directory-tool{EXEEXT}): New target.
* lib-src/asset-directory-tool.c (struct directory_tree, xmalloc)
(main_1, main_2, main): New file.
* lib, m4: Merge from gnulib. This will be reverted before
merging to master.
* lisp/button.el (button-map):
(push-button):
* lisp/frame.el (display-popup-menus-p): Improve touchscreen
support.
* 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.
* src/alloc.c (make_lisp_symbol): Avoid ICE on Android NDK GCC.
(mark_pinned_symbols): Likewise.
* src/android.c (struct android_emacs_window): New struct.
(window_class): New variable.
(android_run_select_thread): Add workaround for Android platform
bug.
(android_extract_long, android_scan_directory_tree): New
functions.
(android_file_access_p): Use those functions instead.
(android_init_emacs_window): New function.
(android_init_emacs_gc_class): Update signature of `markDirty'.
(android_change_gc, android_set_clip_rectangles): Tell the GC
whether or not clip rects were dirtied.
(android_swap_buffers): Do not look up method every time.
(struct android_dir): Adjust for new directory tree lookup.
(android_opendir, android_readdir, android_closedir): Likewise.
(android_four_corners_bilinear): Fix coding style.
(android_ftruncate): New function.
* src/android.h: Update prototypes. Replace ftruncate with
android_ftruncate when necessary.
* src/androidterm.c (handle_one_android_event): Pacify GCC. Fix
touch screen tool bar bug.
* src/emacs.c (using_utf8): Fix compilation error.
* src/fileio.c (Ffile_system_info): Return Qnil when fsusage.o
is not built.
* src/filelock.c (BOOT_TIME_FILE): Fix definition for Android.
* src/frame.c (Fx_parse_geometry): Fix uninitialized variable
uses.
* src/keyboard.c (lispy_function_keys): Fix `back'.
* src/menu.c (x_popup_menu_1): Handle touch screen events.
(Fx_popup_menu): Document changes.
* src/sfnt.c (main): Improve tests.
* src/sfntfont-android.c (sfntfont_android_put_glyphs): Fix
minor problem.
(init_sfntfont_android): Check for
HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL.
* src/sfntfont.c (struct sfnt_font_desc): New fields `adstyle'
and `languages'.
(sfnt_parse_style): Append tokens to adstyle.
(sfnt_parse_languages): New function.
(sfnt_enum_font_1): Parse supported languages and adstyle.
(sfntfont_list_1): Handle new fields.
(sfntfont_text_extents): Fix uninitialized variable use.
(syms_of_sfntfont, mark_sfntfont): Adjust accordingly.
2023-01-19 14:19:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-07-20 01:22:41 +00:00
|
|
|
|
;;; Event handling exports. These functions are intended for use by
|
|
|
|
|
;;; Lisp commands bound to touch screen gesture events.
|
|
|
|
|
|
2023-12-06 02:34:41 +00:00
|
|
|
|
;;;###autoload
|
2023-07-20 01:22:41 +00:00
|
|
|
|
(defun touch-screen-inhibit-drag ()
|
|
|
|
|
"Inhibit subsequent `touchscreen-drag' events from being sent.
|
|
|
|
|
Prevent `touchscreen-drag' and translated mouse events from being
|
|
|
|
|
sent until the touch sequence currently being translated ends.
|
|
|
|
|
Must be called from a command bound to a `touchscreen-hold' or
|
|
|
|
|
`touchscreen-drag' event."
|
|
|
|
|
(let* ((tool touch-screen-current-tool)
|
2024-06-25 04:27:08 +00:00
|
|
|
|
(current-what (nth 3 tool)))
|
2024-06-17 13:38:37 +00:00
|
|
|
|
;; Signal an error if no hold and no drag is in progress.
|
2024-06-25 04:52:23 +00:00
|
|
|
|
(when (and (not (eq current-what 'held))
|
2024-06-17 13:38:37 +00:00
|
|
|
|
(not (eq current-what 'drag)))
|
2023-07-20 01:22:41 +00:00
|
|
|
|
(error "Calling `touch-screen-inhibit-drag' outside hold or drag"))
|
|
|
|
|
;; Now set the fourth element of tool to `command-inhibit'.
|
|
|
|
|
(setcar (nthcdr 3 tool) 'command-inhibit)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Update Android port
* doc/emacs/android.texi (Android, Android Environment): Improve
documentation.
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to touchscreen support.
* doc/lispref/display.texi (Defining Faces, Window Systems):
* doc/lispref/frames.texi (Frame Layout, Font and Color
Parameters):
* doc/lispref/os.texi (System Environment): Document Android in
various places.
* java/org/gnu/emacs/EmacsWindow.java (figureChange): Fix crash.
* lisp/loadup.el: ("touch-screen"): Load touch-screen.el.
* lisp/pixel-scroll.el: Autoload two functions.
* lisp/term/android-win.el: Add require 'touch-screen.
* lisp/touch-screen.el (touch-screen-current-tool)
(touch-screen-current-timer, touch-screen-delay)
(touch-screen-relative-xy, touch-screen-handle-scroll)
(touch-screen-handle-timeout, touch-screen-handle-point-update)
(touch-screen-handle-point-up, touch-screen-handle-touch)
(global-map, touch-screen): New file.
* src/android.c (android_run_debug_thread): Fix build on 64 bit
systems.
(JNICALL, android_put_pixel): Likewise.
(android_transform_coordinates, android_four_corners_bilinear)
(android_fetch_pixel_bilinear, android_project_image_bilinear)
(android_fetch_pixel_nearest_24, android_fetch_pixel_nearest_1)
(android_project_image_nearest): New functions.
* src/androidgui.h (struct android_transform): New structure.
* src/androidterm.c (android_note_mouse_movement): Remove
obsolete TODO.
(android_get_scale_factor): New function.
(android_draw_underwave): Scale underwave correctly.
* src/dispextern.h: Support native image transforms on Android.
* src/image.c (matrix_identity, matrix_rotate)
(matrix_mirror_horizontal, matrix_translate): New functions.
(image_set_transform): Implement native image transforms on
Android.
(Fimage_transforms_p): Implement on Android.
* src/keyboard.c (make_lispy_event, syms_of_keyboard): Handle
touch screen- menu bar events.
* src/sfnt.c: Fix typo in comment.
* src/sfntfont-android.c (sfntfont_android_blend, U255TO256)
(sfntfont_android_put_glyphs): Avoid redundant swizzling.
* src/sfntfont.c (sfntfont_lookup_char): Fix build on 64 bit
systems.
2023-01-16 11:50:02 +00:00
|
|
|
|
(provide 'touch-screen)
|
|
|
|
|
|
2024-07-18 07:44:28 +00:00
|
|
|
|
;;; touch-screen.el ends here
|