Function: device-class
device-class is a byte-compiled function defined in frame.el.gz.
Signature
(device-class FRAME NAME)
Documentation
Return the class of the device NAME for an event generated on FRAME.
NAME is a string that can be the value of last-event-device, or
nil. FRAME is a window system frame, typically the value of
last-event-frame when last-event-device was set. On some
window systems, it can also be a display name or a terminal.
The class of a device is one of the following symbols:
core-keyboard means the device is a keyboard-like device, but
any other characteristics are unknown.
core-pointer means the device is a pointing device, but any
other characteristics are unknown.
mouse means the device is a computer mouse.
trackpoint means the device is a joystick or trackpoint.
eraser means the device is an eraser, which is typically the
other end of a stylus on a graphics tablet.
pen means the device is a stylus or some other similar
device.
puck means the device is a device similar to a mouse, but
reports absolute coordinates.
power-button means the device is a power button, volume
button, or some similar control.
keyboard means the device is a keyboard.
touchscreen means the device is a touchscreen.
pad means the device is a collection of buttons and rings and
strips commonly found in drawing tablets.
touchpad means the device is an indirect touch device, such
as a touchpad.
piano means the device is a piano, or some other kind of
musical instrument.
test means the device is used by the XTEST extension to
report input.
It can also be nil, which means the class of the device could not be determined. Individual window systems may also return other symbols.
Probably introduced at or before Emacs version 29.1.
Source Code
;; Defined in /usr/src/emacs/lisp/frame.el.gz
(defun device-class (frame name)
"Return the class of the device NAME for an event generated on FRAME.
NAME is a string that can be the value of `last-event-device', or
nil. FRAME is a window system frame, typically the value of
`last-event-frame' when `last-event-device' was set. On some
window systems, it can also be a display name or a terminal.
The class of a device is one of the following symbols:
`core-keyboard' means the device is a keyboard-like device, but
any other characteristics are unknown.
`core-pointer' means the device is a pointing device, but any
other characteristics are unknown.
`mouse' means the device is a computer mouse.
`trackpoint' means the device is a joystick or trackpoint.
`eraser' means the device is an eraser, which is typically the
other end of a stylus on a graphics tablet.
`pen' means the device is a stylus or some other similar
device.
`puck' means the device is a device similar to a mouse, but
reports absolute coordinates.
`power-button' means the device is a power button, volume
button, or some similar control.
`keyboard' means the device is a keyboard.
`touchscreen' means the device is a touchscreen.
`pad' means the device is a collection of buttons and rings and
strips commonly found in drawing tablets.
`touchpad' means the device is an indirect touch device, such
as a touchpad.
`piano' means the device is a piano, or some other kind of
musical instrument.
`test' means the device is used by the XTEST extension to
report input.
It can also be nil, which means the class of the device could not
be determined. Individual window systems may also return other
symbols."
(let ((frame-type (framep-on-display frame)))
(cond ((eq frame-type 'x)
(x-device-class name))
((eq frame-type 'pgtk)
(pgtk-device-class name))
(t (cond
((not name) nil)
((string= name "Virtual core pointer")
'core-pointer)
((string= name "Virtual core keyboard")
'core-keyboard))))))