aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorCecilio Pardo2024-12-02 17:30:42 +0100
committerStefan Monnier2025-06-30 11:34:54 -0400
commitba02efb85e403a55d321e3d213f1449246ad9484 (patch)
tree59689a9187907215c6f0ac3ecc1057f59f11f328 /doc/lispref
parent67aed063f6460e8add0fcfdebf562a3062cc26a2 (diff)
downloademacs-scratch/low-level-key.tar.gz
emacs-scratch/low-level-key.zip
Go through normal keymapsscratch/low-level-key
In this new version I changed the way events are handled. Now llk-handle generates input events to be used with normal keymaps, instead of running a command. The function llk-bind activates event generation for a key and a combination of events press, release, double, triple. I also made changes following your notes, such as: - Clarification on the event's time, documentation of keysyms variables moved, don't limit to GUI systems. - cl-defstruct for the event payload. - Format and naming conventions. - Default timeout to mouse double click timeout. You suggested to auto generate the keysym table, but we would still need a table to relate the Windows keys to the X equivalent. * doc/lispref/commands.texi (Misc Events): Adjust to new semantics. * src/keyboard.c (syms_of_keyboard): Adust docstring. FIXME: Old commit msg. * lisp/low-level-key.el (New file). (low-level-key): Struct with event data. (llk-bindings): User bindings for low level key events. (llk-tap-timeout): User option. (llk-keysyms): List of available keysyms. (llk--define-xk): Macro for defining keysyms. (llk--define-keysyms): Build llk-keysyms. (llk-bind): Function to create a binding. (llk--event-history-for-tap): Event history for tap detection. (llk--detect-n-tap): Function to detect taps. (describe-low-level-key): Command to get information about a key. (llk--describe): Show help buffer with information about an event. (llk-handle): Handler for key events. (llk--generate-event): Generate input event for key. (llk--generate-events): Generate input events for key.
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/commands.texi41
1 files changed, 17 insertions, 24 deletions
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index 32b4df6b3bf..01565727e15 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -2670,35 +2670,28 @@ size of the object beneath the gesture: image, window, etc.
2670 2670
2671@cindex @code{low-level-key} event 2671@cindex @code{low-level-key} event
2672@item (low-level-key @var{is-key-press} @var{key} @var{modifier} @var{time} @var{frame}) 2672@item (low-level-key @var{is-key-press} @var{key} @var{modifier} @var{time} @var{frame})
2673This event is sent on the physical press or release of keys, only on GUI 2673This event is sent on the physical press or release of keys, only on
2674systems, currently X, MS-Windows and PGTK, and only if the variable 2674systems where it is supported, currently X, MS-Windows and PGTK, and
2675@code{enable-low-level-key-events} has a non-@code{nil} value. See its 2675only if the variable @code{enable-low-level-key-events} has a
2676documentation for the values it can take, that allow to filter which 2676non-@code{nil} value. See its documentation for the values to use, that
2677keys should generate this kind of event. 2677can activate the events for all or some keys.
2678 2678
2679@var{is-key-press} is @code{t} for a key press, @code{nil} for a key release. 2679@var{is-key-press} is @code{t} for a key press, @code{nil} for a key
2680@var{time} is the event's time in milliseconds, @var{frame} is the 2680release. @var{time} is the event's time in milliseconds, as reported by
2681frame receiving it. @var{modifier} is @code{nil} if the key is not a 2681the underlying platform, and should only be used to measure time
2682intervals between events of this same kind. @var{frame} is the frame
2683receiving the event. @var{modifier} is @code{nil} if the key is not a
2682modifier key, @code{t} if it is, but it is unknown which one, or one of 2684modifier key, @code{t} if it is, but it is unknown which one, or one of
2683@code{shift}, @code{control}, @code{meta}, @code{alt}, @code{super}, 2685@code{shift}, @code{control}, @code{meta}, @code{alt}, @code{super},
2684@code{hyper}. 2686@code{hyper}.
2685 2687
2686@var{key}, an integer, identifies the key pressed or released. This 2688@var{key}, an integer, identifies the key pressed or released. This
2687number is platform dependent, but there are variables for most keys that 2689number is platform dependent.
2688can be used in place of the numbers to identify them. For example, the 2690
2689variable @code{xk-backspace} identifies the @key{backspace} key. 2691This is a special event (@pxref{Special Events}), ignored by
2690 2692default. Loading @file{low-level-key.el} sets a handler
2691The names are parallel to those for KeySyms on X, as defined in 2693that can generate normal input events for key press, release and multi
2692@file{xkeysymdef.h}. For example, @code{XK_Shift_L} (the left shift 2694tap. See the function @code{llk-bind}.
2693key), corresponds to @code{xk-shift-l}. The @file{xkeysymdef.h} file
2694defines different KeySyms for capital and small versions of letters.
2695For this event, only the capital version is used, with the variables
2696@code{xk-a}, @code{xk-b}, etc.
2697
2698These variables are initialized by calling the function @code{llk-init}.
2699This function also binds a handler to this event, which allows to detect
2700double taps on keys (normally modifier keys) and bind commands or
2701functions to be run. See the function @code{llk-bind}.
2702 2695
2703@cindex @code{preedit-text} event 2696@cindex @code{preedit-text} event
2704@item (preedit-text @var{arg}) 2697@item (preedit-text @var{arg})