summaryrefslogtreecommitdiff
path: root/src/termhooks.h
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-04-07 21:16:11 +0800
committerPo Lu <luangruo@yahoo.com>2022-04-07 21:16:11 +0800
commit3b411417086ceb2ce3838160d01c6f250e47bbf3 (patch)
tree7605008be2090be2cc58ba6df8df6c2d22b8184e /src/termhooks.h
parentc1a6aa0c3eb1029e3f7f5c3b227d7952bee775b8 (diff)
downloademacs-3b411417086ceb2ce3838160d01c6f250e47bbf3.tar.gz
Expose the name of an event's input device to Lisp
This name can be used to identify the device for special treatment, i.e. only interpolating scrolls coming from mice and not touchpads inside pixel-scroll-precision-mode. * doc/lispref/commands.texi (Command Loop Info): Document new variable `last-event-device'. * etc/NEWS: Announce new variable `last-event-device'. * src/frame.h (struct frame): New field `last_mouse_device'. * src/keyboard.c (read_char): Clear last-event-device. (kbd_buffer_get_event): Set last-event-device to the event's recorded device. (init_keyboard): Clear last-event-device. (syms_of_keyboard): New defvar `last-event-device'. * src/termhooks.h (struct input_event): New field `device'. (EVENT_INIT): Set it to the special value `Qt' by default. * src/xterm.c (x_init_master_valuators): Record the device's name. (x_dnd_begin_drag_and_drop): Only preserve last event device if the mouse ended up in the source frame. (x_note_mouse_movement): New argument `source'. (handle_one_xevent): Set input event sources whenever appropriate. (mark_xterm): Mark device names. * src/xterm.h (struct xi_device_t): New field `name'.
Diffstat (limited to 'src/termhooks.h')
-rw-r--r--src/termhooks.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/termhooks.h b/src/termhooks.h
index 0f02b56e9ee..8c193914ba8 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -392,9 +392,17 @@ struct input_event
when building events. Unfortunately some events have to pass much
more data than it's reasonable to pack directly into this structure. */
Lisp_Object arg;
+
+ /* The name of the device from which this event originated.
+
+ It can either be a string, or Qt, which means to use the name
+ "Virtual core pointer" for all events other than keystroke
+ events, and "Virtual core keyboard" for those. */
+ Lisp_Object device;
};
-#define EVENT_INIT(event) memset (&(event), 0, sizeof (struct input_event))
+#define EVENT_INIT(event) (memset (&(event), 0, sizeof (struct input_event)), \
+ (event).device = Qt)
/* Bits in the modifiers member of the input_event structure.
Note that reorder_modifiers assumes that the bits are in canonical