Create a gesture-spec.
system
make-gesture-spec data modifiers &optional can-shift-both-case-p => gspec
data⇩ |
A non-negative integer less than cl:char-code-limit, or a Gesture Spec keyword, or nil . |
modifiers⇩ |
A non-negative integer less than 64, or nil . |
can-shift-both-case-p⇩ | |
A generalized boolean. |
gspec⇩ |
A gesture-spec. |
The function make-gesture-spec
returns a new gesture-spec gspec. This can be used to represent a keystroke consisting of the key indicated by data, modified by the modifier keys indicated by modifiers.
If data is an integer, it represents the key (code-char data)
. If data is a keyword, it must be one of the known Gesture Spec keywords and represents the key with the same name. If data is nil
, then gspec has a wild data component.
These are the Gesture Spec keywords:
:f1
:f2
:f3
:f4
:f5
:f6
:f7
:f8
:f9
:f10
:f11
:f12
:f13
:f14
:f15
:f16
:f17
:f18
:f19
:f20
:f21
:f22
:f23
:f24
:f25
:f26
:f27
:f28
:f29
:f30
:f31
:f32
:f33
:f34
:f35
:help
:left
:right
:up
:down
:home
:prior
:next
:end
:begin
:select
:print
:execute
:insert
:undo
:redo
:menu
:find
:cancel
:break
:clear
:pause
:kp-f1
:kp-f2
:kp-f3
:kp-f4
:kp-enter
:applications-menu
:print-screen
:scroll-lock
:sys-req
:reset
:stop
:user
:system
:clear-line
:clear-display
:insert-line
:delete-line
:insert-char
:delete-char
:prev-item
:next-item
Not all of these Gesture Spec keywords will be generated by all platforms and/or keyboards.
If modifiers is an integer, it represents modifier keys according to the values gesture-spec-accelerator-bit, gesture-spec-control-bit, gesture-spec-hyper-bit, gesture-spec-meta-bit, gesture-spec-shift-bit, and gesture-spec-super-bit. If modifiers is nil
, then gspec has a wild modifiers component.
The gesture Shift+X
could potentially be represented by the unmodified uppercase character X
, or lowercase x
with the Shift
modifier. In order to ensure a consistent representation the latter form is not supported by Gesture Specs by default. That is, a both-case-p character may not be combined with the single modifier Shift
in the accelerator argument. This can be overridden by passing a true value for can-shift-both-case-p.
A both-case-p character is allowed with Shift
if there are other modifiers. See the below for examples.
Wild Gesture Specs can be useful when specifying an input model for a capi:output-pane.
(sys:make-gesture-spec 97 (logior sys:gesture-spec-control-bit sys:gesture-spec-meta-bit))
A both-case-p character may not be combined with the single modifier Shift
in the accelerator argument, so code like this signals an error:
(sys:make-gesture-spec (char-code #\x) sys:gesture-spec-shift-bit)
Instead you should use:
(sys:make-gesture-spec (char-code #\X) 0)
A both-case-p character is allowed with Shift
if there are other modifiers:
(sys:make-gesture-spec (char-code #\x) (logior sys:gesture-spec-shift-bit sys:gesture-spec-meta-bit))
gesture-spec
gesture-spec-accelerator-bit
gesture-spec-control-bit
gesture-spec-hyper-bit
gesture-spec-meta-bit
gesture-spec-p
gesture-spec-shift-bit
gesture-spec-super-bit
print-pretty-gesture-spec
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:31:02