mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 06:50:05 +01:00
Compare commits
25 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0412fb3d44 | ||
|
|
a376fe366c | ||
|
|
9a07784451 | ||
|
|
3cf723451f | ||
|
|
2d3e47290c | ||
|
|
5bd7f93c16 | ||
|
|
a202ed6115 | ||
|
|
c0c809aaa1 | ||
|
|
e8dfc3bfd6 | ||
|
|
b3f7b4b1ea | ||
|
|
0285001272 | ||
|
|
bde6d07d57 | ||
|
|
1b4dbb9087 | ||
|
|
d5d38b2ed1 | ||
|
|
38b5c2e0cc | ||
|
|
20851b5020 | ||
|
|
2003ab3aef | ||
|
|
4bb6a31894 | ||
|
|
db6a04665c | ||
|
|
7621edab05 | ||
|
|
39aea2a8d6 | ||
|
|
7e8298e9ec | ||
|
|
49d9528bdf | ||
|
|
1e8901d009 | ||
|
|
a6ad084280 |
82 changed files with 2136 additions and 1209 deletions
|
|
@ -148,6 +148,9 @@ ModelBouncingKeys
|
||||||
ModelSynapticsSerialTouchpad
|
ModelSynapticsSerialTouchpad
|
||||||
Reserved for touchpads made by Synaptics on the serial bus
|
Reserved for touchpads made by Synaptics on the serial bus
|
||||||
ModelPressurePad
|
ModelPressurePad
|
||||||
|
.. warning:: This quirk is no longer in use. Use
|
||||||
|
``AttrInputProp=+INPUT_PROP_PRESSUREPAD`` instead.
|
||||||
|
|
||||||
Unlike in traditional touchpads, whose pressure value equals contact size,
|
Unlike in traditional touchpads, whose pressure value equals contact size,
|
||||||
on pressure pads pressure is a real physical axis.
|
on pressure pads pressure is a real physical axis.
|
||||||
Indicates that the device is a pressure pad.
|
Indicates that the device is a pressure pad.
|
||||||
|
|
@ -199,6 +202,9 @@ AttrInputProp=+INPUT_PROP_BUTTONPAD;-INPUT_PROP_POINTER;
|
||||||
Enables or disables the evdev input property on the device. The prefix
|
Enables or disables the evdev input property on the device. The prefix
|
||||||
for each entry is either '+' (enable) or '-' (disable). Entries may be
|
for each entry is either '+' (enable) or '-' (disable). Entries may be
|
||||||
a named input property or the hexadecimal value of that property.
|
a named input property or the hexadecimal value of that property.
|
||||||
|
|
||||||
|
The most common use of this is ``AttrInputProp=+INPUT_PROP_PRESSUREPAD``
|
||||||
|
which marks a touchpad as a :ref:`forcepad or pressurepad <touchpads_buttons_forcepads>`.
|
||||||
AttrPointingStickIntegration=internal|external
|
AttrPointingStickIntegration=internal|external
|
||||||
Indicates the integration of the pointing stick. This is a string enum.
|
Indicates the integration of the pointing stick. This is a string enum.
|
||||||
Only needed for external pointing sticks. These are rare.
|
Only needed for external pointing sticks. These are rare.
|
||||||
|
|
|
||||||
36
doc/user/dot/libinput-contexts.gv
Normal file
36
doc/user/dot/libinput-contexts.gv
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
digraph stack
|
||||||
|
{
|
||||||
|
compound=true;
|
||||||
|
splines=line;
|
||||||
|
rankdir="LR";
|
||||||
|
node [
|
||||||
|
shape="box";
|
||||||
|
]
|
||||||
|
|
||||||
|
subgraph cluster_2 {
|
||||||
|
label="Kernel";
|
||||||
|
event0 [label="/dev/input/event0"];
|
||||||
|
event1 [label="/dev/input/event1"];
|
||||||
|
}
|
||||||
|
|
||||||
|
subgraph cluster_0 {
|
||||||
|
label="Compositor process";
|
||||||
|
libinput [label="libinput context 1"];
|
||||||
|
}
|
||||||
|
|
||||||
|
subgraph cluster_1 {
|
||||||
|
label="libinput debug-events";
|
||||||
|
libinput2 [label="libinput context 2"];
|
||||||
|
}
|
||||||
|
|
||||||
|
stdout;
|
||||||
|
|
||||||
|
client [label="Wayland client"];
|
||||||
|
|
||||||
|
event0:e -> libinput:w;
|
||||||
|
event1:e -> libinput:w;
|
||||||
|
event0:e -> libinput2:w;
|
||||||
|
event1:e -> libinput2:w;
|
||||||
|
libinput -> client [ltail=cluster_0 label="Wayland protocol"];
|
||||||
|
libinput2 -> stdout [ltail=cluster_1];
|
||||||
|
}
|
||||||
|
|
@ -348,10 +348,14 @@ compositor. This indicates a misunderstanding of how libinput works:
|
||||||
libinput is a library that converts kernel events into libinput events, much
|
libinput is a library that converts kernel events into libinput events, much
|
||||||
like ``sed`` reads data in, modifies it, and provides it to stdout.
|
like ``sed`` reads data in, modifies it, and provides it to stdout.
|
||||||
|
|
||||||
If ``sed`` is used by a shell-script, that script has full control over how
|
.. graphviz:: libinput-contexts.gv
|
||||||
``sed`` processes data. In this analogy, ``sed`` is libinput and the
|
|
||||||
shell script is the compositor. It is not possible to write a program
|
A libinput context is private to the process and cannot be modified from the
|
||||||
to modify the behavior of the ``sed`` instance used inside that shell script
|
outside. To use the ``sed`` analogy again: if ``sed`` is used by a
|
||||||
|
shell-script, that script has full control over how ``sed`` processes data. In
|
||||||
|
this analogy, ``sed`` is libinput and the shell script is the compositor. It is
|
||||||
|
not possible to write a program to modify the behavior of the ``sed`` instance
|
||||||
|
used inside that shell script.
|
||||||
|
|
||||||
Writing a program that uses libinput is akin to writing a new script that
|
Writing a program that uses libinput is akin to writing a new script that
|
||||||
invoke ``sed``. It will not have any effect on the original ``sed`` instance.
|
invoke ``sed``. It will not have any effect on the original ``sed`` instance.
|
||||||
|
|
@ -360,6 +364,14 @@ The only way to modify libinput's behavior is to use the configuration options
|
||||||
exposed by the respective compositor. Those affect the libinput context inside
|
exposed by the respective compositor. Those affect the libinput context inside
|
||||||
the compositor and thus have an effect on the input device behavior.
|
the compositor and thus have an effect on the input device behavior.
|
||||||
|
|
||||||
|
.. _faq_debug_events_not_showing_configuration:
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Why doesn't libinput debug-events show my configuration
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
See :ref:`faq_separate_contexts`.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
Can I configure scroll speed?
|
Can I configure scroll speed?
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ src_rst = files(
|
||||||
# dot drawings
|
# dot drawings
|
||||||
'dot/seats-sketch.gv',
|
'dot/seats-sketch.gv',
|
||||||
'dot/seats-sketch-libinput.gv',
|
'dot/seats-sketch-libinput.gv',
|
||||||
|
'dot/libinput-contexts.gv',
|
||||||
'dot/libinput-stack-wayland.gv',
|
'dot/libinput-stack-wayland.gv',
|
||||||
'dot/libinput-stack-xorg.gv',
|
'dot/libinput-stack-xorg.gv',
|
||||||
'dot/libinput-stack-gnome.gv',
|
'dot/libinput-stack-gnome.gv',
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ other properties.
|
||||||
Number of buttons
|
Number of buttons
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
.. _touchapds_buttons_phys:
|
.. _touchpads_buttons_phys:
|
||||||
|
|
||||||
..............................................................................
|
..............................................................................
|
||||||
Physically separate buttons
|
Physically separate buttons
|
||||||
|
|
@ -57,7 +57,7 @@ property.
|
||||||
.. _touchpads_buttons_forcepads:
|
.. _touchpads_buttons_forcepads:
|
||||||
|
|
||||||
..............................................................................
|
..............................................................................
|
||||||
Forcepads
|
Forcepads/Pressurepads
|
||||||
..............................................................................
|
..............................................................................
|
||||||
|
|
||||||
Forcepads are Clickpads without a physical button underneath the hardware.
|
Forcepads are Clickpads without a physical button underneath the hardware.
|
||||||
|
|
@ -65,6 +65,7 @@ They provide pressure and may have a vibration element that is
|
||||||
software-controlled. This element can simulate the feel of a physical
|
software-controlled. This element can simulate the feel of a physical
|
||||||
click or be co-opted for other tasks.
|
click or be co-opted for other tasks.
|
||||||
|
|
||||||
|
Forcepads are also called pressurepads or haptic touchpads.
|
||||||
|
|
||||||
.. _touchpads_touch:
|
.. _touchpads_touch:
|
||||||
|
|
||||||
|
|
@ -79,7 +80,7 @@ device can **track**, i.e. provide reliable positional information for.
|
||||||
In the kernel each finger is tracked in a so-called "slot", the number of
|
In the kernel each finger is tracked in a so-called "slot", the number of
|
||||||
slots thus equals the number of simultaneous touches a device can track.
|
slots thus equals the number of simultaneous touches a device can track.
|
||||||
|
|
||||||
.. _touchapds_touch_st:
|
.. _touchpads_touch_st:
|
||||||
|
|
||||||
..............................................................................
|
..............................................................................
|
||||||
Single-touch touchpads
|
Single-touch touchpads
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
|
#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
|
||||||
#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
|
#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
|
||||||
#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */
|
#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */
|
||||||
|
#define INPUT_PROP_PRESSUREPAD 0x07 /* pressure triggers clicks */
|
||||||
|
|
||||||
#define INPUT_PROP_MAX 0x1f
|
#define INPUT_PROP_MAX 0x1f
|
||||||
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
|
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
|
||||||
|
|
@ -278,7 +279,8 @@
|
||||||
#define KEY_PAUSECD 201
|
#define KEY_PAUSECD 201
|
||||||
#define KEY_PROG3 202
|
#define KEY_PROG3 202
|
||||||
#define KEY_PROG4 203
|
#define KEY_PROG4 203
|
||||||
#define KEY_DASHBOARD 204 /* AL Dashboard */
|
#define KEY_ALL_APPLICATIONS 204 /* AC Desktop Show All Applications */
|
||||||
|
#define KEY_DASHBOARD KEY_ALL_APPLICATIONS
|
||||||
#define KEY_SUSPEND 205
|
#define KEY_SUSPEND 205
|
||||||
#define KEY_CLOSE 206 /* AC Close */
|
#define KEY_CLOSE 206 /* AC Close */
|
||||||
#define KEY_PLAY 207
|
#define KEY_PLAY 207
|
||||||
|
|
@ -515,6 +517,10 @@
|
||||||
#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
|
#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
|
||||||
#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
|
#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
|
||||||
#define KEY_IMAGES 0x1ba /* AL Image Browser */
|
#define KEY_IMAGES 0x1ba /* AL Image Browser */
|
||||||
|
#define KEY_NOTIFICATION_CENTER 0x1bc /* Show/hide the notification center */
|
||||||
|
#define KEY_PICKUP_PHONE 0x1bd /* Answer incoming call */
|
||||||
|
#define KEY_HANGUP_PHONE 0x1be /* Decline incoming call */
|
||||||
|
#define KEY_LINK_PHONE 0x1bf /* AL Phone Syncing */
|
||||||
|
|
||||||
#define KEY_DEL_EOL 0x1c0
|
#define KEY_DEL_EOL 0x1c0
|
||||||
#define KEY_DEL_EOS 0x1c1
|
#define KEY_DEL_EOS 0x1c1
|
||||||
|
|
@ -542,6 +548,7 @@
|
||||||
#define KEY_FN_F 0x1e2
|
#define KEY_FN_F 0x1e2
|
||||||
#define KEY_FN_S 0x1e3
|
#define KEY_FN_S 0x1e3
|
||||||
#define KEY_FN_B 0x1e4
|
#define KEY_FN_B 0x1e4
|
||||||
|
#define KEY_FN_RIGHT_SHIFT 0x1e5
|
||||||
|
|
||||||
#define KEY_BRL_DOT1 0x1f1
|
#define KEY_BRL_DOT1 0x1f1
|
||||||
#define KEY_BRL_DOT2 0x1f2
|
#define KEY_BRL_DOT2 0x1f2
|
||||||
|
|
@ -595,8 +602,14 @@
|
||||||
#define BTN_DPAD_LEFT 0x222
|
#define BTN_DPAD_LEFT 0x222
|
||||||
#define BTN_DPAD_RIGHT 0x223
|
#define BTN_DPAD_RIGHT 0x223
|
||||||
|
|
||||||
|
#define BTN_GRIPL 0x224
|
||||||
|
#define BTN_GRIPR 0x225
|
||||||
|
#define BTN_GRIPL2 0x226
|
||||||
|
#define BTN_GRIPR2 0x227
|
||||||
|
|
||||||
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
|
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
|
||||||
#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
|
#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
|
||||||
|
#define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */
|
||||||
|
|
||||||
#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
|
#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
|
||||||
#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
|
#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
|
||||||
|
|
@ -607,10 +620,29 @@
|
||||||
#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
|
#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
|
||||||
#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
|
#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
|
||||||
#define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
|
#define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
|
||||||
|
#define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */
|
||||||
|
#define KEY_DICTATE 0x24a /* Start or Stop Voice Dictation Session (HUTRR99) */
|
||||||
|
#define KEY_CAMERA_ACCESS_ENABLE 0x24b /* Enables programmatic access to camera devices. (HUTRR72) */
|
||||||
|
#define KEY_CAMERA_ACCESS_DISABLE 0x24c /* Disables programmatic access to camera devices. (HUTRR72) */
|
||||||
|
#define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */
|
||||||
|
#define KEY_ACCESSIBILITY 0x24e /* Toggles the system bound accessibility UI/command (HUTRR116) */
|
||||||
|
#define KEY_DO_NOT_DISTURB 0x24f /* Toggles the system-wide "Do Not Disturb" control (HUTRR94)*/
|
||||||
|
|
||||||
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
|
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
|
||||||
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
|
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Keycodes for hotkeys toggling the electronic privacy screen found on some
|
||||||
|
* laptops on/off. Note when the embedded-controller turns on/off the eprivacy
|
||||||
|
* screen itself then the state should be reported through drm connecter props:
|
||||||
|
* https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties
|
||||||
|
* Except when implementing the drm connecter properties API is not possible
|
||||||
|
* because e.g. the firmware does not allow querying the presence and/or status
|
||||||
|
* of the eprivacy screen at boot.
|
||||||
|
*/
|
||||||
|
#define KEY_EPRIVACY_SCREEN_ON 0x252
|
||||||
|
#define KEY_EPRIVACY_SCREEN_OFF 0x253
|
||||||
|
|
||||||
#define KEY_KBDINPUTASSIST_PREV 0x260
|
#define KEY_KBDINPUTASSIST_PREV 0x260
|
||||||
#define KEY_KBDINPUTASSIST_NEXT 0x261
|
#define KEY_KBDINPUTASSIST_NEXT 0x261
|
||||||
#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
|
#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
|
||||||
|
|
@ -655,6 +687,27 @@
|
||||||
/* Select an area of screen to be copied */
|
/* Select an area of screen to be copied */
|
||||||
#define KEY_SELECTIVE_SCREENSHOT 0x27a
|
#define KEY_SELECTIVE_SCREENSHOT 0x27a
|
||||||
|
|
||||||
|
/* Move the focus to the next or previous user controllable element within a UI container */
|
||||||
|
#define KEY_NEXT_ELEMENT 0x27b
|
||||||
|
#define KEY_PREVIOUS_ELEMENT 0x27c
|
||||||
|
|
||||||
|
/* Toggle Autopilot engagement */
|
||||||
|
#define KEY_AUTOPILOT_ENGAGE_TOGGLE 0x27d
|
||||||
|
|
||||||
|
/* Shortcut Keys */
|
||||||
|
#define KEY_MARK_WAYPOINT 0x27e
|
||||||
|
#define KEY_SOS 0x27f
|
||||||
|
#define KEY_NAV_CHART 0x280
|
||||||
|
#define KEY_FISHING_CHART 0x281
|
||||||
|
#define KEY_SINGLE_RANGE_RADAR 0x282
|
||||||
|
#define KEY_DUAL_RANGE_RADAR 0x283
|
||||||
|
#define KEY_RADAR_OVERLAY 0x284
|
||||||
|
#define KEY_TRADITIONAL_SONAR 0x285
|
||||||
|
#define KEY_CLEARVU_SONAR 0x286
|
||||||
|
#define KEY_SIDEVU_SONAR 0x287
|
||||||
|
#define KEY_NAV_INFO 0x288
|
||||||
|
#define KEY_BRIGHTNESS_MENU 0x289
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some keyboards have keys which do not have a defined meaning, these keys
|
* Some keyboards have keys which do not have a defined meaning, these keys
|
||||||
* are intended to be programmed / bound to macros by the user. For most
|
* are intended to be programmed / bound to macros by the user. For most
|
||||||
|
|
@ -730,6 +783,9 @@
|
||||||
#define KEY_KBD_LCD_MENU4 0x2bb
|
#define KEY_KBD_LCD_MENU4 0x2bb
|
||||||
#define KEY_KBD_LCD_MENU5 0x2bc
|
#define KEY_KBD_LCD_MENU5 0x2bc
|
||||||
|
|
||||||
|
/* Performance Boost key (Alienware)/G-Mode key (Dell) */
|
||||||
|
#define KEY_PERFORMANCE 0x2bd
|
||||||
|
|
||||||
#define BTN_TRIGGER_HAPPY 0x2c0
|
#define BTN_TRIGGER_HAPPY 0x2c0
|
||||||
#define BTN_TRIGGER_HAPPY1 0x2c0
|
#define BTN_TRIGGER_HAPPY1 0x2c0
|
||||||
#define BTN_TRIGGER_HAPPY2 0x2c1
|
#define BTN_TRIGGER_HAPPY2 0x2c1
|
||||||
|
|
@ -834,6 +890,7 @@
|
||||||
#define ABS_TOOL_WIDTH 0x1c
|
#define ABS_TOOL_WIDTH 0x1c
|
||||||
|
|
||||||
#define ABS_VOLUME 0x20
|
#define ABS_VOLUME 0x20
|
||||||
|
#define ABS_PROFILE 0x21
|
||||||
|
|
||||||
#define ABS_MISC 0x28
|
#define ABS_MISC 0x28
|
||||||
|
|
||||||
|
|
@ -889,7 +946,8 @@
|
||||||
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
|
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
|
||||||
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
|
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
|
||||||
#define SW_MACHINE_COVER 0x10 /* set = cover closed */
|
#define SW_MACHINE_COVER 0x10 /* set = cover closed */
|
||||||
#define SW_MAX 0x10
|
#define SW_USB_INSERT 0x11 /* set = USB audio device connected */
|
||||||
|
#define SW_MAX 0x11
|
||||||
#define SW_CNT (SW_MAX+1)
|
#define SW_CNT (SW_MAX+1)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
|
#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
|
||||||
#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
|
#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
|
||||||
#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */
|
#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */
|
||||||
|
#define INPUT_PROP_PRESSUREPAD 0x07 /* pressure triggers clicks */
|
||||||
|
|
||||||
#define INPUT_PROP_MAX 0x1f
|
#define INPUT_PROP_MAX 0x1f
|
||||||
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
|
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
|
||||||
|
|
@ -278,7 +279,8 @@
|
||||||
#define KEY_PAUSECD 201
|
#define KEY_PAUSECD 201
|
||||||
#define KEY_PROG3 202
|
#define KEY_PROG3 202
|
||||||
#define KEY_PROG4 203
|
#define KEY_PROG4 203
|
||||||
#define KEY_DASHBOARD 204 /* AL Dashboard */
|
#define KEY_ALL_APPLICATIONS 204 /* AC Desktop Show All Applications */
|
||||||
|
#define KEY_DASHBOARD KEY_ALL_APPLICATIONS
|
||||||
#define KEY_SUSPEND 205
|
#define KEY_SUSPEND 205
|
||||||
#define KEY_CLOSE 206 /* AC Close */
|
#define KEY_CLOSE 206 /* AC Close */
|
||||||
#define KEY_PLAY 207
|
#define KEY_PLAY 207
|
||||||
|
|
@ -515,6 +517,10 @@
|
||||||
#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
|
#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
|
||||||
#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
|
#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
|
||||||
#define KEY_IMAGES 0x1ba /* AL Image Browser */
|
#define KEY_IMAGES 0x1ba /* AL Image Browser */
|
||||||
|
#define KEY_NOTIFICATION_CENTER 0x1bc /* Show/hide the notification center */
|
||||||
|
#define KEY_PICKUP_PHONE 0x1bd /* Answer incoming call */
|
||||||
|
#define KEY_HANGUP_PHONE 0x1be /* Decline incoming call */
|
||||||
|
#define KEY_LINK_PHONE 0x1bf /* AL Phone Syncing */
|
||||||
|
|
||||||
#define KEY_DEL_EOL 0x1c0
|
#define KEY_DEL_EOL 0x1c0
|
||||||
#define KEY_DEL_EOS 0x1c1
|
#define KEY_DEL_EOS 0x1c1
|
||||||
|
|
@ -542,6 +548,7 @@
|
||||||
#define KEY_FN_F 0x1e2
|
#define KEY_FN_F 0x1e2
|
||||||
#define KEY_FN_S 0x1e3
|
#define KEY_FN_S 0x1e3
|
||||||
#define KEY_FN_B 0x1e4
|
#define KEY_FN_B 0x1e4
|
||||||
|
#define KEY_FN_RIGHT_SHIFT 0x1e5
|
||||||
|
|
||||||
#define KEY_BRL_DOT1 0x1f1
|
#define KEY_BRL_DOT1 0x1f1
|
||||||
#define KEY_BRL_DOT2 0x1f2
|
#define KEY_BRL_DOT2 0x1f2
|
||||||
|
|
@ -595,8 +602,14 @@
|
||||||
#define BTN_DPAD_LEFT 0x222
|
#define BTN_DPAD_LEFT 0x222
|
||||||
#define BTN_DPAD_RIGHT 0x223
|
#define BTN_DPAD_RIGHT 0x223
|
||||||
|
|
||||||
|
#define BTN_GRIPL 0x224
|
||||||
|
#define BTN_GRIPR 0x225
|
||||||
|
#define BTN_GRIPL2 0x226
|
||||||
|
#define BTN_GRIPR2 0x227
|
||||||
|
|
||||||
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
|
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
|
||||||
#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
|
#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
|
||||||
|
#define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */
|
||||||
|
|
||||||
#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
|
#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
|
||||||
#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
|
#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
|
||||||
|
|
@ -607,10 +620,29 @@
|
||||||
#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
|
#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
|
||||||
#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
|
#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
|
||||||
#define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
|
#define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
|
||||||
|
#define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */
|
||||||
|
#define KEY_DICTATE 0x24a /* Start or Stop Voice Dictation Session (HUTRR99) */
|
||||||
|
#define KEY_CAMERA_ACCESS_ENABLE 0x24b /* Enables programmatic access to camera devices. (HUTRR72) */
|
||||||
|
#define KEY_CAMERA_ACCESS_DISABLE 0x24c /* Disables programmatic access to camera devices. (HUTRR72) */
|
||||||
|
#define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */
|
||||||
|
#define KEY_ACCESSIBILITY 0x24e /* Toggles the system bound accessibility UI/command (HUTRR116) */
|
||||||
|
#define KEY_DO_NOT_DISTURB 0x24f /* Toggles the system-wide "Do Not Disturb" control (HUTRR94)*/
|
||||||
|
|
||||||
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
|
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
|
||||||
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
|
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Keycodes for hotkeys toggling the electronic privacy screen found on some
|
||||||
|
* laptops on/off. Note when the embedded-controller turns on/off the eprivacy
|
||||||
|
* screen itself then the state should be reported through drm connecter props:
|
||||||
|
* https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties
|
||||||
|
* Except when implementing the drm connecter properties API is not possible
|
||||||
|
* because e.g. the firmware does not allow querying the presence and/or status
|
||||||
|
* of the eprivacy screen at boot.
|
||||||
|
*/
|
||||||
|
#define KEY_EPRIVACY_SCREEN_ON 0x252
|
||||||
|
#define KEY_EPRIVACY_SCREEN_OFF 0x253
|
||||||
|
|
||||||
#define KEY_KBDINPUTASSIST_PREV 0x260
|
#define KEY_KBDINPUTASSIST_PREV 0x260
|
||||||
#define KEY_KBDINPUTASSIST_NEXT 0x261
|
#define KEY_KBDINPUTASSIST_NEXT 0x261
|
||||||
#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
|
#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
|
||||||
|
|
@ -655,6 +687,27 @@
|
||||||
/* Select an area of screen to be copied */
|
/* Select an area of screen to be copied */
|
||||||
#define KEY_SELECTIVE_SCREENSHOT 0x27a
|
#define KEY_SELECTIVE_SCREENSHOT 0x27a
|
||||||
|
|
||||||
|
/* Move the focus to the next or previous user controllable element within a UI container */
|
||||||
|
#define KEY_NEXT_ELEMENT 0x27b
|
||||||
|
#define KEY_PREVIOUS_ELEMENT 0x27c
|
||||||
|
|
||||||
|
/* Toggle Autopilot engagement */
|
||||||
|
#define KEY_AUTOPILOT_ENGAGE_TOGGLE 0x27d
|
||||||
|
|
||||||
|
/* Shortcut Keys */
|
||||||
|
#define KEY_MARK_WAYPOINT 0x27e
|
||||||
|
#define KEY_SOS 0x27f
|
||||||
|
#define KEY_NAV_CHART 0x280
|
||||||
|
#define KEY_FISHING_CHART 0x281
|
||||||
|
#define KEY_SINGLE_RANGE_RADAR 0x282
|
||||||
|
#define KEY_DUAL_RANGE_RADAR 0x283
|
||||||
|
#define KEY_RADAR_OVERLAY 0x284
|
||||||
|
#define KEY_TRADITIONAL_SONAR 0x285
|
||||||
|
#define KEY_CLEARVU_SONAR 0x286
|
||||||
|
#define KEY_SIDEVU_SONAR 0x287
|
||||||
|
#define KEY_NAV_INFO 0x288
|
||||||
|
#define KEY_BRIGHTNESS_MENU 0x289
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some keyboards have keys which do not have a defined meaning, these keys
|
* Some keyboards have keys which do not have a defined meaning, these keys
|
||||||
* are intended to be programmed / bound to macros by the user. For most
|
* are intended to be programmed / bound to macros by the user. For most
|
||||||
|
|
@ -730,6 +783,9 @@
|
||||||
#define KEY_KBD_LCD_MENU4 0x2bb
|
#define KEY_KBD_LCD_MENU4 0x2bb
|
||||||
#define KEY_KBD_LCD_MENU5 0x2bc
|
#define KEY_KBD_LCD_MENU5 0x2bc
|
||||||
|
|
||||||
|
/* Performance Boost key (Alienware)/G-Mode key (Dell) */
|
||||||
|
#define KEY_PERFORMANCE 0x2bd
|
||||||
|
|
||||||
#define BTN_TRIGGER_HAPPY 0x2c0
|
#define BTN_TRIGGER_HAPPY 0x2c0
|
||||||
#define BTN_TRIGGER_HAPPY1 0x2c0
|
#define BTN_TRIGGER_HAPPY1 0x2c0
|
||||||
#define BTN_TRIGGER_HAPPY2 0x2c1
|
#define BTN_TRIGGER_HAPPY2 0x2c1
|
||||||
|
|
@ -834,6 +890,7 @@
|
||||||
#define ABS_TOOL_WIDTH 0x1c
|
#define ABS_TOOL_WIDTH 0x1c
|
||||||
|
|
||||||
#define ABS_VOLUME 0x20
|
#define ABS_VOLUME 0x20
|
||||||
|
#define ABS_PROFILE 0x21
|
||||||
|
|
||||||
#define ABS_MISC 0x28
|
#define ABS_MISC 0x28
|
||||||
|
|
||||||
|
|
@ -889,7 +946,8 @@
|
||||||
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
|
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
|
||||||
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
|
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
|
||||||
#define SW_MACHINE_COVER 0x10 /* set = cover closed */
|
#define SW_MACHINE_COVER 0x10 /* set = cover closed */
|
||||||
#define SW_MAX 0x10
|
#define SW_USB_INSERT 0x11 /* set = USB audio device connected */
|
||||||
|
#define SW_MAX 0x11
|
||||||
#define SW_CNT (SW_MAX+1)
|
#define SW_CNT (SW_MAX+1)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -891,6 +891,7 @@ if get_option('tests')
|
||||||
'test/litest-device-keyboard-razer-blackwidow.c',
|
'test/litest-device-keyboard-razer-blackwidow.c',
|
||||||
'test/litest-device-keyboard-razer-blade-stealth.c',
|
'test/litest-device-keyboard-razer-blade-stealth.c',
|
||||||
'test/litest-device-keyboard-razer-blade-stealth-videoswitch.c',
|
'test/litest-device-keyboard-razer-blade-stealth-videoswitch.c',
|
||||||
|
'test/litest-device-keypad-slide-switch.c',
|
||||||
'test/litest-device-lenovo-scrollpoint.c',
|
'test/litest-device-lenovo-scrollpoint.c',
|
||||||
'test/litest-device-lid-switch.c',
|
'test/litest-device-lid-switch.c',
|
||||||
'test/litest-device-lid-switch-surface3.c',
|
'test/litest-device-lid-switch-surface3.c',
|
||||||
|
|
|
||||||
|
|
@ -323,3 +323,10 @@ MatchBus=usb
|
||||||
MatchVendor=0x1532
|
MatchVendor=0x1532
|
||||||
MatchProduct=0x02C6
|
MatchProduct=0x02C6
|
||||||
AttrKeyboardIntegration=internal
|
AttrKeyboardIntegration=internal
|
||||||
|
|
||||||
|
[RazerBlade182025 Keyboard]
|
||||||
|
MatchUdevType=keyboard
|
||||||
|
MatchBus=usb
|
||||||
|
MatchVendor=0x1532
|
||||||
|
MatchProduct=0x02C7
|
||||||
|
AttrKeyboardIntegration=internal
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,14 @@ MatchVendor=0x0002
|
||||||
MatchProduct=0x0007
|
MatchProduct=0x0007
|
||||||
ModelSynapticsSerialTouchpad=1
|
ModelSynapticsSerialTouchpad=1
|
||||||
|
|
||||||
|
# "SYNA3580:00 06CB:CFD2 Touchpad": pressure touchpad mostly used in HP laptops.
|
||||||
|
[Synaptics 06CB:CFD2 Touchpad]
|
||||||
|
MatchBus=i2c
|
||||||
|
MatchVendor=0x06CB
|
||||||
|
MatchProduct=0xCFD2
|
||||||
|
MatchUdevType=touchpad
|
||||||
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
# SYNA3602:00 0911:5288 touchpad, clickpad pretending it has a right button.
|
# SYNA3602:00 0911:5288 touchpad, clickpad pretending it has a right button.
|
||||||
# Integrated into several systems, including
|
# Integrated into several systems, including
|
||||||
# Purism Librem 14v1
|
# Purism Librem 14v1
|
||||||
|
|
|
||||||
|
|
@ -136,13 +136,13 @@ ModelTabletModeNoSuspend=1
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x27C6
|
MatchVendor=0x27C6
|
||||||
MatchProduct=0x0F60
|
MatchProduct=0x0F60
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
[Dell Mayabay Touchpad]
|
[Dell Mayabay Touchpad]
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x06CB
|
MatchVendor=0x06CB
|
||||||
MatchProduct=0xCFA0
|
MatchProduct=0xCFA0
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
[Dell Precision 5480]
|
[Dell Precision 5480]
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
|
|
@ -156,58 +156,58 @@ ModelTouchpadVisibleMarker=0
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x06CB
|
MatchVendor=0x06CB
|
||||||
MatchProduct=0xCFF8
|
MatchProduct=0xCFF8
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
[Dell laptop 16 Synaptics touchpad]
|
[Dell laptop 16 Synaptics touchpad]
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x06CB
|
MatchVendor=0x06CB
|
||||||
MatchProduct=0xCFF9
|
MatchProduct=0xCFF9
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
[Dell laptop 14 Goodix touchpad]
|
[Dell laptop 14 Goodix touchpad]
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x27C6
|
MatchVendor=0x27C6
|
||||||
MatchProduct=0x0F61
|
MatchProduct=0x0F61
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
[Dell laptop 16 Goodix touchpad]
|
[Dell laptop 16 Goodix touchpad]
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x27C6
|
MatchVendor=0x27C6
|
||||||
MatchProduct=0x0F62
|
MatchProduct=0x0F62
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
[Dell 14 Premium DA14250 touchpad]
|
[Dell 14 Premium DA14250 touchpad]
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x0488
|
MatchVendor=0x0488
|
||||||
MatchProduct=0x108C
|
MatchProduct=0x108C
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
[Dell 16 Premium DA16250 touchpad]
|
[Dell 16 Premium DA16250 touchpad]
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x0488
|
MatchVendor=0x0488
|
||||||
MatchProduct=0x108D
|
MatchProduct=0x108D
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
[Dell laptop 14_1 Synaptics touchpad]
|
[Dell laptop 14_1 Synaptics touchpad]
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x06CB
|
MatchVendor=0x06CB
|
||||||
MatchProduct=0xD01D
|
MatchProduct=0xD01D
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
[Dell laptop 16_1 Synaptics touchpad]
|
[Dell laptop 16_1 Synaptics touchpad]
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x06CB
|
MatchVendor=0x06CB
|
||||||
MatchProduct=0xD01A
|
MatchProduct=0xD01A
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
[Dell laptop 14 Sensel touchpad]
|
[Dell laptop 14 Sensel touchpad]
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x2C2F
|
MatchVendor=0x2C2F
|
||||||
MatchProduct=0x0034
|
MatchProduct=0x0034
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
[Dell laptop 16 Sensel touchpad]
|
[Dell laptop 16 Sensel touchpad]
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x2C2F
|
MatchVendor=0x2C2F
|
||||||
MatchProduct=0x0033
|
MatchProduct=0x0033
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
# Clickpad that announces BTN_RIGHT
|
# Clickpad that announces BTN_RIGHT
|
||||||
# requires ModelPressurePad=1
|
# requires AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
[HONOR MagicBook Art 14]
|
[HONOR MagicBook Art 14]
|
||||||
MatchName=*TOPS0102*
|
MatchName=*TOPS0102*
|
||||||
MatchDMIModalias=dmi:*svnHONOR:*pnMRA-XXX*
|
MatchDMIModalias=dmi:*svnHONOR:*pnMRA-XXX*
|
||||||
MatchUdevType=touchpad
|
MatchUdevType=touchpad
|
||||||
AttrEventCode=-BTN_RIGHT
|
AttrEventCode=-BTN_RIGHT
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
# Do not edit this file, it will be overwritten on update
|
# Do not edit this file, it will be overwritten on update
|
||||||
#
|
|
||||||
|
[HP Chromebook 14]
|
||||||
|
MatchName=*Cypress APA Trackpad *cyapa*
|
||||||
|
MatchDMIModalias=dmi:*svnHewlett-Packard*:pnFalco*
|
||||||
|
AttrPressureRange=12:8
|
||||||
|
|
||||||
# Claims to have double/tripletap but doesn't actually send it
|
# Claims to have double/tripletap but doesn't actually send it
|
||||||
# https://bugs.freedesktop.org/show_bug.cgi?id=98538
|
# https://bugs.freedesktop.org/show_bug.cgi?id=98538
|
||||||
[HP Compaq 6910p]
|
[HP Compaq 6910p]
|
||||||
|
|
@ -14,43 +19,59 @@ MatchName=*SynPS/2 Synaptics TouchPad
|
||||||
MatchDMIModalias=dmi:*svnHewlett-Packard:*pnHPCompaq8510w*
|
MatchDMIModalias=dmi:*svnHewlett-Packard:*pnHPCompaq8510w*
|
||||||
AttrEventCode=-BTN_TOOL_DOUBLETAP;-BTN_TOOL_TRIPLETAP;
|
AttrEventCode=-BTN_TOOL_DOUBLETAP;-BTN_TOOL_TRIPLETAP;
|
||||||
|
|
||||||
|
[HP Elite x2 1013 G3 Keyboard]
|
||||||
|
MatchUdevType=keyboard
|
||||||
|
MatchBus=ps2
|
||||||
|
MatchDMIModalias=dmi:*svnHP:pnHPElitex21013G3:*
|
||||||
|
AttrKeyboardIntegration=external
|
||||||
|
|
||||||
|
[HP Elite x2 1013 G3 Tablet Mode Switch]
|
||||||
|
MatchName=*Intel Virtual Button*
|
||||||
|
MatchDMIModalias=dmi:*svnHP:pnHPElitex21013G3:*
|
||||||
|
ModelTabletModeSwitchUnreliable=1
|
||||||
|
|
||||||
|
[HP Elite x2 1013 G3 Touchpad]
|
||||||
|
MatchUdevType=touchpad
|
||||||
|
MatchBus=usb
|
||||||
|
MatchVendor=0x044E
|
||||||
|
MatchProduct=0x1221
|
||||||
|
AttrTPKComboLayout=below
|
||||||
|
|
||||||
|
# The HP OmniBook Ultra Flip Laptop 14-fh0xxx's custom Intel ISH firmware
|
||||||
|
# filters out events from its builtin keyboard and touchpad when the hinge is
|
||||||
|
# opened little more than 180 degrees but toggles tablet-mode when it's opened
|
||||||
|
# little less than 180 degrees.
|
||||||
|
# Do not suspend the keyboard and touchpad to let use the device in flat
|
||||||
|
# position and also give consistency with some keyboard keys controlled by the
|
||||||
|
# Video Bus device (brightness down/up), the HP WMI hotkeys device (mic mute and
|
||||||
|
# hp hubs launcher key) and the backlight getting on and off by the firmware at
|
||||||
|
# the same time it enables disables the input.
|
||||||
|
# This one is for the keyboard and...
|
||||||
|
[HP OmniBook Ultra Flip Laptop 14-fh0xxx Keyboard]
|
||||||
|
MatchBus=ps2
|
||||||
|
MatchUdevType=keyboard
|
||||||
|
MatchDMIModalias=dmi:*:svnHP:pnHPOmniBookUltraFlipLaptop14-fh0xxx:*
|
||||||
|
ModelTabletModeNoSuspend=1
|
||||||
|
|
||||||
|
# ...this one is for the touchpad.
|
||||||
|
[HP OmniBook Ultra Flip Laptop 14-fh0xxx Touchpad]
|
||||||
|
MatchBus=i2c
|
||||||
|
MatchVendor=0x06CB
|
||||||
|
MatchProduct=0xCFD2
|
||||||
|
MatchUdevType=touchpad
|
||||||
|
MatchDMIModalias=dmi:*:svnHP:pnHPOmniBookUltraFlipLaptop14-fh0xxx:*
|
||||||
|
ModelTabletModeNoSuspend=1
|
||||||
|
|
||||||
[HP Pavilion dmi4]
|
[HP Pavilion dmi4]
|
||||||
MatchName=*SynPS/2 Synaptics TouchPad
|
MatchName=*SynPS/2 Synaptics TouchPad
|
||||||
MatchDMIModalias=dmi:*svnHewlett-Packard:*pnHPPaviliondm4NotebookPC*
|
MatchDMIModalias=dmi:*svnHewlett-Packard:*pnHPPaviliondm4NotebookPC*
|
||||||
ModelHPPavilionDM4Touchpad=1
|
ModelHPPavilionDM4Touchpad=1
|
||||||
|
|
||||||
# Touchpad is a clickpad but INPUT_PROP_BUTTONPAD is not set, see
|
|
||||||
# https://bugs.freedesktop.org/show_bug.cgi?id=97147
|
|
||||||
[HP Stream 11]
|
|
||||||
MatchName=SYN1EDE:00 06CB:7442*
|
|
||||||
MatchDMIModalias=dmi:*svnHewlett-Packard:pnHPStreamNotebookPC11*
|
|
||||||
AttrInputProp=+INPUT_PROP_BUTTONPAD
|
|
||||||
|
|
||||||
# The HP stream x360's embedded-controller filters out events form its builtin
|
|
||||||
# keyboard when in tablet-mode itself; and it has a capacitive home-button
|
|
||||||
# (windows logo) underneath its display which also sends PS/2 key-events.
|
|
||||||
# Do not suspend the keyboard when in tablet-mode so that the home button
|
|
||||||
# keeps working when in tablet-mode.
|
|
||||||
[HP Stream x360 11]
|
|
||||||
MatchName=AT Translated Set 2 keyboard
|
|
||||||
MatchDMIModalias=dmi:*:svnHewlett-Packard:pnHPStreamx360ConvertiblePC11:*
|
|
||||||
ModelTabletModeNoSuspend=1
|
|
||||||
|
|
||||||
[HP Spectre x360 Convertible 15-bl000]
|
[HP Spectre x360 Convertible 15-bl000]
|
||||||
MatchName=AT Translated Set 2 keyboard
|
MatchName=AT Translated Set 2 keyboard
|
||||||
MatchDMIModalias=dmi:*:svnHP:pnHPSpectrex360Convertible15-bl0XX:*
|
MatchDMIModalias=dmi:*:svnHP:pnHPSpectrex360Convertible15-bl0XX:*
|
||||||
ModelTabletModeNoSuspend=1
|
ModelTabletModeNoSuspend=1
|
||||||
|
|
||||||
[HP ZBook Studio G3]
|
|
||||||
MatchName=AlpsPS/2 ALPS GlidePoint
|
|
||||||
MatchDMIModalias=dmi:*svnHP:pnHPZBookStudioG3:*
|
|
||||||
ModelHPZBookStudioG3=1
|
|
||||||
|
|
||||||
[HP Chromebook 14]
|
|
||||||
MatchName=*Cypress APA Trackpad *cyapa*
|
|
||||||
MatchDMIModalias=dmi:*svnHewlett-Packard*:pnFalco*
|
|
||||||
AttrPressureRange=12:8
|
|
||||||
|
|
||||||
[HP Spectre x360 Convertible 15-bl1xx]
|
[HP Spectre x360 Convertible 15-bl1xx]
|
||||||
MatchUdevType=touchpad
|
MatchUdevType=touchpad
|
||||||
MatchName=*SynPS/2 Synaptics TouchPad
|
MatchName=*SynPS/2 Synaptics TouchPad
|
||||||
|
|
@ -75,47 +96,24 @@ MatchName=AT Translated Set 2 keyboard
|
||||||
MatchDMIModalias=dmi:*svnHP:pnHPSpectrex360Convertible15-ch0xx:*
|
MatchDMIModalias=dmi:*svnHP:pnHPSpectrex360Convertible15-ch0xx:*
|
||||||
ModelTabletModeNoSuspend=1
|
ModelTabletModeNoSuspend=1
|
||||||
|
|
||||||
[HP Elite x2 1013 G3 Tablet Mode Switch]
|
# Touchpad is a clickpad but INPUT_PROP_BUTTONPAD is not set, see
|
||||||
MatchName=*Intel Virtual Button*
|
# https://bugs.freedesktop.org/show_bug.cgi?id=97147
|
||||||
MatchDMIModalias=dmi:*svnHP:pnHPElitex21013G3:*
|
[HP Stream 11]
|
||||||
ModelTabletModeSwitchUnreliable=1
|
MatchName=SYN1EDE:00 06CB:7442*
|
||||||
|
MatchDMIModalias=dmi:*svnHewlett-Packard:pnHPStreamNotebookPC11*
|
||||||
|
AttrInputProp=+INPUT_PROP_BUTTONPAD
|
||||||
|
|
||||||
[HP Elite x2 1013 G3 Touchpad]
|
# The HP stream x360's embedded-controller filters out events form its builtin
|
||||||
MatchUdevType=touchpad
|
# keyboard when in tablet-mode itself; and it has a capacitive home-button
|
||||||
MatchBus=usb
|
# (windows logo) underneath its display which also sends PS/2 key-events.
|
||||||
MatchVendor=0x044E
|
# Do not suspend the keyboard when in tablet-mode so that the home button
|
||||||
MatchProduct=0x1221
|
# keeps working when in tablet-mode.
|
||||||
AttrTPKComboLayout=below
|
[HP Stream x360 11]
|
||||||
|
|
||||||
[HP Elite x2 1013 G3 Keyboard]
|
|
||||||
MatchUdevType=keyboard
|
|
||||||
MatchBus=ps2
|
|
||||||
MatchDMIModalias=dmi:*svnHP:pnHPElitex21013G3:*
|
|
||||||
AttrKeyboardIntegration=external
|
|
||||||
|
|
||||||
[HP Haptics Touchpad CFD2]
|
|
||||||
MatchBus=i2c
|
|
||||||
MatchVendor=0x06CB
|
|
||||||
MatchProduct=0xCFD2
|
|
||||||
ModelPressurePad=1
|
|
||||||
|
|
||||||
# The HP OmniBook Ultra Flip Laptop 14-fh0xxx's custom Intel ISH firmware
|
|
||||||
# filters out events from its builtin keyboard and touchpad when the hinge is
|
|
||||||
# opened little more than 180 degrees but toggles tablet-mode when it's opened
|
|
||||||
# little less than 180 degrees.
|
|
||||||
# Do not suspend the keyboard and touchpad to let use the device in flat
|
|
||||||
# position and also give consistency with some keyboard keys controlled by the
|
|
||||||
# Video Bus device (brightness down/up), the HP WMI hotkeys device (mic mute and
|
|
||||||
# hp hubs launcher key) and the backlight getting on and off by the firmware at
|
|
||||||
# the same time it enables disables the input.
|
|
||||||
# This one is for the keyboard and...
|
|
||||||
[HP OmniBook Ultra Flip Laptop 14-fh0xxx Keyboard]
|
|
||||||
MatchName=AT Translated Set 2 keyboard
|
MatchName=AT Translated Set 2 keyboard
|
||||||
MatchDMIModalias=dmi:*svnHP:pnHPOmniBookUltraFlipLaptop14-fh0xxx:*
|
MatchDMIModalias=dmi:*:svnHewlett-Packard:pnHPStreamx360ConvertiblePC11:*
|
||||||
ModelTabletModeNoSuspend=1
|
ModelTabletModeNoSuspend=1
|
||||||
|
|
||||||
# ...this one is for the touchpad.
|
[HP ZBook Studio G3]
|
||||||
[HP OmniBook Ultra Flip Laptop 14-fh0xxx Touchpad]
|
MatchName=AlpsPS/2 ALPS GlidePoint
|
||||||
MatchName=SYNA3580:00 06CB:CFD2 Touchpad
|
MatchDMIModalias=dmi:*svnHP:pnHPZBookStudioG3:*
|
||||||
MatchDMIModalias=dmi:*svnHP:pnHPOmniBookUltraFlipLaptop14-fh0xxx:*
|
ModelHPZBookStudioG3=1
|
||||||
ModelTabletModeNoSuspend=1
|
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ MatchUdevType=touchpad
|
||||||
MatchDMIModalias=dmi:*svnHUAWEI:*pnMRGF-XX*
|
MatchDMIModalias=dmi:*svnHUAWEI:*pnMRGF-XX*
|
||||||
AttrEventCode=-BTN_RIGHT
|
AttrEventCode=-BTN_RIGHT
|
||||||
|
|
||||||
# 2024 model requires ModelPressurePad=1
|
# 2024 model requires AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
[Huawei MateBook X Pro 2024 Touchpad]
|
[Huawei MateBook X Pro 2024 Touchpad]
|
||||||
MatchName=GXTP7863:00 27C6:01E0 Touchpad
|
MatchName=GXTP7863:00 27C6:01E0 Touchpad
|
||||||
MatchUdevType=touchpad
|
MatchUdevType=touchpad
|
||||||
MatchDMIModalias=dmi:*svnHUAWEI:*pnVGHH-XX*
|
MatchDMIModalias=dmi:*svnHUAWEI:*pnVGHH-XX*
|
||||||
AttrEventCode=-BTN_RIGHT
|
AttrEventCode=-BTN_RIGHT
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ AttrTrackpointMultiplier=1.25
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x06CB
|
MatchVendor=0x06CB
|
||||||
MatchProduct=0xCE37
|
MatchProduct=0xCE37
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
[Lenovo Yoga C930 Tablet]
|
[Lenovo Yoga C930 Tablet]
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
|
|
@ -317,7 +317,7 @@ AttrKeyboardIntegration=internal
|
||||||
MatchBus=i2c
|
MatchBus=i2c
|
||||||
MatchVendor=0x27C6
|
MatchVendor=0x27C6
|
||||||
MatchProduct=0x01E8
|
MatchProduct=0x01E8
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
# Duet 7i tablet switch activated by folding keyboard cover, or removing it.
|
# Duet 7i tablet switch activated by folding keyboard cover, or removing it.
|
||||||
# We must not disable volume rocker 'keyboard'.
|
# We must not disable volume rocker 'keyboard'.
|
||||||
|
|
@ -394,14 +394,14 @@ AttrKeyboardIntegration=internal
|
||||||
MatchName=*GXTP5100*
|
MatchName=*GXTP5100*
|
||||||
MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkBook*G7+ASP*:*
|
MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkBook*G7+ASP*:*
|
||||||
MatchUdevType=touchpad
|
MatchUdevType=touchpad
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
# The ThinkBook 14/16 G6+ IMH also has a similar issue as the G7+ mentioned above.
|
# The ThinkBook 14/16 G6+ IMH also has a similar issue as the G7+ mentioned above.
|
||||||
[Lenovo ThinkBook G6+ IMH]
|
[Lenovo ThinkBook G6+ IMH]
|
||||||
MatchName=*GXTP5100*
|
MatchName=*GXTP5100*
|
||||||
MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkBook*G6+IMH*:*
|
MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkBook*G6+IMH*:*
|
||||||
MatchUdevType=touchpad
|
MatchUdevType=touchpad
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
# Lenovo Yoga Slim 7i Carbon sends bogus ABS_MT_TOOL_TYPE MT_TOOL_PALM events
|
# Lenovo Yoga Slim 7i Carbon sends bogus ABS_MT_TOOL_TYPE MT_TOOL_PALM events
|
||||||
[Lenovo Yoga Slim 7i Carbon]
|
[Lenovo Yoga Slim 7i Carbon]
|
||||||
|
|
@ -415,11 +415,11 @@ AttrEventCode=-ABS_MT_TOOL_TYPE
|
||||||
MatchName=*GXTP5100*
|
MatchName=*GXTP5100*
|
||||||
MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPadX9-15Gen1*:*
|
MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPadX9-15Gen1*:*
|
||||||
MatchUdevType=touchpad
|
MatchUdevType=touchpad
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
||||||
# The ThinkBook 14/16 G7+ IAH also has a similar issue as the ASP mentioned above.
|
# The ThinkBook 14/16 G7+ IAH also has a similar issue as the ASP mentioned above.
|
||||||
[Lenovo ThinkBook G7+ IAH touchpad]
|
[Lenovo ThinkBook G7+ IAH touchpad]
|
||||||
MatchName=*GXTP5100*
|
MatchName=*GXTP5100*
|
||||||
MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkBook*G7+IAH*:*
|
MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkBook*G7+IAH*:*
|
||||||
MatchUdevType=touchpad
|
MatchUdevType=touchpad
|
||||||
ModelPressurePad=1
|
AttrInputProp=+INPUT_PROP_PRESSUREPAD
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
static void
|
static void
|
||||||
fallback_keyboard_notify_key(struct fallback_dispatch *dispatch,
|
fallback_keyboard_notify_key(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
evdev_usage_t usage,
|
evdev_usage_t usage,
|
||||||
enum libinput_key_state state)
|
enum libinput_key_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -53,7 +53,7 @@ fallback_keyboard_notify_key(struct fallback_dispatch *dispatch,
|
||||||
static void
|
static void
|
||||||
fallback_lid_notify_toggle(struct fallback_dispatch *dispatch,
|
fallback_lid_notify_toggle(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (dispatch->lid.is_closed ^ dispatch->lid.is_closed_client_state) {
|
if (dispatch->lid.is_closed ^ dispatch->lid.is_closed_client_state) {
|
||||||
switch_notify_toggle(&device->base,
|
switch_notify_toggle(&device->base,
|
||||||
|
|
@ -67,7 +67,7 @@ fallback_lid_notify_toggle(struct fallback_dispatch *dispatch,
|
||||||
void
|
void
|
||||||
fallback_notify_physical_button(struct fallback_dispatch *dispatch,
|
fallback_notify_physical_button(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
evdev_usage_t button,
|
evdev_usage_t button,
|
||||||
enum libinput_button_state state)
|
enum libinput_button_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -82,20 +82,23 @@ fallback_interface_get_switch_state(struct evdev_dispatch *evdev_dispatch,
|
||||||
|
|
||||||
switch (sw) {
|
switch (sw) {
|
||||||
case LIBINPUT_SWITCH_TABLET_MODE:
|
case LIBINPUT_SWITCH_TABLET_MODE:
|
||||||
|
return dispatch->tablet_mode.sw.state ? LIBINPUT_SWITCH_STATE_ON
|
||||||
|
: LIBINPUT_SWITCH_STATE_OFF;
|
||||||
|
break;
|
||||||
|
case LIBINPUT_SWITCH_KEYPAD_SLIDE:
|
||||||
|
return dispatch->keypad_slide.sw.state ? LIBINPUT_SWITCH_STATE_ON
|
||||||
|
: LIBINPUT_SWITCH_STATE_OFF;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Internal function only, so we can abort here */
|
/* Internal function only, so we can abort here */
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
return dispatch->tablet_mode.sw.state ? LIBINPUT_SWITCH_STATE_ON
|
|
||||||
: LIBINPUT_SWITCH_STATE_OFF;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
post_button_scroll(struct evdev_device *device,
|
post_button_scroll(struct evdev_device *device,
|
||||||
struct device_float_coords raw,
|
struct device_float_coords raw,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (device->scroll.method != LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN)
|
if (device->scroll.method != LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -171,7 +174,7 @@ fallback_rotate_relative(struct fallback_dispatch *dispatch,
|
||||||
static void
|
static void
|
||||||
fallback_flush_relative_motion(struct fallback_dispatch *dispatch,
|
fallback_flush_relative_motion(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct libinput_device *base = &device->base;
|
struct libinput_device *base = &device->base;
|
||||||
struct normalized_coords accel;
|
struct normalized_coords accel;
|
||||||
|
|
@ -205,7 +208,7 @@ fallback_flush_relative_motion(struct fallback_dispatch *dispatch,
|
||||||
static void
|
static void
|
||||||
fallback_flush_wheels(struct fallback_dispatch *dispatch,
|
fallback_flush_wheels(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (!libinput_device_has_capability(&device->base, LIBINPUT_DEVICE_CAP_POINTER))
|
if (!libinput_device_has_capability(&device->base, LIBINPUT_DEVICE_CAP_POINTER))
|
||||||
return;
|
return;
|
||||||
|
|
@ -322,7 +325,7 @@ fallback_flush_wheels(struct fallback_dispatch *dispatch,
|
||||||
static void
|
static void
|
||||||
fallback_flush_absolute_motion(struct fallback_dispatch *dispatch,
|
fallback_flush_absolute_motion(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct libinput_device *base = &device->base;
|
struct libinput_device *base = &device->base;
|
||||||
struct device_coords point;
|
struct device_coords point;
|
||||||
|
|
@ -340,7 +343,7 @@ static bool
|
||||||
fallback_flush_mt_down(struct fallback_dispatch *dispatch,
|
fallback_flush_mt_down(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
int slot_idx,
|
int slot_idx,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct libinput_device *base = &device->base;
|
struct libinput_device *base = &device->base;
|
||||||
struct libinput_seat *seat = base->seat;
|
struct libinput_seat *seat = base->seat;
|
||||||
|
|
@ -379,7 +382,7 @@ static bool
|
||||||
fallback_flush_mt_motion(struct fallback_dispatch *dispatch,
|
fallback_flush_mt_motion(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
int slot_idx,
|
int slot_idx,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct libinput_device *base = &device->base;
|
struct libinput_device *base = &device->base;
|
||||||
struct device_coords point;
|
struct device_coords point;
|
||||||
|
|
@ -409,7 +412,7 @@ static bool
|
||||||
fallback_flush_mt_up(struct fallback_dispatch *dispatch,
|
fallback_flush_mt_up(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
int slot_idx,
|
int slot_idx,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct libinput_device *base = &device->base;
|
struct libinput_device *base = &device->base;
|
||||||
struct libinput_seat *seat = base->seat;
|
struct libinput_seat *seat = base->seat;
|
||||||
|
|
@ -437,7 +440,7 @@ static bool
|
||||||
fallback_flush_mt_cancel(struct fallback_dispatch *dispatch,
|
fallback_flush_mt_cancel(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
int slot_idx,
|
int slot_idx,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct libinput_device *base = &device->base;
|
struct libinput_device *base = &device->base;
|
||||||
struct libinput_seat *seat = base->seat;
|
struct libinput_seat *seat = base->seat;
|
||||||
|
|
@ -464,7 +467,7 @@ fallback_flush_mt_cancel(struct fallback_dispatch *dispatch,
|
||||||
static bool
|
static bool
|
||||||
fallback_flush_st_down(struct fallback_dispatch *dispatch,
|
fallback_flush_st_down(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct libinput_device *base = &device->base;
|
struct libinput_device *base = &device->base;
|
||||||
struct libinput_seat *seat = base->seat;
|
struct libinput_seat *seat = base->seat;
|
||||||
|
|
@ -500,7 +503,7 @@ fallback_flush_st_down(struct fallback_dispatch *dispatch,
|
||||||
static bool
|
static bool
|
||||||
fallback_flush_st_motion(struct fallback_dispatch *dispatch,
|
fallback_flush_st_motion(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct libinput_device *base = &device->base;
|
struct libinput_device *base = &device->base;
|
||||||
struct device_coords point;
|
struct device_coords point;
|
||||||
|
|
@ -522,7 +525,7 @@ fallback_flush_st_motion(struct fallback_dispatch *dispatch,
|
||||||
static bool
|
static bool
|
||||||
fallback_flush_st_up(struct fallback_dispatch *dispatch,
|
fallback_flush_st_up(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct libinput_device *base = &device->base;
|
struct libinput_device *base = &device->base;
|
||||||
struct libinput_seat *seat = base->seat;
|
struct libinput_seat *seat = base->seat;
|
||||||
|
|
@ -547,7 +550,7 @@ fallback_flush_st_up(struct fallback_dispatch *dispatch,
|
||||||
static bool
|
static bool
|
||||||
fallback_flush_st_cancel(struct fallback_dispatch *dispatch,
|
fallback_flush_st_cancel(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct libinput_device *base = &device->base;
|
struct libinput_device *base = &device->base;
|
||||||
struct libinput_seat *seat = base->seat;
|
struct libinput_seat *seat = base->seat;
|
||||||
|
|
@ -572,7 +575,7 @@ fallback_flush_st_cancel(struct fallback_dispatch *dispatch,
|
||||||
static void
|
static void
|
||||||
fallback_process_touch_button(struct fallback_dispatch *dispatch,
|
fallback_process_touch_button(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int value)
|
int value)
|
||||||
{
|
{
|
||||||
dispatch->pending_event |=
|
dispatch->pending_event |=
|
||||||
|
|
@ -583,7 +586,7 @@ static inline void
|
||||||
fallback_process_key(struct fallback_dispatch *dispatch,
|
fallback_process_key(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
/* ignore kernel key repeat */
|
/* ignore kernel key repeat */
|
||||||
if (e->value == 2)
|
if (e->value == 2)
|
||||||
|
|
@ -625,7 +628,7 @@ static void
|
||||||
fallback_process_touch(struct fallback_dispatch *dispatch,
|
fallback_process_touch(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct mt_slot *slot = &dispatch->mt.slots[dispatch->mt.slot];
|
struct mt_slot *slot = &dispatch->mt.slots[dispatch->mt.slot];
|
||||||
|
|
||||||
|
|
@ -726,7 +729,7 @@ fallback_process_absolute_motion(struct fallback_dispatch *dispatch,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fallback_lid_keyboard_event(uint64_t time, struct libinput_event *event, void *data)
|
fallback_lid_keyboard_event(usec_t time, struct libinput_event *event, void *data)
|
||||||
{
|
{
|
||||||
struct fallback_dispatch *dispatch = fallback_dispatch(data);
|
struct fallback_dispatch *dispatch = fallback_dispatch(data);
|
||||||
|
|
||||||
|
|
@ -741,8 +744,8 @@ fallback_lid_keyboard_event(uint64_t time, struct libinput_event *event, void *d
|
||||||
int rc;
|
int rc;
|
||||||
struct input_event ev[2];
|
struct input_event ev[2];
|
||||||
|
|
||||||
ev[0] = input_event_init(0, EV_SW, SW_LID, 0);
|
ev[0] = input_event_init(usec_from_uint64_t(0), EV_SW, SW_LID, 0);
|
||||||
ev[1] = input_event_init(0, EV_SYN, SYN_REPORT, 0);
|
ev[1] = input_event_init(usec_from_uint64_t(0), EV_SYN, SYN_REPORT, 0);
|
||||||
|
|
||||||
rc = write(fd, ev, sizeof(ev));
|
rc = write(fd, ev, sizeof(ev));
|
||||||
|
|
||||||
|
|
@ -800,7 +803,7 @@ static inline void
|
||||||
fallback_process_switch(struct fallback_dispatch *dispatch,
|
fallback_process_switch(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum libinput_switch_state state;
|
enum libinput_switch_state state;
|
||||||
bool is_closed;
|
bool is_closed;
|
||||||
|
|
@ -833,6 +836,20 @@ fallback_process_switch(struct fallback_dispatch *dispatch,
|
||||||
LIBINPUT_SWITCH_TABLET_MODE,
|
LIBINPUT_SWITCH_TABLET_MODE,
|
||||||
state);
|
state);
|
||||||
break;
|
break;
|
||||||
|
case EVDEV_SW_KEYPAD_SLIDE:
|
||||||
|
if (dispatch->keypad_slide.sw.state == e->value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dispatch->keypad_slide.sw.state = e->value;
|
||||||
|
if (e->value)
|
||||||
|
state = LIBINPUT_SWITCH_STATE_ON;
|
||||||
|
else
|
||||||
|
state = LIBINPUT_SWITCH_STATE_OFF;
|
||||||
|
switch_notify_toggle(&device->base,
|
||||||
|
time,
|
||||||
|
LIBINPUT_SWITCH_KEYPAD_SLIDE,
|
||||||
|
state);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -841,7 +858,7 @@ fallback_process_switch(struct fallback_dispatch *dispatch,
|
||||||
static inline bool
|
static inline bool
|
||||||
fallback_reject_relative(struct evdev_device *device,
|
fallback_reject_relative(struct evdev_device *device,
|
||||||
const struct evdev_event *e,
|
const struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (evdev_usage_enum(e->usage)) {
|
switch (evdev_usage_enum(e->usage)) {
|
||||||
case EVDEV_REL_X:
|
case EVDEV_REL_X:
|
||||||
|
|
@ -876,7 +893,7 @@ static inline void
|
||||||
fallback_process_relative(struct fallback_dispatch *dispatch,
|
fallback_process_relative(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (fallback_reject_relative(device, e, time))
|
if (fallback_reject_relative(device, e, time))
|
||||||
return;
|
return;
|
||||||
|
|
@ -915,7 +932,7 @@ static inline void
|
||||||
fallback_process_absolute(struct fallback_dispatch *dispatch,
|
fallback_process_absolute(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (device->is_mt) {
|
if (device->is_mt) {
|
||||||
fallback_process_touch(dispatch, device, e, time);
|
fallback_process_touch(dispatch, device, e, time);
|
||||||
|
|
@ -959,7 +976,7 @@ fallback_arbitrate_touch(struct fallback_dispatch *dispatch, struct mt_slot *slo
|
||||||
static inline bool
|
static inline bool
|
||||||
fallback_flush_mt_events(struct fallback_dispatch *dispatch,
|
fallback_flush_mt_events(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
bool sent = false;
|
bool sent = false;
|
||||||
|
|
||||||
|
|
@ -1030,7 +1047,7 @@ fallback_flush_mt_events(struct fallback_dispatch *dispatch,
|
||||||
static void
|
static void
|
||||||
fallback_handle_state(struct fallback_dispatch *dispatch,
|
fallback_handle_state(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
bool need_touch_frame = false;
|
bool need_touch_frame = false;
|
||||||
|
|
||||||
|
|
@ -1098,7 +1115,7 @@ static void
|
||||||
fallback_interface_process_event(struct evdev_dispatch *evdev_dispatch,
|
fallback_interface_process_event(struct evdev_dispatch *evdev_dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *event,
|
struct evdev_event *event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
|
struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
|
||||||
static bool warned = false;
|
static bool warned = false;
|
||||||
|
|
@ -1138,7 +1155,7 @@ static void
|
||||||
fallback_interface_process(struct evdev_dispatch *dispatch,
|
fallback_interface_process(struct evdev_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
size_t nevents;
|
size_t nevents;
|
||||||
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
||||||
|
|
@ -1152,7 +1169,7 @@ static void
|
||||||
cancel_touches(struct fallback_dispatch *dispatch,
|
cancel_touches(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
const struct device_coord_rect *rect,
|
const struct device_coord_rect *rect,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
bool need_frame = false;
|
bool need_frame = false;
|
||||||
|
|
@ -1183,7 +1200,7 @@ cancel_touches(struct fallback_dispatch *dispatch,
|
||||||
static void
|
static void
|
||||||
release_pressed_keys(struct fallback_dispatch *dispatch,
|
release_pressed_keys(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
for (evdev_usage_t usage = evdev_usage_from(EVDEV_KEY_RESERVED);
|
for (evdev_usage_t usage = evdev_usage_from(EVDEV_KEY_RESERVED);
|
||||||
evdev_usage_le(usage, EVDEV_KEY_MAX);
|
evdev_usage_le(usage, EVDEV_KEY_MAX);
|
||||||
|
|
@ -1233,9 +1250,9 @@ fallback_return_to_neutral_state(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device)
|
struct evdev_device *device)
|
||||||
{
|
{
|
||||||
struct libinput *libinput = evdev_libinput_context(device);
|
struct libinput *libinput = evdev_libinput_context(device);
|
||||||
uint64_t time;
|
usec_t time = libinput_now(libinput);
|
||||||
|
|
||||||
if ((time = libinput_now(libinput)) == 0)
|
if (usec_is_zero(time))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cancel_touches(dispatch, device, NULL, time);
|
cancel_touches(dispatch, device, NULL, time);
|
||||||
|
|
@ -1275,7 +1292,7 @@ fallback_interface_sync_initial_state(struct evdev_device *device,
|
||||||
struct evdev_dispatch *evdev_dispatch)
|
struct evdev_dispatch *evdev_dispatch)
|
||||||
{
|
{
|
||||||
struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
|
struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
|
||||||
uint64_t time = libinput_now(evdev_libinput_context(device));
|
usec_t time = libinput_now(evdev_libinput_context(device));
|
||||||
|
|
||||||
if (device->tags & EVDEV_TAG_LID_SWITCH) {
|
if (device->tags & EVDEV_TAG_LID_SWITCH) {
|
||||||
struct libevdev *evdev = device->evdev;
|
struct libevdev *evdev = device->evdev;
|
||||||
|
|
@ -1303,13 +1320,20 @@ fallback_interface_sync_initial_state(struct evdev_device *device,
|
||||||
LIBINPUT_SWITCH_TABLET_MODE,
|
LIBINPUT_SWITCH_TABLET_MODE,
|
||||||
LIBINPUT_SWITCH_STATE_ON);
|
LIBINPUT_SWITCH_STATE_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dispatch->keypad_slide.sw.state) {
|
||||||
|
switch_notify_toggle(&device->base,
|
||||||
|
time,
|
||||||
|
LIBINPUT_SWITCH_KEYPAD_SLIDE,
|
||||||
|
LIBINPUT_SWITCH_STATE_ON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fallback_interface_update_rect(struct evdev_dispatch *evdev_dispatch,
|
fallback_interface_update_rect(struct evdev_dispatch *evdev_dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
const struct phys_rect *phys_rect,
|
const struct phys_rect *phys_rect,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
|
struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
|
||||||
struct device_coord_rect rect;
|
struct device_coord_rect rect;
|
||||||
|
|
@ -1328,7 +1352,7 @@ fallback_interface_toggle_touch(struct evdev_dispatch *evdev_dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
enum evdev_arbitration_state which,
|
enum evdev_arbitration_state which,
|
||||||
const struct phys_rect *phys_rect,
|
const struct phys_rect *phys_rect,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
|
struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
|
||||||
struct device_coord_rect rect = { 0 };
|
struct device_coord_rect rect = { 0 };
|
||||||
|
|
@ -1347,7 +1371,7 @@ fallback_interface_toggle_touch(struct evdev_dispatch *evdev_dispatch,
|
||||||
* arbitration by just a little bit so that any touch in
|
* arbitration by just a little bit so that any touch in
|
||||||
* event is caught as palm touch. */
|
* event is caught as palm touch. */
|
||||||
libinput_timer_set(&dispatch->arbitration.arbitration_timer,
|
libinput_timer_set(&dispatch->arbitration.arbitration_timer,
|
||||||
time + ms2us(90));
|
usec_add_millis(time, 90));
|
||||||
state = "not-active";
|
state = "not-active";
|
||||||
break;
|
break;
|
||||||
case ARBITRATION_IGNORE_RECT:
|
case ARBITRATION_IGNORE_RECT:
|
||||||
|
|
@ -1441,9 +1465,7 @@ fallback_suspend(struct fallback_dispatch *dispatch, struct evdev_device *device
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fallback_tablet_mode_switch_event(uint64_t time,
|
fallback_tablet_mode_switch_event(usec_t time, struct libinput_event *event, void *data)
|
||||||
struct libinput_event *event,
|
|
||||||
void *data)
|
|
||||||
{
|
{
|
||||||
struct fallback_dispatch *dispatch = data;
|
struct fallback_dispatch *dispatch = data;
|
||||||
struct evdev_device *device = dispatch->device;
|
struct evdev_device *device = dispatch->device;
|
||||||
|
|
@ -1733,11 +1755,16 @@ fallback_dispatch_init_switch(struct fallback_dispatch *dispatch,
|
||||||
dispatch->tablet_mode.sw.state = val;
|
dispatch->tablet_mode.sw.state = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (device->tags & EVDEV_TAG_KEYPAD_SLIDE_SWITCH) {
|
||||||
|
val = libevdev_get_event_value(device->evdev, EV_SW, SW_KEYPAD_SLIDE);
|
||||||
|
dispatch->keypad_slide.sw.state = val;
|
||||||
|
}
|
||||||
|
|
||||||
libinput_device_init_event_listener(&dispatch->tablet_mode.other.listener);
|
libinput_device_init_event_listener(&dispatch->tablet_mode.other.listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fallback_arbitration_timeout(uint64_t now, void *data)
|
fallback_arbitration_timeout(usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct fallback_dispatch *dispatch = data;
|
struct fallback_dispatch *dispatch = data;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,13 @@ struct fallback_dispatch {
|
||||||
} other;
|
} other;
|
||||||
} tablet_mode;
|
} tablet_mode;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
/* Switch */
|
||||||
|
struct {
|
||||||
|
int state;
|
||||||
|
} sw;
|
||||||
|
} keypad_slide;
|
||||||
|
|
||||||
/* Bitmask of pressed keys used to ignore initial release events from
|
/* Bitmask of pressed keys used to ignore initial release events from
|
||||||
* the kernel. */
|
* the kernel. */
|
||||||
unsigned long hw_key_mask[NLONGS(KEY_CNT)];
|
unsigned long hw_key_mask[NLONGS(KEY_CNT)];
|
||||||
|
|
@ -213,11 +220,11 @@ get_key_down_count(struct evdev_device *device, evdev_usage_t usage)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fallback_debounce_handle_state(struct fallback_dispatch *dispatch, uint64_t time);
|
fallback_debounce_handle_state(struct fallback_dispatch *dispatch, usec_t time);
|
||||||
void
|
void
|
||||||
fallback_notify_physical_button(struct fallback_dispatch *dispatch,
|
fallback_notify_physical_button(struct fallback_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
evdev_usage_t button,
|
evdev_usage_t button,
|
||||||
enum libinput_button_state state);
|
enum libinput_button_state state);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,7 @@ enum evdev_usage {
|
||||||
|
|
||||||
EVDEV_SW_LID = _evbit(EV_SW, SW_LID),
|
EVDEV_SW_LID = _evbit(EV_SW, SW_LID),
|
||||||
EVDEV_SW_TABLET_MODE = _evbit(EV_SW, SW_TABLET_MODE),
|
EVDEV_SW_TABLET_MODE = _evbit(EV_SW, SW_TABLET_MODE),
|
||||||
|
EVDEV_SW_KEYPAD_SLIDE = _evbit(EV_SW, SW_KEYPAD_SLIDE),
|
||||||
EVDEV_SW_MAX = _evbit(EV_SW, SW_MAX),
|
EVDEV_SW_MAX = _evbit(EV_SW, SW_MAX),
|
||||||
|
|
||||||
EVDEV_MSC_SCAN = _evbit(EV_MSC, MSC_SCAN),
|
EVDEV_MSC_SCAN = _evbit(EV_MSC, MSC_SCAN),
|
||||||
|
|
@ -248,6 +249,7 @@ evdev_usage_name(evdev_usage_t usage)
|
||||||
|
|
||||||
CASE_RETURN_STRING(EVDEV_SW_LID);
|
CASE_RETURN_STRING(EVDEV_SW_LID);
|
||||||
CASE_RETURN_STRING(EVDEV_SW_TABLET_MODE);
|
CASE_RETURN_STRING(EVDEV_SW_TABLET_MODE);
|
||||||
|
CASE_RETURN_STRING(EVDEV_SW_KEYPAD_SLIDE);
|
||||||
CASE_RETURN_STRING(EVDEV_SW_MAX);
|
CASE_RETURN_STRING(EVDEV_SW_MAX);
|
||||||
|
|
||||||
CASE_RETURN_STRING(EVDEV_MSC_SCAN);
|
CASE_RETURN_STRING(EVDEV_MSC_SCAN);
|
||||||
|
|
@ -392,9 +394,9 @@ evdev_event_get_code_name(const struct evdev_event *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct input_event
|
static inline struct input_event
|
||||||
evdev_event_to_input_event(const struct evdev_event *e, uint64_t time)
|
evdev_event_to_input_event(const struct evdev_event *e, usec_t time)
|
||||||
{
|
{
|
||||||
struct timeval tv = us2tv(time);
|
struct timeval tv = usec_to_timeval(time);
|
||||||
return (struct input_event){
|
return (struct input_event){
|
||||||
.type = evdev_event_type(e),
|
.type = evdev_event_type(e),
|
||||||
.code = evdev_event_code(e),
|
.code = evdev_event_code(e),
|
||||||
|
|
@ -405,7 +407,7 @@ evdev_event_to_input_event(const struct evdev_event *e, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct evdev_event
|
static inline struct evdev_event
|
||||||
evdev_event_from_input_event(const struct input_event *e, uint64_t *time)
|
evdev_event_from_input_event(const struct input_event *e, usec_t *time)
|
||||||
{
|
{
|
||||||
if (time)
|
if (time)
|
||||||
*time = input_event_time(e);
|
*time = input_event_time(e);
|
||||||
|
|
@ -432,7 +434,7 @@ struct evdev_frame {
|
||||||
int refcount;
|
int refcount;
|
||||||
size_t max_size;
|
size_t max_size;
|
||||||
size_t count;
|
size_t count;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
struct evdev_event events[];
|
struct evdev_event events[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -485,12 +487,12 @@ evdev_frame_get_events(struct evdev_frame *frame, size_t *nevents)
|
||||||
* Set the timestamp for all events in this event frame.
|
* Set the timestamp for all events in this event frame.
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
evdev_frame_set_time(struct evdev_frame *frame, uint64_t time)
|
evdev_frame_set_time(struct evdev_frame *frame, usec_t time)
|
||||||
{
|
{
|
||||||
frame->time = time;
|
frame->time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t
|
static inline usec_t
|
||||||
evdev_frame_get_time(const struct evdev_frame *frame)
|
evdev_frame_get_time(const struct evdev_frame *frame)
|
||||||
{
|
{
|
||||||
return frame->time;
|
return frame->time;
|
||||||
|
|
@ -590,7 +592,7 @@ evdev_frame_append_input_event(struct evdev_frame *frame,
|
||||||
{
|
{
|
||||||
struct evdev_event e = evdev_event_from_input_event(event, NULL);
|
struct evdev_event e = evdev_event_from_input_event(event, NULL);
|
||||||
if (evdev_usage_as_uint32_t(e.usage) == EVDEV_SYN_REPORT) {
|
if (evdev_usage_as_uint32_t(e.usage) == EVDEV_SYN_REPORT) {
|
||||||
uint64_t time = input_event_time(event);
|
usec_t time = input_event_time(event);
|
||||||
evdev_frame_set_time(frame, time);
|
evdev_frame_set_time(frame, time);
|
||||||
}
|
}
|
||||||
return evdev_frame_append(frame, &e, 1);
|
return evdev_frame_append(frame, &e, 1);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include "evdev.h"
|
#include "evdev.h"
|
||||||
|
|
||||||
#define MIDDLEBUTTON_TIMEOUT ms2us(50)
|
#define MIDDLEBUTTON_TIMEOUT usec_from_millis(50)
|
||||||
|
|
||||||
/*****************************************
|
/*****************************************
|
||||||
* BEFORE YOU EDIT THIS FILE, look at the state diagram in
|
* BEFORE YOU EDIT THIS FILE, look at the state diagram in
|
||||||
|
|
@ -88,9 +88,10 @@ middlebutton_state_error(struct evdev_device *device,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
middlebutton_timer_set(struct evdev_device *device, uint64_t now)
|
middlebutton_timer_set(struct evdev_device *device, usec_t now)
|
||||||
{
|
{
|
||||||
libinput_timer_set(&device->middlebutton.timer, now + MIDDLEBUTTON_TIMEOUT);
|
libinput_timer_set(&device->middlebutton.timer,
|
||||||
|
usec_add(now, MIDDLEBUTTON_TIMEOUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -102,7 +103,7 @@ middlebutton_timer_cancel(struct evdev_device *device)
|
||||||
static inline void
|
static inline void
|
||||||
middlebutton_set_state(struct evdev_device *device,
|
middlebutton_set_state(struct evdev_device *device,
|
||||||
enum evdev_middlebutton_state state,
|
enum evdev_middlebutton_state state,
|
||||||
uint64_t now)
|
usec_t now)
|
||||||
{
|
{
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case MIDDLEBUTTON_LEFT_DOWN:
|
case MIDDLEBUTTON_LEFT_DOWN:
|
||||||
|
|
@ -127,7 +128,7 @@ middlebutton_set_state(struct evdev_device *device,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
middlebutton_post_event(struct evdev_device *device,
|
middlebutton_post_event(struct evdev_device *device,
|
||||||
uint64_t now,
|
usec_t now,
|
||||||
evdev_usage_t button,
|
evdev_usage_t button,
|
||||||
enum libinput_button_state state)
|
enum libinput_button_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -136,7 +137,7 @@ middlebutton_post_event(struct evdev_device *device,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
evdev_middlebutton_idle_handle_event(struct evdev_device *device,
|
evdev_middlebutton_idle_handle_event(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum evdev_middlebutton_event event)
|
enum evdev_middlebutton_event event)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -162,7 +163,7 @@ evdev_middlebutton_idle_handle_event(struct evdev_device *device,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
evdev_middlebutton_ldown_handle_event(struct evdev_device *device,
|
evdev_middlebutton_ldown_handle_event(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum evdev_middlebutton_event event)
|
enum evdev_middlebutton_event event)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -214,7 +215,7 @@ evdev_middlebutton_ldown_handle_event(struct evdev_device *device,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
evdev_middlebutton_rdown_handle_event(struct evdev_device *device,
|
evdev_middlebutton_rdown_handle_event(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum evdev_middlebutton_event event)
|
enum evdev_middlebutton_event event)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -266,7 +267,7 @@ evdev_middlebutton_rdown_handle_event(struct evdev_device *device,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
evdev_middlebutton_middle_handle_event(struct evdev_device *device,
|
evdev_middlebutton_middle_handle_event(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum evdev_middlebutton_event event)
|
enum evdev_middlebutton_event event)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -308,7 +309,7 @@ evdev_middlebutton_middle_handle_event(struct evdev_device *device,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
evdev_middlebutton_lup_pending_handle_event(struct evdev_device *device,
|
evdev_middlebutton_lup_pending_handle_event(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum evdev_middlebutton_event event)
|
enum evdev_middlebutton_event event)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -344,7 +345,7 @@ evdev_middlebutton_lup_pending_handle_event(struct evdev_device *device,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
evdev_middlebutton_rup_pending_handle_event(struct evdev_device *device,
|
evdev_middlebutton_rup_pending_handle_event(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum evdev_middlebutton_event event)
|
enum evdev_middlebutton_event event)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -380,7 +381,7 @@ evdev_middlebutton_rup_pending_handle_event(struct evdev_device *device,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
evdev_middlebutton_passthrough_handle_event(struct evdev_device *device,
|
evdev_middlebutton_passthrough_handle_event(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum evdev_middlebutton_event event)
|
enum evdev_middlebutton_event event)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -403,7 +404,7 @@ evdev_middlebutton_passthrough_handle_event(struct evdev_device *device,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
evdev_middlebutton_ignore_lr_handle_event(struct evdev_device *device,
|
evdev_middlebutton_ignore_lr_handle_event(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum evdev_middlebutton_event event)
|
enum evdev_middlebutton_event event)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -432,7 +433,7 @@ evdev_middlebutton_ignore_lr_handle_event(struct evdev_device *device,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
evdev_middlebutton_ignore_l_handle_event(struct evdev_device *device,
|
evdev_middlebutton_ignore_l_handle_event(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum evdev_middlebutton_event event)
|
enum evdev_middlebutton_event event)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -457,7 +458,7 @@ evdev_middlebutton_ignore_l_handle_event(struct evdev_device *device,
|
||||||
}
|
}
|
||||||
static int
|
static int
|
||||||
evdev_middlebutton_ignore_r_handle_event(struct evdev_device *device,
|
evdev_middlebutton_ignore_r_handle_event(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum evdev_middlebutton_event event)
|
enum evdev_middlebutton_event event)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -483,7 +484,7 @@ evdev_middlebutton_ignore_r_handle_event(struct evdev_device *device,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
evdev_middlebutton_handle_event(struct evdev_device *device,
|
evdev_middlebutton_handle_event(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum evdev_middlebutton_event event)
|
enum evdev_middlebutton_event event)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
@ -553,7 +554,7 @@ evdev_middlebutton_apply_config(struct evdev_device *device)
|
||||||
|
|
||||||
bool
|
bool
|
||||||
evdev_middlebutton_filter_button(struct evdev_device *device,
|
evdev_middlebutton_filter_button(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
evdev_usage_t button,
|
evdev_usage_t button,
|
||||||
enum libinput_button_state state)
|
enum libinput_button_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -616,7 +617,7 @@ evdev_middlebutton_filter_button(struct evdev_device *device,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
evdev_middlebutton_handle_timeout(uint64_t now, void *data)
|
evdev_middlebutton_handle_timeout(usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct evdev_device *device = evdev_device(data);
|
struct evdev_device *device = evdev_device(data);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@
|
||||||
#include "evdev-mt-touchpad.h"
|
#include "evdev-mt-touchpad.h"
|
||||||
#include "linux/input.h"
|
#include "linux/input.h"
|
||||||
|
|
||||||
#define DEFAULT_BUTTON_ENTER_TIMEOUT ms2us(100)
|
#define DEFAULT_BUTTON_ENTER_TIMEOUT usec_from_millis(100)
|
||||||
#define DEFAULT_BUTTON_LEAVE_TIMEOUT ms2us(300)
|
#define DEFAULT_BUTTON_LEAVE_TIMEOUT usec_from_millis(300)
|
||||||
|
|
||||||
/*****************************************
|
/*****************************************
|
||||||
* BEFORE YOU EDIT THIS FILE, look at the state diagram in
|
* BEFORE YOU EDIT THIS FILE, look at the state diagram in
|
||||||
|
|
@ -121,15 +121,17 @@ is_inside_top_middle_area(const struct tp_dispatch *tp, const struct tp_touch *t
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_button_set_enter_timer(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_button_set_enter_timer(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
libinput_timer_set(&t->button.timer, time + DEFAULT_BUTTON_ENTER_TIMEOUT);
|
libinput_timer_set(&t->button.timer,
|
||||||
|
usec_add(time, DEFAULT_BUTTON_ENTER_TIMEOUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_button_set_leave_timer(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_button_set_leave_timer(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
libinput_timer_set(&t->button.timer, time + DEFAULT_BUTTON_LEAVE_TIMEOUT);
|
libinput_timer_set(&t->button.timer,
|
||||||
|
usec_add(time, DEFAULT_BUTTON_LEAVE_TIMEOUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -141,7 +143,7 @@ tp_button_set_state(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum button_state new_state,
|
enum button_state new_state,
|
||||||
enum button_event event,
|
enum button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
libinput_timer_cancel(&t->button.timer);
|
libinput_timer_cancel(&t->button.timer);
|
||||||
|
|
||||||
|
|
@ -176,7 +178,7 @@ static void
|
||||||
tp_button_none_handle_event(struct tp_dispatch *tp,
|
tp_button_none_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum button_event event,
|
enum button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case BUTTON_EVENT_IN_BOTTOM_R:
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
||||||
|
|
@ -206,7 +208,7 @@ static void
|
||||||
tp_button_area_handle_event(struct tp_dispatch *tp,
|
tp_button_area_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum button_event event,
|
enum button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case BUTTON_EVENT_IN_BOTTOM_R:
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
||||||
|
|
@ -233,23 +235,22 @@ tp_button_area_handle_event(struct tp_dispatch *tp,
|
||||||
* that triggered this call).
|
* that triggered this call).
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
tp_button_release_other_bottom_touches(struct tp_dispatch *tp,
|
tp_button_release_other_bottom_touches(struct tp_dispatch *tp, usec_t other_start_time)
|
||||||
uint64_t other_start_time)
|
|
||||||
{
|
{
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
|
|
||||||
tp_for_each_touch(tp, t) {
|
tp_for_each_touch(tp, t) {
|
||||||
uint64_t tdelta;
|
usec_t tdelta;
|
||||||
|
|
||||||
if (t->button.state != BUTTON_STATE_BOTTOM || t->button.has_moved)
|
if (t->button.state != BUTTON_STATE_BOTTOM || t->button.has_moved)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (other_start_time > t->button.initial_time)
|
if (usec_cmp(other_start_time, t->button.initial_time) > 0)
|
||||||
tdelta = other_start_time - t->button.initial_time;
|
tdelta = usec_delta(other_start_time, t->button.initial_time);
|
||||||
else
|
else
|
||||||
tdelta = t->button.initial_time - other_start_time;
|
tdelta = usec_delta(t->button.initial_time, other_start_time);
|
||||||
|
|
||||||
if (tdelta > ms2us(80))
|
if (usec_cmp(tdelta, usec_from_millis(80)) > 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
t->button.has_moved = true;
|
t->button.has_moved = true;
|
||||||
|
|
@ -260,7 +261,7 @@ static void
|
||||||
tp_button_bottom_handle_event(struct tp_dispatch *tp,
|
tp_button_bottom_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum button_event event,
|
enum button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case BUTTON_EVENT_IN_BOTTOM_R:
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
||||||
|
|
@ -296,7 +297,7 @@ static void
|
||||||
tp_button_top_handle_event(struct tp_dispatch *tp,
|
tp_button_top_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum button_event event,
|
enum button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case BUTTON_EVENT_IN_BOTTOM_R:
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
||||||
|
|
@ -327,7 +328,7 @@ static void
|
||||||
tp_button_top_new_handle_event(struct tp_dispatch *tp,
|
tp_button_top_new_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum button_event event,
|
enum button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case BUTTON_EVENT_IN_BOTTOM_R:
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
||||||
|
|
@ -362,7 +363,7 @@ static void
|
||||||
tp_button_top_to_ignore_handle_event(struct tp_dispatch *tp,
|
tp_button_top_to_ignore_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum button_event event,
|
enum button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case BUTTON_EVENT_IN_TOP_R:
|
case BUTTON_EVENT_IN_TOP_R:
|
||||||
|
|
@ -394,7 +395,7 @@ static void
|
||||||
tp_button_ignore_handle_event(struct tp_dispatch *tp,
|
tp_button_ignore_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum button_event event,
|
enum button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case BUTTON_EVENT_IN_BOTTOM_R:
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
||||||
|
|
@ -422,7 +423,7 @@ static void
|
||||||
tp_button_handle_event(struct tp_dispatch *tp,
|
tp_button_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum button_event event,
|
enum button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum button_state current = t->button.state;
|
enum button_state current = t->button.state;
|
||||||
|
|
||||||
|
|
@ -496,7 +497,7 @@ tp_button_check_for_movement(struct tp_dispatch *tp, struct tp_touch *t)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_button_handle_state(struct tp_dispatch *tp, uint64_t time)
|
tp_button_handle_state(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
|
|
||||||
|
|
@ -547,7 +548,7 @@ tp_button_handle_state(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_button_handle_timeout(uint64_t now, void *data)
|
tp_button_handle_timeout(usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct tp_touch *t = data;
|
struct tp_touch *t = data;
|
||||||
|
|
||||||
|
|
@ -555,7 +556,7 @@ tp_button_handle_timeout(uint64_t now, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_process_button(struct tp_dispatch *tp, const struct evdev_event *e, uint64_t time)
|
tp_process_button(struct tp_dispatch *tp, const struct evdev_event *e, usec_t time)
|
||||||
{
|
{
|
||||||
uint32_t mask = bit(evdev_usage_enum(e->usage) - EVDEV_BTN_LEFT);
|
uint32_t mask = bit(evdev_usage_enum(e->usage) - EVDEV_BTN_LEFT);
|
||||||
|
|
||||||
|
|
@ -577,7 +578,7 @@ tp_process_button(struct tp_dispatch *tp, const struct evdev_event *e, uint64_t
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_release_all_buttons(struct tp_dispatch *tp, uint64_t time)
|
tp_release_all_buttons(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
if (tp->buttons.state) {
|
if (tp->buttons.state) {
|
||||||
tp->buttons.state = 0;
|
tp->buttons.state = 0;
|
||||||
|
|
@ -1032,7 +1033,7 @@ tp_remove_buttons(struct tp_dispatch *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tp_post_physical_buttons(struct tp_dispatch *tp, uint64_t time)
|
tp_post_physical_buttons(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
uint32_t current, old, button;
|
uint32_t current, old, button;
|
||||||
|
|
||||||
|
|
@ -1180,7 +1181,7 @@ out:
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tp_notify_clickpadbutton(struct tp_dispatch *tp,
|
tp_notify_clickpadbutton(struct tp_dispatch *tp,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
evdev_usage_t button,
|
evdev_usage_t button,
|
||||||
uint32_t is_topbutton,
|
uint32_t is_topbutton,
|
||||||
enum libinput_button_state state)
|
enum libinput_button_state state)
|
||||||
|
|
@ -1227,7 +1228,7 @@ tp_notify_clickpadbutton(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tp_post_clickpadbutton_buttons(struct tp_dispatch *tp, uint64_t time)
|
tp_post_clickpadbutton_buttons(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
uint32_t current, old, is_top;
|
uint32_t current, old, is_top;
|
||||||
evdev_usage_t button;
|
evdev_usage_t button;
|
||||||
|
|
@ -1332,7 +1333,7 @@ tp_post_clickpadbutton_buttons(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
tp_post_button_events(struct tp_dispatch *tp, uint64_t time)
|
tp_post_button_events(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
if (tp->buttons.is_clickpad ||
|
if (tp->buttons.is_clickpad ||
|
||||||
tp->device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD_ONEBUTTON)
|
tp->device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD_ONEBUTTON)
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,9 @@ tp_touch_get_edge(const struct tp_dispatch *tp, const struct tp_touch *t)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
tp_edge_scroll_set_timer(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_edge_scroll_set_timer(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
const int DEFAULT_SCROLL_LOCK_TIMEOUT = ms2us(300);
|
const usec_t DEFAULT_SCROLL_LOCK_TIMEOUT = usec_from_millis(300);
|
||||||
/* if we use software buttons, we disable timeout-based
|
/* if we use software buttons, we disable timeout-based
|
||||||
* edge scrolling. A finger resting on the button areas is
|
* edge scrolling. A finger resting on the button areas is
|
||||||
* likely there to trigger a button event.
|
* likely there to trigger a button event.
|
||||||
|
|
@ -97,14 +97,15 @@ tp_edge_scroll_set_timer(struct tp_dispatch *tp, struct tp_touch *t, uint64_t ti
|
||||||
if (tp->buttons.click_method == LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS)
|
if (tp->buttons.click_method == LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
libinput_timer_set(&t->scroll.timer, time + DEFAULT_SCROLL_LOCK_TIMEOUT);
|
libinput_timer_set(&t->scroll.timer,
|
||||||
|
usec_add(time, DEFAULT_SCROLL_LOCK_TIMEOUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_edge_scroll_set_state(struct tp_dispatch *tp,
|
tp_edge_scroll_set_state(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tp_edge_scroll_touch_state state,
|
enum tp_edge_scroll_touch_state state,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
libinput_timer_cancel(&t->scroll.timer);
|
libinput_timer_cancel(&t->scroll.timer);
|
||||||
|
|
||||||
|
|
@ -131,7 +132,7 @@ static void
|
||||||
tp_edge_scroll_handle_none(struct tp_dispatch *tp,
|
tp_edge_scroll_handle_none(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum scroll_event event,
|
enum scroll_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case SCROLL_EVENT_TOUCH:
|
case SCROLL_EVENT_TOUCH:
|
||||||
|
|
@ -164,7 +165,7 @@ static void
|
||||||
tp_edge_scroll_handle_edge_new(struct tp_dispatch *tp,
|
tp_edge_scroll_handle_edge_new(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum scroll_event event,
|
enum scroll_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case SCROLL_EVENT_TOUCH:
|
case SCROLL_EVENT_TOUCH:
|
||||||
|
|
@ -196,7 +197,7 @@ static void
|
||||||
tp_edge_scroll_handle_edge(struct tp_dispatch *tp,
|
tp_edge_scroll_handle_edge(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum scroll_event event,
|
enum scroll_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case SCROLL_EVENT_TOUCH:
|
case SCROLL_EVENT_TOUCH:
|
||||||
|
|
@ -230,7 +231,7 @@ static void
|
||||||
tp_edge_scroll_handle_area(struct tp_dispatch *tp,
|
tp_edge_scroll_handle_area(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum scroll_event event,
|
enum scroll_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case SCROLL_EVENT_TOUCH:
|
case SCROLL_EVENT_TOUCH:
|
||||||
|
|
@ -252,7 +253,7 @@ static void
|
||||||
tp_edge_scroll_handle_event(struct tp_dispatch *tp,
|
tp_edge_scroll_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum scroll_event event,
|
enum scroll_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum tp_edge_scroll_touch_state current = t->scroll.edge_state;
|
enum tp_edge_scroll_touch_state current = t->scroll.edge_state;
|
||||||
|
|
||||||
|
|
@ -281,7 +282,7 @@ tp_edge_scroll_handle_event(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_edge_scroll_handle_timeout(uint64_t now, void *data)
|
tp_edge_scroll_handle_timeout(usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct tp_touch *t = data;
|
struct tp_touch *t = data;
|
||||||
|
|
||||||
|
|
@ -349,7 +350,7 @@ tp_remove_edge_scroll(struct tp_dispatch *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_edge_scroll_handle_state(struct tp_dispatch *tp, uint64_t time)
|
tp_edge_scroll_handle_state(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
|
|
||||||
|
|
@ -393,7 +394,7 @@ tp_edge_scroll_handle_state(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
|
tp_edge_scroll_post_events(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct evdev_device *device = tp->device;
|
struct evdev_device *device = tp->device;
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
|
|
@ -478,7 +479,7 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_edge_scroll_stop_events(struct tp_dispatch *tp, uint64_t time)
|
tp_edge_scroll_stop_events(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct evdev_device *device = tp->device;
|
struct evdev_device *device = tp->device;
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,11 @@ enum gesture_cancelled {
|
||||||
CANCEL_GESTURE = 1,
|
CANCEL_GESTURE = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define QUICK_GESTURE_HOLD_TIMEOUT ms2us(40)
|
#define QUICK_GESTURE_HOLD_TIMEOUT usec_from_millis(40)
|
||||||
#define DEFAULT_GESTURE_HOLD_TIMEOUT ms2us(180)
|
#define DEFAULT_GESTURE_HOLD_TIMEOUT usec_from_millis(180)
|
||||||
#define DEFAULT_GESTURE_SWITCH_TIMEOUT ms2us(100)
|
#define DEFAULT_GESTURE_SWITCH_TIMEOUT usec_from_millis(100)
|
||||||
#define DEFAULT_GESTURE_SWIPE_TIMEOUT ms2us(150)
|
#define DEFAULT_GESTURE_SWIPE_TIMEOUT usec_from_millis(150)
|
||||||
#define DEFAULT_GESTURE_PINCH_TIMEOUT ms2us(300)
|
#define DEFAULT_GESTURE_PINCH_TIMEOUT usec_from_millis(300)
|
||||||
|
|
||||||
#define HOLD_AND_MOTION_THRESHOLD 0.5 /* mm */
|
#define HOLD_AND_MOTION_THRESHOLD 0.5 /* mm */
|
||||||
#define PINCH_DISAMBIGUATION_MOVE_THRESHOLD 1.5 /* mm */
|
#define PINCH_DISAMBIGUATION_MOVE_THRESHOLD 1.5 /* mm */
|
||||||
|
|
@ -152,10 +152,10 @@ tp_gesture_init_scroll(struct tp_dispatch *tp)
|
||||||
struct phys_coords zero = { 0.0, 0.0 };
|
struct phys_coords zero = { 0.0, 0.0 };
|
||||||
tp->scroll.active.h = false;
|
tp->scroll.active.h = false;
|
||||||
tp->scroll.active.v = false;
|
tp->scroll.active.v = false;
|
||||||
tp->scroll.duration.h = 0;
|
tp->scroll.duration.h = usec_from_uint64_t(0);
|
||||||
tp->scroll.duration.v = 0;
|
tp->scroll.duration.v = usec_from_uint64_t(0);
|
||||||
tp->scroll.vector = zero;
|
tp->scroll.vector = zero;
|
||||||
tp->scroll.time_prev = 0;
|
tp->scroll.time_prev = usec_from_uint64_t(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct device_float_coords
|
static inline struct device_float_coords
|
||||||
|
|
@ -185,7 +185,7 @@ tp_get_raw_pointer_motion(struct tp_dispatch *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
tp_has_pending_pointer_motion(struct tp_dispatch *tp, uint64_t time)
|
tp_has_pending_pointer_motion(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct device_float_coords raw;
|
struct device_float_coords raw;
|
||||||
|
|
||||||
|
|
@ -202,7 +202,7 @@ tp_has_pending_pointer_motion(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_post_pointer_motion(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_post_pointer_motion(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct device_float_coords raw;
|
struct device_float_coords raw;
|
||||||
struct normalized_coords delta;
|
struct normalized_coords delta;
|
||||||
|
|
@ -316,12 +316,12 @@ tp_gesture_init_pinch(struct tp_dispatch *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
tp_gesture_init_3fg_drag(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_init_3fg_drag(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
tp_gesture_stop_3fg_drag(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_stop_3fg_drag(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -344,24 +344,27 @@ static void
|
||||||
tp_gesture_apply_scroll_constraints(struct tp_dispatch *tp,
|
tp_gesture_apply_scroll_constraints(struct tp_dispatch *tp,
|
||||||
struct device_float_coords *raw,
|
struct device_float_coords *raw,
|
||||||
struct normalized_coords *delta,
|
struct normalized_coords *delta,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
uint64_t tdelta = 0;
|
usec_t tdelta = usec_from_millis(0);
|
||||||
struct phys_coords delta_mm, vector;
|
struct phys_coords delta_mm, vector;
|
||||||
double vector_decay, vector_length, slope;
|
double vector_decay, vector_length, slope;
|
||||||
|
|
||||||
const uint64_t ACTIVE_THRESHOLD = ms2us(100), INACTIVE_THRESHOLD = ms2us(50),
|
const usec_t ACTIVE_THRESHOLD = usec_from_millis(100),
|
||||||
EVENT_TIMEOUT = ms2us(100);
|
INACTIVE_THRESHOLD = usec_from_millis(50),
|
||||||
|
EVENT_TIMEOUT = usec_from_millis(100);
|
||||||
|
|
||||||
/* Both axes active == true means free scrolling is enabled */
|
/* Both axes active == true means free scrolling is enabled */
|
||||||
if (tp->scroll.active.h && tp->scroll.active.v)
|
if (tp->scroll.active.h && tp->scroll.active.v)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Determine time delta since last movement event */
|
/* Determine time delta since last movement event */
|
||||||
if (tp->scroll.time_prev != 0)
|
if (!usec_is_zero(tp->scroll.time_prev)) {
|
||||||
tdelta = time - tp->scroll.time_prev;
|
usec_t diff = usec_delta(time, tp->scroll.time_prev);
|
||||||
if (tdelta > EVENT_TIMEOUT)
|
if (usec_cmp(diff, EVENT_TIMEOUT) <= 0)
|
||||||
tdelta = 0;
|
tdelta = diff;
|
||||||
|
}
|
||||||
|
|
||||||
tp->scroll.time_prev = time;
|
tp->scroll.time_prev = time;
|
||||||
|
|
||||||
/* Delta since last movement event in mm */
|
/* Delta since last movement event in mm */
|
||||||
|
|
@ -372,11 +375,13 @@ tp_gesture_apply_scroll_constraints(struct tp_dispatch *tp,
|
||||||
* EVENT_TIMEOUT of 100, vector_decay = (0.97)^tdelta. This linear
|
* EVENT_TIMEOUT of 100, vector_decay = (0.97)^tdelta. This linear
|
||||||
* approximation allows easier tweaking of EVENT_TIMEOUT and is faster.
|
* approximation allows easier tweaking of EVENT_TIMEOUT and is faster.
|
||||||
*/
|
*/
|
||||||
if (tdelta > 0) {
|
if (usec_gt(tdelta, 0)) {
|
||||||
|
uint64_t delta = usec_as_uint64_t(tdelta);
|
||||||
double recent, later;
|
double recent, later;
|
||||||
recent = ((EVENT_TIMEOUT / 2.0) - tdelta) / (EVENT_TIMEOUT / 2.0);
|
uint64_t timeout_us = usec_as_uint64_t(EVENT_TIMEOUT);
|
||||||
later = (EVENT_TIMEOUT - tdelta) / (EVENT_TIMEOUT * 2.0);
|
recent = ((timeout_us / 2.0) - delta) / (timeout_us / 2.0);
|
||||||
vector_decay = tdelta <= (0.33 * EVENT_TIMEOUT) ? recent : later;
|
later = (timeout_us - delta) / (timeout_us * 2.0);
|
||||||
|
vector_decay = delta <= (0.33 * timeout_us) ? recent : later;
|
||||||
} else {
|
} else {
|
||||||
vector_decay = 0.0;
|
vector_decay = 0.0;
|
||||||
}
|
}
|
||||||
|
|
@ -407,36 +412,38 @@ tp_gesture_apply_scroll_constraints(struct tp_dispatch *tp,
|
||||||
const double MIN_VECTOR = 0.15;
|
const double MIN_VECTOR = 0.15;
|
||||||
|
|
||||||
if (slope >= DEGREE_30 && vector_length > MIN_VECTOR) {
|
if (slope >= DEGREE_30 && vector_length > MIN_VECTOR) {
|
||||||
tp->scroll.duration.v += tdelta;
|
tp->scroll.duration.v = usec_add(tp->scroll.duration.v, tdelta);
|
||||||
if (tp->scroll.duration.v > ACTIVE_THRESHOLD)
|
if (usec_cmp(tp->scroll.duration.v, ACTIVE_THRESHOLD) > 0)
|
||||||
tp->scroll.duration.v = ACTIVE_THRESHOLD;
|
tp->scroll.duration.v = ACTIVE_THRESHOLD;
|
||||||
if (slope >= DEGREE_75) {
|
if (slope >= DEGREE_75) {
|
||||||
if (tp->scroll.duration.h > tdelta)
|
if (usec_cmp(tp->scroll.duration.h, tdelta) > 0)
|
||||||
tp->scroll.duration.h -= tdelta;
|
tp->scroll.duration.h =
|
||||||
|
usec_sub(tp->scroll.duration.h, tdelta);
|
||||||
else
|
else
|
||||||
tp->scroll.duration.h = 0;
|
tp->scroll.duration.h = usec_from_uint64_t(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (slope < DEGREE_60 && vector_length > MIN_VECTOR) {
|
if (slope < DEGREE_60 && vector_length > MIN_VECTOR) {
|
||||||
tp->scroll.duration.h += tdelta;
|
tp->scroll.duration.h = usec_add(tp->scroll.duration.h, tdelta);
|
||||||
if (tp->scroll.duration.h > ACTIVE_THRESHOLD)
|
if (usec_cmp(tp->scroll.duration.h, ACTIVE_THRESHOLD) > 0)
|
||||||
tp->scroll.duration.h = ACTIVE_THRESHOLD;
|
tp->scroll.duration.h = ACTIVE_THRESHOLD;
|
||||||
if (slope < DEGREE_15) {
|
if (slope < DEGREE_15) {
|
||||||
if (tp->scroll.duration.v > tdelta)
|
if (usec_cmp(tp->scroll.duration.v, tdelta) > 0)
|
||||||
tp->scroll.duration.v -= tdelta;
|
tp->scroll.duration.v =
|
||||||
|
usec_sub(tp->scroll.duration.v, tdelta);
|
||||||
else
|
else
|
||||||
tp->scroll.duration.v = 0;
|
tp->scroll.duration.v = usec_from_uint64_t(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tp->scroll.duration.h == ACTIVE_THRESHOLD) {
|
if (usec_cmp(tp->scroll.duration.h, ACTIVE_THRESHOLD) == 0) {
|
||||||
tp->scroll.active.h = true;
|
tp->scroll.active.h = true;
|
||||||
if (tp->scroll.duration.v < INACTIVE_THRESHOLD)
|
if (usec_cmp(tp->scroll.duration.v, INACTIVE_THRESHOLD) < 0)
|
||||||
tp->scroll.active.v = false;
|
tp->scroll.active.v = false;
|
||||||
}
|
}
|
||||||
if (tp->scroll.duration.v == ACTIVE_THRESHOLD) {
|
if (usec_cmp(tp->scroll.duration.v, ACTIVE_THRESHOLD) == 0) {
|
||||||
tp->scroll.active.v = true;
|
tp->scroll.active.v = true;
|
||||||
if (tp->scroll.duration.h < INACTIVE_THRESHOLD)
|
if (usec_cmp(tp->scroll.duration.h, INACTIVE_THRESHOLD) < 0)
|
||||||
tp->scroll.active.h = false;
|
tp->scroll.active.h = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -519,9 +526,9 @@ tp_gesture_use_hold_timer(struct tp_dispatch *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_set_hold_timer(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_set_hold_timer(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
uint64_t timeout;
|
usec_t timeout;
|
||||||
|
|
||||||
if (!tp->gesture.hold_enabled)
|
if (!tp->gesture.hold_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
@ -530,14 +537,14 @@ tp_gesture_set_hold_timer(struct tp_dispatch *tp, uint64_t time)
|
||||||
timeout = tp_gesture_is_quick_hold(tp) ? QUICK_GESTURE_HOLD_TIMEOUT
|
timeout = tp_gesture_is_quick_hold(tp) ? QUICK_GESTURE_HOLD_TIMEOUT
|
||||||
: DEFAULT_GESTURE_HOLD_TIMEOUT;
|
: DEFAULT_GESTURE_HOLD_TIMEOUT;
|
||||||
|
|
||||||
libinput_timer_set(&tp->gesture.hold_timer, time + timeout);
|
libinput_timer_set(&tp->gesture.hold_timer, usec_add(time, timeout));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_none(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_none(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GESTURE_EVENT_RESET:
|
case GESTURE_EVENT_RESET:
|
||||||
|
|
@ -581,7 +588,7 @@ tp_gesture_handle_event_on_state_none(struct tp_dispatch *tp,
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_unknown(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_unknown(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GESTURE_EVENT_RESET:
|
case GESTURE_EVENT_RESET:
|
||||||
|
|
@ -634,7 +641,7 @@ tp_gesture_handle_event_on_state_unknown(struct tp_dispatch *tp,
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_hold(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_hold(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GESTURE_EVENT_RESET:
|
case GESTURE_EVENT_RESET:
|
||||||
|
|
@ -692,7 +699,7 @@ tp_gesture_handle_event_on_state_hold(struct tp_dispatch *tp,
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_hold_and_motion(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_hold_and_motion(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GESTURE_EVENT_RESET:
|
case GESTURE_EVENT_RESET:
|
||||||
|
|
@ -733,7 +740,7 @@ tp_gesture_handle_event_on_state_hold_and_motion(struct tp_dispatch *tp,
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_pointer_motion(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_pointer_motion(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *first;
|
struct tp_touch *first;
|
||||||
struct phys_coords first_moved;
|
struct phys_coords first_moved;
|
||||||
|
|
@ -779,7 +786,7 @@ tp_gesture_handle_event_on_state_pointer_motion(struct tp_dispatch *tp,
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_scroll_start(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_scroll_start(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GESTURE_EVENT_RESET:
|
case GESTURE_EVENT_RESET:
|
||||||
|
|
@ -812,7 +819,7 @@ tp_gesture_handle_event_on_state_scroll_start(struct tp_dispatch *tp,
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_scroll(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_scroll(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GESTURE_EVENT_RESET:
|
case GESTURE_EVENT_RESET:
|
||||||
|
|
@ -847,7 +854,7 @@ tp_gesture_handle_event_on_state_scroll(struct tp_dispatch *tp,
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_pinch_start(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_pinch_start(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GESTURE_EVENT_RESET:
|
case GESTURE_EVENT_RESET:
|
||||||
|
|
@ -875,7 +882,7 @@ tp_gesture_handle_event_on_state_pinch_start(struct tp_dispatch *tp,
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_pinch(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_pinch(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GESTURE_EVENT_RESET:
|
case GESTURE_EVENT_RESET:
|
||||||
|
|
@ -914,7 +921,7 @@ tp_gesture_handle_event_on_state_pinch(struct tp_dispatch *tp,
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_swipe_start(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_swipe_start(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GESTURE_EVENT_RESET:
|
case GESTURE_EVENT_RESET:
|
||||||
|
|
@ -943,7 +950,7 @@ tp_gesture_handle_event_on_state_swipe_start(struct tp_dispatch *tp,
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_swipe(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_swipe(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GESTURE_EVENT_RESET:
|
case GESTURE_EVENT_RESET:
|
||||||
|
|
@ -981,7 +988,7 @@ tp_gesture_handle_event_on_state_swipe(struct tp_dispatch *tp,
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_3fg_drag_start(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_3fg_drag_start(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GESTURE_EVENT_RESET:
|
case GESTURE_EVENT_RESET:
|
||||||
|
|
@ -1008,16 +1015,16 @@ tp_gesture_handle_event_on_state_3fg_drag_start(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_set_3fg_drag_timer(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_set_3fg_drag_timer(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
tp->gesture.drag_3fg_release_time = time;
|
tp->gesture.drag_3fg_release_time = time;
|
||||||
libinput_timer_set(&tp->gesture.drag_3fg_timer, time + ms2us(700));
|
libinput_timer_set(&tp->gesture.drag_3fg_timer, usec_add_millis(time, 700));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_3fg_drag(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_3fg_drag(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GESTURE_EVENT_RESET:
|
case GESTURE_EVENT_RESET:
|
||||||
|
|
@ -1065,7 +1072,7 @@ tp_gesture_handle_event_on_state_3fg_drag(struct tp_dispatch *tp,
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event_on_state_3fg_drag_released(struct tp_dispatch *tp,
|
tp_gesture_handle_event_on_state_3fg_drag_released(struct tp_dispatch *tp,
|
||||||
enum gesture_event event,
|
enum gesture_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case GESTURE_EVENT_RESET:
|
case GESTURE_EVENT_RESET:
|
||||||
|
|
@ -1125,7 +1132,7 @@ tp_gesture_handle_event_on_state_3fg_drag_released(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_event(struct tp_dispatch *tp, enum gesture_event event, uint64_t time)
|
tp_gesture_handle_event(struct tp_dispatch *tp, enum gesture_event event, usec_t time)
|
||||||
{
|
{
|
||||||
enum tp_gesture_state oldstate;
|
enum tp_gesture_state oldstate;
|
||||||
|
|
||||||
|
|
@ -1187,7 +1194,7 @@ tp_gesture_handle_event(struct tp_dispatch *tp, enum gesture_event event, uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_hold_timeout(uint64_t now, void *data)
|
tp_gesture_hold_timeout(usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct tp_dispatch *tp = data;
|
struct tp_dispatch *tp = data;
|
||||||
|
|
||||||
|
|
@ -1198,7 +1205,7 @@ tp_gesture_hold_timeout(uint64_t now, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_tap_timeout(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_tap_timeout(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
if (!tp->gesture.hold_enabled)
|
if (!tp->gesture.hold_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1208,7 +1215,7 @@ tp_gesture_tap_timeout(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_3fg_drag_timeout(uint64_t now, void *data)
|
tp_gesture_3fg_drag_timeout(usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct tp_dispatch *tp = data;
|
struct tp_dispatch *tp = data;
|
||||||
|
|
||||||
|
|
@ -1216,7 +1223,7 @@ tp_gesture_3fg_drag_timeout(uint64_t now, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_detect_motion_gestures(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_detect_motion_gestures(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *first = tp->gesture.touches[0],
|
struct tp_touch *first = tp->gesture.touches[0],
|
||||||
*second = tp->gesture.touches[1], *thumb;
|
*second = tp->gesture.touches[1], *thumb;
|
||||||
|
|
@ -1281,7 +1288,9 @@ tp_gesture_detect_motion_gestures(struct tp_dispatch *tp, uint64_t time)
|
||||||
/* If both touches are within 7mm vertically and 40mm horizontally
|
/* If both touches are within 7mm vertically and 40mm horizontally
|
||||||
* past the timeout, assume scroll/swipe */
|
* past the timeout, assume scroll/swipe */
|
||||||
if ((!tp->gesture.enabled || (distance_mm.x < 40.0 && distance_mm.y < 7.0)) &&
|
if ((!tp->gesture.enabled || (distance_mm.x < 40.0 && distance_mm.y < 7.0)) &&
|
||||||
time > (tp->gesture.initial_time + DEFAULT_GESTURE_SWIPE_TIMEOUT)) {
|
usec_cmp(time,
|
||||||
|
usec_add(tp->gesture.initial_time,
|
||||||
|
DEFAULT_GESTURE_SWIPE_TIMEOUT)) > 0) {
|
||||||
if (tp->gesture.finger_count == 2)
|
if (tp->gesture.finger_count == 2)
|
||||||
tp_gesture_handle_event(tp, GESTURE_EVENT_SCROLL_START, time);
|
tp_gesture_handle_event(tp, GESTURE_EVENT_SCROLL_START, time);
|
||||||
else if (tp->drag_3fg.nfingers == tp->gesture.finger_count)
|
else if (tp->drag_3fg.nfingers == tp->gesture.finger_count)
|
||||||
|
|
@ -1416,7 +1425,7 @@ tp_gesture_is_pinch(struct tp_dispatch *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_none(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_handle_state_none(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *first, *second;
|
struct tp_touch *first, *second;
|
||||||
struct tp_touch *touches[4];
|
struct tp_touch *touches[4];
|
||||||
|
|
@ -1485,23 +1494,21 @@ tp_gesture_handle_state_none(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_unknown(struct tp_dispatch *tp,
|
tp_gesture_handle_state_unknown(struct tp_dispatch *tp, usec_t time, bool ignore_motion)
|
||||||
uint64_t time,
|
|
||||||
bool ignore_motion)
|
|
||||||
{
|
{
|
||||||
if (!ignore_motion)
|
if (!ignore_motion)
|
||||||
tp_gesture_detect_motion_gestures(tp, time);
|
tp_gesture_detect_motion_gestures(tp, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_hold(struct tp_dispatch *tp, uint64_t time, bool ignore_motion)
|
tp_gesture_handle_state_hold(struct tp_dispatch *tp, usec_t time, bool ignore_motion)
|
||||||
{
|
{
|
||||||
if (!ignore_motion)
|
if (!ignore_motion)
|
||||||
tp_gesture_detect_motion_gestures(tp, time);
|
tp_gesture_detect_motion_gestures(tp, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_hold_and_pointer_motion(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_handle_state_hold_and_pointer_motion(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
if (tp->queued & TOUCHPAD_EVENT_MOTION)
|
if (tp->queued & TOUCHPAD_EVENT_MOTION)
|
||||||
tp_gesture_post_pointer_motion(tp, time);
|
tp_gesture_post_pointer_motion(tp, time);
|
||||||
|
|
@ -1510,14 +1517,14 @@ tp_gesture_handle_state_hold_and_pointer_motion(struct tp_dispatch *tp, uint64_t
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_pointer_motion(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_handle_state_pointer_motion(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
if (tp->queued & TOUCHPAD_EVENT_MOTION)
|
if (tp->queued & TOUCHPAD_EVENT_MOTION)
|
||||||
tp_gesture_post_pointer_motion(tp, time);
|
tp_gesture_post_pointer_motion(tp, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_scroll_start(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_handle_state_scroll_start(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct device_float_coords raw;
|
struct device_float_coords raw;
|
||||||
struct normalized_coords delta;
|
struct normalized_coords delta;
|
||||||
|
|
@ -1528,7 +1535,9 @@ tp_gesture_handle_state_scroll_start(struct tp_dispatch *tp, uint64_t time)
|
||||||
/* We may confuse a pinch for a scroll initially,
|
/* We may confuse a pinch for a scroll initially,
|
||||||
* allow ourselves to correct our guess.
|
* allow ourselves to correct our guess.
|
||||||
*/
|
*/
|
||||||
if (time < (tp->gesture.initial_time + DEFAULT_GESTURE_PINCH_TIMEOUT) &&
|
if (usec_cmp(time,
|
||||||
|
usec_add(tp->gesture.initial_time,
|
||||||
|
DEFAULT_GESTURE_PINCH_TIMEOUT)) < 0 &&
|
||||||
tp_gesture_is_pinch(tp)) {
|
tp_gesture_is_pinch(tp)) {
|
||||||
tp_gesture_handle_event(tp, GESTURE_EVENT_PINCH_START, time);
|
tp_gesture_handle_event(tp, GESTURE_EVENT_PINCH_START, time);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1547,7 +1556,7 @@ tp_gesture_handle_state_scroll_start(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_scroll(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_handle_state_scroll(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct device_float_coords raw;
|
struct device_float_coords raw;
|
||||||
struct normalized_coords delta;
|
struct normalized_coords delta;
|
||||||
|
|
@ -1558,7 +1567,9 @@ tp_gesture_handle_state_scroll(struct tp_dispatch *tp, uint64_t time)
|
||||||
/* We may confuse a pinch for a scroll initially,
|
/* We may confuse a pinch for a scroll initially,
|
||||||
* allow ourselves to correct our guess.
|
* allow ourselves to correct our guess.
|
||||||
*/
|
*/
|
||||||
if (time < (tp->gesture.initial_time + DEFAULT_GESTURE_PINCH_TIMEOUT) &&
|
if (usec_cmp(time,
|
||||||
|
usec_add(tp->gesture.initial_time,
|
||||||
|
DEFAULT_GESTURE_PINCH_TIMEOUT)) < 0 &&
|
||||||
tp_gesture_is_pinch(tp)) {
|
tp_gesture_is_pinch(tp)) {
|
||||||
tp_gesture_handle_event(tp, GESTURE_EVENT_PINCH_START, time);
|
tp_gesture_handle_event(tp, GESTURE_EVENT_PINCH_START, time);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1580,7 +1591,7 @@ tp_gesture_handle_state_scroll(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_swipe_start(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_handle_state_swipe_start(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct device_float_coords raw;
|
struct device_float_coords raw;
|
||||||
struct normalized_coords delta;
|
struct normalized_coords delta;
|
||||||
|
|
@ -1601,7 +1612,7 @@ tp_gesture_handle_state_swipe_start(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_swipe(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_handle_state_swipe(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct device_float_coords raw;
|
struct device_float_coords raw;
|
||||||
struct normalized_coords delta, unaccel;
|
struct normalized_coords delta, unaccel;
|
||||||
|
|
@ -1621,7 +1632,7 @@ tp_gesture_handle_state_swipe(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_pinch_start(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_handle_state_pinch_start(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
const struct normalized_coords zero = { 0.0, 0.0 };
|
const struct normalized_coords zero = { 0.0, 0.0 };
|
||||||
double angle, angle_delta, distance, scale;
|
double angle, angle_delta, distance, scale;
|
||||||
|
|
@ -1662,7 +1673,7 @@ tp_gesture_handle_state_pinch_start(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_pinch(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_handle_state_pinch(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
double angle, angle_delta, distance, scale;
|
double angle, angle_delta, distance, scale;
|
||||||
struct device_float_coords center, fdelta;
|
struct device_float_coords center, fdelta;
|
||||||
|
|
@ -1702,7 +1713,7 @@ tp_gesture_handle_state_pinch(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_3fg_drag_start(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_handle_state_3fg_drag_start(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
evdev_pointer_notify_button(tp->device,
|
evdev_pointer_notify_button(tp->device,
|
||||||
time,
|
time,
|
||||||
|
|
@ -1713,7 +1724,7 @@ tp_gesture_handle_state_3fg_drag_start(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_3fg_drag(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_handle_state_3fg_drag(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
if (tp->queued & TOUCHPAD_EVENT_MOTION)
|
if (tp->queued & TOUCHPAD_EVENT_MOTION)
|
||||||
tp_gesture_post_pointer_motion(tp, time);
|
tp_gesture_post_pointer_motion(tp, time);
|
||||||
|
|
@ -1721,14 +1732,14 @@ tp_gesture_handle_state_3fg_drag(struct tp_dispatch *tp, uint64_t time)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state_3fg_drag_released(struct tp_dispatch *tp,
|
tp_gesture_handle_state_3fg_drag_released(struct tp_dispatch *tp,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
bool ignore_motion)
|
bool ignore_motion)
|
||||||
{
|
{
|
||||||
tp_gesture_detect_motion_gestures(tp, time);
|
tp_gesture_detect_motion_gestures(tp, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time, bool ignore_motion)
|
tp_gesture_handle_state(struct tp_dispatch *tp, usec_t time, bool ignore_motion)
|
||||||
{
|
{
|
||||||
enum tp_gesture_state oldstate = tp->gesture.state;
|
enum tp_gesture_state oldstate = tp->gesture.state;
|
||||||
enum tp_gesture_state transitions[16] = { 0 };
|
enum tp_gesture_state transitions[16] = { 0 };
|
||||||
|
|
@ -1839,7 +1850,7 @@ tp_gesture_thumb_moved(struct tp_dispatch *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time, bool ignore_motion)
|
tp_gesture_post_events(struct tp_dispatch *tp, usec_t time, bool ignore_motion)
|
||||||
{
|
{
|
||||||
if (tp->gesture.finger_count == 0)
|
if (tp->gesture.finger_count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1867,7 +1878,9 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time, bool ignore_motion
|
||||||
/* When pinching, the thumb tends to move slower than the finger,
|
/* When pinching, the thumb tends to move slower than the finger,
|
||||||
* so we may suppress it too early. Give it some time to move.
|
* so we may suppress it too early. Give it some time to move.
|
||||||
*/
|
*/
|
||||||
if (time < (tp->gesture.initial_time + DEFAULT_GESTURE_PINCH_TIMEOUT) &&
|
if (usec_cmp(time,
|
||||||
|
usec_add(tp->gesture.initial_time,
|
||||||
|
DEFAULT_GESTURE_PINCH_TIMEOUT)) < 0 &&
|
||||||
tp_gesture_thumb_moved(tp))
|
tp_gesture_thumb_moved(tp))
|
||||||
tp_thumb_reset(tp);
|
tp_thumb_reset(tp);
|
||||||
|
|
||||||
|
|
@ -1876,7 +1889,7 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time, bool ignore_motion
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_2FG)
|
if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_2FG)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1885,7 +1898,7 @@ tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_end(struct tp_dispatch *tp, uint64_t time, enum gesture_cancelled cancelled)
|
tp_gesture_end(struct tp_dispatch *tp, usec_t time, enum gesture_cancelled cancelled)
|
||||||
{
|
{
|
||||||
switch (tp->gesture.state) {
|
switch (tp->gesture.state) {
|
||||||
case GESTURE_STATE_NONE:
|
case GESTURE_STATE_NONE:
|
||||||
|
|
@ -1917,13 +1930,13 @@ tp_gesture_end(struct tp_dispatch *tp, uint64_t time, enum gesture_cancelled can
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_cancel(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_cancel(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
tp_gesture_end(tp, time, CANCEL_GESTURE);
|
tp_gesture_end(tp, time, CANCEL_GESTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_cancel_motion_gestures(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_cancel_motion_gestures(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (tp->gesture.state) {
|
switch (tp->gesture.state) {
|
||||||
|
|
@ -1952,13 +1965,13 @@ tp_gesture_cancel_motion_gestures(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_stop(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_stop(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
tp_gesture_end(tp, time, END_GESTURE);
|
tp_gesture_end(tp, time, END_GESTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_gesture_finger_count_switch_timeout(uint64_t now, void *data)
|
tp_gesture_finger_count_switch_timeout(usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct tp_dispatch *tp = data;
|
struct tp_dispatch *tp = data;
|
||||||
|
|
||||||
|
|
@ -1996,7 +2009,7 @@ tp_gesture_debounce_finger_changes(struct tp_dispatch *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_update_finger_state(struct tp_dispatch *tp, uint64_t time)
|
tp_gesture_update_finger_state(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
unsigned int active_touches = 0;
|
unsigned int active_touches = 0;
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
|
|
@ -2026,8 +2039,9 @@ tp_gesture_update_finger_state(struct tp_dispatch *tp, uint64_t time)
|
||||||
/* Else debounce finger changes */
|
/* Else debounce finger changes */
|
||||||
} else if (active_touches != tp->gesture.finger_count_pending) {
|
} else if (active_touches != tp->gesture.finger_count_pending) {
|
||||||
tp->gesture.finger_count_pending = active_touches;
|
tp->gesture.finger_count_pending = active_touches;
|
||||||
libinput_timer_set(&tp->gesture.finger_count_switch_timer,
|
libinput_timer_set(
|
||||||
time + DEFAULT_GESTURE_SWITCH_TIMEOUT);
|
&tp->gesture.finger_count_switch_timer,
|
||||||
|
usec_add(time, DEFAULT_GESTURE_SWITCH_TIMEOUT));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tp->gesture.finger_count_pending = 0;
|
tp->gesture.finger_count_pending = 0;
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,10 @@
|
||||||
|
|
||||||
#include "evdev-mt-touchpad.h"
|
#include "evdev-mt-touchpad.h"
|
||||||
|
|
||||||
#define DEFAULT_TAP_TIMEOUT_PERIOD ms2us(180)
|
#define DEFAULT_TAP_TIMEOUT_PERIOD usec_from_millis(180)
|
||||||
#define DEFAULT_DRAG_TIMEOUT_PERIOD_BASE ms2us(160)
|
#define DEFAULT_DRAG_TIMEOUT_PERIOD_BASE usec_from_millis(160)
|
||||||
#define DEFAULT_DRAG_TIMEOUT_PERIOD_PERFINGER ms2us(20)
|
#define DEFAULT_DRAG_TIMEOUT_PERIOD_PERFINGER usec_from_millis(20)
|
||||||
#define DEFAULT_DRAGLOCK_TIMEOUT_PERIOD ms2us(300)
|
#define DEFAULT_DRAGLOCK_TIMEOUT_PERIOD usec_from_millis(300)
|
||||||
#define DEFAULT_TAP_MOVE_THRESHOLD 1.3 /* mm */
|
#define DEFAULT_TAP_MOVE_THRESHOLD 1.3 /* mm */
|
||||||
|
|
||||||
enum tap_event {
|
enum tap_event {
|
||||||
|
|
@ -120,7 +120,7 @@ log_tap_bug(struct tp_dispatch *tp, struct tp_touch *t, enum tap_event event)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_tap_notify(struct tp_dispatch *tp,
|
tp_tap_notify(struct tp_dispatch *tp,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int nfingers,
|
int nfingers,
|
||||||
enum libinput_button_state state)
|
enum libinput_button_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -151,24 +151,25 @@ tp_tap_notify(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_tap_set_timer(struct tp_dispatch *tp, uint64_t time)
|
tp_tap_set_timer(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
libinput_timer_set(&tp->tap.timer, time + DEFAULT_TAP_TIMEOUT_PERIOD);
|
libinput_timer_set(&tp->tap.timer, usec_add(time, DEFAULT_TAP_TIMEOUT_PERIOD));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_tap_set_drag_timer(struct tp_dispatch *tp, uint64_t time, int nfingers_tapped)
|
tp_tap_set_drag_timer(struct tp_dispatch *tp, usec_t time, int nfingers_tapped)
|
||||||
{
|
{
|
||||||
libinput_timer_set(
|
usec_t per_finger_timeout =
|
||||||
&tp->tap.timer,
|
usec_mul(DEFAULT_DRAG_TIMEOUT_PERIOD_PERFINGER, nfingers_tapped);
|
||||||
time + DEFAULT_DRAG_TIMEOUT_PERIOD_BASE +
|
usec_t timeout = usec_add(DEFAULT_DRAG_TIMEOUT_PERIOD_BASE, per_finger_timeout);
|
||||||
(nfingers_tapped * DEFAULT_DRAG_TIMEOUT_PERIOD_PERFINGER));
|
libinput_timer_set(&tp->tap.timer, usec_add(time, timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_tap_set_draglock_timer(struct tp_dispatch *tp, uint64_t time)
|
tp_tap_set_draglock_timer(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
libinput_timer_set(&tp->tap.timer, time + DEFAULT_DRAGLOCK_TIMEOUT_PERIOD);
|
libinput_timer_set(&tp->tap.timer,
|
||||||
|
usec_add(time, DEFAULT_DRAGLOCK_TIMEOUT_PERIOD));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -189,7 +190,7 @@ static void
|
||||||
tp_tap_idle_handle_event(struct tp_dispatch *tp,
|
tp_tap_idle_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case TAP_EVENT_TOUCH:
|
case TAP_EVENT_TOUCH:
|
||||||
|
|
@ -222,7 +223,7 @@ static void
|
||||||
tp_tap_touch_handle_event(struct tp_dispatch *tp,
|
tp_tap_touch_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -276,7 +277,7 @@ static void
|
||||||
tp_tap_hold_handle_event(struct tp_dispatch *tp,
|
tp_tap_hold_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -314,7 +315,7 @@ static void
|
||||||
tp_tap_tapped_handle_event(struct tp_dispatch *tp,
|
tp_tap_tapped_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int nfingers_tapped)
|
int nfingers_tapped)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -363,7 +364,7 @@ static void
|
||||||
tp_tap_touch2_handle_event(struct tp_dispatch *tp,
|
tp_tap_touch2_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -401,7 +402,7 @@ static void
|
||||||
tp_tap_touch2_hold_handle_event(struct tp_dispatch *tp,
|
tp_tap_touch2_hold_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -436,7 +437,7 @@ static void
|
||||||
tp_tap_touch2_release_handle_event(struct tp_dispatch *tp,
|
tp_tap_touch2_release_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -505,7 +506,7 @@ static void
|
||||||
tp_tap_touch3_handle_event(struct tp_dispatch *tp,
|
tp_tap_touch3_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -543,7 +544,7 @@ static void
|
||||||
tp_tap_touch3_hold_handle_event(struct tp_dispatch *tp,
|
tp_tap_touch3_hold_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -576,7 +577,7 @@ static void
|
||||||
tp_tap_touch3_release_handle_event(struct tp_dispatch *tp,
|
tp_tap_touch3_release_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -644,7 +645,7 @@ static void
|
||||||
tp_tap_touch3_release2_handle_event(struct tp_dispatch *tp,
|
tp_tap_touch3_release2_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -742,7 +743,7 @@ static void
|
||||||
tp_tap_dragging_or_doubletap_handle_event(struct tp_dispatch *tp,
|
tp_tap_dragging_or_doubletap_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int nfingers_tapped)
|
int nfingers_tapped)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -808,7 +809,7 @@ static void
|
||||||
tp_tap_dragging_handle_event(struct tp_dispatch *tp,
|
tp_tap_dragging_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int nfingers_tapped)
|
int nfingers_tapped)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -872,7 +873,7 @@ static void
|
||||||
tp_tap_dragging_wait_handle_event(struct tp_dispatch *tp,
|
tp_tap_dragging_wait_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int nfingers_tapped)
|
int nfingers_tapped)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -919,7 +920,7 @@ static void
|
||||||
tp_tap_dragging_tap_handle_event(struct tp_dispatch *tp,
|
tp_tap_dragging_tap_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int nfingers_tapped)
|
int nfingers_tapped)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -979,7 +980,7 @@ static void
|
||||||
tp_tap_dragging2_handle_event(struct tp_dispatch *tp,
|
tp_tap_dragging2_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int nfingers_tapped)
|
int nfingers_tapped)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -1033,7 +1034,7 @@ static void
|
||||||
tp_tap_dead_handle_event(struct tp_dispatch *tp,
|
tp_tap_dead_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -1060,7 +1061,7 @@ static void
|
||||||
tp_tap_handle_event(struct tp_dispatch *tp,
|
tp_tap_handle_event(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
enum tap_event event,
|
enum tap_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum tp_tap_state current;
|
enum tp_tap_state current;
|
||||||
|
|
||||||
|
|
@ -1206,7 +1207,7 @@ tp_tap_enabled(struct tp_dispatch *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time)
|
tp_tap_handle_state(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
int filter_motion = 0;
|
int filter_motion = 0;
|
||||||
|
|
@ -1341,7 +1342,7 @@ tp_tap_post_process_state(struct tp_dispatch *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_tap_handle_timeout(uint64_t time, void *data)
|
tp_tap_handle_timeout(usec_t time, void *data)
|
||||||
{
|
{
|
||||||
struct tp_dispatch *tp = data;
|
struct tp_dispatch *tp = data;
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
|
|
@ -1357,10 +1358,7 @@ tp_tap_handle_timeout(uint64_t time, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_tap_enabled_update(struct tp_dispatch *tp,
|
tp_tap_enabled_update(struct tp_dispatch *tp, bool suspended, bool enabled, usec_t time)
|
||||||
bool suspended,
|
|
||||||
bool enabled,
|
|
||||||
uint64_t time)
|
|
||||||
{
|
{
|
||||||
bool was_enabled = tp_tap_enabled(tp);
|
bool was_enabled = tp_tap_enabled(tp);
|
||||||
|
|
||||||
|
|
@ -1599,7 +1597,7 @@ tp_remove_tap(struct tp_dispatch *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_release_all_taps(struct tp_dispatch *tp, uint64_t now)
|
tp_release_all_taps(struct tp_dispatch *tp, usec_t now)
|
||||||
{
|
{
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -1626,13 +1624,13 @@ tp_release_all_taps(struct tp_dispatch *tp, uint64_t now)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_tap_suspend(struct tp_dispatch *tp, uint64_t time)
|
tp_tap_suspend(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
tp_tap_enabled_update(tp, true, tp->tap.enabled, time);
|
tp_tap_enabled_update(tp, true, tp->tap.enabled, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_tap_resume(struct tp_dispatch *tp, uint64_t time)
|
tp_tap_resume(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
tp_tap_enabled_update(tp, false, tp->tap.enabled, time);
|
tp_tap_enabled_update(tp, false, tp->tap.enabled, time);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
/* distance between fingers to assume it is not a scroll */
|
/* distance between fingers to assume it is not a scroll */
|
||||||
#define SCROLL_MM_X 35
|
#define SCROLL_MM_X 35
|
||||||
#define SCROLL_MM_Y 25
|
#define SCROLL_MM_Y 25
|
||||||
#define THUMB_TIMEOUT ms2us(100)
|
#define THUMB_TIMEOUT usec_from_millis(100)
|
||||||
|
|
||||||
static inline const char *
|
static inline const char *
|
||||||
thumb_state_to_str(enum tp_thumb_state state)
|
thumb_state_to_str(enum tp_thumb_state state)
|
||||||
|
|
@ -193,7 +193,7 @@ tp_thumb_revive(struct tp_dispatch *tp, struct tp_touch *t)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_thumb_update_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_thumb_update_touch(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
if (!tp->thumb.detect_thumbs)
|
if (!tp->thumb.detect_thumbs)
|
||||||
return;
|
return;
|
||||||
|
|
@ -274,7 +274,7 @@ tp_thumb_update_multifinger(struct tp_dispatch *tp)
|
||||||
speed_exceeded_count =
|
speed_exceeded_count =
|
||||||
max(speed_exceeded_count, t->speed.exceeded_count);
|
max(speed_exceeded_count, t->speed.exceeded_count);
|
||||||
|
|
||||||
if (!oldest || t->initial_time < oldest->initial_time) {
|
if (!oldest || usec_cmp(t->initial_time, oldest->initial_time) < 0) {
|
||||||
oldest = t;
|
oldest = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -337,10 +337,13 @@ tp_thumb_update_multifinger(struct tp_dispatch *tp)
|
||||||
* the behavior of the other touches.)
|
* the behavior of the other touches.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (newest && (newest->initial_time - oldest->initial_time) < THUMB_TIMEOUT &&
|
if (newest) {
|
||||||
first->point.y < tp->thumb.lower_thumb_line) {
|
usec_t delta = usec_delta(newest->initial_time, oldest->initial_time);
|
||||||
tp_thumb_lift(tp);
|
if (usec_cmp(delta, THUMB_TIMEOUT) < 0 &&
|
||||||
return;
|
first->point.y < tp->thumb.lower_thumb_line) {
|
||||||
|
tp_thumb_lift(tp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're past the THUMB_TIMEOUT, and the touches are relatively far
|
/* If we're past the THUMB_TIMEOUT, and the touches are relatively far
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,10 @@
|
||||||
#include "libinput-feature.h"
|
#include "libinput-feature.h"
|
||||||
#include "quirks.h"
|
#include "quirks.h"
|
||||||
|
|
||||||
#define DEFAULT_TRACKPOINT_ACTIVITY_TIMEOUT ms2us(300)
|
#define DEFAULT_TRACKPOINT_ACTIVITY_TIMEOUT usec_from_millis(300)
|
||||||
#define DEFAULT_TRACKPOINT_EVENT_TIMEOUT ms2us(40)
|
#define DEFAULT_TRACKPOINT_EVENT_TIMEOUT usec_from_millis(40)
|
||||||
#define DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_1 ms2us(200)
|
#define DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_1 usec_from_millis(200)
|
||||||
#define DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_2 ms2us(500)
|
#define DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_2 usec_from_millis(500)
|
||||||
#define FAKE_FINGER_OVERFLOW bit(7)
|
#define FAKE_FINGER_OVERFLOW bit(7)
|
||||||
#define THUMB_IGNORE_SPEED_THRESHOLD 20 /* mm/s */
|
#define THUMB_IGNORE_SPEED_THRESHOLD 20 /* mm/s */
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ tp_motion_history_offset(struct tp_touch *t, int offset)
|
||||||
struct normalized_coords
|
struct normalized_coords
|
||||||
tp_filter_motion(struct tp_dispatch *tp,
|
tp_filter_motion(struct tp_dispatch *tp,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct device_float_coords raw;
|
struct device_float_coords raw;
|
||||||
const struct normalized_coords zero = { 0.0, 0.0 };
|
const struct normalized_coords zero = { 0.0, 0.0 };
|
||||||
|
|
@ -79,7 +79,7 @@ tp_filter_motion(struct tp_dispatch *tp,
|
||||||
struct normalized_coords
|
struct normalized_coords
|
||||||
tp_filter_motion_unaccelerated(struct tp_dispatch *tp,
|
tp_filter_motion_unaccelerated(struct tp_dispatch *tp,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct device_float_coords raw;
|
struct device_float_coords raw;
|
||||||
const struct normalized_coords zero = { 0.0, 0.0 };
|
const struct normalized_coords zero = { 0.0, 0.0 };
|
||||||
|
|
@ -96,7 +96,7 @@ tp_filter_motion_unaccelerated(struct tp_dispatch *tp,
|
||||||
struct normalized_coords
|
struct normalized_coords
|
||||||
tp_filter_scroll(struct tp_dispatch *tp,
|
tp_filter_scroll(struct tp_dispatch *tp,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct device_float_coords raw;
|
struct device_float_coords raw;
|
||||||
const struct normalized_coords zero = { 0.0, 0.0 };
|
const struct normalized_coords zero = { 0.0, 0.0 };
|
||||||
|
|
@ -115,13 +115,11 @@ tp_filter_scroll(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
tp_calculate_motion_speed(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_calculate_motion_speed(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
const struct tp_history_point *last;
|
const struct tp_history_point *last;
|
||||||
struct device_coords delta;
|
struct device_coords delta;
|
||||||
struct phys_coords mm;
|
struct phys_coords mm;
|
||||||
double distance;
|
|
||||||
double speed;
|
|
||||||
|
|
||||||
/* Don't do this on single-touch or semi-mt devices */
|
/* Don't do this on single-touch or semi-mt devices */
|
||||||
if (!tp->has_mt || tp->semi_mt)
|
if (!tp->has_mt || tp->semi_mt)
|
||||||
|
|
@ -149,15 +147,16 @@ tp_calculate_motion_speed(struct tp_dispatch *tp, struct tp_touch *t, uint64_t t
|
||||||
delta.y = abs(t->point.y - last->point.y);
|
delta.y = abs(t->point.y - last->point.y);
|
||||||
mm = evdev_device_unit_delta_to_mm(tp->device, &delta);
|
mm = evdev_device_unit_delta_to_mm(tp->device, &delta);
|
||||||
|
|
||||||
distance = length_in_mm(mm);
|
usec_t tdelta = usec_delta(time, last->time);
|
||||||
speed = distance / (time - last->time); /* mm/us */
|
double distance = length_in_mm(mm);
|
||||||
speed *= 1000000; /* mm/s */
|
double speed = distance / usec_as_uint64_t(tdelta); /* mm/us */
|
||||||
|
speed *= 1000000; /* mm/s */
|
||||||
|
|
||||||
t->speed.last_speed = speed;
|
t->speed.last_speed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
tp_motion_history_push(struct tp_touch *t, uint64_t time)
|
tp_motion_history_push(struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
int motion_index = (t->history.index + 1) % TOUCHPAD_HISTORY_LENGTH;
|
int motion_index = (t->history.index + 1) % TOUCHPAD_HISTORY_LENGTH;
|
||||||
|
|
||||||
|
|
@ -181,10 +180,9 @@ tp_motion_history_push(struct tp_touch *t, uint64_t time)
|
||||||
* This only looks at x changes, y changes are ignored.
|
* This only looks at x changes, y changes are ignored.
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
tp_detect_wobbling(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_detect_wobbling(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
uint64_t dtime;
|
|
||||||
const struct device_coords *prev_point;
|
const struct device_coords *prev_point;
|
||||||
|
|
||||||
if (tp->nfingers_down != 1 || tp->nfingers_down != tp->old_nfingers_down)
|
if (tp->nfingers_down != 1 || tp->nfingers_down != tp->old_nfingers_down)
|
||||||
|
|
@ -201,11 +199,11 @@ tp_detect_wobbling(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
prev_point = &tp_motion_history_offset(t, 0)->point;
|
prev_point = &tp_motion_history_offset(t, 0)->point;
|
||||||
dx = prev_point->x - t->point.x;
|
dx = prev_point->x - t->point.x;
|
||||||
dy = prev_point->y - t->point.y;
|
dy = prev_point->y - t->point.y;
|
||||||
dtime = time - tp->hysteresis.last_motion_time;
|
usec_t dtime = usec_delta(time, tp->hysteresis.last_motion_time);
|
||||||
|
|
||||||
tp->hysteresis.last_motion_time = time;
|
tp->hysteresis.last_motion_time = time;
|
||||||
|
|
||||||
if ((dx == 0 && dy != 0) || dtime > ms2us(40)) {
|
if ((dx == 0 && dy != 0) || usec_cmp(dtime, usec_from_millis(40)) > 0) {
|
||||||
t->hysteresis.x_motion_history = 0;
|
t->hysteresis.x_motion_history = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -323,7 +321,7 @@ tp_fake_finger_set(struct tp_dispatch *tp, evdev_usage_t usage, bool is_press)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
tp_new_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_new_touch(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
if (t->state == TOUCH_BEGIN || t->state == TOUCH_UPDATE ||
|
if (t->state == TOUCH_BEGIN || t->state == TOUCH_UPDATE ||
|
||||||
t->state == TOUCH_HOVERING)
|
t->state == TOUCH_HOVERING)
|
||||||
|
|
@ -358,7 +356,7 @@ tp_new_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
tp_begin_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_begin_touch(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
t->dirty = true;
|
t->dirty = true;
|
||||||
t->state = TOUCH_BEGIN;
|
t->state = TOUCH_BEGIN;
|
||||||
|
|
@ -382,7 +380,7 @@ tp_begin_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
* need.
|
* need.
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
tp_maybe_end_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_maybe_end_touch(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
switch (t->state) {
|
switch (t->state) {
|
||||||
case TOUCH_NONE:
|
case TOUCH_NONE:
|
||||||
|
|
@ -427,7 +425,7 @@ tp_recover_ended_touch(struct tp_dispatch *tp, struct tp_touch *t)
|
||||||
* Use tp_maybe_end_touch() instead.
|
* Use tp_maybe_end_touch() instead.
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
tp_end_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_end_touch(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
if (t->state != TOUCH_MAYBE_END) {
|
if (t->state != TOUCH_MAYBE_END) {
|
||||||
evdev_log_bug_libinput(tp->device,
|
evdev_log_bug_libinput(tp->device,
|
||||||
|
|
@ -441,7 +439,7 @@ tp_end_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
t->palm.state = PALM_NONE;
|
t->palm.state = PALM_NONE;
|
||||||
t->state = TOUCH_END;
|
t->state = TOUCH_END;
|
||||||
t->pinned.is_pinned = false;
|
t->pinned.is_pinned = false;
|
||||||
t->palm.time = 0;
|
t->palm.time = usec_from_uint64_t(0);
|
||||||
t->speed.exceeded_count = 0;
|
t->speed.exceeded_count = 0;
|
||||||
tp->queued |= TOUCHPAD_EVENT_MOTION;
|
tp->queued |= TOUCHPAD_EVENT_MOTION;
|
||||||
}
|
}
|
||||||
|
|
@ -450,14 +448,14 @@ tp_end_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
* End the touch sequence on ABS_MT_TRACKING_ID -1 or when the BTN_TOOL_* 0 is received.
|
* End the touch sequence on ABS_MT_TRACKING_ID -1 or when the BTN_TOOL_* 0 is received.
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
tp_end_sequence(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_end_sequence(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
t->has_ended = true;
|
t->has_ended = true;
|
||||||
tp_maybe_end_touch(tp, t, time);
|
tp_maybe_end_touch(tp, t, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_stop_actions(struct tp_dispatch *tp, uint64_t time)
|
tp_stop_actions(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
tp_edge_scroll_stop_events(tp, time);
|
tp_edge_scroll_stop_events(tp, time);
|
||||||
tp_gesture_cancel(tp, time);
|
tp_gesture_cancel(tp, time);
|
||||||
|
|
@ -505,7 +503,7 @@ rotated(struct tp_dispatch *tp, evdev_usage_t usage, int value)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_process_absolute(struct tp_dispatch *tp, const struct evdev_event *e, uint64_t time)
|
tp_process_absolute(struct tp_dispatch *tp, const struct evdev_event *e, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *t = tp_current_touch(tp);
|
struct tp_touch *t = tp_current_touch(tp);
|
||||||
|
|
||||||
|
|
@ -560,9 +558,7 @@ tp_process_absolute(struct tp_dispatch *tp, const struct evdev_event *e, uint64_
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_process_absolute_st(struct tp_dispatch *tp,
|
tp_process_absolute_st(struct tp_dispatch *tp, const struct evdev_event *e, usec_t time)
|
||||||
const struct evdev_event *e,
|
|
||||||
uint64_t time)
|
|
||||||
{
|
{
|
||||||
struct tp_touch *t = tp_current_touch(tp);
|
struct tp_touch *t = tp_current_touch(tp);
|
||||||
|
|
||||||
|
|
@ -590,7 +586,7 @@ tp_process_absolute_st(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
tp_restore_synaptics_touches(struct tp_dispatch *tp, uint64_t time)
|
tp_restore_synaptics_touches(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int nfake_touches;
|
unsigned int nfake_touches;
|
||||||
|
|
@ -624,7 +620,7 @@ tp_restore_synaptics_touches(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_process_fake_touches(struct tp_dispatch *tp, uint64_t time)
|
tp_process_fake_touches(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
unsigned int nfake_touches;
|
unsigned int nfake_touches;
|
||||||
|
|
@ -677,7 +673,7 @@ tp_process_fake_touches(struct tp_dispatch *tp, uint64_t time)
|
||||||
static void
|
static void
|
||||||
tp_process_trackpoint_button(struct tp_dispatch *tp,
|
tp_process_trackpoint_button(struct tp_dispatch *tp,
|
||||||
const struct evdev_event *e,
|
const struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct evdev_dispatch *dispatch;
|
struct evdev_dispatch *dispatch;
|
||||||
evdev_usage_t button;
|
evdev_usage_t button;
|
||||||
|
|
@ -709,7 +705,7 @@ tp_process_trackpoint_button(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_process_key(struct tp_dispatch *tp, const struct evdev_event *e, uint64_t time)
|
tp_process_key(struct tp_dispatch *tp, const struct evdev_event *e, usec_t time)
|
||||||
{
|
{
|
||||||
/* ignore kernel key repeat */
|
/* ignore kernel key repeat */
|
||||||
if (e->value == 2)
|
if (e->value == 2)
|
||||||
|
|
@ -740,12 +736,12 @@ tp_process_key(struct tp_dispatch *tp, const struct evdev_event *e, uint64_t tim
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_process_msc(struct tp_dispatch *tp, const struct evdev_event *e, uint64_t time)
|
tp_process_msc(struct tp_dispatch *tp, const struct evdev_event *e, usec_t time)
|
||||||
{
|
{
|
||||||
if (evdev_usage_eq(e->usage, EVDEV_MSC_TIMESTAMP))
|
if (evdev_usage_eq(e->usage, EVDEV_MSC_TIMESTAMP))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tp->quirks.msc_timestamp.now = e->value;
|
tp->quirks.msc_timestamp.now = usec_from_uint64_t(e->value);
|
||||||
tp->queued |= TOUCHPAD_EVENT_TIMESTAMP;
|
tp->queued |= TOUCHPAD_EVENT_TIMESTAMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -831,7 +827,7 @@ tp_palm_in_edge(const struct tp_dispatch *tp, const struct tp_touch *t)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
tp_palm_detect_dwt_triggered(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_palm_detect_dwt_triggered(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
if (tp->dwt.dwt_enabled && tp->dwt.keyboard_active && t->state == TOUCH_BEGIN) {
|
if (tp->dwt.dwt_enabled && tp->dwt.keyboard_active && t->state == TOUCH_BEGIN) {
|
||||||
t->palm.state = PALM_TYPING;
|
t->palm.state = PALM_TYPING;
|
||||||
|
|
@ -847,8 +843,8 @@ tp_palm_detect_dwt_triggered(struct tp_dispatch *tp, struct tp_touch *t, uint64_
|
||||||
started once we stop typing will be able to control the
|
started once we stop typing will be able to control the
|
||||||
pointer (alas not tap, etc.).
|
pointer (alas not tap, etc.).
|
||||||
*/
|
*/
|
||||||
if (t->palm.time == 0 ||
|
if (usec_is_zero(t->palm.time) ||
|
||||||
t->palm.time > tp->dwt.keyboard_last_press_time) {
|
usec_cmp(t->palm.time, tp->dwt.keyboard_last_press_time) > 0) {
|
||||||
t->palm.state = PALM_NONE;
|
t->palm.state = PALM_NONE;
|
||||||
evdev_log_debug(
|
evdev_log_debug(
|
||||||
tp->device,
|
tp->device,
|
||||||
|
|
@ -863,7 +859,7 @@ tp_palm_detect_dwt_triggered(struct tp_dispatch *tp, struct tp_touch *t, uint64_
|
||||||
static bool
|
static bool
|
||||||
tp_palm_detect_trackpoint_triggered(struct tp_dispatch *tp,
|
tp_palm_detect_trackpoint_triggered(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (!tp->palm.monitor_trackpoint)
|
if (!tp->palm.monitor_trackpoint)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -877,8 +873,8 @@ tp_palm_detect_trackpoint_triggered(struct tp_dispatch *tp,
|
||||||
if (t->palm.state == PALM_TRACKPOINT && t->state == TOUCH_UPDATE &&
|
if (t->palm.state == PALM_TRACKPOINT && t->state == TOUCH_UPDATE &&
|
||||||
!tp->palm.trackpoint_active) {
|
!tp->palm.trackpoint_active) {
|
||||||
|
|
||||||
if (t->palm.time == 0 ||
|
if (usec_is_zero(t->palm.time) ||
|
||||||
t->palm.time > tp->palm.trackpoint_last_event_time) {
|
usec_cmp(t->palm.time, tp->palm.trackpoint_last_event_time) > 0) {
|
||||||
t->palm.state = PALM_NONE;
|
t->palm.state = PALM_NONE;
|
||||||
evdev_log_debug(
|
evdev_log_debug(
|
||||||
tp->device,
|
tp->device,
|
||||||
|
|
@ -891,7 +887,7 @@ tp_palm_detect_trackpoint_triggered(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
tp_palm_detect_tool_triggered(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_palm_detect_tool_triggered(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
if (!tp->palm.use_mt_tool)
|
if (!tp->palm.use_mt_tool)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -908,16 +904,15 @@ tp_palm_detect_tool_triggered(struct tp_dispatch *tp, struct tp_touch *t, uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
tp_palm_detect_move_out_of_edge(struct tp_dispatch *tp,
|
tp_palm_detect_move_out_of_edge(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
struct tp_touch *t,
|
|
||||||
uint64_t time)
|
|
||||||
{
|
{
|
||||||
const int PALM_TIMEOUT = ms2us(200);
|
const usec_t PALM_TIMEOUT = usec_from_millis(200);
|
||||||
int directions = 0;
|
int directions = 0;
|
||||||
struct device_float_coords delta;
|
struct device_float_coords delta;
|
||||||
int dirs;
|
int dirs;
|
||||||
|
|
||||||
if (time < t->palm.time + PALM_TIMEOUT && !tp_palm_in_edge(tp, t)) {
|
if (usec_cmp(time, usec_add(t->palm.time, PALM_TIMEOUT)) < 0 &&
|
||||||
|
!tp_palm_in_edge(tp, t)) {
|
||||||
if (tp_palm_was_in_side_edge(tp, t))
|
if (tp_palm_was_in_side_edge(tp, t))
|
||||||
directions = NE | E | SE | SW | W | NW;
|
directions = NE | E | SE | SW | W | NW;
|
||||||
else if (tp_palm_was_in_top_edge(tp, t))
|
else if (tp_palm_was_in_top_edge(tp, t))
|
||||||
|
|
@ -935,7 +930,7 @@ tp_palm_detect_move_out_of_edge(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
tp_palm_detect_multifinger(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_palm_detect_multifinger(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *other;
|
struct tp_touch *other;
|
||||||
|
|
||||||
|
|
@ -965,7 +960,7 @@ tp_palm_detect_multifinger(struct tp_dispatch *tp, struct tp_touch *t, uint64_t
|
||||||
static inline bool
|
static inline bool
|
||||||
tp_palm_detect_touch_size_triggered(struct tp_dispatch *tp,
|
tp_palm_detect_touch_size_triggered(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (!tp->palm.use_size)
|
if (!tp->palm.use_size)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -988,7 +983,7 @@ tp_palm_detect_touch_size_triggered(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
tp_palm_detect_edge(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_palm_detect_edge(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
if (t->palm.state == PALM_EDGE) {
|
if (t->palm.state == PALM_EDGE) {
|
||||||
if (tp_palm_detect_multifinger(tp, t, time)) {
|
if (tp_palm_detect_multifinger(tp, t, time)) {
|
||||||
|
|
@ -1035,7 +1030,7 @@ tp_palm_detect_edge(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
static bool
|
static bool
|
||||||
tp_palm_detect_pressure_triggered(struct tp_dispatch *tp,
|
tp_palm_detect_pressure_triggered(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (!tp->palm.use_pressure)
|
if (!tp->palm.use_pressure)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1052,7 +1047,7 @@ tp_palm_detect_pressure_triggered(struct tp_dispatch *tp,
|
||||||
static bool
|
static bool
|
||||||
tp_palm_detect_arbitration_triggered(struct tp_dispatch *tp,
|
tp_palm_detect_arbitration_triggered(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (tp->arbitration.state == ARBITRATION_NOT_ACTIVE)
|
if (tp->arbitration.state == ARBITRATION_NOT_ACTIVE)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1063,7 +1058,7 @@ tp_palm_detect_arbitration_triggered(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
const char *palm_state;
|
const char *palm_state;
|
||||||
enum touch_palm_state oldstate = t->palm.state;
|
enum touch_palm_state oldstate = t->palm.state;
|
||||||
|
|
@ -1139,7 +1134,7 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_unhover_pressure(struct tp_dispatch *tp, uint64_t time)
|
tp_unhover_pressure(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -1223,7 +1218,7 @@ tp_unhover_pressure(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_unhover_size(struct tp_dispatch *tp, uint64_t time)
|
tp_unhover_size(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
int low = tp->touch_size.low, high = tp->touch_size.high;
|
int low = tp->touch_size.low, high = tp->touch_size.high;
|
||||||
|
|
@ -1263,7 +1258,7 @@ tp_unhover_size(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_unhover_fake_touches(struct tp_dispatch *tp, uint64_t time)
|
tp_unhover_fake_touches(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
unsigned int nfake_touches;
|
unsigned int nfake_touches;
|
||||||
|
|
@ -1317,7 +1312,7 @@ tp_unhover_fake_touches(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_unhover_touches(struct tp_dispatch *tp, uint64_t time)
|
tp_unhover_touches(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
if (tp->pressure.use_pressure)
|
if (tp->pressure.use_pressure)
|
||||||
tp_unhover_pressure(tp, time);
|
tp_unhover_pressure(tp, time);
|
||||||
|
|
@ -1403,17 +1398,17 @@ tp_need_motion_history_reset(struct tp_dispatch *tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
tp_detect_jumps(const struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_detect_jumps(const struct tp_dispatch *tp, struct tp_touch *t, usec_t time)
|
||||||
{
|
{
|
||||||
struct device_coords delta;
|
struct device_coords delta;
|
||||||
struct phys_coords mm;
|
struct phys_coords mm;
|
||||||
struct tp_history_point *last;
|
struct tp_history_point *last;
|
||||||
double abs_distance, rel_distance;
|
double abs_distance, rel_distance;
|
||||||
bool is_jump = false;
|
bool is_jump = false;
|
||||||
uint64_t tdelta;
|
usec_t tdelta;
|
||||||
/* Reference interval from the touchpad the various thresholds
|
/* Reference interval from the touchpad the various thresholds
|
||||||
* were measured from */
|
* were measured from */
|
||||||
unsigned int reference_interval = ms2us(12);
|
usec_t reference_interval = usec_from_millis(12);
|
||||||
|
|
||||||
/* On some touchpads the firmware does funky stuff and we cannot
|
/* On some touchpads the firmware does funky stuff and we cannot
|
||||||
* have our own jump detection, e.g. Lenovo Carbon X1 Gen 6 (see
|
* have our own jump detection, e.g. Lenovo Carbon X1 Gen 6 (see
|
||||||
|
|
@ -1436,7 +1431,7 @@ tp_detect_jumps(const struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
/* called before tp_motion_history_push, so offset 0 is the most
|
/* called before tp_motion_history_push, so offset 0 is the most
|
||||||
* recent coordinate */
|
* recent coordinate */
|
||||||
last = tp_motion_history_offset(t, 0);
|
last = tp_motion_history_offset(t, 0);
|
||||||
tdelta = time - last->time;
|
tdelta = usec_delta(time, last->time);
|
||||||
|
|
||||||
/* For test devices we always force the time delta to 12, at least
|
/* For test devices we always force the time delta to 12, at least
|
||||||
until the test suite actually does proper intervals. */
|
until the test suite actually does proper intervals. */
|
||||||
|
|
@ -1446,7 +1441,8 @@ tp_detect_jumps(const struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
/* If the last frame is more than 30ms ago, we have irregular
|
/* If the last frame is more than 30ms ago, we have irregular
|
||||||
* frames, who knows what's a pointer jump here and what's
|
* frames, who knows what's a pointer jump here and what's
|
||||||
* legitimate movement.... */
|
* legitimate movement.... */
|
||||||
if (tdelta > 2.5 * reference_interval || tdelta == 0)
|
if (usec_cmp(tdelta, usec_mul(reference_interval, 2.5)) > 0 ||
|
||||||
|
usec_is_zero(tdelta))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* We historically expected ~12ms frame intervals, so the numbers
|
/* We historically expected ~12ms frame intervals, so the numbers
|
||||||
|
|
@ -1455,7 +1451,8 @@ tp_detect_jumps(const struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
delta.x = abs(t->point.x - last->point.x);
|
delta.x = abs(t->point.x - last->point.x);
|
||||||
delta.y = abs(t->point.y - last->point.y);
|
delta.y = abs(t->point.y - last->point.y);
|
||||||
mm = evdev_device_unit_delta_to_mm(tp->device, &delta);
|
mm = evdev_device_unit_delta_to_mm(tp->device, &delta);
|
||||||
abs_distance = hypot(mm.x, mm.y) * reference_interval / tdelta;
|
abs_distance = hypot(mm.x, mm.y) * usec_as_uint64_t(reference_interval) /
|
||||||
|
usec_as_uint64_t(tdelta);
|
||||||
rel_distance = abs_distance - t->jumps.last_delta_mm;
|
rel_distance = abs_distance - t->jumps.last_delta_mm;
|
||||||
|
|
||||||
/* Special case for the ALPS devices in the Lenovo ThinkPad E465,
|
/* Special case for the ALPS devices in the Lenovo ThinkPad E465,
|
||||||
|
|
@ -1496,9 +1493,9 @@ tp_detect_jumps(const struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
static inline void
|
static inline void
|
||||||
tp_motion_history_fix_last(struct tp_dispatch *tp,
|
tp_motion_history_fix_last(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
unsigned int jumping_interval,
|
usec_t jumping_interval,
|
||||||
unsigned int normal_interval,
|
usec_t normal_interval,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (t->state != TOUCH_UPDATE)
|
if (t->state != TOUCH_UPDATE)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1514,12 +1511,13 @@ tp_motion_history_fix_last(struct tp_dispatch *tp,
|
||||||
struct tp_history_point *p;
|
struct tp_history_point *p;
|
||||||
|
|
||||||
p = tp_motion_history_offset(t, i);
|
p = tp_motion_history_offset(t, i);
|
||||||
p->time = time - jumping_interval - normal_interval * i;
|
p->time = usec_sub(usec_sub(time, jumping_interval),
|
||||||
|
usec_mul(normal_interval, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_process_msc_timestamp(struct tp_dispatch *tp, uint64_t time)
|
tp_process_msc_timestamp(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct msc_timestamp *m = &tp->quirks.msc_timestamp;
|
struct msc_timestamp *m = &tp->quirks.msc_timestamp;
|
||||||
|
|
||||||
|
|
@ -1553,15 +1551,15 @@ tp_process_msc_timestamp(struct tp_dispatch *tp, uint64_t time)
|
||||||
delta is equivalent to 10 events and the movement is x, we
|
delta is equivalent to 10 events and the movement is x, we
|
||||||
instead pretend there was movement of x/10.
|
instead pretend there was movement of x/10.
|
||||||
*/
|
*/
|
||||||
if (m->now == 0) {
|
if (usec_is_zero(m->now)) {
|
||||||
m->state = JUMP_STATE_EXPECT_FIRST;
|
m->state = JUMP_STATE_EXPECT_FIRST;
|
||||||
m->interval = 0;
|
m->interval = usec_from_uint64_t(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m->state) {
|
switch (m->state) {
|
||||||
case JUMP_STATE_EXPECT_FIRST:
|
case JUMP_STATE_EXPECT_FIRST:
|
||||||
if (m->now > ms2us(20)) {
|
if (usec_cmp(m->now, usec_from_millis(20)) > 0) {
|
||||||
m->state = JUMP_STATE_IGNORE;
|
m->state = JUMP_STATE_IGNORE;
|
||||||
} else {
|
} else {
|
||||||
m->state = JUMP_STATE_EXPECT_DELAY;
|
m->state = JUMP_STATE_EXPECT_DELAY;
|
||||||
|
|
@ -1569,13 +1567,13 @@ tp_process_msc_timestamp(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JUMP_STATE_EXPECT_DELAY:
|
case JUMP_STATE_EXPECT_DELAY:
|
||||||
if (m->now > m->interval * 2) {
|
if (usec_cmp(m->now, usec_mul(m->interval, 2)) > 0) {
|
||||||
uint32_t tdelta; /* µs */
|
usec_t tdelta; /* µs */
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
|
|
||||||
/* The current time is > 2 times the interval so we
|
/* The current time is > 2 times the interval so we
|
||||||
* have a jump. Fix the motion history */
|
* have a jump. Fix the motion history */
|
||||||
tdelta = m->now - m->interval;
|
tdelta = usec_delta(m->now, m->interval);
|
||||||
|
|
||||||
tp_for_each_touch(tp, t) {
|
tp_for_each_touch(tp, t) {
|
||||||
tp_motion_history_fix_last(tp,
|
tp_motion_history_fix_last(tp,
|
||||||
|
|
@ -1593,7 +1591,9 @@ tp_process_msc_timestamp(struct tp_dispatch *tp, uint64_t time)
|
||||||
* only ever see those jumps over the first three events it
|
* only ever see those jumps over the first three events it
|
||||||
* doesn't matter.
|
* doesn't matter.
|
||||||
*/
|
*/
|
||||||
filter_restart(tp->device->pointer.filter, tp, time - tdelta);
|
filter_restart(tp->device->pointer.filter,
|
||||||
|
tp,
|
||||||
|
usec_sub(time, tdelta));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JUMP_STATE_IGNORE:
|
case JUMP_STATE_IGNORE:
|
||||||
|
|
@ -1602,7 +1602,7 @@ tp_process_msc_timestamp(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_pre_process_state(struct tp_dispatch *tp, uint64_t time)
|
tp_pre_process_state(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
|
|
||||||
|
|
@ -1624,7 +1624,7 @@ tp_pre_process_state(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_process_state(struct tp_dispatch *tp, uint64_t time)
|
tp_process_state(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
bool restart_filter = false;
|
bool restart_filter = false;
|
||||||
|
|
@ -1735,7 +1735,7 @@ tp_process_state(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_post_process_state(struct tp_dispatch *tp, uint64_t time)
|
tp_post_process_state(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
|
|
||||||
|
|
@ -1769,7 +1769,7 @@ tp_post_process_state(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_post_events(struct tp_dispatch *tp, uint64_t time)
|
tp_post_events(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
bool ignore_motion = false;
|
bool ignore_motion = false;
|
||||||
|
|
||||||
|
|
@ -1820,7 +1820,7 @@ tp_apply_rotation(struct evdev_device *device)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_handle_state(struct tp_dispatch *tp, uint64_t time)
|
tp_handle_state(struct tp_dispatch *tp, usec_t time)
|
||||||
{
|
{
|
||||||
tp_pre_process_state(tp, time);
|
tp_pre_process_state(tp, time);
|
||||||
tp_process_state(tp, time);
|
tp_process_state(tp, time);
|
||||||
|
|
@ -1858,7 +1858,7 @@ static void
|
||||||
tp_interface_process_event(struct evdev_dispatch *dispatch,
|
tp_interface_process_event(struct evdev_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_dispatch *tp = tp_dispatch(dispatch);
|
struct tp_dispatch *tp = tp_dispatch(dispatch);
|
||||||
|
|
||||||
|
|
@ -1889,7 +1889,7 @@ static void
|
||||||
tp_interface_process(struct evdev_dispatch *dispatch,
|
tp_interface_process(struct evdev_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
size_t nevents;
|
size_t nevents;
|
||||||
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
||||||
|
|
@ -1982,7 +1982,7 @@ tp_release_fake_touches(struct tp_dispatch *tp)
|
||||||
static void
|
static void
|
||||||
tp_clear_state(struct tp_dispatch *tp)
|
tp_clear_state(struct tp_dispatch *tp)
|
||||||
{
|
{
|
||||||
uint64_t now = libinput_now(tp_libinput_context(tp));
|
usec_t now = libinput_now(tp_libinput_context(tp));
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
|
|
||||||
/* Unroll the touchpad state.
|
/* Unroll the touchpad state.
|
||||||
|
|
@ -2106,7 +2106,7 @@ tp_resume(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_trackpoint_timeout(uint64_t now, void *data)
|
tp_trackpoint_timeout(usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct tp_dispatch *tp = data;
|
struct tp_dispatch *tp = data;
|
||||||
|
|
||||||
|
|
@ -2118,7 +2118,7 @@ tp_trackpoint_timeout(uint64_t now, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_trackpoint_event(uint64_t time, struct libinput_event *event, void *data)
|
tp_trackpoint_event(usec_t time, struct libinput_event *event, void *data)
|
||||||
{
|
{
|
||||||
struct tp_dispatch *tp = data;
|
struct tp_dispatch *tp = data;
|
||||||
|
|
||||||
|
|
@ -2136,7 +2136,7 @@ tp_trackpoint_event(uint64_t time, struct libinput_event *event, void *data)
|
||||||
/* Require at least three events before enabling palm detection */
|
/* Require at least three events before enabling palm detection */
|
||||||
if (tp->palm.trackpoint_event_count < 3) {
|
if (tp->palm.trackpoint_event_count < 3) {
|
||||||
libinput_timer_set(&tp->palm.trackpoint_timer,
|
libinput_timer_set(&tp->palm.trackpoint_timer,
|
||||||
time + DEFAULT_TRACKPOINT_EVENT_TIMEOUT);
|
usec_add(time, DEFAULT_TRACKPOINT_EVENT_TIMEOUT));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2146,18 +2146,18 @@ tp_trackpoint_event(uint64_t time, struct libinput_event *event, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
libinput_timer_set(&tp->palm.trackpoint_timer,
|
libinput_timer_set(&tp->palm.trackpoint_timer,
|
||||||
time + DEFAULT_TRACKPOINT_ACTIVITY_TIMEOUT);
|
usec_add(time, tp->palm.timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_keyboard_timeout(uint64_t now, void *data)
|
tp_keyboard_timeout(usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct tp_dispatch *tp = data;
|
struct tp_dispatch *tp = data;
|
||||||
|
|
||||||
if (tp->dwt.dwt_enabled &&
|
if (tp->dwt.dwt_enabled &&
|
||||||
long_any_bit_set(tp->dwt.key_mask, ARRAY_LENGTH(tp->dwt.key_mask))) {
|
long_any_bit_set(tp->dwt.key_mask, ARRAY_LENGTH(tp->dwt.key_mask))) {
|
||||||
libinput_timer_set(&tp->dwt.keyboard_timer,
|
libinput_timer_set(&tp->dwt.keyboard_timer,
|
||||||
now + DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_2);
|
usec_add(now, tp->dwt.timeout));
|
||||||
tp->dwt.keyboard_last_press_time = now;
|
tp->dwt.keyboard_last_press_time = now;
|
||||||
evdev_log_debug(tp->device, "palm: keyboard timeout refresh\n");
|
evdev_log_debug(tp->device, "palm: keyboard timeout refresh\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -2219,11 +2219,11 @@ tp_key_ignore_for_dwt(unsigned int keycode)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_keyboard_event(uint64_t time, struct libinput_event *event, void *data)
|
tp_keyboard_event(usec_t time, struct libinput_event *event, void *data)
|
||||||
{
|
{
|
||||||
struct tp_dispatch *tp = data;
|
struct tp_dispatch *tp = data;
|
||||||
struct libinput_event_keyboard *kbdev;
|
struct libinput_event_keyboard *kbdev;
|
||||||
unsigned int timeout;
|
usec_t timeout;
|
||||||
unsigned int key;
|
unsigned int key;
|
||||||
bool is_modifier;
|
bool is_modifier;
|
||||||
|
|
||||||
|
|
@ -2272,12 +2272,12 @@ tp_keyboard_event(uint64_t time, struct libinput_event *event, void *data)
|
||||||
tp->dwt.keyboard_active = true;
|
tp->dwt.keyboard_active = true;
|
||||||
timeout = DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_1;
|
timeout = DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_1;
|
||||||
} else {
|
} else {
|
||||||
timeout = DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_2;
|
timeout = tp->dwt.timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
tp->dwt.keyboard_last_press_time = time;
|
tp->dwt.keyboard_last_press_time = time;
|
||||||
long_set_bit(tp->dwt.key_mask, key);
|
long_set_bit(tp->dwt.key_mask, key);
|
||||||
libinput_timer_set(&tp->dwt.keyboard_timer, time + timeout);
|
libinput_timer_set(&tp->dwt.keyboard_timer, usec_add(time, timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
@ -2363,7 +2363,7 @@ tp_pair_trackpoint(struct evdev_device *touchpad, struct evdev_device *trackpoin
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_lid_switch_event(uint64_t time, struct libinput_event *event, void *data)
|
tp_lid_switch_event(usec_t time, struct libinput_event *event, void *data)
|
||||||
{
|
{
|
||||||
struct tp_dispatch *tp = data;
|
struct tp_dispatch *tp = data;
|
||||||
struct libinput_event_switch *swev;
|
struct libinput_event_switch *swev;
|
||||||
|
|
@ -2388,7 +2388,7 @@ tp_lid_switch_event(uint64_t time, struct libinput_event *event, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_tablet_mode_switch_event(uint64_t time, struct libinput_event *event, void *data)
|
tp_tablet_mode_switch_event(usec_t time, struct libinput_event *event, void *data)
|
||||||
{
|
{
|
||||||
struct tp_dispatch *tp = data;
|
struct tp_dispatch *tp = data;
|
||||||
struct libinput_event_switch *swev;
|
struct libinput_event_switch *swev;
|
||||||
|
|
@ -2694,7 +2694,7 @@ evdev_tag_touchpad(struct evdev_device *device, struct udev_device *udev_device)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_arbitration_timeout(uint64_t now, void *data)
|
tp_arbitration_timeout(usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct tp_dispatch *tp = data;
|
struct tp_dispatch *tp = data;
|
||||||
|
|
||||||
|
|
@ -2707,7 +2707,7 @@ tp_interface_toggle_touch(struct evdev_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
enum evdev_arbitration_state which,
|
enum evdev_arbitration_state which,
|
||||||
const struct phys_rect *rect,
|
const struct phys_rect *rect,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct tp_dispatch *tp = tp_dispatch(dispatch);
|
struct tp_dispatch *tp = tp_dispatch(dispatch);
|
||||||
|
|
||||||
|
|
@ -2730,7 +2730,7 @@ tp_interface_toggle_touch(struct evdev_dispatch *dispatch,
|
||||||
* arbitration by just a little bit so that any touch in
|
* arbitration by just a little bit so that any touch in
|
||||||
* event is caught as palm touch. */
|
* event is caught as palm touch. */
|
||||||
libinput_timer_set(&tp->arbitration.arbitration_timer,
|
libinput_timer_set(&tp->arbitration.arbitration_timer,
|
||||||
time + ms2us(90));
|
usec_add_millis(time, 90));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2938,12 +2938,12 @@ tp_init_accel(struct tp_dispatch *tp, enum libinput_config_accel_profile which)
|
||||||
tp->device->model_flags & EVDEV_MODEL_LENOVO_X220_TOUCHPAD_FW81) {
|
tp->device->model_flags & EVDEV_MODEL_LENOVO_X220_TOUCHPAD_FW81) {
|
||||||
filter = create_pointer_accelerator_filter_lenovo_x230(dpi, use_v_avg);
|
filter = create_pointer_accelerator_filter_lenovo_x230(dpi, use_v_avg);
|
||||||
} else {
|
} else {
|
||||||
uint64_t eds_threshold = 0;
|
usec_t eds_threshold = usec_from_uint64_t(0);
|
||||||
uint64_t eds_value = 0;
|
usec_t eds_value = usec_from_uint64_t(0);
|
||||||
|
|
||||||
if (libevdev_get_id_bustype(device->evdev) == BUS_BLUETOOTH) {
|
if (libevdev_get_id_bustype(device->evdev) == BUS_BLUETOOTH) {
|
||||||
eds_threshold = ms2us(50);
|
eds_threshold = usec_from_millis(50);
|
||||||
eds_value = ms2us(10);
|
eds_value = usec_from_millis(10);
|
||||||
}
|
}
|
||||||
filter = create_pointer_accelerator_filter_touchpad(dpi,
|
filter = create_pointer_accelerator_filter_touchpad(dpi,
|
||||||
eds_threshold,
|
eds_threshold,
|
||||||
|
|
@ -3032,7 +3032,7 @@ tp_scroll_config_scroll_method_set_method(struct libinput_device *device,
|
||||||
{
|
{
|
||||||
struct evdev_device *evdev = evdev_device(device);
|
struct evdev_device *evdev = evdev_device(device);
|
||||||
struct tp_dispatch *tp = (struct tp_dispatch *)evdev->dispatch;
|
struct tp_dispatch *tp = (struct tp_dispatch *)evdev->dispatch;
|
||||||
uint64_t time = libinput_now(tp_libinput_context(tp));
|
usec_t time = libinput_now(tp_libinput_context(tp));
|
||||||
|
|
||||||
if (method == tp->scroll.method)
|
if (method == tp->scroll.method)
|
||||||
return LIBINPUT_CONFIG_STATUS_SUCCESS;
|
return LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||||
|
|
@ -3170,6 +3170,30 @@ tp_dwt_config_get_default(struct libinput_device *device)
|
||||||
: LIBINPUT_CONFIG_DWT_DISABLED;
|
: LIBINPUT_CONFIG_DWT_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum libinput_config_status
|
||||||
|
tp_dwt_config_set_timeout(struct libinput_device *device, usec_t timeout)
|
||||||
|
{
|
||||||
|
struct evdev_device *evdev = evdev_device(device);
|
||||||
|
struct tp_dispatch *tp = (struct tp_dispatch *)evdev->dispatch;
|
||||||
|
|
||||||
|
if (usec_cmp(timeout, usec_from_millis(100)) < 0 ||
|
||||||
|
usec_cmp(timeout, usec_from_millis(5000)) > 0)
|
||||||
|
return LIBINPUT_CONFIG_STATUS_INVALID;
|
||||||
|
|
||||||
|
tp->dwt.timeout = timeout;
|
||||||
|
|
||||||
|
return LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static usec_t
|
||||||
|
tp_dwt_config_get_timeout(struct libinput_device *device)
|
||||||
|
{
|
||||||
|
struct evdev_device *evdev = evdev_device(device);
|
||||||
|
struct tp_dispatch *tp = (struct tp_dispatch *)evdev->dispatch;
|
||||||
|
|
||||||
|
return tp->dwt.timeout;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tp_dwtp_config_is_available(struct libinput_device *device)
|
tp_dwtp_config_is_available(struct libinput_device *device)
|
||||||
{
|
{
|
||||||
|
|
@ -3222,6 +3246,30 @@ tp_dwtp_config_get_default(struct libinput_device *device)
|
||||||
: LIBINPUT_CONFIG_DWTP_DISABLED;
|
: LIBINPUT_CONFIG_DWTP_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum libinput_config_status
|
||||||
|
tp_dwtp_config_set_timeout(struct libinput_device *device, usec_t timeout)
|
||||||
|
{
|
||||||
|
struct evdev_device *evdev = evdev_device(device);
|
||||||
|
struct tp_dispatch *tp = (struct tp_dispatch *)evdev->dispatch;
|
||||||
|
|
||||||
|
if (usec_cmp(timeout, usec_from_millis(100)) < 0 ||
|
||||||
|
usec_cmp(timeout, usec_from_millis(5000)) > 0)
|
||||||
|
return LIBINPUT_CONFIG_STATUS_INVALID;
|
||||||
|
|
||||||
|
tp->palm.timeout = timeout;
|
||||||
|
|
||||||
|
return LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static usec_t
|
||||||
|
tp_dwtp_config_get_timeout(struct libinput_device *device)
|
||||||
|
{
|
||||||
|
struct evdev_device *evdev = evdev_device(device);
|
||||||
|
struct tp_dispatch *tp = (struct tp_dispatch *)evdev->dispatch;
|
||||||
|
|
||||||
|
return tp->palm.timeout;
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
tp_is_tpkb_combo_below(struct evdev_device *device)
|
tp_is_tpkb_combo_below(struct evdev_device *device)
|
||||||
{
|
{
|
||||||
|
|
@ -3258,7 +3306,10 @@ tp_init_dwt(struct tp_dispatch *tp, struct evdev_device *device)
|
||||||
tp->dwt.config.set_enabled = tp_dwt_config_set;
|
tp->dwt.config.set_enabled = tp_dwt_config_set;
|
||||||
tp->dwt.config.get_enabled = tp_dwt_config_get;
|
tp->dwt.config.get_enabled = tp_dwt_config_get;
|
||||||
tp->dwt.config.get_default_enabled = tp_dwt_config_get_default;
|
tp->dwt.config.get_default_enabled = tp_dwt_config_get_default;
|
||||||
|
tp->dwt.config.set_timeout = tp_dwt_config_set_timeout;
|
||||||
|
tp->dwt.config.get_timeout = tp_dwt_config_get_timeout;
|
||||||
tp->dwt.dwt_enabled = tp_dwt_default_enabled(tp);
|
tp->dwt.dwt_enabled = tp_dwt_default_enabled(tp);
|
||||||
|
tp->dwt.timeout = DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_2;
|
||||||
device->base.config.dwt = &tp->dwt.config;
|
device->base.config.dwt = &tp->dwt.config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3274,6 +3325,9 @@ tp_init_dwtp(struct tp_dispatch *tp, struct evdev_device *device)
|
||||||
tp->palm.config.set_enabled = tp_dwtp_config_set;
|
tp->palm.config.set_enabled = tp_dwtp_config_set;
|
||||||
tp->palm.config.get_enabled = tp_dwtp_config_get;
|
tp->palm.config.get_enabled = tp_dwtp_config_get;
|
||||||
tp->palm.config.get_default_enabled = tp_dwtp_config_get_default;
|
tp->palm.config.get_default_enabled = tp_dwtp_config_get_default;
|
||||||
|
tp->palm.config.set_timeout = tp_dwtp_config_set_timeout;
|
||||||
|
tp->palm.config.get_timeout = tp_dwtp_config_get_timeout;
|
||||||
|
tp->palm.timeout = DEFAULT_TRACKPOINT_ACTIVITY_TIMEOUT;
|
||||||
device->base.config.dwtp = &tp->palm.config;
|
device->base.config.dwtp = &tp->palm.config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3622,8 +3676,8 @@ tp_init_pressurepad(struct tp_dispatch *tp, struct evdev_device *device)
|
||||||
*
|
*
|
||||||
* See also #562
|
* See also #562
|
||||||
*/
|
*/
|
||||||
if (libevdev_get_abs_resolution(device->evdev, ABS_MT_PRESSURE) != 0 ||
|
if (libevdev_has_property(device->evdev, INPUT_PROP_PRESSUREPAD) ||
|
||||||
evdev_device_has_model_quirk(device, QUIRK_MODEL_PRESSURE_PAD)) {
|
libevdev_get_abs_resolution(device->evdev, ABS_MT_PRESSURE) != 0) {
|
||||||
libevdev_disable_event_code(device->evdev, EV_ABS, ABS_MT_PRESSURE);
|
libevdev_disable_event_code(device->evdev, EV_ABS, ABS_MT_PRESSURE);
|
||||||
libevdev_disable_event_code(device->evdev, EV_ABS, ABS_PRESSURE);
|
libevdev_disable_event_code(device->evdev, EV_ABS, ABS_PRESSURE);
|
||||||
}
|
}
|
||||||
|
|
@ -3655,7 +3709,7 @@ tp_init(struct tp_dispatch *tp, struct evdev_device *device)
|
||||||
tp_init_pressure(tp, device);
|
tp_init_pressure(tp, device);
|
||||||
|
|
||||||
/* 5 warnings per 24 hours should be enough */
|
/* 5 warnings per 24 hours should be enough */
|
||||||
ratelimit_init(&tp->jump.warning, h2us(24), 5);
|
ratelimit_init(&tp->jump.warning, usec_from_hours(24), 5);
|
||||||
|
|
||||||
/* Set the dpi to that of the x axis, because that's what we normalize
|
/* Set the dpi to that of the x axis, because that's what we normalize
|
||||||
to when needed*/
|
to when needed*/
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ struct tp_touch {
|
||||||
bool has_ended; /* TRACKING_ID == -1 */
|
bool has_ended; /* TRACKING_ID == -1 */
|
||||||
bool dirty;
|
bool dirty;
|
||||||
struct device_coords point;
|
struct device_coords point;
|
||||||
uint64_t initial_time;
|
usec_t initial_time;
|
||||||
int pressure;
|
int pressure;
|
||||||
bool is_tool_palm; /* MT_TOOL_PALM */
|
bool is_tool_palm; /* MT_TOOL_PALM */
|
||||||
int major, minor;
|
int major, minor;
|
||||||
|
|
@ -213,7 +213,7 @@ struct tp_touch {
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct tp_history_point {
|
struct tp_history_point {
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
struct device_coords point;
|
struct device_coords point;
|
||||||
} samples[TOUCHPAD_HISTORY_LENGTH];
|
} samples[TOUCHPAD_HISTORY_LENGTH];
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
|
|
@ -246,7 +246,7 @@ struct tp_touch {
|
||||||
struct libinput_timer timer;
|
struct libinput_timer timer;
|
||||||
struct device_coords initial;
|
struct device_coords initial;
|
||||||
bool has_moved; /* has moved more than threshold */
|
bool has_moved; /* has moved more than threshold */
|
||||||
uint64_t initial_time;
|
usec_t initial_time;
|
||||||
} button;
|
} button;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -267,7 +267,7 @@ struct tp_touch {
|
||||||
struct {
|
struct {
|
||||||
enum touch_palm_state state;
|
enum touch_palm_state state;
|
||||||
struct device_coords first; /* first coordinates if is_palm == true */
|
struct device_coords first; /* first coordinates if is_palm == true */
|
||||||
uint64_t time; /* first timestamp if is_palm == true */
|
usec_t time; /* first timestamp if is_palm == true */
|
||||||
} palm;
|
} palm;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -344,7 +344,7 @@ struct tp_dispatch {
|
||||||
bool enabled;
|
bool enabled;
|
||||||
struct device_coords margin;
|
struct device_coords margin;
|
||||||
unsigned int other_event_count;
|
unsigned int other_event_count;
|
||||||
uint64_t last_motion_time;
|
usec_t last_motion_time;
|
||||||
} hysteresis;
|
} hysteresis;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -361,7 +361,7 @@ struct tp_dispatch {
|
||||||
struct libinput_timer finger_count_switch_timer;
|
struct libinput_timer finger_count_switch_timer;
|
||||||
enum tp_gesture_state state;
|
enum tp_gesture_state state;
|
||||||
struct tp_touch *touches[2];
|
struct tp_touch *touches[2];
|
||||||
uint64_t initial_time;
|
usec_t initial_time;
|
||||||
double initial_distance;
|
double initial_distance;
|
||||||
double prev_scale;
|
double prev_scale;
|
||||||
double angle;
|
double angle;
|
||||||
|
|
@ -370,7 +370,7 @@ struct tp_dispatch {
|
||||||
bool hold_enabled;
|
bool hold_enabled;
|
||||||
|
|
||||||
struct libinput_timer drag_3fg_timer;
|
struct libinput_timer drag_3fg_timer;
|
||||||
uint64_t drag_3fg_release_time;
|
usec_t drag_3fg_release_time;
|
||||||
} gesture;
|
} gesture;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -421,9 +421,9 @@ struct tp_dispatch {
|
||||||
bool h, v;
|
bool h, v;
|
||||||
} active;
|
} active;
|
||||||
struct phys_coords vector;
|
struct phys_coords vector;
|
||||||
uint64_t time_prev;
|
usec_t time_prev;
|
||||||
struct {
|
struct {
|
||||||
uint64_t h, v;
|
usec_t h, v;
|
||||||
} duration;
|
} duration;
|
||||||
} scroll;
|
} scroll;
|
||||||
|
|
||||||
|
|
@ -436,7 +436,7 @@ struct tp_dispatch {
|
||||||
struct libinput_timer timer;
|
struct libinput_timer timer;
|
||||||
enum tp_tap_state state;
|
enum tp_tap_state state;
|
||||||
uint32_t buttons_pressed;
|
uint32_t buttons_pressed;
|
||||||
uint64_t saved_press_time, saved_release_time;
|
usec_t saved_press_time, saved_release_time;
|
||||||
|
|
||||||
enum libinput_config_tap_button_map map;
|
enum libinput_config_tap_button_map map;
|
||||||
enum libinput_config_tap_button_map want_map;
|
enum libinput_config_tap_button_map want_map;
|
||||||
|
|
@ -457,6 +457,7 @@ struct tp_dispatch {
|
||||||
struct {
|
struct {
|
||||||
struct libinput_device_config_dwtp config;
|
struct libinput_device_config_dwtp config;
|
||||||
bool dwtp_enabled;
|
bool dwtp_enabled;
|
||||||
|
usec_t timeout;
|
||||||
|
|
||||||
int32_t right_edge; /* in device coordinates */
|
int32_t right_edge; /* in device coordinates */
|
||||||
int32_t left_edge; /* in device coordinates */
|
int32_t left_edge; /* in device coordinates */
|
||||||
|
|
@ -465,7 +466,7 @@ struct tp_dispatch {
|
||||||
bool trackpoint_active;
|
bool trackpoint_active;
|
||||||
struct libinput_event_listener trackpoint_listener;
|
struct libinput_event_listener trackpoint_listener;
|
||||||
struct libinput_timer trackpoint_timer;
|
struct libinput_timer trackpoint_timer;
|
||||||
uint64_t trackpoint_last_event_time;
|
usec_t trackpoint_last_event_time;
|
||||||
uint32_t trackpoint_event_count;
|
uint32_t trackpoint_event_count;
|
||||||
bool monitor_trackpoint;
|
bool monitor_trackpoint;
|
||||||
|
|
||||||
|
|
@ -486,6 +487,7 @@ struct tp_dispatch {
|
||||||
struct {
|
struct {
|
||||||
struct libinput_device_config_dwt config;
|
struct libinput_device_config_dwt config;
|
||||||
bool dwt_enabled;
|
bool dwt_enabled;
|
||||||
|
usec_t timeout;
|
||||||
|
|
||||||
/* We have to allow for more than one device node to be the
|
/* We have to allow for more than one device node to be the
|
||||||
* internal dwt keyboard (Razer Blade). But they're the same
|
* internal dwt keyboard (Razer Blade). But they're the same
|
||||||
|
|
@ -498,7 +500,7 @@ struct tp_dispatch {
|
||||||
unsigned long mod_mask[NLONGS(KEY_CNT)];
|
unsigned long mod_mask[NLONGS(KEY_CNT)];
|
||||||
bool keyboard_active;
|
bool keyboard_active;
|
||||||
struct libinput_timer keyboard_timer;
|
struct libinput_timer keyboard_timer;
|
||||||
uint64_t keyboard_last_press_time;
|
usec_t keyboard_last_press_time;
|
||||||
} dwt;
|
} dwt;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -529,8 +531,8 @@ struct tp_dispatch {
|
||||||
|
|
||||||
struct msc_timestamp {
|
struct msc_timestamp {
|
||||||
enum tp_jump_state state;
|
enum tp_jump_state state;
|
||||||
uint32_t interval;
|
usec_t interval;
|
||||||
uint32_t now;
|
usec_t now;
|
||||||
} msc_timestamp;
|
} msc_timestamp;
|
||||||
} quirks;
|
} quirks;
|
||||||
|
|
||||||
|
|
@ -614,17 +616,17 @@ tp_get_delta(struct tp_touch *t);
|
||||||
struct normalized_coords
|
struct normalized_coords
|
||||||
tp_filter_motion(struct tp_dispatch *tp,
|
tp_filter_motion(struct tp_dispatch *tp,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
|
|
||||||
struct normalized_coords
|
struct normalized_coords
|
||||||
tp_filter_motion_unaccelerated(struct tp_dispatch *tp,
|
tp_filter_motion_unaccelerated(struct tp_dispatch *tp,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
|
|
||||||
struct normalized_coords
|
struct normalized_coords
|
||||||
tp_filter_scroll(struct tp_dispatch *tp,
|
tp_filter_scroll(struct tp_dispatch *tp,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
tp_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t);
|
tp_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t);
|
||||||
|
|
@ -633,7 +635,7 @@ bool
|
||||||
tp_touch_active_for_gesture(const struct tp_dispatch *tp, const struct tp_touch *t);
|
tp_touch_active_for_gesture(const struct tp_dispatch *tp, const struct tp_touch *t);
|
||||||
|
|
||||||
int
|
int
|
||||||
tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time);
|
tp_tap_handle_state(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_tap_post_process_state(struct tp_dispatch *tp);
|
tp_tap_post_process_state(struct tp_dispatch *tp);
|
||||||
|
|
@ -659,16 +661,16 @@ void
|
||||||
tp_remove_buttons(struct tp_dispatch *tp);
|
tp_remove_buttons(struct tp_dispatch *tp);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_process_button(struct tp_dispatch *tp, const struct evdev_event *e, uint64_t time);
|
tp_process_button(struct tp_dispatch *tp, const struct evdev_event *e, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_release_all_buttons(struct tp_dispatch *tp, uint64_t time);
|
tp_release_all_buttons(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
int
|
int
|
||||||
tp_post_button_events(struct tp_dispatch *tp, uint64_t time);
|
tp_post_button_events(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_button_handle_state(struct tp_dispatch *tp, uint64_t time);
|
tp_button_handle_state(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
tp_button_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t);
|
tp_button_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t);
|
||||||
|
|
@ -678,13 +680,13 @@ tp_button_is_inside_softbutton_area(const struct tp_dispatch *tp,
|
||||||
const struct tp_touch *t);
|
const struct tp_touch *t);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_release_all_taps(struct tp_dispatch *tp, uint64_t now);
|
tp_release_all_taps(struct tp_dispatch *tp, usec_t now);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_tap_suspend(struct tp_dispatch *tp, uint64_t time);
|
tp_tap_suspend(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_tap_resume(struct tp_dispatch *tp, uint64_t time);
|
tp_tap_resume(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
tp_tap_dragging(const struct tp_dispatch *tp);
|
tp_tap_dragging(const struct tp_dispatch *tp);
|
||||||
|
|
@ -699,13 +701,13 @@ void
|
||||||
tp_remove_edge_scroll(struct tp_dispatch *tp);
|
tp_remove_edge_scroll(struct tp_dispatch *tp);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_edge_scroll_handle_state(struct tp_dispatch *tp, uint64_t time);
|
tp_edge_scroll_handle_state(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
int
|
int
|
||||||
tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time);
|
tp_edge_scroll_post_events(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_edge_scroll_stop_events(struct tp_dispatch *tp, uint64_t time);
|
tp_edge_scroll_stop_events(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
int
|
int
|
||||||
tp_edge_scroll_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t);
|
tp_edge_scroll_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t);
|
||||||
|
|
@ -720,25 +722,25 @@ void
|
||||||
tp_remove_gesture(struct tp_dispatch *tp);
|
tp_remove_gesture(struct tp_dispatch *tp);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_stop(struct tp_dispatch *tp, uint64_t time);
|
tp_gesture_stop(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_cancel(struct tp_dispatch *tp, uint64_t time);
|
tp_gesture_cancel(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_cancel_motion_gestures(struct tp_dispatch *tp, uint64_t time);
|
tp_gesture_cancel_motion_gestures(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_update_finger_state(struct tp_dispatch *tp, uint64_t time);
|
tp_gesture_update_finger_state(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time, bool ignore_motion);
|
tp_gesture_post_events(struct tp_dispatch *tp, usec_t time, bool ignore_motion);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, uint64_t time);
|
tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_gesture_tap_timeout(struct tp_dispatch *tp, uint64_t time);
|
tp_gesture_tap_timeout(struct tp_dispatch *tp, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_clickpad_middlebutton_apply_config(struct evdev_device *device);
|
tp_clickpad_middlebutton_apply_config(struct evdev_device *device);
|
||||||
|
|
@ -759,7 +761,7 @@ void
|
||||||
tp_thumb_suppress(struct tp_dispatch *tp, struct tp_touch *t);
|
tp_thumb_suppress(struct tp_dispatch *tp, struct tp_touch *t);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_thumb_update_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time);
|
tp_thumb_update_touch(struct tp_dispatch *tp, struct tp_touch *t, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_detect_thumb_while_moving(struct tp_dispatch *tp);
|
tp_detect_thumb_while_moving(struct tp_dispatch *tp);
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,7 @@
|
||||||
#include "evdev.h"
|
#include "evdev.h"
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
evdev_process_frame(struct evdev_device *device,
|
evdev_process_frame(struct evdev_device *device, struct evdev_frame *frame, usec_t time)
|
||||||
struct evdev_frame *frame,
|
|
||||||
uint64_t time)
|
|
||||||
{
|
{
|
||||||
struct evdev_dispatch *dispatch = device->dispatch;
|
struct evdev_dispatch *dispatch = device->dispatch;
|
||||||
|
|
||||||
|
|
@ -47,7 +45,7 @@ evdev_device_dispatch_frame(struct libinput_plugin *plugin,
|
||||||
struct evdev_frame *frame)
|
struct evdev_frame *frame)
|
||||||
{
|
{
|
||||||
struct evdev_device *device = evdev_device(libinput_device);
|
struct evdev_device *device = evdev_device(libinput_device);
|
||||||
uint64_t time = evdev_frame_get_time(frame);
|
usec_t time = evdev_frame_get_time(frame);
|
||||||
evdev_process_frame(device, frame, time);
|
evdev_process_frame(device, frame, time);
|
||||||
|
|
||||||
/* Discard event to make the plugin system aware we're done */
|
/* Discard event to make the plugin system aware we're done */
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ static void
|
||||||
pad_process_relative(struct pad_dispatch *pad,
|
pad_process_relative(struct pad_dispatch *pad,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (evdev_usage_enum(e->usage)) {
|
switch (evdev_usage_enum(e->usage)) {
|
||||||
case EVDEV_REL_DIAL:
|
case EVDEV_REL_DIAL:
|
||||||
|
|
@ -172,7 +172,7 @@ static void
|
||||||
pad_process_absolute(struct pad_dispatch *pad,
|
pad_process_absolute(struct pad_dispatch *pad,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum pad_axes axis = PAD_AXIS_NONE;
|
enum pad_axes axis = PAD_AXIS_NONE;
|
||||||
|
|
||||||
|
|
@ -310,7 +310,7 @@ pad_dial_get_mode_group(struct pad_dispatch *pad, unsigned int dial)
|
||||||
|
|
||||||
evdev_log_bug_libinput_ratelimit(pad->device,
|
evdev_log_bug_libinput_ratelimit(pad->device,
|
||||||
&pad->modes.group_not_found,
|
&pad->modes.group_not_found,
|
||||||
"Unable to find mode group for dial %d",
|
"Unable to find mode group for dial %d\n",
|
||||||
dial);
|
dial);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -329,7 +329,7 @@ pad_ring_get_mode_group(struct pad_dispatch *pad, unsigned int ring)
|
||||||
|
|
||||||
evdev_log_bug_libinput_ratelimit(pad->device,
|
evdev_log_bug_libinput_ratelimit(pad->device,
|
||||||
&pad->modes.group_not_found,
|
&pad->modes.group_not_found,
|
||||||
"Unable to find mode group for ring %d",
|
"Unable to find mode group for ring %d\n",
|
||||||
ring);
|
ring);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -348,7 +348,7 @@ pad_strip_get_mode_group(struct pad_dispatch *pad, unsigned int strip)
|
||||||
|
|
||||||
evdev_log_bug_libinput_ratelimit(pad->device,
|
evdev_log_bug_libinput_ratelimit(pad->device,
|
||||||
&pad->modes.group_not_found,
|
&pad->modes.group_not_found,
|
||||||
"Unable to find mode group for strip %d",
|
"Unable to find mode group for strip %d\n",
|
||||||
strip);
|
strip);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -357,7 +357,7 @@ pad_strip_get_mode_group(struct pad_dispatch *pad, unsigned int strip)
|
||||||
static void
|
static void
|
||||||
pad_check_notify_axes(struct pad_dispatch *pad,
|
pad_check_notify_axes(struct pad_dispatch *pad,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct libinput_device *base = &device->base;
|
struct libinput_device *base = &device->base;
|
||||||
struct libinput_tablet_pad_mode_group *group;
|
struct libinput_tablet_pad_mode_group *group;
|
||||||
|
|
@ -452,7 +452,7 @@ static void
|
||||||
pad_process_key(struct pad_dispatch *pad,
|
pad_process_key(struct pad_dispatch *pad,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
uint32_t is_press = e->value != 0;
|
uint32_t is_press = e->value != 0;
|
||||||
|
|
||||||
|
|
@ -481,7 +481,7 @@ pad_button_get_mode_group(struct pad_dispatch *pad, unsigned int button)
|
||||||
static void
|
static void
|
||||||
pad_notify_button_mask(struct pad_dispatch *pad,
|
pad_notify_button_mask(struct pad_dispatch *pad,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
const struct button_state *buttons,
|
const struct button_state *buttons,
|
||||||
enum libinput_button_state state)
|
enum libinput_button_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -537,7 +537,7 @@ pad_notify_button_mask(struct pad_dispatch *pad,
|
||||||
static void
|
static void
|
||||||
pad_notify_buttons(struct pad_dispatch *pad,
|
pad_notify_buttons(struct pad_dispatch *pad,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum libinput_button_state state)
|
enum libinput_button_state state)
|
||||||
{
|
{
|
||||||
struct button_state buttons;
|
struct button_state buttons;
|
||||||
|
|
@ -565,7 +565,7 @@ pad_change_to_left_handed(struct evdev_device *device)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pad_flush(struct pad_dispatch *pad, struct evdev_device *device, uint64_t time)
|
pad_flush(struct pad_dispatch *pad, struct evdev_device *device, usec_t time)
|
||||||
{
|
{
|
||||||
if (pad_has_status(pad, PAD_AXES_UPDATED)) {
|
if (pad_has_status(pad, PAD_AXES_UPDATED)) {
|
||||||
pad_check_notify_axes(pad, device, time);
|
pad_check_notify_axes(pad, device, time);
|
||||||
|
|
@ -594,7 +594,7 @@ static void
|
||||||
pad_process_event(struct evdev_dispatch *dispatch,
|
pad_process_event(struct evdev_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct pad_dispatch *pad = pad_dispatch(dispatch);
|
struct pad_dispatch *pad = pad_dispatch(dispatch);
|
||||||
|
|
||||||
|
|
@ -629,7 +629,7 @@ static void
|
||||||
pad_process(struct evdev_dispatch *dispatch,
|
pad_process(struct evdev_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
size_t nevents;
|
size_t nevents;
|
||||||
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
||||||
|
|
@ -822,7 +822,7 @@ pad_init(struct pad_dispatch *pad, struct evdev_device *device)
|
||||||
pad->device = device;
|
pad->device = device;
|
||||||
pad->status = PAD_NONE;
|
pad->status = PAD_NONE;
|
||||||
pad->changed_axes = PAD_AXIS_NONE;
|
pad->changed_axes = PAD_AXIS_NONE;
|
||||||
ratelimit_init(&pad->modes.group_not_found, h2us(1), 3);
|
ratelimit_init(&pad->modes.group_not_found, usec_from_hours(1), 3);
|
||||||
|
|
||||||
/* We expect the kernel to either give us both axes as hires or neither.
|
/* We expect the kernel to either give us both axes as hires or neither.
|
||||||
* Getting one is a kernel bug we don't need to care about */
|
* Getting one is a kernel bug we don't need to care about */
|
||||||
|
|
@ -842,7 +842,7 @@ pad_init(struct pad_dispatch *pad, struct evdev_device *device)
|
||||||
rc = pad_init_leds(pad, device, wacom);
|
rc = pad_init_leds(pad, device, wacom);
|
||||||
|
|
||||||
/* at most 5 "Multiple EV_ABS events" log messages per hour */
|
/* at most 5 "Multiple EV_ABS events" log messages per hour */
|
||||||
ratelimit_init(&pad->duplicate_abs_limit, s2us(60 * 60), 5);
|
ratelimit_init(&pad->duplicate_abs_limit, usec_from_seconds(60 * 60), 5);
|
||||||
|
|
||||||
#ifdef HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
if (wacom)
|
if (wacom)
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ static void
|
||||||
tablet_process_absolute(struct tablet_dispatch *tablet,
|
tablet_process_absolute(struct tablet_dispatch *tablet,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum libinput_tablet_tool_axis axis;
|
enum libinput_tablet_tool_axis axis;
|
||||||
|
|
||||||
|
|
@ -557,7 +557,7 @@ tablet_tool_process_delta(struct tablet_dispatch *tablet,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
const struct evdev_device *device,
|
const struct evdev_device *device,
|
||||||
struct tablet_axes *axes,
|
struct tablet_axes *axes,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
const struct normalized_coords zero = { 0.0, 0.0 };
|
const struct normalized_coords zero = { 0.0, 0.0 };
|
||||||
struct device_coords delta = { 0, 0 };
|
struct device_coords delta = { 0, 0 };
|
||||||
|
|
@ -759,7 +759,7 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
struct tablet_axes *axes_out,
|
struct tablet_axes *axes_out,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct tablet_axes axes = { 0 };
|
struct tablet_axes axes = { 0 };
|
||||||
const char tmp[sizeof(tablet->changed_axes)] = { 0 };
|
const char tmp[sizeof(tablet->changed_axes)] = { 0 };
|
||||||
|
|
@ -884,7 +884,7 @@ static void
|
||||||
tablet_process_key(struct tablet_dispatch *tablet,
|
tablet_process_key(struct tablet_dispatch *tablet,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum libinput_tablet_tool_type type;
|
enum libinput_tablet_tool_type type;
|
||||||
|
|
||||||
|
|
@ -930,7 +930,7 @@ static void
|
||||||
tablet_process_relative(struct tablet_dispatch *tablet,
|
tablet_process_relative(struct tablet_dispatch *tablet,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum libinput_tablet_tool_axis axis;
|
enum libinput_tablet_tool_axis axis;
|
||||||
|
|
||||||
|
|
@ -960,7 +960,7 @@ static void
|
||||||
tablet_process_misc(struct tablet_dispatch *tablet,
|
tablet_process_misc(struct tablet_dispatch *tablet,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (evdev_usage_enum(e->usage)) {
|
switch (evdev_usage_enum(e->usage)) {
|
||||||
case EVDEV_MSC_SERIAL:
|
case EVDEV_MSC_SERIAL:
|
||||||
|
|
@ -1272,10 +1272,13 @@ static void
|
||||||
eraser_button_toggle(struct libinput_tablet_tool *tool)
|
eraser_button_toggle(struct libinput_tablet_tool *tool)
|
||||||
{
|
{
|
||||||
struct libinput_device *libinput_device = tool->last_device;
|
struct libinput_device *libinput_device = tool->last_device;
|
||||||
struct evdev_device *device = evdev_device(libinput_device);
|
|
||||||
struct tablet_dispatch *tablet = tablet_dispatch(device->dispatch);
|
|
||||||
|
|
||||||
tablet_tool_apply_eraser_button(tablet, tool);
|
if (libinput_device) {
|
||||||
|
struct evdev_device *device = evdev_device(libinput_device);
|
||||||
|
struct tablet_dispatch *tablet = tablet_dispatch(device->dispatch);
|
||||||
|
|
||||||
|
tablet_tool_apply_eraser_button(tablet, tool);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum libinput_config_status
|
static enum libinput_config_status
|
||||||
|
|
@ -1296,7 +1299,7 @@ eraser_button_set_mode(struct libinput_tablet_tool *tool,
|
||||||
static enum libinput_config_eraser_button_mode
|
static enum libinput_config_eraser_button_mode
|
||||||
eraser_button_get_mode(struct libinput_tablet_tool *tool)
|
eraser_button_get_mode(struct libinput_tablet_tool *tool)
|
||||||
{
|
{
|
||||||
return tool->eraser_button.mode;
|
return tool->eraser_button.want_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum libinput_config_eraser_button_mode
|
static enum libinput_config_eraser_button_mode
|
||||||
|
|
@ -1330,7 +1333,7 @@ eraser_button_set_button(struct libinput_tablet_tool *tool, uint32_t button)
|
||||||
static unsigned int
|
static unsigned int
|
||||||
eraser_button_get_button(struct libinput_tablet_tool *tool)
|
eraser_button_get_button(struct libinput_tablet_tool *tool)
|
||||||
{
|
{
|
||||||
return tool->eraser_button.button;
|
return tool->eraser_button.want_button;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
|
|
@ -1519,7 +1522,7 @@ tablet_get_tool(struct tablet_dispatch *tablet,
|
||||||
static void
|
static void
|
||||||
tablet_notify_button_mask(struct tablet_dispatch *tablet,
|
tablet_notify_button_mask(struct tablet_dispatch *tablet,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
const struct button_state *buttons,
|
const struct button_state *buttons,
|
||||||
enum libinput_button_state state)
|
enum libinput_button_state state)
|
||||||
|
|
@ -1553,7 +1556,7 @@ tablet_notify_button_mask(struct tablet_dispatch *tablet,
|
||||||
static void
|
static void
|
||||||
tablet_notify_buttons(struct tablet_dispatch *tablet,
|
tablet_notify_buttons(struct tablet_dispatch *tablet,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
enum libinput_button_state state)
|
enum libinput_button_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -1914,7 +1917,7 @@ tablet_calculate_arbitration_rect(struct tablet_dispatch *tablet)
|
||||||
static inline void
|
static inline void
|
||||||
tablet_update_touch_device_rect(struct tablet_dispatch *tablet,
|
tablet_update_touch_device_rect(struct tablet_dispatch *tablet,
|
||||||
const struct tablet_axes *axes,
|
const struct tablet_axes *axes,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct evdev_dispatch *dispatch;
|
struct evdev_dispatch *dispatch;
|
||||||
struct phys_rect rect = { 0 };
|
struct phys_rect rect = { 0 };
|
||||||
|
|
@ -1938,7 +1941,7 @@ tablet_send_proximity_in(struct tablet_dispatch *tablet,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct tablet_axes *axes,
|
struct tablet_axes *axes,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (!tablet_has_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY))
|
if (!tablet_has_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY))
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1966,7 +1969,7 @@ tablet_send_proximity_out(struct tablet_dispatch *tablet,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct tablet_axes *axes,
|
struct tablet_axes *axes,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (tablet_has_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY) &&
|
if (tablet_has_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY) &&
|
||||||
!tablet_has_status(tablet, TABLET_TOOL_OUTSIDE_AREA)) {
|
!tablet_has_status(tablet, TABLET_TOOL_OUTSIDE_AREA)) {
|
||||||
|
|
@ -1986,7 +1989,7 @@ tablet_send_tip(struct tablet_dispatch *tablet,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct tablet_axes *axes,
|
struct tablet_axes *axes,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (tablet_has_status(tablet, TABLET_TOOL_ENTERING_CONTACT)) {
|
if (tablet_has_status(tablet, TABLET_TOOL_ENTERING_CONTACT)) {
|
||||||
tablet_notify_tip(&device->base,
|
tablet_notify_tip(&device->base,
|
||||||
|
|
@ -2036,7 +2039,7 @@ tablet_send_axes(struct tablet_dispatch *tablet,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct tablet_axes *axes,
|
struct tablet_axes *axes,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum libinput_tablet_tool_tip_state tip_state;
|
enum libinput_tablet_tool_tip_state tip_state;
|
||||||
|
|
||||||
|
|
@ -2066,7 +2069,7 @@ static inline void
|
||||||
tablet_send_buttons(struct tablet_dispatch *tablet,
|
tablet_send_buttons(struct tablet_dispatch *tablet,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (tablet_has_status(tablet, TABLET_BUTTONS_RELEASED)) {
|
if (tablet_has_status(tablet, TABLET_BUTTONS_RELEASED)) {
|
||||||
tablet_notify_buttons(tablet,
|
tablet_notify_buttons(tablet,
|
||||||
|
|
@ -2091,7 +2094,7 @@ static void
|
||||||
tablet_send_events(struct tablet_dispatch *tablet,
|
tablet_send_events(struct tablet_dispatch *tablet,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct tablet_axes axes = { 0 };
|
struct tablet_axes axes = { 0 };
|
||||||
|
|
||||||
|
|
@ -2128,7 +2131,7 @@ tablet_send_events(struct tablet_dispatch *tablet,
|
||||||
static void
|
static void
|
||||||
tablet_update_tool_state(struct tablet_dispatch *tablet,
|
tablet_update_tool_state(struct tablet_dispatch *tablet,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum libinput_tablet_tool_type type;
|
enum libinput_tablet_tool_type type;
|
||||||
uint32_t changed;
|
uint32_t changed;
|
||||||
|
|
@ -2203,7 +2206,7 @@ update_pressure_range(struct tablet_dispatch *tablet,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tablet_flush(struct tablet_dispatch *tablet, struct evdev_device *device, uint64_t time)
|
tablet_flush(struct tablet_dispatch *tablet, struct evdev_device *device, usec_t time)
|
||||||
{
|
{
|
||||||
struct libinput_tablet_tool *tool;
|
struct libinput_tablet_tool *tool;
|
||||||
|
|
||||||
|
|
@ -2287,7 +2290,7 @@ static inline void
|
||||||
tablet_set_touch_device_enabled(struct tablet_dispatch *tablet,
|
tablet_set_touch_device_enabled(struct tablet_dispatch *tablet,
|
||||||
enum evdev_arbitration_state which,
|
enum evdev_arbitration_state which,
|
||||||
const struct phys_rect *rect,
|
const struct phys_rect *rect,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct evdev_device *touch_device = tablet->touch_device;
|
struct evdev_device *touch_device = tablet->touch_device;
|
||||||
struct evdev_dispatch *dispatch;
|
struct evdev_dispatch *dispatch;
|
||||||
|
|
@ -2309,7 +2312,7 @@ tablet_set_touch_device_enabled(struct tablet_dispatch *tablet,
|
||||||
static inline void
|
static inline void
|
||||||
tablet_toggle_touch_device(struct tablet_dispatch *tablet,
|
tablet_toggle_touch_device(struct tablet_dispatch *tablet,
|
||||||
struct evdev_device *tablet_device,
|
struct evdev_device *tablet_device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum evdev_arbitration_state which;
|
enum evdev_arbitration_state which;
|
||||||
struct phys_rect r = { 0 };
|
struct phys_rect r = { 0 };
|
||||||
|
|
@ -2356,7 +2359,7 @@ static void
|
||||||
tablet_process_event(struct evdev_dispatch *dispatch,
|
tablet_process_event(struct evdev_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct tablet_dispatch *tablet = tablet_dispatch(dispatch);
|
struct tablet_dispatch *tablet = tablet_dispatch(dispatch);
|
||||||
|
|
||||||
|
|
@ -2392,7 +2395,7 @@ static void
|
||||||
tablet_process(struct evdev_dispatch *dispatch,
|
tablet_process(struct evdev_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
size_t nevents;
|
size_t nevents;
|
||||||
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
||||||
|
|
@ -2407,7 +2410,7 @@ tablet_suspend(struct evdev_dispatch *dispatch, struct evdev_device *device)
|
||||||
{
|
{
|
||||||
struct tablet_dispatch *tablet = tablet_dispatch(dispatch);
|
struct tablet_dispatch *tablet = tablet_dispatch(dispatch);
|
||||||
struct libinput *li = tablet_libinput_context(tablet);
|
struct libinput *li = tablet_libinput_context(tablet);
|
||||||
uint64_t now = libinput_now(li);
|
usec_t now = libinput_now(li);
|
||||||
|
|
||||||
tablet_set_touch_device_enabled(tablet, ARBITRATION_NOT_ACTIVE, NULL, now);
|
tablet_set_touch_device_enabled(tablet, ARBITRATION_NOT_ACTIVE, NULL, now);
|
||||||
|
|
||||||
|
|
@ -2448,6 +2451,8 @@ tablet_destroy(struct evdev_dispatch *dispatch)
|
||||||
struct libinput *li = tablet_libinput_context(tablet);
|
struct libinput *li = tablet_libinput_context(tablet);
|
||||||
|
|
||||||
list_for_each_safe(tool, &tablet->tool_list, link) {
|
list_for_each_safe(tool, &tablet->tool_list, link) {
|
||||||
|
list_remove(&tool->link);
|
||||||
|
list_init(&tool->link); /* unref may list_remove() too */
|
||||||
libinput_tablet_tool_unref(tool);
|
libinput_tablet_tool_unref(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ totem_new_tool(struct totem_dispatch *totem)
|
||||||
static inline void
|
static inline void
|
||||||
totem_set_touch_device_enabled(struct totem_dispatch *totem,
|
totem_set_touch_device_enabled(struct totem_dispatch *totem,
|
||||||
bool enable_touch_device,
|
bool enable_touch_device,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct evdev_device *touch_device = totem->touch_device;
|
struct evdev_device *touch_device = totem->touch_device;
|
||||||
struct evdev_dispatch *dispatch;
|
struct evdev_dispatch *dispatch;
|
||||||
|
|
@ -183,7 +183,7 @@ static void
|
||||||
totem_process_key(struct totem_dispatch *totem,
|
totem_process_key(struct totem_dispatch *totem,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
/* ignore kernel key repeat */
|
/* ignore kernel key repeat */
|
||||||
if (e->value == 2)
|
if (e->value == 2)
|
||||||
|
|
@ -205,7 +205,7 @@ static void
|
||||||
totem_process_abs(struct totem_dispatch *totem,
|
totem_process_abs(struct totem_dispatch *totem,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct totem_slot *slot = &totem->slots[totem->slot];
|
struct totem_slot *slot = &totem->slots[totem->slot];
|
||||||
|
|
||||||
|
|
@ -263,7 +263,7 @@ totem_slot_fetch_axes(struct totem_dispatch *totem,
|
||||||
struct totem_slot *slot,
|
struct totem_slot *slot,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
struct tablet_axes *axes_out,
|
struct tablet_axes *axes_out,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct evdev_device *device = totem->device;
|
struct evdev_device *device = totem->device;
|
||||||
const char tmp[sizeof(slot->changed_axes)] = { 0 };
|
const char tmp[sizeof(slot->changed_axes)] = { 0 };
|
||||||
|
|
@ -358,7 +358,7 @@ slot_axes_initialize(struct totem_dispatch *totem, struct totem_slot *slot)
|
||||||
static enum totem_slot_state
|
static enum totem_slot_state
|
||||||
totem_handle_slot_state(struct totem_dispatch *totem,
|
totem_handle_slot_state(struct totem_dispatch *totem,
|
||||||
struct totem_slot *slot,
|
struct totem_slot *slot,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct evdev_device *device = totem->device;
|
struct evdev_device *device = totem->device;
|
||||||
struct tablet_axes axes;
|
struct tablet_axes axes;
|
||||||
|
|
@ -493,7 +493,7 @@ totem_handle_slot_state(struct totem_dispatch *totem,
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum totem_slot_state
|
static enum totem_slot_state
|
||||||
totem_handle_state(struct totem_dispatch *totem, uint64_t time)
|
totem_handle_state(struct totem_dispatch *totem, usec_t time)
|
||||||
{
|
{
|
||||||
enum totem_slot_state global_state = SLOT_STATE_NONE;
|
enum totem_slot_state global_state = SLOT_STATE_NONE;
|
||||||
|
|
||||||
|
|
@ -514,7 +514,7 @@ static void
|
||||||
totem_process_event(struct evdev_dispatch *dispatch,
|
totem_process_event(struct evdev_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct totem_dispatch *totem = totem_dispatch(dispatch);
|
struct totem_dispatch *totem = totem_dispatch(dispatch);
|
||||||
enum totem_slot_state global_state;
|
enum totem_slot_state global_state;
|
||||||
|
|
@ -549,7 +549,7 @@ static void
|
||||||
totem_interface_process(struct evdev_dispatch *dispatch,
|
totem_interface_process(struct evdev_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
size_t nevents;
|
size_t nevents;
|
||||||
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
||||||
|
|
@ -563,7 +563,7 @@ static void
|
||||||
totem_interface_suspend(struct evdev_dispatch *dispatch, struct evdev_device *device)
|
totem_interface_suspend(struct evdev_dispatch *dispatch, struct evdev_device *device)
|
||||||
{
|
{
|
||||||
struct totem_dispatch *totem = totem_dispatch(dispatch);
|
struct totem_dispatch *totem = totem_dispatch(dispatch);
|
||||||
uint64_t now = libinput_now(evdev_libinput_context(device));
|
usec_t now = libinput_now(evdev_libinput_context(device));
|
||||||
|
|
||||||
for (size_t i = 0; i < totem->nslots; i++) {
|
for (size_t i = 0; i < totem->nslots; i++) {
|
||||||
struct totem_slot *slot = &totem->slots[i];
|
struct totem_slot *slot = &totem->slots[i];
|
||||||
|
|
@ -682,7 +682,7 @@ totem_interface_initial_proximity(struct evdev_device *device,
|
||||||
struct evdev_dispatch *dispatch)
|
struct evdev_dispatch *dispatch)
|
||||||
{
|
{
|
||||||
struct totem_dispatch *totem = totem_dispatch(dispatch);
|
struct totem_dispatch *totem = totem_dispatch(dispatch);
|
||||||
uint64_t now = libinput_now(evdev_libinput_context(device));
|
usec_t now = libinput_now(evdev_libinput_context(device));
|
||||||
bool enable_touch = true;
|
bool enable_touch = true;
|
||||||
|
|
||||||
for (size_t i = 0; i < totem->nslots; i++) {
|
for (size_t i = 0; i < totem->nslots; i++) {
|
||||||
|
|
|
||||||
52
src/evdev.c
52
src/evdev.c
|
|
@ -53,7 +53,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEFAULT_WHEEL_CLICK_ANGLE 15
|
#define DEFAULT_WHEEL_CLICK_ANGLE 15
|
||||||
#define DEFAULT_BUTTON_SCROLL_TIMEOUT ms2us(200)
|
#define DEFAULT_BUTTON_SCROLL_TIMEOUT usec_from_millis(200)
|
||||||
|
|
||||||
enum evdev_device_udev_tags {
|
enum evdev_device_udev_tags {
|
||||||
EVDEV_UDEV_TAG_NONE = 0,
|
EVDEV_UDEV_TAG_NONE = 0,
|
||||||
|
|
@ -167,7 +167,7 @@ evdev_device_switch_get_state(struct evdev_device *device, enum libinput_switch
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_pointer_notify_physical_button(struct evdev_device *device,
|
evdev_pointer_notify_physical_button(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
evdev_usage_t button,
|
evdev_usage_t button,
|
||||||
enum libinput_button_state state)
|
enum libinput_button_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -179,7 +179,7 @@ evdev_pointer_notify_physical_button(struct evdev_device *device,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
evdev_pointer_post_button(struct evdev_device *device,
|
evdev_pointer_post_button(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
evdev_usage_t button,
|
evdev_usage_t button,
|
||||||
enum libinput_button_state state)
|
enum libinput_button_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -205,7 +205,7 @@ evdev_pointer_post_button(struct evdev_device *device,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
evdev_button_scroll_timeout(uint64_t time, void *data)
|
evdev_button_scroll_timeout(usec_t time, void *data)
|
||||||
{
|
{
|
||||||
struct evdev_device *device = data;
|
struct evdev_device *device = data;
|
||||||
|
|
||||||
|
|
@ -213,7 +213,7 @@ evdev_button_scroll_timeout(uint64_t time, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
evdev_button_scroll_button(struct evdev_device *device, uint64_t time, int is_press)
|
evdev_button_scroll_button(struct evdev_device *device, usec_t time, int is_press)
|
||||||
{
|
{
|
||||||
/* Where the button lock is enabled, we wrap the buttons into
|
/* Where the button lock is enabled, we wrap the buttons into
|
||||||
their own little state machine and filter out the events.
|
their own little state machine and filter out the events.
|
||||||
|
|
@ -265,9 +265,10 @@ evdev_button_scroll_button(struct evdev_device *device, uint64_t time, int is_pr
|
||||||
flags = TIMER_FLAG_ALLOW_NEGATIVE;
|
flags = TIMER_FLAG_ALLOW_NEGATIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
libinput_timer_set_flags(&device->scroll.timer,
|
libinput_timer_set_flags(
|
||||||
time + DEFAULT_BUTTON_SCROLL_TIMEOUT,
|
&device->scroll.timer,
|
||||||
flags);
|
usec_add(time, DEFAULT_BUTTON_SCROLL_TIMEOUT),
|
||||||
|
flags);
|
||||||
} else {
|
} else {
|
||||||
/* For extra mouse buttons numbered 6 or more (0x115+) we assume
|
/* For extra mouse buttons numbered 6 or more (0x115+) we assume
|
||||||
* it is dedicated exclusively to scrolling, so we don't apply
|
* it is dedicated exclusively to scrolling, so we don't apply
|
||||||
|
|
@ -314,7 +315,7 @@ evdev_button_scroll_button(struct evdev_device *device, uint64_t time, int is_pr
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_pointer_notify_button(struct evdev_device *device,
|
evdev_pointer_notify_button(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
evdev_usage_t button,
|
evdev_usage_t button,
|
||||||
enum libinput_button_state state)
|
enum libinput_button_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -394,7 +395,7 @@ evdev_device_transform_y(struct evdev_device *device, double y, uint32_t height)
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_notify_axis_legacy_wheel(struct evdev_device *device,
|
evdev_notify_axis_legacy_wheel(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta_in,
|
const struct normalized_coords *delta_in,
|
||||||
const struct discrete_coords *discrete_in)
|
const struct discrete_coords *discrete_in)
|
||||||
|
|
@ -419,7 +420,7 @@ evdev_notify_axis_legacy_wheel(struct evdev_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_notify_axis_wheel(struct evdev_device *device,
|
evdev_notify_axis_wheel(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta_in,
|
const struct normalized_coords *delta_in,
|
||||||
const struct wheel_v120 *v120_in)
|
const struct wheel_v120 *v120_in)
|
||||||
|
|
@ -444,7 +445,7 @@ evdev_notify_axis_wheel(struct evdev_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_notify_axis_finger(struct evdev_device *device,
|
evdev_notify_axis_finger(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta_in)
|
const struct normalized_coords *delta_in)
|
||||||
{
|
{
|
||||||
|
|
@ -460,7 +461,7 @@ evdev_notify_axis_finger(struct evdev_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_notify_axis_continous(struct evdev_device *device,
|
evdev_notify_axis_continous(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta_in)
|
const struct normalized_coords *delta_in)
|
||||||
{
|
{
|
||||||
|
|
@ -1014,7 +1015,7 @@ evdev_note_time_delay(struct evdev_device *device, const struct input_event *ev)
|
||||||
{
|
{
|
||||||
struct libinput *libinput = evdev_libinput_context(device);
|
struct libinput *libinput = evdev_libinput_context(device);
|
||||||
uint32_t tdelta;
|
uint32_t tdelta;
|
||||||
uint64_t eventtime = input_event_time(ev);
|
usec_t eventtime = input_event_time(ev);
|
||||||
|
|
||||||
/* if we have a current libinput_dispatch() snapshot, compare our
|
/* if we have a current libinput_dispatch() snapshot, compare our
|
||||||
* event time with the one from the snapshot. If we have more than
|
* event time with the one from the snapshot. If we have more than
|
||||||
|
|
@ -1022,10 +1023,11 @@ evdev_note_time_delay(struct evdev_device *device, const struct input_event *ev)
|
||||||
* where there is no steady event flow and thus SYN_DROPPED may not
|
* where there is no steady event flow and thus SYN_DROPPED may not
|
||||||
* get hit by the kernel despite us being too slow.
|
* get hit by the kernel despite us being too slow.
|
||||||
*/
|
*/
|
||||||
if (libinput->dispatch_time == 0 || eventtime > libinput->dispatch_time)
|
if (usec_is_zero(libinput->dispatch_time) ||
|
||||||
|
usec_cmp(eventtime, libinput->dispatch_time) > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tdelta = us2ms(libinput->dispatch_time - eventtime);
|
tdelta = usec_to_millis(usec_delta(libinput->dispatch_time, eventtime));
|
||||||
if (tdelta > 20) {
|
if (tdelta > 20) {
|
||||||
evdev_log_bug_client_ratelimit(
|
evdev_log_bug_client_ratelimit(
|
||||||
device,
|
device,
|
||||||
|
|
@ -1999,6 +2001,11 @@ evdev_configure_device(struct evdev_device *device,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (libevdev_has_event_code(evdev, EV_SW, SW_KEYPAD_SLIDE)) {
|
||||||
|
device->seat_caps |= EVDEV_DEVICE_SWITCH;
|
||||||
|
device->tags |= EVDEV_TAG_KEYPAD_SLIDE_SWITCH;
|
||||||
|
}
|
||||||
|
|
||||||
if (device->seat_caps & EVDEV_DEVICE_SWITCH)
|
if (device->seat_caps & EVDEV_DEVICE_SWITCH)
|
||||||
evdev_log_info(device, "device is a switch device\n");
|
evdev_log_info(device, "device is a switch device\n");
|
||||||
}
|
}
|
||||||
|
|
@ -2308,11 +2315,11 @@ evdev_device_create(struct libinput_seat *seat, struct udev_device *udev_device)
|
||||||
device->dpi = DEFAULT_MOUSE_DPI;
|
device->dpi = DEFAULT_MOUSE_DPI;
|
||||||
|
|
||||||
/* at most 5 SYN_DROPPED log-messages per 30s */
|
/* at most 5 SYN_DROPPED log-messages per 30s */
|
||||||
ratelimit_init(&device->syn_drop_limit, s2us(30), 5);
|
ratelimit_init(&device->syn_drop_limit, usec_from_seconds(30), 5);
|
||||||
/* at most 5 "delayed processing" log messages per hour */
|
/* at most 5 "delayed processing" log messages per hour */
|
||||||
ratelimit_init(&device->delay_warning_limit, s2us(60 * 60), 5);
|
ratelimit_init(&device->delay_warning_limit, usec_from_hours(1), 5);
|
||||||
/* at most 5 log-messages per 5s */
|
/* at most 5 log-messages per 5s */
|
||||||
ratelimit_init(&device->nonpointer_rel_limit, s2us(5), 5);
|
ratelimit_init(&device->nonpointer_rel_limit, usec_from_seconds(5), 5);
|
||||||
|
|
||||||
matrix_init_identity(&device->abs.calibration);
|
matrix_init_identity(&device->abs.calibration);
|
||||||
matrix_init_identity(&device->abs.usermatrix);
|
matrix_init_identity(&device->abs.usermatrix);
|
||||||
|
|
@ -2670,6 +2677,9 @@ evdev_device_has_switch(struct evdev_device *device, enum libinput_switch sw)
|
||||||
case LIBINPUT_SWITCH_TABLET_MODE:
|
case LIBINPUT_SWITCH_TABLET_MODE:
|
||||||
code = SW_TABLET_MODE;
|
code = SW_TABLET_MODE;
|
||||||
break;
|
break;
|
||||||
|
case LIBINPUT_SWITCH_KEYPAD_SLIDE:
|
||||||
|
code = SW_KEYPAD_SLIDE;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -2697,7 +2707,7 @@ evdev_start_scrolling(struct evdev_device *device, enum libinput_pointer_axis ax
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_post_scroll(struct evdev_device *device,
|
evdev_post_scroll(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum libinput_pointer_axis_source source,
|
enum libinput_pointer_axis_source source,
|
||||||
const struct normalized_coords *delta)
|
const struct normalized_coords *delta)
|
||||||
{
|
{
|
||||||
|
|
@ -2771,7 +2781,7 @@ evdev_post_scroll(struct evdev_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_stop_scroll(struct evdev_device *device,
|
evdev_stop_scroll(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum libinput_pointer_axis_source source)
|
enum libinput_pointer_axis_source source)
|
||||||
{
|
{
|
||||||
const struct normalized_coords zero = { 0.0, 0.0 };
|
const struct normalized_coords zero = { 0.0, 0.0 };
|
||||||
|
|
|
||||||
33
src/evdev.h
33
src/evdev.h
|
|
@ -80,6 +80,7 @@ enum evdev_device_tags {
|
||||||
EVDEV_TAG_TABLET_MODE_SWITCH = bit(8),
|
EVDEV_TAG_TABLET_MODE_SWITCH = bit(8),
|
||||||
EVDEV_TAG_TABLET_TOUCHPAD = bit(9),
|
EVDEV_TAG_TABLET_TOUCHPAD = bit(9),
|
||||||
EVDEV_TAG_VIRTUAL = bit(10),
|
EVDEV_TAG_VIRTUAL = bit(10),
|
||||||
|
EVDEV_TAG_KEYPAD_SLIDE_SWITCH = bit(11),
|
||||||
};
|
};
|
||||||
|
|
||||||
enum evdev_middlebutton_state {
|
enum evdev_middlebutton_state {
|
||||||
|
|
@ -218,7 +219,7 @@ struct evdev_device {
|
||||||
/* Currently enabled method, button */
|
/* Currently enabled method, button */
|
||||||
enum libinput_config_scroll_method method;
|
enum libinput_config_scroll_method method;
|
||||||
evdev_usage_t button;
|
evdev_usage_t button;
|
||||||
uint64_t button_down_time;
|
usec_t button_down_time;
|
||||||
|
|
||||||
/* set during device init, used at runtime to delay changes
|
/* set during device init, used at runtime to delay changes
|
||||||
* until all buttons are up */
|
* until all buttons are up */
|
||||||
|
|
@ -278,7 +279,7 @@ struct evdev_device {
|
||||||
enum evdev_middlebutton_state state;
|
enum evdev_middlebutton_state state;
|
||||||
struct libinput_timer timer;
|
struct libinput_timer timer;
|
||||||
uint32_t button_mask;
|
uint32_t button_mask;
|
||||||
uint64_t first_event_time;
|
usec_t first_event_time;
|
||||||
} middlebutton;
|
} middlebutton;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -297,7 +298,7 @@ struct evdev_dispatch_interface {
|
||||||
void (*process)(struct evdev_dispatch *dispatch,
|
void (*process)(struct evdev_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
|
|
||||||
/* Device is being suspended */
|
/* Device is being suspended */
|
||||||
void (*suspend)(struct evdev_dispatch *dispatch, struct evdev_device *device);
|
void (*suspend)(struct evdev_dispatch *dispatch, struct evdev_device *device);
|
||||||
|
|
@ -336,7 +337,7 @@ struct evdev_dispatch_interface {
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
enum evdev_arbitration_state which,
|
enum evdev_arbitration_state which,
|
||||||
const struct phys_rect *rect, /* may be NULL */
|
const struct phys_rect *rect, /* may be NULL */
|
||||||
uint64_t now);
|
usec_t now);
|
||||||
|
|
||||||
/* Called when touch arbitration is on, updates the area where touch
|
/* Called when touch arbitration is on, updates the area where touch
|
||||||
* arbitration should apply.
|
* arbitration should apply.
|
||||||
|
|
@ -344,7 +345,7 @@ struct evdev_dispatch_interface {
|
||||||
void (*touch_arbitration_update_rect)(struct evdev_dispatch *dispatch,
|
void (*touch_arbitration_update_rect)(struct evdev_dispatch *dispatch,
|
||||||
struct evdev_device *device,
|
struct evdev_device *device,
|
||||||
const struct phys_rect *rect,
|
const struct phys_rect *rect,
|
||||||
uint64_t now);
|
usec_t now);
|
||||||
|
|
||||||
/* Return the state of the given switch */
|
/* Return the state of the given switch */
|
||||||
enum libinput_switch_state (*get_switch_state)(struct evdev_dispatch *dispatch,
|
enum libinput_switch_state (*get_switch_state)(struct evdev_dispatch *dispatch,
|
||||||
|
|
@ -552,12 +553,12 @@ evdev_notify_resumed_device(struct evdev_device *device);
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_pointer_notify_button(struct evdev_device *device,
|
evdev_pointer_notify_button(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
evdev_usage_t button,
|
evdev_usage_t button,
|
||||||
enum libinput_button_state state);
|
enum libinput_button_state state);
|
||||||
void
|
void
|
||||||
evdev_pointer_notify_physical_button(struct evdev_device *device,
|
evdev_pointer_notify_physical_button(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
evdev_usage_t button,
|
evdev_usage_t button,
|
||||||
enum libinput_button_state state);
|
enum libinput_button_state state);
|
||||||
|
|
||||||
|
|
@ -578,36 +579,36 @@ evdev_update_key_down_count(struct evdev_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_notify_axis_legacy_wheel(struct evdev_device *device,
|
evdev_notify_axis_legacy_wheel(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta_in,
|
const struct normalized_coords *delta_in,
|
||||||
const struct discrete_coords *discrete_in);
|
const struct discrete_coords *discrete_in);
|
||||||
void
|
void
|
||||||
evdev_notify_axis_wheel(struct evdev_device *device,
|
evdev_notify_axis_wheel(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta_in,
|
const struct normalized_coords *delta_in,
|
||||||
const struct wheel_v120 *v120_in);
|
const struct wheel_v120 *v120_in);
|
||||||
void
|
void
|
||||||
evdev_notify_axis_finger(struct evdev_device *device,
|
evdev_notify_axis_finger(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta_in);
|
const struct normalized_coords *delta_in);
|
||||||
void
|
void
|
||||||
evdev_notify_axis_continous(struct evdev_device *device,
|
evdev_notify_axis_continous(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta_in);
|
const struct normalized_coords *delta_in);
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_post_scroll(struct evdev_device *device,
|
evdev_post_scroll(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum libinput_pointer_axis_source source,
|
enum libinput_pointer_axis_source source,
|
||||||
const struct normalized_coords *delta);
|
const struct normalized_coords *delta);
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_stop_scroll(struct evdev_device *device,
|
evdev_stop_scroll(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum libinput_pointer_axis_source source);
|
enum libinput_pointer_axis_source source);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -618,7 +619,7 @@ evdev_device_destroy(struct evdev_device *device);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
evdev_middlebutton_filter_button(struct evdev_device *device,
|
evdev_middlebutton_filter_button(struct evdev_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
evdev_usage_t button,
|
evdev_usage_t button,
|
||||||
enum libinput_button_state state);
|
enum libinput_button_state state);
|
||||||
|
|
||||||
|
|
@ -969,7 +970,9 @@ evdev_device_init_abs_range_warnings(struct evdev_device *device)
|
||||||
device->abs.warning_range.max.y = y->maximum + 0.05 * height;
|
device->abs.warning_range.max.y = y->maximum + 0.05 * height;
|
||||||
|
|
||||||
/* One warning every 5 min is enough */
|
/* One warning every 5 min is enough */
|
||||||
ratelimit_init(&device->abs.warning_range.range_warn_limit, s2us(3000), 1);
|
ratelimit_init(&device->abs.warning_range.range_warn_limit,
|
||||||
|
usec_from_seconds(3000),
|
||||||
|
1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,12 @@
|
||||||
#include "filter-private.h"
|
#include "filter-private.h"
|
||||||
#include "filter.h"
|
#include "filter.h"
|
||||||
|
|
||||||
#define MOTION_TIMEOUT ms2us(1000)
|
#define MOTION_TIMEOUT usec_from_millis(1000)
|
||||||
#define FIRST_MOTION_TIME_INTERVAL ms2us(7) /* random but good enough interval for very first event */
|
#define FIRST_MOTION_TIME_INTERVAL usec_from_millis(7) /* random but good enough interval for very first event */
|
||||||
|
|
||||||
struct custom_accel_function {
|
struct custom_accel_function {
|
||||||
uint64_t last_time;
|
usec_t last_time;
|
||||||
uint64_t last_delta_time;
|
usec_t last_delta_time;
|
||||||
double step;
|
double step;
|
||||||
size_t npoints;
|
size_t npoints;
|
||||||
double points[];
|
double points[];
|
||||||
|
|
@ -58,7 +58,7 @@ create_custom_accel_function(double step, const double *points, size_t npoints)
|
||||||
|
|
||||||
struct custom_accel_function *cf =
|
struct custom_accel_function *cf =
|
||||||
zalloc(sizeof(*cf) + npoints * sizeof(*points));
|
zalloc(sizeof(*cf) + npoints * sizeof(*points));
|
||||||
cf->last_time = 0;
|
cf->last_time = usec_from_uint64_t(0);
|
||||||
cf->last_delta_time = FIRST_MOTION_TIME_INTERVAL;
|
cf->last_delta_time = FIRST_MOTION_TIME_INTERVAL;
|
||||||
cf->step = step;
|
cf->step = step;
|
||||||
cf->npoints = npoints;
|
cf->npoints = npoints;
|
||||||
|
|
@ -79,7 +79,7 @@ custom_accel_function_destroy(struct custom_accel_function *cf)
|
||||||
static double
|
static double
|
||||||
custom_accel_function_calculate_speed(struct custom_accel_function *cf,
|
custom_accel_function_calculate_speed(struct custom_accel_function *cf,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
/* Although most devices have a constant polling rate, and for fast
|
/* Although most devices have a constant polling rate, and for fast
|
||||||
* movements these distances do represent the actual speed,
|
* movements these distances do represent the actual speed,
|
||||||
|
|
@ -121,10 +121,11 @@ custom_accel_function_calculate_speed(struct custom_accel_function *cf,
|
||||||
* Reusing the last delta_time is a graceful fallback even if there are
|
* Reusing the last delta_time is a graceful fallback even if there are
|
||||||
* duplicate events or event-ordering bugs.
|
* duplicate events or event-ordering bugs.
|
||||||
*/
|
*/
|
||||||
uint64_t delta_time =
|
usec_t delta_time = usec_cmp(time, cf->last_time) > 0
|
||||||
(time > cf->last_time) ? time - cf->last_time : cf->last_delta_time;
|
? usec_delta(time, cf->last_time)
|
||||||
|
: cf->last_delta_time;
|
||||||
/* handle first event in a motion */
|
/* handle first event in a motion */
|
||||||
if (delta_time > MOTION_TIMEOUT)
|
if (usec_cmp(delta_time, MOTION_TIMEOUT) > 0)
|
||||||
delta_time = FIRST_MOTION_TIME_INTERVAL;
|
delta_time = FIRST_MOTION_TIME_INTERVAL;
|
||||||
|
|
||||||
/* speed is in device-units per ms */
|
/* speed is in device-units per ms */
|
||||||
|
|
@ -196,7 +197,7 @@ custom_accel_function_profile(struct custom_accel_function *cf, double speed_in)
|
||||||
static struct normalized_coords
|
static struct normalized_coords
|
||||||
custom_accel_function_filter(struct custom_accel_function *cf,
|
custom_accel_function_filter(struct custom_accel_function *cf,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
double speed = custom_accel_function_calculate_speed(cf, unaccelerated, time);
|
double speed = custom_accel_function_calculate_speed(cf, unaccelerated, time);
|
||||||
|
|
||||||
|
|
@ -252,7 +253,7 @@ static struct normalized_coords
|
||||||
custom_accelerator_filter(enum libinput_config_accel_type accel_type,
|
custom_accelerator_filter(enum libinput_config_accel_type accel_type,
|
||||||
struct motion_filter *filter,
|
struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct custom_accelerator *f = (struct custom_accelerator *)filter;
|
struct custom_accelerator *f = (struct custom_accelerator *)filter;
|
||||||
struct custom_accel_function *cf;
|
struct custom_accel_function *cf;
|
||||||
|
|
@ -263,7 +264,7 @@ custom_accelerator_filter(enum libinput_config_accel_type accel_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
custom_accelerator_restart(struct motion_filter *filter, void *data, uint64_t time)
|
custom_accelerator_restart(struct motion_filter *filter, void *data, usec_t time)
|
||||||
{
|
{
|
||||||
/* noop, this function has no effect in the custom interface */
|
/* noop, this function has no effect in the custom interface */
|
||||||
}
|
}
|
||||||
|
|
@ -347,7 +348,7 @@ double
|
||||||
custom_accel_profile_fallback(struct motion_filter *filter,
|
custom_accel_profile_fallback(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in,
|
double speed_in,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
return custom_accelerator_profile(LIBINPUT_ACCEL_TYPE_FALLBACK,
|
return custom_accelerator_profile(LIBINPUT_ACCEL_TYPE_FALLBACK,
|
||||||
filter,
|
filter,
|
||||||
|
|
@ -358,7 +359,7 @@ static struct normalized_coords
|
||||||
custom_accelerator_filter_fallback(struct motion_filter *filter,
|
custom_accelerator_filter_fallback(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
return custom_accelerator_filter(LIBINPUT_ACCEL_TYPE_FALLBACK,
|
return custom_accelerator_filter(LIBINPUT_ACCEL_TYPE_FALLBACK,
|
||||||
filter,
|
filter,
|
||||||
|
|
@ -370,7 +371,7 @@ double
|
||||||
custom_accel_profile_motion(struct motion_filter *filter,
|
custom_accel_profile_motion(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in,
|
double speed_in,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
return custom_accelerator_profile(LIBINPUT_ACCEL_TYPE_MOTION, filter, speed_in);
|
return custom_accelerator_profile(LIBINPUT_ACCEL_TYPE_MOTION, filter, speed_in);
|
||||||
}
|
}
|
||||||
|
|
@ -379,7 +380,7 @@ static struct normalized_coords
|
||||||
custom_accelerator_filter_motion(struct motion_filter *filter,
|
custom_accelerator_filter_motion(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
return custom_accelerator_filter(LIBINPUT_ACCEL_TYPE_MOTION,
|
return custom_accelerator_filter(LIBINPUT_ACCEL_TYPE_MOTION,
|
||||||
filter,
|
filter,
|
||||||
|
|
@ -391,7 +392,7 @@ double
|
||||||
custom_accel_profile_scroll(struct motion_filter *filter,
|
custom_accel_profile_scroll(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in,
|
double speed_in,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
return custom_accelerator_profile(LIBINPUT_ACCEL_TYPE_SCROLL, filter, speed_in);
|
return custom_accelerator_profile(LIBINPUT_ACCEL_TYPE_SCROLL, filter, speed_in);
|
||||||
}
|
}
|
||||||
|
|
@ -400,7 +401,7 @@ static struct normalized_coords
|
||||||
custom_accelerator_filter_scroll(struct motion_filter *filter,
|
custom_accelerator_filter_scroll(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum filter_scroll_type type)
|
enum filter_scroll_type type)
|
||||||
{
|
{
|
||||||
return custom_accelerator_filter(LIBINPUT_ACCEL_TYPE_SCROLL,
|
return custom_accelerator_filter(LIBINPUT_ACCEL_TYPE_SCROLL,
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_flat(struct motion_filter *filter,
|
accelerator_filter_flat(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct pointer_accelerator_flat *accel_filter =
|
struct pointer_accelerator_flat *accel_filter =
|
||||||
(struct pointer_accelerator_flat *)filter;
|
(struct pointer_accelerator_flat *)filter;
|
||||||
|
|
@ -65,7 +65,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_constant_flat(struct motion_filter *filter,
|
accelerator_filter_constant_flat(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
/* We map the unaccelerated flat filter to have the same behavior as
|
/* We map the unaccelerated flat filter to have the same behavior as
|
||||||
* the "accelerated" flat filter.
|
* the "accelerated" flat filter.
|
||||||
|
|
@ -85,7 +85,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_scroll_flat(struct motion_filter *filter,
|
accelerator_filter_scroll_flat(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum filter_scroll_type type)
|
enum filter_scroll_type type)
|
||||||
{
|
{
|
||||||
/* Scroll wheels were not historically accelerated and have different
|
/* Scroll wheels were not historically accelerated and have different
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@
|
||||||
* Default parameters for pointer acceleration profiles.
|
* Default parameters for pointer acceleration profiles.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DEFAULT_THRESHOLD v_ms2us(0.4) /* in units/us */
|
#define DEFAULT_THRESHOLD v_usec_from_millis(0.4) /* in units/us */
|
||||||
#define MINIMUM_THRESHOLD v_ms2us(0.2) /* in units/us */
|
#define MINIMUM_THRESHOLD v_usec_from_millis(0.2) /* in units/us */
|
||||||
#define DEFAULT_ACCELERATION 2.0 /* unitless factor */
|
#define DEFAULT_ACCELERATION 2.0 /* unitless factor */
|
||||||
#define DEFAULT_INCLINE 1.1 /* unitless factor */
|
#define DEFAULT_INCLINE 1.1 /* unitless factor */
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ double
|
||||||
pointer_accel_profile_linear_low_dpi(struct motion_filter *filter,
|
pointer_accel_profile_linear_low_dpi(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in, /* in device units (units/us) */
|
double speed_in, /* in device units (units/us) */
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct pointer_accelerator_low_dpi *accel_filter =
|
struct pointer_accelerator_low_dpi *accel_filter =
|
||||||
(struct pointer_accelerator_low_dpi *)filter;
|
(struct pointer_accelerator_low_dpi *)filter;
|
||||||
|
|
@ -107,7 +107,7 @@ static inline double
|
||||||
calculate_acceleration_factor(struct pointer_accelerator_low_dpi *accel,
|
calculate_acceleration_factor(struct pointer_accelerator_low_dpi *accel,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
double velocity; /* units/us in device-native dpi*/
|
double velocity; /* units/us in device-native dpi*/
|
||||||
double accel_factor;
|
double accel_factor;
|
||||||
|
|
@ -129,7 +129,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_low_dpi(struct motion_filter *filter,
|
accelerator_filter_low_dpi(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct pointer_accelerator_low_dpi *accel =
|
struct pointer_accelerator_low_dpi *accel =
|
||||||
(struct pointer_accelerator_low_dpi *)filter;
|
(struct pointer_accelerator_low_dpi *)filter;
|
||||||
|
|
@ -148,7 +148,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_constant(struct motion_filter *filter,
|
accelerator_filter_constant(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
const struct normalized_coords normalized = {
|
const struct normalized_coords normalized = {
|
||||||
.x = unaccelerated->x,
|
.x = unaccelerated->x,
|
||||||
|
|
@ -161,14 +161,14 @@ static struct normalized_coords
|
||||||
accelerator_filter_scroll(struct motion_filter *filter,
|
accelerator_filter_scroll(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum filter_scroll_type type)
|
enum filter_scroll_type type)
|
||||||
{
|
{
|
||||||
return accelerator_filter_constant(filter, unaccelerated, data, time);
|
return accelerator_filter_constant(filter, unaccelerated, data, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
accelerator_restart(struct motion_filter *filter, void *data, uint64_t time)
|
accelerator_restart(struct motion_filter *filter, void *data, usec_t time)
|
||||||
{
|
{
|
||||||
struct pointer_accelerator_low_dpi *accel =
|
struct pointer_accelerator_low_dpi *accel =
|
||||||
(struct pointer_accelerator_low_dpi *)filter;
|
(struct pointer_accelerator_low_dpi *)filter;
|
||||||
|
|
@ -198,7 +198,8 @@ accelerator_set_speed(struct motion_filter *filter, double speed_adjustment)
|
||||||
don't read more into them other than "they mostly worked ok" */
|
don't read more into them other than "they mostly worked ok" */
|
||||||
|
|
||||||
/* delay when accel kicks in */
|
/* delay when accel kicks in */
|
||||||
accel_filter->threshold = DEFAULT_THRESHOLD - v_ms2us(0.25) * speed_adjustment;
|
accel_filter->threshold =
|
||||||
|
DEFAULT_THRESHOLD - v_usec_from_millis(0.25) * speed_adjustment;
|
||||||
if (accel_filter->threshold < MINIMUM_THRESHOLD)
|
if (accel_filter->threshold < MINIMUM_THRESHOLD)
|
||||||
accel_filter->threshold = MINIMUM_THRESHOLD;
|
accel_filter->threshold = MINIMUM_THRESHOLD;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@
|
||||||
* Default parameters for pointer acceleration profiles.
|
* Default parameters for pointer acceleration profiles.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DEFAULT_THRESHOLD v_ms2us(0.4) /* in 1000dpi units/us */
|
#define DEFAULT_THRESHOLD v_usec_from_millis(0.4) /* in 1000dpi units/us */
|
||||||
#define MINIMUM_THRESHOLD v_ms2us(0.2) /* in 1000dpi units/us */
|
#define MINIMUM_THRESHOLD v_usec_from_millis(0.2) /* in 1000dpi units/us */
|
||||||
#define DEFAULT_ACCELERATION 2.0 /* unitless factor */
|
#define DEFAULT_ACCELERATION 2.0 /* unitless factor */
|
||||||
#define DEFAULT_INCLINE 1.1 /* unitless factor */
|
#define DEFAULT_INCLINE 1.1 /* unitless factor */
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ static inline double
|
||||||
calculate_acceleration_factor(struct pointer_accelerator *accel,
|
calculate_acceleration_factor(struct pointer_accelerator *accel,
|
||||||
const struct normalized_coords *unaccelerated,
|
const struct normalized_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
double velocity; /* units/us in normalized 1000dpi units*/
|
double velocity; /* units/us in normalized 1000dpi units*/
|
||||||
double accel_factor;
|
double accel_factor;
|
||||||
|
|
@ -104,7 +104,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_linear(struct motion_filter *filter,
|
accelerator_filter_linear(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct pointer_accelerator *accel = (struct pointer_accelerator *)filter;
|
struct pointer_accelerator *accel = (struct pointer_accelerator *)filter;
|
||||||
|
|
||||||
|
|
@ -136,7 +136,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_constant(struct motion_filter *filter,
|
accelerator_filter_constant(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct pointer_accelerator *accel = (struct pointer_accelerator *)filter;
|
struct pointer_accelerator *accel = (struct pointer_accelerator *)filter;
|
||||||
|
|
||||||
|
|
@ -147,7 +147,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_scroll(struct motion_filter *filter,
|
accelerator_filter_scroll(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum filter_scroll_type type)
|
enum filter_scroll_type type)
|
||||||
{
|
{
|
||||||
/* Scroll wheels were not historically accelerated and have different
|
/* Scroll wheels were not historically accelerated and have different
|
||||||
|
|
@ -165,7 +165,7 @@ accelerator_filter_scroll(struct motion_filter *filter,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
accelerator_restart(struct motion_filter *filter, void *data, uint64_t time)
|
accelerator_restart(struct motion_filter *filter, void *data, usec_t time)
|
||||||
{
|
{
|
||||||
struct pointer_accelerator *accel = (struct pointer_accelerator *)filter;
|
struct pointer_accelerator *accel = (struct pointer_accelerator *)filter;
|
||||||
|
|
||||||
|
|
@ -192,7 +192,8 @@ accelerator_set_speed(struct motion_filter *filter, double speed_adjustment)
|
||||||
don't read more into them other than "they mostly worked ok" */
|
don't read more into them other than "they mostly worked ok" */
|
||||||
|
|
||||||
/* delay when accel kicks in */
|
/* delay when accel kicks in */
|
||||||
accel_filter->threshold = DEFAULT_THRESHOLD - v_ms2us(0.25) * speed_adjustment;
|
accel_filter->threshold =
|
||||||
|
DEFAULT_THRESHOLD - v_usec_from_millis(0.25) * speed_adjustment;
|
||||||
if (accel_filter->threshold < MINIMUM_THRESHOLD)
|
if (accel_filter->threshold < MINIMUM_THRESHOLD)
|
||||||
accel_filter->threshold = MINIMUM_THRESHOLD;
|
accel_filter->threshold = MINIMUM_THRESHOLD;
|
||||||
|
|
||||||
|
|
@ -210,7 +211,7 @@ double
|
||||||
pointer_accel_profile_linear(struct motion_filter *filter,
|
pointer_accel_profile_linear(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in, /* in normalized units */
|
double speed_in, /* in normalized units */
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct pointer_accelerator *accel_filter = (struct pointer_accelerator *)filter;
|
struct pointer_accelerator *accel_filter = (struct pointer_accelerator *)filter;
|
||||||
const double max_accel = accel_filter->accel; /* unitless factor */
|
const double max_accel = accel_filter->accel; /* unitless factor */
|
||||||
|
|
|
||||||
|
|
@ -34,19 +34,19 @@ struct motion_filter_interface {
|
||||||
struct motion_filter *filter,
|
struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
struct normalized_coords (*filter_constant)(
|
struct normalized_coords (*filter_constant)(
|
||||||
struct motion_filter *filter,
|
struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
struct normalized_coords (*filter_scroll)(
|
struct normalized_coords (*filter_scroll)(
|
||||||
struct motion_filter *filter,
|
struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum filter_scroll_type type);
|
enum filter_scroll_type type);
|
||||||
void (*restart)(struct motion_filter *filter, void *data, uint64_t time);
|
void (*restart)(struct motion_filter *filter, void *data, usec_t time);
|
||||||
void (*destroy)(struct motion_filter *filter);
|
void (*destroy)(struct motion_filter *filter);
|
||||||
bool (*set_speed)(struct motion_filter *filter, double speed_adjustment);
|
bool (*set_speed)(struct motion_filter *filter, double speed_adjustment);
|
||||||
bool (*set_accel_config)(struct motion_filter *filter,
|
bool (*set_accel_config)(struct motion_filter *filter,
|
||||||
|
|
@ -60,19 +60,19 @@ struct motion_filter {
|
||||||
|
|
||||||
struct pointer_tracker {
|
struct pointer_tracker {
|
||||||
struct device_float_coords delta; /* delta to most recent event */
|
struct device_float_coords delta; /* delta to most recent event */
|
||||||
uint64_t time; /* us */
|
usec_t time; /* us */
|
||||||
uint32_t dir;
|
uint32_t dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* For smoothing timestamps from devices with unreliable timing */
|
/* For smoothing timestamps from devices with unreliable timing */
|
||||||
struct pointer_delta_smoothener {
|
struct pointer_delta_smoothener {
|
||||||
uint64_t threshold;
|
usec_t threshold;
|
||||||
uint64_t value;
|
usec_t value;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct pointer_delta_smoothener *
|
static inline struct pointer_delta_smoothener *
|
||||||
pointer_delta_smoothener_create(uint64_t event_delta_smooth_threshold,
|
pointer_delta_smoothener_create(usec_t event_delta_smooth_threshold,
|
||||||
uint64_t event_delta_smooth_value)
|
usec_t event_delta_smooth_value)
|
||||||
{
|
{
|
||||||
struct pointer_delta_smoothener *s = zalloc(sizeof(*s));
|
struct pointer_delta_smoothener *s = zalloc(sizeof(*s));
|
||||||
s->threshold = event_delta_smooth_threshold;
|
s->threshold = event_delta_smooth_threshold;
|
||||||
|
|
@ -100,17 +100,17 @@ void
|
||||||
trackers_free(struct pointer_trackers *trackers);
|
trackers_free(struct pointer_trackers *trackers);
|
||||||
|
|
||||||
void
|
void
|
||||||
trackers_reset(struct pointer_trackers *trackers, uint64_t time);
|
trackers_reset(struct pointer_trackers *trackers, usec_t time);
|
||||||
void
|
void
|
||||||
trackers_feed(struct pointer_trackers *trackers,
|
trackers_feed(struct pointer_trackers *trackers,
|
||||||
const struct device_float_coords *delta,
|
const struct device_float_coords *delta,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
|
|
||||||
struct pointer_tracker *
|
struct pointer_tracker *
|
||||||
trackers_by_offset(struct pointer_trackers *trackers, unsigned int offset);
|
trackers_by_offset(struct pointer_trackers *trackers, unsigned int offset);
|
||||||
|
|
||||||
double
|
double
|
||||||
trackers_velocity(struct pointer_trackers *trackers, uint64_t time);
|
trackers_velocity(struct pointer_trackers *trackers, usec_t time);
|
||||||
|
|
||||||
double
|
double
|
||||||
calculate_acceleration_simpsons(struct motion_filter *filter,
|
calculate_acceleration_simpsons(struct motion_filter *filter,
|
||||||
|
|
@ -118,7 +118,7 @@ calculate_acceleration_simpsons(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double velocity,
|
double velocity,
|
||||||
double last_velocity,
|
double last_velocity,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
|
|
||||||
/* Convert speed/velocity from units/us to units/ms */
|
/* Convert speed/velocity from units/us to units/ms */
|
||||||
static inline double
|
static inline double
|
||||||
|
|
@ -135,7 +135,7 @@ v_us2s(double units_per_us)
|
||||||
|
|
||||||
/* Convert speed/velocity from units/ms to units/us */
|
/* Convert speed/velocity from units/ms to units/us */
|
||||||
static inline double
|
static inline double
|
||||||
v_ms2us(double units_per_ms)
|
v_usec_from_millis(double units_per_ms)
|
||||||
{
|
{
|
||||||
return units_per_ms / 1000.0;
|
return units_per_ms / 1000.0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ static struct normalized_coords
|
||||||
tablet_accelerator_filter_flat(struct motion_filter *filter,
|
tablet_accelerator_filter_flat(struct motion_filter *filter,
|
||||||
const struct device_float_coords *units,
|
const struct device_float_coords *units,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct tablet_accelerator_flat *accel_filter =
|
struct tablet_accelerator_flat *accel_filter =
|
||||||
(struct tablet_accelerator_flat *)filter;
|
(struct tablet_accelerator_flat *)filter;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_touchpad_flat(struct motion_filter *filter,
|
accelerator_filter_touchpad_flat(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct touchpad_accelerator_flat *accel =
|
struct touchpad_accelerator_flat *accel =
|
||||||
(struct touchpad_accelerator_flat *)filter;
|
(struct touchpad_accelerator_flat *)filter;
|
||||||
|
|
@ -69,7 +69,7 @@ accelerator_filter_constant_touchpad_flat(
|
||||||
struct motion_filter *filter,
|
struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
/* We map the unaccelerated flat filter to have the same behavior as
|
/* We map the unaccelerated flat filter to have the same behavior as
|
||||||
* the "accelerated" flat filter.
|
* the "accelerated" flat filter.
|
||||||
|
|
@ -89,7 +89,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_scroll_touchpad_flat(struct motion_filter *filter,
|
accelerator_filter_scroll_touchpad_flat(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum filter_scroll_type type)
|
enum filter_scroll_type type)
|
||||||
{
|
{
|
||||||
/* Scroll wheels were not historically accelerated and have different
|
/* Scroll wheels were not historically accelerated and have different
|
||||||
|
|
|
||||||
|
|
@ -45,13 +45,13 @@
|
||||||
* Default parameters for pointer acceleration profiles.
|
* Default parameters for pointer acceleration profiles.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DEFAULT_THRESHOLD v_ms2us(0.4) /* in units/us */
|
#define DEFAULT_THRESHOLD v_usec_from_millis(0.4) /* in units/us */
|
||||||
#define MINIMUM_THRESHOLD v_ms2us(0.2) /* in units/us */
|
#define MINIMUM_THRESHOLD v_usec_from_millis(0.2) /* in units/us */
|
||||||
#define DEFAULT_ACCELERATION 2.0 /* unitless factor */
|
#define DEFAULT_ACCELERATION 2.0 /* unitless factor */
|
||||||
#define DEFAULT_INCLINE 1.1 /* unitless factor */
|
#define DEFAULT_INCLINE 1.1 /* unitless factor */
|
||||||
|
|
||||||
/* for the Lenovo x230 custom accel. do not touch */
|
/* for the Lenovo x230 custom accel. do not touch */
|
||||||
#define X230_THRESHOLD v_ms2us(0.4) /* in units/us */
|
#define X230_THRESHOLD v_usec_from_millis(0.4) /* in units/us */
|
||||||
#define X230_ACCELERATION 2.0 /* unitless factor */
|
#define X230_ACCELERATION 2.0 /* unitless factor */
|
||||||
#define X230_INCLINE 1.1 /* unitless factor */
|
#define X230_INCLINE 1.1 /* unitless factor */
|
||||||
#define X230_MAGIC_SLOWDOWN 0.4 /* unitless */
|
#define X230_MAGIC_SLOWDOWN 0.4 /* unitless */
|
||||||
|
|
@ -88,7 +88,7 @@ static double
|
||||||
acceleration_profile(struct pointer_accelerator_x230 *accel,
|
acceleration_profile(struct pointer_accelerator_x230 *accel,
|
||||||
void *data,
|
void *data,
|
||||||
double velocity,
|
double velocity,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
return accel->profile(&accel->base, data, velocity, time);
|
return accel->profile(&accel->base, data, velocity, time);
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +110,7 @@ calculate_acceleration(struct pointer_accelerator_x230 *accel,
|
||||||
void *data,
|
void *data,
|
||||||
double velocity,
|
double velocity,
|
||||||
double last_velocity,
|
double last_velocity,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
double factor;
|
double factor;
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_x230(struct motion_filter *filter,
|
accelerator_filter_x230(struct motion_filter *filter,
|
||||||
const struct device_float_coords *raw,
|
const struct device_float_coords *raw,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct pointer_accelerator_x230 *accel =
|
struct pointer_accelerator_x230 *accel =
|
||||||
(struct pointer_accelerator_x230 *)filter;
|
(struct pointer_accelerator_x230 *)filter;
|
||||||
|
|
@ -171,7 +171,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_constant_x230(struct motion_filter *filter,
|
accelerator_filter_constant_x230(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct pointer_accelerator_x230 *accel =
|
struct pointer_accelerator_x230 *accel =
|
||||||
(struct pointer_accelerator_x230 *)filter;
|
(struct pointer_accelerator_x230 *)filter;
|
||||||
|
|
@ -189,7 +189,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_scroll_x230(struct motion_filter *filter,
|
accelerator_filter_scroll_x230(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum filter_scroll_type type)
|
enum filter_scroll_type type)
|
||||||
{
|
{
|
||||||
/* Scroll wheels were not historically accelerated and have different
|
/* Scroll wheels were not historically accelerated and have different
|
||||||
|
|
@ -207,7 +207,7 @@ accelerator_filter_scroll_x230(struct motion_filter *filter,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
accelerator_restart_x230(struct motion_filter *filter, void *data, uint64_t time)
|
accelerator_restart_x230(struct motion_filter *filter, void *data, usec_t time)
|
||||||
{
|
{
|
||||||
struct pointer_accelerator_x230 *accel =
|
struct pointer_accelerator_x230 *accel =
|
||||||
(struct pointer_accelerator_x230 *)filter;
|
(struct pointer_accelerator_x230 *)filter;
|
||||||
|
|
@ -216,7 +216,7 @@ accelerator_restart_x230(struct motion_filter *filter, void *data, uint64_t time
|
||||||
|
|
||||||
for (offset = 1; offset < accel->trackers.ntrackers; offset++) {
|
for (offset = 1; offset < accel->trackers.ntrackers; offset++) {
|
||||||
tracker = trackers_by_offset(&accel->trackers, offset);
|
tracker = trackers_by_offset(&accel->trackers, offset);
|
||||||
tracker->time = 0;
|
tracker->time = usec_from_uint64_t(0);
|
||||||
tracker->dir = 0;
|
tracker->dir = 0;
|
||||||
tracker->delta.x = 0;
|
tracker->delta.x = 0;
|
||||||
tracker->delta.y = 0;
|
tracker->delta.y = 0;
|
||||||
|
|
@ -249,7 +249,8 @@ accelerator_set_speed_x230(struct motion_filter *filter, double speed_adjustment
|
||||||
don't read more into them other than "they mostly worked ok" */
|
don't read more into them other than "they mostly worked ok" */
|
||||||
|
|
||||||
/* delay when accel kicks in */
|
/* delay when accel kicks in */
|
||||||
accel_filter->threshold = DEFAULT_THRESHOLD - v_ms2us(0.25) * speed_adjustment;
|
accel_filter->threshold =
|
||||||
|
DEFAULT_THRESHOLD - v_usec_from_millis(0.25) * speed_adjustment;
|
||||||
if (accel_filter->threshold < MINIMUM_THRESHOLD)
|
if (accel_filter->threshold < MINIMUM_THRESHOLD)
|
||||||
accel_filter->threshold = MINIMUM_THRESHOLD;
|
accel_filter->threshold = MINIMUM_THRESHOLD;
|
||||||
|
|
||||||
|
|
@ -267,7 +268,7 @@ double
|
||||||
touchpad_lenovo_x230_accel_profile(struct motion_filter *filter,
|
touchpad_lenovo_x230_accel_profile(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in, /* 1000dpi-units/µs */
|
double speed_in, /* 1000dpi-units/µs */
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
/* Those touchpads presents an actual lower resolution that what is
|
/* Those touchpads presents an actual lower resolution that what is
|
||||||
* advertised. We see some jumps from the cursor due to the big steps
|
* advertised. We see some jumps from the cursor due to the big steps
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ static inline double
|
||||||
calculate_acceleration_factor(struct touchpad_accelerator *accel,
|
calculate_acceleration_factor(struct touchpad_accelerator *accel,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
double velocity; /* units/us in device-native dpi*/
|
double velocity; /* units/us in device-native dpi*/
|
||||||
double accel_factor;
|
double accel_factor;
|
||||||
|
|
@ -94,7 +94,7 @@ static struct normalized_coords
|
||||||
accelerator_filter_touchpad(struct motion_filter *filter,
|
accelerator_filter_touchpad(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct touchpad_accelerator *accel = (struct touchpad_accelerator *)filter;
|
struct touchpad_accelerator *accel = (struct touchpad_accelerator *)filter;
|
||||||
|
|
||||||
|
|
@ -141,7 +141,7 @@ static struct normalized_coords
|
||||||
touchpad_constant_filter(struct motion_filter *filter,
|
touchpad_constant_filter(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct touchpad_accelerator *accel = (struct touchpad_accelerator *)filter;
|
struct touchpad_accelerator *accel = (struct touchpad_accelerator *)filter;
|
||||||
struct normalized_coords normalized;
|
struct normalized_coords normalized;
|
||||||
|
|
@ -166,7 +166,7 @@ static struct normalized_coords
|
||||||
touchpad_scroll_filter(struct motion_filter *filter,
|
touchpad_scroll_filter(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum filter_scroll_type type)
|
enum filter_scroll_type type)
|
||||||
{
|
{
|
||||||
/* Scroll wheels were not historically accelerated and have different
|
/* Scroll wheels were not historically accelerated and have different
|
||||||
|
|
@ -184,7 +184,7 @@ touchpad_scroll_filter(struct motion_filter *filter,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
touchpad_accelerator_restart(struct motion_filter *filter, void *data, uint64_t time)
|
touchpad_accelerator_restart(struct motion_filter *filter, void *data, usec_t time)
|
||||||
{
|
{
|
||||||
struct touchpad_accelerator *accel = (struct touchpad_accelerator *)filter;
|
struct touchpad_accelerator *accel = (struct touchpad_accelerator *)filter;
|
||||||
|
|
||||||
|
|
@ -204,7 +204,7 @@ double
|
||||||
touchpad_accel_profile_linear(struct motion_filter *filter,
|
touchpad_accel_profile_linear(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in, /* in device units/µs */
|
double speed_in, /* in device units/µs */
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct touchpad_accelerator *accel_filter =
|
struct touchpad_accelerator *accel_filter =
|
||||||
(struct touchpad_accelerator *)filter;
|
(struct touchpad_accelerator *)filter;
|
||||||
|
|
@ -301,8 +301,8 @@ static const struct motion_filter_interface accelerator_interface_touchpad = {
|
||||||
|
|
||||||
struct motion_filter *
|
struct motion_filter *
|
||||||
create_pointer_accelerator_filter_touchpad(int dpi,
|
create_pointer_accelerator_filter_touchpad(int dpi,
|
||||||
uint64_t event_delta_smooth_threshold,
|
usec_t event_delta_smooth_threshold,
|
||||||
uint64_t event_delta_smooth_value,
|
usec_t event_delta_smooth_value,
|
||||||
bool use_velocity_averaging)
|
bool use_velocity_averaging)
|
||||||
{
|
{
|
||||||
struct touchpad_accelerator *filter;
|
struct touchpad_accelerator *filter;
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ static struct normalized_coords
|
||||||
trackpoint_flat_filter(struct motion_filter *filter,
|
trackpoint_flat_filter(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct trackpoint_flat_accelerator *accel_filter =
|
struct trackpoint_flat_accelerator *accel_filter =
|
||||||
(struct trackpoint_flat_accelerator *)filter;
|
(struct trackpoint_flat_accelerator *)filter;
|
||||||
|
|
@ -63,7 +63,7 @@ static struct normalized_coords
|
||||||
trackpoint_flat_filter_constant(struct motion_filter *filter,
|
trackpoint_flat_filter_constant(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
/* We map the unaccelerated flat filter to have the same behavior as
|
/* We map the unaccelerated flat filter to have the same behavior as
|
||||||
* the "accelerated" flat filter.
|
* the "accelerated" flat filter.
|
||||||
|
|
@ -83,7 +83,7 @@ static struct normalized_coords
|
||||||
trackpoint_flat_filter_scroll(struct motion_filter *filter,
|
trackpoint_flat_filter_scroll(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum filter_scroll_type type)
|
enum filter_scroll_type type)
|
||||||
{
|
{
|
||||||
/* Scroll wheels were not historically accelerated and have different
|
/* Scroll wheels were not historically accelerated and have different
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ double
|
||||||
trackpoint_accel_profile(struct motion_filter *filter,
|
trackpoint_accel_profile(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double velocity,
|
double velocity,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct trackpoint_accelerator *accel_filter =
|
struct trackpoint_accelerator *accel_filter =
|
||||||
(struct trackpoint_accelerator *)filter;
|
(struct trackpoint_accelerator *)filter;
|
||||||
|
|
@ -74,7 +74,7 @@ static struct normalized_coords
|
||||||
trackpoint_accelerator_filter(struct motion_filter *filter,
|
trackpoint_accelerator_filter(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct trackpoint_accelerator *accel_filter =
|
struct trackpoint_accelerator *accel_filter =
|
||||||
(struct trackpoint_accelerator *)filter;
|
(struct trackpoint_accelerator *)filter;
|
||||||
|
|
@ -100,7 +100,7 @@ static struct normalized_coords
|
||||||
trackpoint_accelerator_filter_constant(struct motion_filter *filter,
|
trackpoint_accelerator_filter_constant(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
struct trackpoint_accelerator *accel_filter =
|
struct trackpoint_accelerator *accel_filter =
|
||||||
(struct trackpoint_accelerator *)filter;
|
(struct trackpoint_accelerator *)filter;
|
||||||
|
|
@ -116,7 +116,7 @@ static struct normalized_coords
|
||||||
trackpoint_accelerator_filter_scroll(struct motion_filter *filter,
|
trackpoint_accelerator_filter_scroll(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum filter_scroll_type type)
|
enum filter_scroll_type type)
|
||||||
{
|
{
|
||||||
/* Scroll wheels were not historically accelerated and have different
|
/* Scroll wheels were not historically accelerated and have different
|
||||||
|
|
@ -174,7 +174,7 @@ trackpoint_accelerator_set_speed(struct motion_filter *filter, double speed_adju
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
trackpoint_accelerator_restart(struct motion_filter *filter, void *data, uint64_t time)
|
trackpoint_accelerator_restart(struct motion_filter *filter, void *data, usec_t time)
|
||||||
{
|
{
|
||||||
struct trackpoint_accelerator *accel = (struct trackpoint_accelerator *)filter;
|
struct trackpoint_accelerator *accel = (struct trackpoint_accelerator *)filter;
|
||||||
|
|
||||||
|
|
@ -231,7 +231,8 @@ create_pointer_accelerator_filter_trackpoint(double multiplier,
|
||||||
|
|
||||||
filter->base.interface = &accelerator_interface_trackpoint;
|
filter->base.interface = &accelerator_interface_trackpoint;
|
||||||
filter->trackers.smoothener =
|
filter->trackers.smoothener =
|
||||||
pointer_delta_smoothener_create(ms2us(10), ms2us(10));
|
pointer_delta_smoothener_create(usec_from_millis(10),
|
||||||
|
usec_from_millis(10));
|
||||||
|
|
||||||
return &filter->base;
|
return &filter->base;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
38
src/filter.c
38
src/filter.c
|
|
@ -35,13 +35,13 @@
|
||||||
#include "filter.h"
|
#include "filter.h"
|
||||||
#include "libinput-util.h"
|
#include "libinput-util.h"
|
||||||
|
|
||||||
#define MOTION_TIMEOUT ms2us(1000)
|
#define MOTION_TIMEOUT usec_from_millis(1000)
|
||||||
|
|
||||||
struct normalized_coords
|
struct normalized_coords
|
||||||
filter_dispatch(struct motion_filter *filter,
|
filter_dispatch(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
return filter->interface->filter(filter, unaccelerated, data, time);
|
return filter->interface->filter(filter, unaccelerated, data, time);
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +50,7 @@ struct normalized_coords
|
||||||
filter_dispatch_constant(struct motion_filter *filter,
|
filter_dispatch_constant(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
return filter->interface->filter_constant(filter, unaccelerated, data, time);
|
return filter->interface->filter_constant(filter, unaccelerated, data, time);
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +59,7 @@ struct normalized_coords
|
||||||
filter_dispatch_scroll(struct motion_filter *filter,
|
filter_dispatch_scroll(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum filter_scroll_type type)
|
enum filter_scroll_type type)
|
||||||
{
|
{
|
||||||
return filter->interface->filter_scroll(filter,
|
return filter->interface->filter_scroll(filter,
|
||||||
|
|
@ -70,7 +70,7 @@ filter_dispatch_scroll(struct motion_filter *filter,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
filter_restart(struct motion_filter *filter, void *data, uint64_t time)
|
filter_restart(struct motion_filter *filter, void *data, usec_t time)
|
||||||
{
|
{
|
||||||
if (filter->interface->restart)
|
if (filter->interface->restart)
|
||||||
filter->interface->restart(filter, data, time);
|
filter->interface->restart(filter, data, time);
|
||||||
|
|
@ -132,14 +132,14 @@ trackers_free(struct pointer_trackers *trackers)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
trackers_reset(struct pointer_trackers *trackers, uint64_t time)
|
trackers_reset(struct pointer_trackers *trackers, usec_t time)
|
||||||
{
|
{
|
||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
struct pointer_tracker *tracker;
|
struct pointer_tracker *tracker;
|
||||||
|
|
||||||
for (offset = 1; offset < trackers->ntrackers; offset++) {
|
for (offset = 1; offset < trackers->ntrackers; offset++) {
|
||||||
tracker = trackers_by_offset(trackers, offset);
|
tracker = trackers_by_offset(trackers, offset);
|
||||||
tracker->time = 0;
|
tracker->time = usec_from_uint64_t(0);
|
||||||
tracker->dir = 0;
|
tracker->dir = 0;
|
||||||
tracker->delta.x = 0;
|
tracker->delta.x = 0;
|
||||||
tracker->delta.y = 0;
|
tracker->delta.y = 0;
|
||||||
|
|
@ -153,7 +153,7 @@ trackers_reset(struct pointer_trackers *trackers, uint64_t time)
|
||||||
void
|
void
|
||||||
trackers_feed(struct pointer_trackers *trackers,
|
trackers_feed(struct pointer_trackers *trackers,
|
||||||
const struct device_float_coords *delta,
|
const struct device_float_coords *delta,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
unsigned int i, current;
|
unsigned int i, current;
|
||||||
struct pointer_tracker *ts = trackers->trackers;
|
struct pointer_tracker *ts = trackers->trackers;
|
||||||
|
|
@ -184,16 +184,17 @@ trackers_by_offset(struct pointer_trackers *trackers, unsigned int offset)
|
||||||
|
|
||||||
static double
|
static double
|
||||||
calculate_trackers_velocity(const struct pointer_tracker *tracker,
|
calculate_trackers_velocity(const struct pointer_tracker *tracker,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
struct pointer_delta_smoothener *smoothener)
|
struct pointer_delta_smoothener *smoothener)
|
||||||
{
|
{
|
||||||
uint64_t tdelta = time - tracker->time + 1;
|
usec_t tdelta = usec_delta(time, tracker->time);
|
||||||
|
tdelta = usec_add(tdelta, usec_from_uint64_t(1));
|
||||||
|
|
||||||
if (smoothener && tdelta < smoothener->threshold)
|
if (smoothener && usec_cmp(tdelta, smoothener->threshold) < 0)
|
||||||
tdelta = smoothener->value;
|
tdelta = smoothener->value;
|
||||||
|
|
||||||
return hypot(tracker->delta.x, tracker->delta.y) /
|
return hypot(tracker->delta.x, tracker->delta.y) /
|
||||||
(double)tdelta; /* units/us */
|
(double)usec_as_uint64_t(tdelta); /* units/us */
|
||||||
}
|
}
|
||||||
|
|
||||||
static double
|
static double
|
||||||
|
|
@ -212,7 +213,7 @@ trackers_velocity_after_timeout(const struct pointer_tracker *tracker,
|
||||||
* movement in normal use-cases (pause, move, pause, move)
|
* movement in normal use-cases (pause, move, pause, move)
|
||||||
*/
|
*/
|
||||||
return calculate_trackers_velocity(tracker,
|
return calculate_trackers_velocity(tracker,
|
||||||
tracker->time + MOTION_TIMEOUT,
|
usec_add(tracker->time, MOTION_TIMEOUT),
|
||||||
smoothener);
|
smoothener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -224,9 +225,9 @@ trackers_velocity_after_timeout(const struct pointer_tracker *tracker,
|
||||||
* change between events.
|
* change between events.
|
||||||
*/
|
*/
|
||||||
double
|
double
|
||||||
trackers_velocity(struct pointer_trackers *trackers, uint64_t time)
|
trackers_velocity(struct pointer_trackers *trackers, usec_t time)
|
||||||
{
|
{
|
||||||
const double MAX_VELOCITY_DIFF = v_ms2us(1); /* units/us */
|
const double MAX_VELOCITY_DIFF = v_usec_from_millis(1); /* units/us */
|
||||||
double result = 0.0;
|
double result = 0.0;
|
||||||
double initial_velocity = 0.0;
|
double initial_velocity = 0.0;
|
||||||
|
|
||||||
|
|
@ -239,11 +240,12 @@ trackers_velocity(struct pointer_trackers *trackers, uint64_t time)
|
||||||
trackers_by_offset(trackers, offset);
|
trackers_by_offset(trackers, offset);
|
||||||
|
|
||||||
/* Bug: time running backwards */
|
/* Bug: time running backwards */
|
||||||
if (tracker->time > time)
|
if (usec_cmp(tracker->time, time) > 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Stop if too far away in time */
|
/* Stop if too far away in time */
|
||||||
if (time - tracker->time > MOTION_TIMEOUT) {
|
usec_t tdelta = usec_delta(time, tracker->time);
|
||||||
|
if (usec_cmp(tdelta, MOTION_TIMEOUT) > 0) {
|
||||||
if (offset == 1)
|
if (offset == 1)
|
||||||
result = trackers_velocity_after_timeout(
|
result = trackers_velocity_after_timeout(
|
||||||
tracker,
|
tracker,
|
||||||
|
|
@ -302,7 +304,7 @@ calculate_acceleration_simpsons(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double velocity,
|
double velocity,
|
||||||
double last_velocity,
|
double last_velocity,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
double factor;
|
double factor;
|
||||||
|
|
||||||
|
|
|
||||||
30
src/filter.h
30
src/filter.h
|
|
@ -66,7 +66,7 @@ struct normalized_coords
|
||||||
filter_dispatch(struct motion_filter *filter,
|
filter_dispatch(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply constant motion filters, but no acceleration.
|
* Apply constant motion filters, but no acceleration.
|
||||||
|
|
@ -88,7 +88,7 @@ struct normalized_coords
|
||||||
filter_dispatch_constant(struct motion_filter *filter,
|
filter_dispatch_constant(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply a scroll filter.
|
* Apply a scroll filter.
|
||||||
|
|
@ -112,11 +112,11 @@ struct normalized_coords
|
||||||
filter_dispatch_scroll(struct motion_filter *filter,
|
filter_dispatch_scroll(struct motion_filter *filter,
|
||||||
const struct device_float_coords *unaccelerated,
|
const struct device_float_coords *unaccelerated,
|
||||||
void *data,
|
void *data,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum filter_scroll_type type);
|
enum filter_scroll_type type);
|
||||||
|
|
||||||
void
|
void
|
||||||
filter_restart(struct motion_filter *filter, void *data, uint64_t time);
|
filter_restart(struct motion_filter *filter, void *data, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
filter_destroy(struct motion_filter *filter);
|
filter_destroy(struct motion_filter *filter);
|
||||||
|
|
@ -132,7 +132,7 @@ filter_get_type(struct motion_filter *filter);
|
||||||
typedef double (*accel_profile_func_t)(struct motion_filter *filter,
|
typedef double (*accel_profile_func_t)(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double velocity,
|
double velocity,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
filter_set_accel_config(struct motion_filter *filter,
|
filter_set_accel_config(struct motion_filter *filter,
|
||||||
|
|
@ -150,8 +150,8 @@ create_pointer_accelerator_filter_linear_low_dpi(int dpi, bool use_velocity_aver
|
||||||
|
|
||||||
struct motion_filter *
|
struct motion_filter *
|
||||||
create_pointer_accelerator_filter_touchpad(int dpi,
|
create_pointer_accelerator_filter_touchpad(int dpi,
|
||||||
uint64_t event_delta_smooth_threshold,
|
usec_t event_delta_smooth_threshold,
|
||||||
uint64_t event_delta_smooth_value,
|
usec_t event_delta_smooth_value,
|
||||||
bool use_velocity_averaging);
|
bool use_velocity_averaging);
|
||||||
|
|
||||||
struct motion_filter *
|
struct motion_filter *
|
||||||
|
|
@ -181,40 +181,40 @@ double
|
||||||
pointer_accel_profile_linear_low_dpi(struct motion_filter *filter,
|
pointer_accel_profile_linear_low_dpi(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in,
|
double speed_in,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
double
|
double
|
||||||
pointer_accel_profile_linear(struct motion_filter *filter,
|
pointer_accel_profile_linear(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in,
|
double speed_in,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
double
|
double
|
||||||
touchpad_accel_profile_linear(struct motion_filter *filter,
|
touchpad_accel_profile_linear(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in,
|
double speed_in,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
double
|
double
|
||||||
touchpad_lenovo_x230_accel_profile(struct motion_filter *filter,
|
touchpad_lenovo_x230_accel_profile(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in,
|
double speed_in,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
double
|
double
|
||||||
trackpoint_accel_profile(struct motion_filter *filter,
|
trackpoint_accel_profile(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double velocity,
|
double velocity,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
double
|
double
|
||||||
custom_accel_profile_fallback(struct motion_filter *filter,
|
custom_accel_profile_fallback(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in,
|
double speed_in,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
double
|
double
|
||||||
custom_accel_profile_motion(struct motion_filter *filter,
|
custom_accel_profile_motion(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in,
|
double speed_in,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
double
|
double
|
||||||
custom_accel_profile_scroll(struct motion_filter *filter,
|
custom_accel_profile_scroll(struct motion_filter *filter,
|
||||||
void *data,
|
void *data,
|
||||||
double speed_in,
|
double speed_in,
|
||||||
uint64_t time);
|
usec_t time);
|
||||||
#endif /* FILTER_H */
|
#endif /* FILTER_H */
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ struct plugin_device {
|
||||||
struct plugin_data *parent;
|
struct plugin_data *parent;
|
||||||
|
|
||||||
evdev_usage_t button_usage;
|
evdev_usage_t button_usage;
|
||||||
uint64_t button_time;
|
usec_t button_time;
|
||||||
enum debounce_state state;
|
enum debounce_state state;
|
||||||
bool spurious_enabled;
|
bool spurious_enabled;
|
||||||
|
|
||||||
|
|
@ -222,20 +222,21 @@ debounce_set_state(struct plugin_device *device, enum debounce_state new_state)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
debounce_set_timer(struct plugin_device *device, uint64_t time)
|
debounce_set_timer(struct plugin_device *device, usec_t time)
|
||||||
{
|
{
|
||||||
const int DEBOUNCE_TIMEOUT_BOUNCE = ms2us(25);
|
const usec_t DEBOUNCE_TIMEOUT_BOUNCE = usec_from_millis(25);
|
||||||
|
|
||||||
libinput_plugin_timer_set(device->timer, time + DEBOUNCE_TIMEOUT_BOUNCE);
|
libinput_plugin_timer_set(device->timer,
|
||||||
|
usec_add(time, DEBOUNCE_TIMEOUT_BOUNCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
debounce_set_timer_short(struct plugin_device *device, uint64_t time)
|
debounce_set_timer_short(struct plugin_device *device, usec_t time)
|
||||||
{
|
{
|
||||||
const int DEBOUNCE_TIMEOUT_SPURIOUS = ms2us(12);
|
const usec_t DEBOUNCE_TIMEOUT_SPURIOUS = usec_from_millis(12);
|
||||||
|
|
||||||
libinput_plugin_timer_set(device->timer_short,
|
libinput_plugin_timer_set(device->timer_short,
|
||||||
time + DEBOUNCE_TIMEOUT_SPURIOUS);
|
usec_add(time, DEBOUNCE_TIMEOUT_SPURIOUS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|
@ -295,7 +296,7 @@ static void
|
||||||
debounce_is_up_handle_event(struct plugin_device *device,
|
debounce_is_up_handle_event(struct plugin_device *device,
|
||||||
enum debounce_event event,
|
enum debounce_event event,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case DEBOUNCE_EVENT_PRESS:
|
case DEBOUNCE_EVENT_PRESS:
|
||||||
|
|
@ -318,7 +319,7 @@ static void
|
||||||
debounce_is_down_handle_event(struct plugin_device *device,
|
debounce_is_down_handle_event(struct plugin_device *device,
|
||||||
enum debounce_event event,
|
enum debounce_event event,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case DEBOUNCE_EVENT_PRESS:
|
case DEBOUNCE_EVENT_PRESS:
|
||||||
|
|
@ -354,7 +355,7 @@ static void
|
||||||
debounce_is_down_waiting_handle_event(struct plugin_device *device,
|
debounce_is_down_waiting_handle_event(struct plugin_device *device,
|
||||||
enum debounce_event event,
|
enum debounce_event event,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case DEBOUNCE_EVENT_PRESS:
|
case DEBOUNCE_EVENT_PRESS:
|
||||||
|
|
@ -383,7 +384,7 @@ static void
|
||||||
debounce_is_up_delaying_handle_event(struct plugin_device *device,
|
debounce_is_up_delaying_handle_event(struct plugin_device *device,
|
||||||
enum debounce_event event,
|
enum debounce_event event,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case DEBOUNCE_EVENT_PRESS:
|
case DEBOUNCE_EVENT_PRESS:
|
||||||
|
|
@ -407,7 +408,7 @@ static void
|
||||||
debounce_is_up_delaying_spurious_handle_event(struct plugin_device *device,
|
debounce_is_up_delaying_spurious_handle_event(struct plugin_device *device,
|
||||||
enum debounce_event event,
|
enum debounce_event event,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case DEBOUNCE_EVENT_PRESS:
|
case DEBOUNCE_EVENT_PRESS:
|
||||||
|
|
@ -435,7 +436,7 @@ static void
|
||||||
debounce_is_up_detecting_spurious_handle_event(struct plugin_device *device,
|
debounce_is_up_detecting_spurious_handle_event(struct plugin_device *device,
|
||||||
enum debounce_event event,
|
enum debounce_event event,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case DEBOUNCE_EVENT_PRESS:
|
case DEBOUNCE_EVENT_PRESS:
|
||||||
|
|
@ -467,7 +468,7 @@ static void
|
||||||
debounce_is_down_detecting_spurious_handle_event(struct plugin_device *device,
|
debounce_is_down_detecting_spurious_handle_event(struct plugin_device *device,
|
||||||
enum debounce_event event,
|
enum debounce_event event,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case DEBOUNCE_EVENT_PRESS:
|
case DEBOUNCE_EVENT_PRESS:
|
||||||
|
|
@ -496,7 +497,7 @@ static void
|
||||||
debounce_is_up_waiting_handle_event(struct plugin_device *device,
|
debounce_is_up_waiting_handle_event(struct plugin_device *device,
|
||||||
enum debounce_event event,
|
enum debounce_event event,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case DEBOUNCE_EVENT_PRESS:
|
case DEBOUNCE_EVENT_PRESS:
|
||||||
|
|
@ -522,7 +523,7 @@ static void
|
||||||
debounce_is_down_delaying_handle_event(struct plugin_device *device,
|
debounce_is_down_delaying_handle_event(struct plugin_device *device,
|
||||||
enum debounce_event event,
|
enum debounce_event event,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case DEBOUNCE_EVENT_PRESS:
|
case DEBOUNCE_EVENT_PRESS:
|
||||||
|
|
@ -547,7 +548,7 @@ static void
|
||||||
debounce_disabled_handle_event(struct plugin_device *device,
|
debounce_disabled_handle_event(struct plugin_device *device,
|
||||||
enum debounce_event event,
|
enum debounce_event event,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case DEBOUNCE_EVENT_PRESS:
|
case DEBOUNCE_EVENT_PRESS:
|
||||||
|
|
@ -571,7 +572,7 @@ static void
|
||||||
debounce_handle_event(struct plugin_device *device,
|
debounce_handle_event(struct plugin_device *device,
|
||||||
enum debounce_event event,
|
enum debounce_event event,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum debounce_state current = device->state;
|
enum debounce_state current = device->state;
|
||||||
|
|
||||||
|
|
@ -632,7 +633,7 @@ debounce_handle_event(struct plugin_device *device,
|
||||||
static void
|
static void
|
||||||
debounce_plugin_handle_frame(struct plugin_device *device,
|
debounce_plugin_handle_frame(struct plugin_device *device,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
size_t nchanged = 0;
|
size_t nchanged = 0;
|
||||||
bool flushed = false;
|
bool flushed = false;
|
||||||
|
|
@ -734,7 +735,7 @@ debounce_plugin_evdev_frame(struct libinput_plugin *libinput_plugin,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
debounce_timeout(struct libinput_plugin *plugin, uint64_t now, void *data)
|
debounce_timeout(struct libinput_plugin *plugin, usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct plugin_device *device = data;
|
struct plugin_device *device = data;
|
||||||
|
|
||||||
|
|
@ -742,7 +743,7 @@ debounce_timeout(struct libinput_plugin *plugin, uint64_t now, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
debounce_timeout_short(struct libinput_plugin *plugin, uint64_t now, void *data)
|
debounce_timeout_short(struct libinput_plugin *plugin, usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct plugin_device *device = data;
|
struct plugin_device *device = data;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,8 @@ libinput_lua_plugin_evdev_frame(struct libinput_plugin *libinput_plugin,
|
||||||
lua_rawgeti(plugin->L, LUA_REGISTRYINDEX, evdev->frame_refid);
|
lua_rawgeti(plugin->L, LUA_REGISTRYINDEX, evdev->frame_refid);
|
||||||
lua_rawgeti(plugin->L, LUA_REGISTRYINDEX, evdev->refid);
|
lua_rawgeti(plugin->L, LUA_REGISTRYINDEX, evdev->refid);
|
||||||
lua_push_evdev_frame(plugin->L, frame);
|
lua_push_evdev_frame(plugin->L, frame);
|
||||||
lua_pushinteger(plugin->L, evdev_frame_get_time(frame));
|
lua_pushinteger(plugin->L,
|
||||||
|
usec_as_uint64_t(evdev_frame_get_time(frame)));
|
||||||
|
|
||||||
if (!libinput_lua_pcall(plugin, 3, 1))
|
if (!libinput_lua_pcall(plugin, 3, 1))
|
||||||
return;
|
return;
|
||||||
|
|
@ -464,9 +465,9 @@ libinputplugin_now(lua_State *L)
|
||||||
luaL_argcheck(L, p != NULL, 1, PLUGIN_METATABLE " expected");
|
luaL_argcheck(L, p != NULL, 1, PLUGIN_METATABLE " expected");
|
||||||
|
|
||||||
struct libinput *libinput = lua_get_libinput(L);
|
struct libinput *libinput = lua_get_libinput(L);
|
||||||
uint64_t now = libinput_now(libinput);
|
usec_t now = libinput_now(libinput);
|
||||||
|
|
||||||
lua_pushinteger(L, now);
|
lua_pushinteger(L, usec_as_uint64_t(now));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -555,19 +556,19 @@ libinputplugin_gc(lua_State *L)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plugin_timer_func(struct libinput_plugin *libinput_plugin, uint64_t now, void *data)
|
plugin_timer_func(struct libinput_plugin *libinput_plugin, usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct libinput_lua_plugin *plugin = data;
|
struct libinput_lua_plugin *plugin = data;
|
||||||
struct lua_State *L = plugin->L;
|
struct lua_State *L = plugin->L;
|
||||||
|
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, plugin->timer_expired_refid);
|
lua_rawgeti(L, LUA_REGISTRYINDEX, plugin->timer_expired_refid);
|
||||||
lua_pushinteger(L, now);
|
lua_pushinteger(L, usec_as_uint64_t(now));
|
||||||
|
|
||||||
libinput_lua_pcall(plugin, 1, 0);
|
libinput_lua_pcall(plugin, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
libinputplugin_timer_set(lua_State *L, uint64_t offset)
|
libinputplugin_timer_set(lua_State *L, usec_t offset)
|
||||||
{
|
{
|
||||||
LibinputPlugin *p = luaL_checkudata(L, 1, PLUGIN_METATABLE);
|
LibinputPlugin *p = luaL_checkudata(L, 1, PLUGIN_METATABLE);
|
||||||
luaL_argcheck(L, p != NULL, 1, PLUGIN_METATABLE " expected");
|
luaL_argcheck(L, p != NULL, 1, PLUGIN_METATABLE " expected");
|
||||||
|
|
@ -583,7 +584,8 @@ libinputplugin_timer_set(lua_State *L, uint64_t offset)
|
||||||
plugin);
|
plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
libinput_plugin_timer_set(plugin->timer, offset + timeout);
|
libinput_plugin_timer_set(plugin->timer,
|
||||||
|
usec_add(offset, usec_from_uint64_t(timeout)));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -591,7 +593,7 @@ libinputplugin_timer_set(lua_State *L, uint64_t offset)
|
||||||
static int
|
static int
|
||||||
libinputplugin_timer_set_absolute(lua_State *L)
|
libinputplugin_timer_set_absolute(lua_State *L)
|
||||||
{
|
{
|
||||||
return libinputplugin_timer_set(L, 0);
|
return libinputplugin_timer_set(L, usec_from_uint64_t(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -944,7 +946,7 @@ evdevdevice_frame(lua_State *L, struct libinput_lua_plugin *plugin, EvdevDevice
|
||||||
lua_pop_evdev_frame(plugin, device->evdev, frame);
|
lua_pop_evdev_frame(plugin, device->evdev, frame);
|
||||||
|
|
||||||
struct libinput *libinput = lua_get_libinput(L);
|
struct libinput *libinput = lua_get_libinput(L);
|
||||||
uint64_t now = libinput_now(libinput);
|
usec_t now = libinput_now(libinput);
|
||||||
evdev_frame_set_time(frame, now);
|
evdev_frame_set_time(frame, now);
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
#define ACC_V120_TRIGGER_THRESHOLD 30 /* 1/4 of a wheel detent */
|
#define ACC_V120_TRIGGER_THRESHOLD 30 /* 1/4 of a wheel detent */
|
||||||
#define ACC_V120_THRESHOLD 47 /* Good for both high-ish multipliers (8/120) and the rest of the mice (30/120, 40/120, etc) */
|
#define ACC_V120_THRESHOLD 47 /* Good for both high-ish multipliers (8/120) and the rest of the mice (30/120, 40/120, etc) */
|
||||||
#define WHEEL_SCROLL_TIMEOUT ms2us(500)
|
const usec_t WHEEL_SCROLL_TIMEOUT = { 500 * 1000 };
|
||||||
|
|
||||||
enum wheel_state {
|
enum wheel_state {
|
||||||
WHEEL_STATE_NONE,
|
WHEEL_STATE_NONE,
|
||||||
|
|
@ -126,12 +126,13 @@ log_wheel_bug(struct plugin_device *pd, enum wheel_event event)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
wheel_set_scroll_timer(struct plugin_device *pd, uint64_t time)
|
wheel_set_scroll_timer(struct plugin_device *pd, usec_t time)
|
||||||
{
|
{
|
||||||
if (!pd->scroll_timer)
|
if (!pd->scroll_timer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
libinput_plugin_timer_set(pd->scroll_timer, time + WHEEL_SCROLL_TIMEOUT);
|
libinput_plugin_timer_set(pd->scroll_timer,
|
||||||
|
usec_add(time, WHEEL_SCROLL_TIMEOUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|
@ -165,7 +166,7 @@ wheel_maybe_disable(struct plugin_device *device)
|
||||||
static void
|
static void
|
||||||
wheel_handle_event_on_state_none(struct plugin_device *pd,
|
wheel_handle_event_on_state_none(struct plugin_device *pd,
|
||||||
enum wheel_event event,
|
enum wheel_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case WHEEL_EVENT_SCROLL:
|
case WHEEL_EVENT_SCROLL:
|
||||||
|
|
@ -191,7 +192,7 @@ wheel_handle_event_on_state_none(struct plugin_device *pd,
|
||||||
static void
|
static void
|
||||||
wheel_handle_event_on_state_accumulating_scroll(struct plugin_device *pd,
|
wheel_handle_event_on_state_accumulating_scroll(struct plugin_device *pd,
|
||||||
enum wheel_event event,
|
enum wheel_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case WHEEL_EVENT_SCROLL_ACCUMULATED:
|
case WHEEL_EVENT_SCROLL_ACCUMULATED:
|
||||||
|
|
@ -213,7 +214,7 @@ wheel_handle_event_on_state_accumulating_scroll(struct plugin_device *pd,
|
||||||
static void
|
static void
|
||||||
wheel_handle_event_on_state_scrolling(struct plugin_device *pd,
|
wheel_handle_event_on_state_scrolling(struct plugin_device *pd,
|
||||||
enum wheel_event event,
|
enum wheel_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case WHEEL_EVENT_SCROLL:
|
case WHEEL_EVENT_SCROLL:
|
||||||
|
|
@ -233,7 +234,7 @@ wheel_handle_event_on_state_scrolling(struct plugin_device *pd,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wheel_handle_event(struct plugin_device *pd, enum wheel_event event, uint64_t time)
|
wheel_handle_event(struct plugin_device *pd, enum wheel_event event, usec_t time)
|
||||||
{
|
{
|
||||||
enum wheel_state oldstate = pd->state;
|
enum wheel_state oldstate = pd->state;
|
||||||
|
|
||||||
|
|
@ -319,14 +320,14 @@ wheel_queue_scroll_events(struct plugin_device *pd, struct evdev_frame *frame)
|
||||||
static void
|
static void
|
||||||
wheel_handle_state_none(struct plugin_device *pd,
|
wheel_handle_state_none(struct plugin_device *pd,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wheel_handle_state_accumulating_scroll(struct plugin_device *pd,
|
wheel_handle_state_accumulating_scroll(struct plugin_device *pd,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
wheel_remove_scroll_events(frame);
|
wheel_remove_scroll_events(frame);
|
||||||
|
|
||||||
|
|
@ -340,7 +341,7 @@ wheel_handle_state_accumulating_scroll(struct plugin_device *pd,
|
||||||
static void
|
static void
|
||||||
wheel_handle_state_scrolling(struct plugin_device *pd,
|
wheel_handle_state_scrolling(struct plugin_device *pd,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
wheel_remove_scroll_events(frame);
|
wheel_remove_scroll_events(frame);
|
||||||
wheel_queue_scroll_events(pd, frame);
|
wheel_queue_scroll_events(pd, frame);
|
||||||
|
|
@ -349,7 +350,7 @@ wheel_handle_state_scrolling(struct plugin_device *pd,
|
||||||
static void
|
static void
|
||||||
wheel_handle_direction_change(struct plugin_device *pd,
|
wheel_handle_direction_change(struct plugin_device *pd,
|
||||||
struct evdev_event *e,
|
struct evdev_event *e,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum wheel_direction new_dir = WHEEL_DIR_UNKNOW;
|
enum wheel_direction new_dir = WHEEL_DIR_UNKNOW;
|
||||||
|
|
||||||
|
|
@ -386,7 +387,7 @@ wheel_update_strategy(struct plugin_device *pd, int32_t value)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wheel_process_relative(struct plugin_device *pd, struct evdev_event *e, uint64_t time)
|
wheel_process_relative(struct plugin_device *pd, struct evdev_event *e, usec_t time)
|
||||||
{
|
{
|
||||||
switch (evdev_usage_enum(e->usage)) {
|
switch (evdev_usage_enum(e->usage)) {
|
||||||
case EVDEV_REL_WHEEL:
|
case EVDEV_REL_WHEEL:
|
||||||
|
|
@ -417,7 +418,7 @@ wheel_process_relative(struct plugin_device *pd, struct evdev_event *e, uint64_t
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wheel_handle_state(struct plugin_device *pd, struct evdev_frame *frame, uint64_t time)
|
wheel_handle_state(struct plugin_device *pd, struct evdev_frame *frame, usec_t time)
|
||||||
{
|
{
|
||||||
struct evdev_device *evdev = evdev_device(pd->device);
|
struct evdev_device *evdev = evdev_device(pd->device);
|
||||||
|
|
||||||
|
|
@ -448,7 +449,7 @@ wheel_handle_state(struct plugin_device *pd, struct evdev_frame *frame, uint64_t
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wheel_on_scroll_timer_timeout(struct libinput_plugin *plugin, uint64_t now, void *data)
|
wheel_on_scroll_timer_timeout(struct libinput_plugin *plugin, usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct plugin_device *pd = data;
|
struct plugin_device *pd = data;
|
||||||
|
|
||||||
|
|
@ -469,7 +470,7 @@ wheel_plugin_device_create(struct libinput_plugin *libinput_plugin,
|
||||||
pd->state = WHEEL_STATE_NONE;
|
pd->state = WHEEL_STATE_NONE;
|
||||||
pd->dir = WHEEL_DIR_UNKNOW;
|
pd->dir = WHEEL_DIR_UNKNOW;
|
||||||
pd->min_movement = ACC_V120_THRESHOLD;
|
pd->min_movement = ACC_V120_THRESHOLD;
|
||||||
ratelimit_init(&pd->hires_warning_limit, s2us(24 * 60 * 60), 1);
|
ratelimit_init(&pd->hires_warning_limit, usec_from_hours(24), 1);
|
||||||
|
|
||||||
if (libinput_device_has_model_quirk(device, QUIRK_MODEL_SCROLL_ON_MIDDLE_CLICK))
|
if (libinput_device_has_model_quirk(device, QUIRK_MODEL_SCROLL_ON_MIDDLE_CLICK))
|
||||||
pd->ignore_small_hi_res_movements = ALWAYS_ACCUMULATE;
|
pd->ignore_small_hi_res_movements = ALWAYS_ACCUMULATE;
|
||||||
|
|
@ -575,7 +576,7 @@ wheel_plugin_device_removed(struct libinput_plugin *libinput_plugin,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wheel_handle_frame(struct plugin_device *pd, struct evdev_frame *frame, uint64_t time)
|
wheel_handle_frame(struct plugin_device *pd, struct evdev_frame *frame, usec_t time)
|
||||||
{
|
{
|
||||||
size_t nevents;
|
size_t nevents;
|
||||||
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
||||||
|
|
@ -602,7 +603,7 @@ wheel_plugin_evdev_frame(struct libinput_plugin *libinput_plugin,
|
||||||
{
|
{
|
||||||
struct plugin_data *plugin = libinput_plugin_get_user_data(libinput_plugin);
|
struct plugin_data *plugin = libinput_plugin_get_user_data(libinput_plugin);
|
||||||
struct plugin_device *pd;
|
struct plugin_device *pd;
|
||||||
uint64_t time = evdev_frame_get_time(frame);
|
usec_t time = evdev_frame_get_time(frame);
|
||||||
|
|
||||||
list_for_each(pd, &plugin->devices, link) {
|
list_for_each(pd, &plugin->devices, link) {
|
||||||
if (pd->device == device) {
|
if (pd->device == device) {
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ mtdev_plugin_device_handle_frame(struct libinput_plugin *libinput_plugin,
|
||||||
struct plugin_device *device,
|
struct plugin_device *device,
|
||||||
struct evdev_frame *frame)
|
struct evdev_frame *frame)
|
||||||
{
|
{
|
||||||
uint64_t time = evdev_frame_get_time(frame);
|
usec_t time = evdev_frame_get_time(frame);
|
||||||
size_t nevents;
|
size_t nevents;
|
||||||
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
||||||
for (size_t i = 0; i < nevents; i++) {
|
for (size_t i = 0; i < nevents; i++) {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
#include "libinput-plugin.h"
|
#include "libinput-plugin.h"
|
||||||
#include "libinput-util.h"
|
#include "libinput-util.h"
|
||||||
|
|
||||||
static int ERASER_BUTTON_DELAY = 30 * 1000; /* µs */
|
static usec_t ERASER_BUTTON_DELAY = { 30 * 1000 }; /* µs */
|
||||||
|
|
||||||
enum frame_filter_state {
|
enum frame_filter_state {
|
||||||
DISCARD,
|
DISCARD,
|
||||||
|
|
@ -146,9 +146,9 @@ eraser_button_set_state(struct plugin_device *device, enum eraser_button_state t
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eraser_button_set_timer(struct plugin_device *device, uint64_t time)
|
eraser_button_set_timer(struct plugin_device *device, usec_t time)
|
||||||
{
|
{
|
||||||
libinput_plugin_timer_set(device->timer, time + ERASER_BUTTON_DELAY);
|
libinput_plugin_timer_set(device->timer, usec_add(time, ERASER_BUTTON_DELAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -235,7 +235,7 @@ static enum frame_filter_state
|
||||||
eraser_button_neutral_handle_event(struct plugin_device *device,
|
eraser_button_neutral_handle_event(struct plugin_device *device,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
enum eraser_button_event event,
|
enum eraser_button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case ERASER_EVENT_PEN_ENTERING_PROX:
|
case ERASER_EVENT_PEN_ENTERING_PROX:
|
||||||
|
|
@ -266,7 +266,7 @@ static enum frame_filter_state
|
||||||
eraser_button_pending_eraser_handle_event(struct plugin_device *device,
|
eraser_button_pending_eraser_handle_event(struct plugin_device *device,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
enum eraser_button_event event,
|
enum eraser_button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case ERASER_EVENT_PEN_ENTERING_PROX:
|
case ERASER_EVENT_PEN_ENTERING_PROX:
|
||||||
|
|
@ -306,7 +306,7 @@ static enum frame_filter_state
|
||||||
eraser_button_button_held_handle_event(struct plugin_device *device,
|
eraser_button_button_held_handle_event(struct plugin_device *device,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
enum eraser_button_event event,
|
enum eraser_button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case ERASER_EVENT_PEN_ENTERING_PROX:
|
case ERASER_EVENT_PEN_ENTERING_PROX:
|
||||||
|
|
@ -339,7 +339,7 @@ static enum frame_filter_state
|
||||||
eraser_button_button_released_handle_event(struct plugin_device *device,
|
eraser_button_button_released_handle_event(struct plugin_device *device,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
enum eraser_button_event event,
|
enum eraser_button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case ERASER_EVENT_PEN_ENTERING_PROX:
|
case ERASER_EVENT_PEN_ENTERING_PROX:
|
||||||
|
|
@ -379,7 +379,7 @@ static enum frame_filter_state
|
||||||
eraser_button_handle_state(struct plugin_device *device,
|
eraser_button_handle_state(struct plugin_device *device,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
enum eraser_button_event event,
|
enum eraser_button_event event,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
enum eraser_button_state state = device->state;
|
enum eraser_button_state state = device->state;
|
||||||
enum frame_filter_state ret = PROCESS;
|
enum frame_filter_state ret = PROCESS;
|
||||||
|
|
@ -426,7 +426,7 @@ eraser_button_handle_state(struct plugin_device *device,
|
||||||
static void
|
static void
|
||||||
eraser_button_handle_frame(struct plugin_device *device,
|
eraser_button_handle_frame(struct plugin_device *device,
|
||||||
struct evdev_frame *frame,
|
struct evdev_frame *frame,
|
||||||
uint64_t time)
|
usec_t time)
|
||||||
{
|
{
|
||||||
if (device->mode == LIBINPUT_CONFIG_ERASER_BUTTON_DEFAULT)
|
if (device->mode == LIBINPUT_CONFIG_ERASER_BUTTON_DEFAULT)
|
||||||
return;
|
return;
|
||||||
|
|
@ -505,7 +505,7 @@ eraser_button_plugin_evdev_frame(struct libinput_plugin *libinput_plugin,
|
||||||
{
|
{
|
||||||
struct plugin_data *plugin = libinput_plugin_get_user_data(libinput_plugin);
|
struct plugin_data *plugin = libinput_plugin_get_user_data(libinput_plugin);
|
||||||
struct plugin_device *pd;
|
struct plugin_device *pd;
|
||||||
uint64_t time = evdev_frame_get_time(frame);
|
usec_t time = evdev_frame_get_time(frame);
|
||||||
|
|
||||||
list_for_each(pd, &plugin->devices, link) {
|
list_for_each(pd, &plugin->devices, link) {
|
||||||
if (pd->device == device) {
|
if (pd->device == device) {
|
||||||
|
|
@ -516,7 +516,7 @@ eraser_button_plugin_evdev_frame(struct libinput_plugin *libinput_plugin,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eraser_button_timer_func(struct libinput_plugin *plugin, uint64_t now, void *d)
|
eraser_button_timer_func(struct libinput_plugin *plugin, usec_t now, void *d)
|
||||||
{
|
{
|
||||||
struct plugin_device *device = d;
|
struct plugin_device *device = d;
|
||||||
|
|
||||||
|
|
@ -607,7 +607,7 @@ void
|
||||||
libinput_tablet_plugin_eraser_button(struct libinput *libinput)
|
libinput_tablet_plugin_eraser_button(struct libinput *libinput)
|
||||||
{
|
{
|
||||||
if (getenv("LIBINPUT_RUNNING_TEST_SUITE"))
|
if (getenv("LIBINPUT_RUNNING_TEST_SUITE"))
|
||||||
ERASER_BUTTON_DELAY = ms2us(150);
|
ERASER_BUTTON_DELAY = usec_from_millis(150);
|
||||||
|
|
||||||
_destroy_(plugin_data) *plugin = zalloc(sizeof(*plugin));
|
_destroy_(plugin_data) *plugin = zalloc(sizeof(*plugin));
|
||||||
list_init(&plugin->devices);
|
list_init(&plugin->devices);
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ struct plugin_device {
|
||||||
struct libinput_device *device;
|
struct libinput_device *device;
|
||||||
bitmask_t tool_state;
|
bitmask_t tool_state;
|
||||||
bool pen_forced_into_proximity;
|
bool pen_forced_into_proximity;
|
||||||
|
size_t pen_prox_out_events;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct plugin_data {
|
struct plugin_data {
|
||||||
|
|
@ -121,6 +122,23 @@ forced_tool_plugin_device_handle_frame(struct libinput_plugin *libinput_plugin,
|
||||||
} else {
|
} else {
|
||||||
bitmask_clear_bit(&device->tool_state, BTN_TOOL_PEN);
|
bitmask_clear_bit(&device->tool_state, BTN_TOOL_PEN);
|
||||||
device->pen_forced_into_proximity = false;
|
device->pen_forced_into_proximity = false;
|
||||||
|
|
||||||
|
/* If we get three valid pen proximity out events, let's
|
||||||
|
* assume this device works fine and disable our plugin
|
||||||
|
*/
|
||||||
|
if (++device->pen_prox_out_events > 2) {
|
||||||
|
plugin_log_debug(
|
||||||
|
libinput_plugin,
|
||||||
|
"%s: forced tool handling unloaded\n",
|
||||||
|
libinput_device_get_name(
|
||||||
|
device->device));
|
||||||
|
libinput_plugin_enable_device_event_frame(
|
||||||
|
libinput_plugin,
|
||||||
|
device->device,
|
||||||
|
false);
|
||||||
|
plugin_device_destroy(device);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return; /* Nothing to do */
|
return; /* Nothing to do */
|
||||||
case EVDEV_BTN_TOOL_RUBBER:
|
case EVDEV_BTN_TOOL_RUBBER:
|
||||||
|
|
|
||||||
|
|
@ -39,14 +39,14 @@
|
||||||
/* The tablet sends events every ~2ms , 50ms should be plenty enough to
|
/* The tablet sends events every ~2ms , 50ms should be plenty enough to
|
||||||
detect out-of-range.
|
detect out-of-range.
|
||||||
This value is higher during test suite runs */
|
This value is higher during test suite runs */
|
||||||
static int FORCED_PROXOUT_TIMEOUT = 50 * 1000; /* µs */
|
static usec_t FORCED_PROXOUT_TIMEOUT = { 50 * 1000 };
|
||||||
|
|
||||||
struct plugin_device {
|
struct plugin_device {
|
||||||
struct list link;
|
struct list link;
|
||||||
|
|
||||||
struct libinput_plugin_timer *prox_out_timer;
|
struct libinput_plugin_timer *prox_out_timer;
|
||||||
bool proximity_out_forced;
|
bool proximity_out_forced;
|
||||||
uint64_t last_event_time;
|
usec_t last_event_time;
|
||||||
|
|
||||||
bool pen_state;
|
bool pen_state;
|
||||||
bitmask_t button_state;
|
bitmask_t button_state;
|
||||||
|
|
@ -87,15 +87,15 @@ plugin_data_destroy(void *d)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
proximity_timer_plugin_set_timer(struct plugin_device *device, uint64_t time)
|
proximity_timer_plugin_set_timer(struct plugin_device *device, usec_t time)
|
||||||
{
|
{
|
||||||
libinput_plugin_timer_set(device->prox_out_timer,
|
libinput_plugin_timer_set(device->prox_out_timer,
|
||||||
time + FORCED_PROXOUT_TIMEOUT);
|
usec_add(time, FORCED_PROXOUT_TIMEOUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tablet_proximity_out_quirk_timer_func(struct libinput_plugin *plugin,
|
tablet_proximity_out_quirk_timer_func(struct libinput_plugin *plugin,
|
||||||
uint64_t now,
|
usec_t now,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct plugin_device *device = data;
|
struct plugin_device *device = data;
|
||||||
|
|
@ -105,7 +105,8 @@ tablet_proximity_out_quirk_timer_func(struct libinput_plugin *plugin,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->last_event_time > now - FORCED_PROXOUT_TIMEOUT) {
|
usec_t proxout_time = usec_sub(now, FORCED_PROXOUT_TIMEOUT);
|
||||||
|
if (usec_cmp(device->last_event_time, proxout_time) > 0) {
|
||||||
proximity_timer_plugin_set_timer(device, device->last_event_time);
|
proximity_timer_plugin_set_timer(device, device->last_event_time);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -144,11 +145,10 @@ proximity_timer_plugin_device_handle_frame(struct libinput_plugin *libinput_plug
|
||||||
struct plugin_device *device,
|
struct plugin_device *device,
|
||||||
struct evdev_frame *frame)
|
struct evdev_frame *frame)
|
||||||
{
|
{
|
||||||
uint64_t time = evdev_frame_get_time(frame);
|
usec_t time = evdev_frame_get_time(frame);
|
||||||
/* First event after adding a device - by definition the pen
|
/* First event after adding a device - by definition the pen
|
||||||
*
|
|
||||||
* is in proximity if we get this one */
|
* is in proximity if we get this one */
|
||||||
if (device->last_event_time == 0)
|
if (usec_is_zero(device->last_event_time))
|
||||||
proximity_timer_plugin_set_timer(device, time);
|
proximity_timer_plugin_set_timer(device, time);
|
||||||
|
|
||||||
device->last_event_time = time;
|
device->last_event_time = time;
|
||||||
|
|
@ -303,7 +303,7 @@ libinput_tablet_plugin_proximity_timer(struct libinput *libinput)
|
||||||
|
|
||||||
/* Stop false positives caused by the forced proximity code */
|
/* Stop false positives caused by the forced proximity code */
|
||||||
if (getenv("LIBINPUT_RUNNING_TEST_SUITE"))
|
if (getenv("LIBINPUT_RUNNING_TEST_SUITE"))
|
||||||
FORCED_PROXOUT_TIMEOUT = 150 * 1000; /* µs */
|
FORCED_PROXOUT_TIMEOUT = usec_from_millis(150);
|
||||||
|
|
||||||
_unref_(libinput_plugin) *p = libinput_plugin_new(libinput,
|
_unref_(libinput_plugin) *p = libinput_plugin_new(libinput,
|
||||||
"tablet-proximity-timer",
|
"tablet-proximity-timer",
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ struct libinput_plugin_timer {
|
||||||
struct list link;
|
struct list link;
|
||||||
struct libinput_plugin *plugin;
|
struct libinput_plugin *plugin;
|
||||||
struct libinput_timer timer;
|
struct libinput_timer timer;
|
||||||
void (*func)(struct libinput_plugin *plugin, uint64_t now, void *user_data);
|
void (*func)(struct libinput_plugin *plugin, usec_t now, void *user_data);
|
||||||
void *user_data;
|
void *user_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -657,7 +657,7 @@ print_frame(struct libinput *libinput, struct evdev_frame *frame, const char *pr
|
||||||
{
|
{
|
||||||
static uint32_t offset = 0;
|
static uint32_t offset = 0;
|
||||||
static uint32_t last_time = 0;
|
static uint32_t last_time = 0;
|
||||||
uint32_t time = evdev_frame_get_time(frame) / 1000;
|
uint32_t time = usec_to_millis(evdev_frame_get_time(frame));
|
||||||
|
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
offset = time;
|
offset = time;
|
||||||
|
|
@ -756,7 +756,7 @@ plugin_system_notify_evdev_frame(struct libinput_plugin_system *system,
|
||||||
struct list queued_events = LIST_INIT(queued_events);
|
struct list queued_events = LIST_INIT(queued_events);
|
||||||
list_take_insert(&queued_events, our_event, link);
|
list_take_insert(&queued_events, our_event, link);
|
||||||
|
|
||||||
uint64_t frame_time = evdev_frame_get_time(frame);
|
usec_t frame_time = evdev_frame_get_time(frame);
|
||||||
|
|
||||||
bool delay = !!sender_plugin;
|
bool delay = !!sender_plugin;
|
||||||
|
|
||||||
|
|
@ -784,7 +784,7 @@ plugin_system_notify_evdev_frame(struct libinput_plugin_system *system,
|
||||||
list_for_each_safe(event, &queued_events, link) {
|
list_for_each_safe(event, &queued_events, link) {
|
||||||
struct list next = LIST_INIT(next);
|
struct list next = LIST_INIT(next);
|
||||||
|
|
||||||
if (evdev_frame_get_time(event->frame) == 0)
|
if (usec_is_zero(evdev_frame_get_time(event->frame)))
|
||||||
evdev_frame_set_time(event->frame, frame_time);
|
evdev_frame_set_time(event->frame, frame_time);
|
||||||
|
|
||||||
if (!bitmask_bit_is_set(device->plugin_frame_callbacks,
|
if (!bitmask_bit_is_set(device->plugin_frame_callbacks,
|
||||||
|
|
@ -848,7 +848,7 @@ libinput_plugin_system_notify_evdev_frame(struct libinput_plugin_system *system,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plugin_timer_func(uint64_t now, void *data)
|
plugin_timer_func(usec_t now, void *data)
|
||||||
{
|
{
|
||||||
struct libinput_plugin_timer *timer = data;
|
struct libinput_plugin_timer *timer = data;
|
||||||
struct libinput_plugin *plugin = timer->plugin;
|
struct libinput_plugin *plugin = timer->plugin;
|
||||||
|
|
@ -882,7 +882,7 @@ struct libinput_plugin_timer *
|
||||||
libinput_plugin_timer_new(struct libinput_plugin *plugin,
|
libinput_plugin_timer_new(struct libinput_plugin *plugin,
|
||||||
const char *name,
|
const char *name,
|
||||||
void (*func)(struct libinput_plugin *plugin,
|
void (*func)(struct libinput_plugin *plugin,
|
||||||
uint64_t now,
|
usec_t now,
|
||||||
void *data),
|
void *data),
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
|
|
@ -942,7 +942,7 @@ libinput_plugin_timer_unref(struct libinput_plugin_timer *timer)
|
||||||
|
|
||||||
/* Set timer expire time, in absolute us CLOCK_MONOTONIC */
|
/* Set timer expire time, in absolute us CLOCK_MONOTONIC */
|
||||||
void
|
void
|
||||||
libinput_plugin_timer_set(struct libinput_plugin_timer *timer, uint64_t expire)
|
libinput_plugin_timer_set(struct libinput_plugin_timer *timer, usec_t expire)
|
||||||
{
|
{
|
||||||
libinput_timer_set(&timer->timer, expire);
|
libinput_timer_set(&timer->timer, expire);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "util-time.h"
|
||||||
|
|
||||||
/* Forward declarations instead of #includes to make
|
/* Forward declarations instead of #includes to make
|
||||||
* this header self-contained (bindgen, etc.) */
|
* this header self-contained (bindgen, etc.) */
|
||||||
struct evdev_frame;
|
struct evdev_frame;
|
||||||
|
|
@ -333,7 +335,7 @@ struct libinput_plugin_timer *
|
||||||
libinput_plugin_timer_new(struct libinput_plugin *plugin,
|
libinput_plugin_timer_new(struct libinput_plugin *plugin,
|
||||||
const char *name,
|
const char *name,
|
||||||
void (*func)(struct libinput_plugin *plugin,
|
void (*func)(struct libinput_plugin *plugin,
|
||||||
uint64_t now,
|
usec_t now,
|
||||||
void *user_data),
|
void *user_data),
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
|
|
@ -349,7 +351,7 @@ DEFINE_UNREF_CLEANUP_FUNC(libinput_plugin_timer);
|
||||||
|
|
||||||
/* Set timer expire time, in absolute us CLOCK_MONOTONIC */
|
/* Set timer expire time, in absolute us CLOCK_MONOTONIC */
|
||||||
void
|
void
|
||||||
libinput_plugin_timer_set(struct libinput_plugin_timer *timer, uint64_t expire);
|
libinput_plugin_timer_set(struct libinput_plugin_timer *timer, usec_t expire);
|
||||||
|
|
||||||
void
|
void
|
||||||
libinput_plugin_timer_set_user_data(struct libinput_plugin_timer *timer,
|
libinput_plugin_timer_set_user_data(struct libinput_plugin_timer *timer,
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ struct libinput {
|
||||||
struct list list;
|
struct list list;
|
||||||
struct libinput_source *source;
|
struct libinput_source *source;
|
||||||
int fd;
|
int fd;
|
||||||
uint64_t next_expiry;
|
usec_t next_expiry;
|
||||||
|
|
||||||
struct ratelimit expiry_in_past_limit;
|
struct ratelimit expiry_in_past_limit;
|
||||||
} timer;
|
} timer;
|
||||||
|
|
@ -221,8 +221,8 @@ struct libinput {
|
||||||
|
|
||||||
struct list device_group_list;
|
struct list device_group_list;
|
||||||
|
|
||||||
uint64_t last_event_time;
|
usec_t last_event_time;
|
||||||
uint64_t dispatch_time;
|
usec_t dispatch_time;
|
||||||
|
|
||||||
bool quirks_initialized;
|
bool quirks_initialized;
|
||||||
struct quirks_context *quirks;
|
struct quirks_context *quirks;
|
||||||
|
|
@ -463,6 +463,9 @@ struct libinput_device_config_dwt {
|
||||||
enum libinput_config_dwt_state (*get_enabled)(struct libinput_device *device);
|
enum libinput_config_dwt_state (*get_enabled)(struct libinput_device *device);
|
||||||
enum libinput_config_dwt_state (*get_default_enabled)(
|
enum libinput_config_dwt_state (*get_default_enabled)(
|
||||||
struct libinput_device *device);
|
struct libinput_device *device);
|
||||||
|
enum libinput_config_status (*set_timeout)(struct libinput_device *device,
|
||||||
|
usec_t timeout);
|
||||||
|
usec_t (*get_timeout)(struct libinput_device *device);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct libinput_device_config_dwtp {
|
struct libinput_device_config_dwtp {
|
||||||
|
|
@ -473,6 +476,9 @@ struct libinput_device_config_dwtp {
|
||||||
enum libinput_config_dwtp_state (*get_enabled)(struct libinput_device *device);
|
enum libinput_config_dwtp_state (*get_enabled)(struct libinput_device *device);
|
||||||
enum libinput_config_dwtp_state (*get_default_enabled)(
|
enum libinput_config_dwtp_state (*get_default_enabled)(
|
||||||
struct libinput_device *device);
|
struct libinput_device *device);
|
||||||
|
enum libinput_config_status (*set_timeout)(struct libinput_device *device,
|
||||||
|
usec_t timeout);
|
||||||
|
usec_t (*get_timeout)(struct libinput_device *device);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct libinput_device_config_rotation {
|
struct libinput_device_config_rotation {
|
||||||
|
|
@ -682,7 +688,7 @@ struct libinput_event {
|
||||||
|
|
||||||
struct libinput_event_listener {
|
struct libinput_event_listener {
|
||||||
struct list link;
|
struct list link;
|
||||||
void (*notify_func)(uint64_t time,
|
void (*notify_func)(usec_t time,
|
||||||
struct libinput_event *ev,
|
struct libinput_event *ev,
|
||||||
void *notify_func_data);
|
void *notify_func_data);
|
||||||
void *notify_func_data;
|
void *notify_func_data;
|
||||||
|
|
@ -753,7 +759,7 @@ libinput_device_init_event_listener(struct libinput_event_listener *listener);
|
||||||
void
|
void
|
||||||
libinput_device_add_event_listener(struct libinput_device *device,
|
libinput_device_add_event_listener(struct libinput_device *device,
|
||||||
struct libinput_event_listener *listener,
|
struct libinput_event_listener *listener,
|
||||||
void (*notify_func)(uint64_t time,
|
void (*notify_func)(usec_t time,
|
||||||
struct libinput_event *event,
|
struct libinput_event *event,
|
||||||
void *notify_func_data),
|
void *notify_func_data),
|
||||||
void *notify_func_data);
|
void *notify_func_data);
|
||||||
|
|
@ -769,84 +775,84 @@ notify_removed_device(struct libinput_device *device);
|
||||||
|
|
||||||
void
|
void
|
||||||
keyboard_notify_key(struct libinput_device *device,
|
keyboard_notify_key(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
keycode_t key,
|
keycode_t key,
|
||||||
enum libinput_key_state state);
|
enum libinput_key_state state);
|
||||||
|
|
||||||
void
|
void
|
||||||
pointer_notify_motion(struct libinput_device *device,
|
pointer_notify_motion(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
const struct normalized_coords *delta,
|
const struct normalized_coords *delta,
|
||||||
const struct device_float_coords *raw);
|
const struct device_float_coords *raw);
|
||||||
|
|
||||||
void
|
void
|
||||||
pointer_notify_motion_absolute(struct libinput_device *device,
|
pointer_notify_motion_absolute(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
const struct device_coords *point);
|
const struct device_coords *point);
|
||||||
|
|
||||||
void
|
void
|
||||||
pointer_notify_button(struct libinput_device *device,
|
pointer_notify_button(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
button_code_t button,
|
button_code_t button,
|
||||||
enum libinput_button_state state);
|
enum libinput_button_state state);
|
||||||
|
|
||||||
void
|
void
|
||||||
pointer_notify_axis_finger(struct libinput_device *device,
|
pointer_notify_axis_finger(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta);
|
const struct normalized_coords *delta);
|
||||||
void
|
void
|
||||||
pointer_notify_axis_continuous(struct libinput_device *device,
|
pointer_notify_axis_continuous(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta);
|
const struct normalized_coords *delta);
|
||||||
|
|
||||||
void
|
void
|
||||||
pointer_notify_axis_legacy_wheel(struct libinput_device *device,
|
pointer_notify_axis_legacy_wheel(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta,
|
const struct normalized_coords *delta,
|
||||||
const struct discrete_coords *discrete);
|
const struct discrete_coords *discrete);
|
||||||
|
|
||||||
void
|
void
|
||||||
pointer_notify_axis_wheel(struct libinput_device *device,
|
pointer_notify_axis_wheel(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta,
|
const struct normalized_coords *delta,
|
||||||
const struct wheel_v120 *v120);
|
const struct wheel_v120 *v120);
|
||||||
|
|
||||||
void
|
void
|
||||||
touch_notify_touch_down(struct libinput_device *device,
|
touch_notify_touch_down(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int32_t slot,
|
int32_t slot,
|
||||||
int32_t seat_slot,
|
int32_t seat_slot,
|
||||||
const struct device_coords *point);
|
const struct device_coords *point);
|
||||||
|
|
||||||
void
|
void
|
||||||
touch_notify_touch_motion(struct libinput_device *device,
|
touch_notify_touch_motion(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int32_t slot,
|
int32_t slot,
|
||||||
int32_t seat_slot,
|
int32_t seat_slot,
|
||||||
const struct device_coords *point);
|
const struct device_coords *point);
|
||||||
|
|
||||||
void
|
void
|
||||||
touch_notify_touch_up(struct libinput_device *device,
|
touch_notify_touch_up(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int32_t slot,
|
int32_t slot,
|
||||||
int32_t seat_slot);
|
int32_t seat_slot);
|
||||||
|
|
||||||
void
|
void
|
||||||
touch_notify_touch_cancel(struct libinput_device *device,
|
touch_notify_touch_cancel(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int32_t slot,
|
int32_t slot,
|
||||||
int32_t seat_slot);
|
int32_t seat_slot);
|
||||||
|
|
||||||
void
|
void
|
||||||
touch_notify_frame(struct libinput_device *device, uint64_t time);
|
touch_notify_frame(struct libinput_device *device, usec_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
gesture_notify_swipe(struct libinput_device *device,
|
gesture_notify_swipe(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum libinput_event_type type,
|
enum libinput_event_type type,
|
||||||
int finger_count,
|
int finger_count,
|
||||||
const struct normalized_coords *delta,
|
const struct normalized_coords *delta,
|
||||||
|
|
@ -854,13 +860,13 @@ gesture_notify_swipe(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
gesture_notify_swipe_end(struct libinput_device *device,
|
gesture_notify_swipe_end(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int finger_count,
|
int finger_count,
|
||||||
bool cancelled);
|
bool cancelled);
|
||||||
|
|
||||||
void
|
void
|
||||||
gesture_notify_pinch(struct libinput_device *device,
|
gesture_notify_pinch(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum libinput_event_type type,
|
enum libinput_event_type type,
|
||||||
int finger_count,
|
int finger_count,
|
||||||
const struct normalized_coords *delta,
|
const struct normalized_coords *delta,
|
||||||
|
|
@ -870,25 +876,25 @@ gesture_notify_pinch(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
gesture_notify_pinch_end(struct libinput_device *device,
|
gesture_notify_pinch_end(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int finger_count,
|
int finger_count,
|
||||||
double scale,
|
double scale,
|
||||||
bool cancelled);
|
bool cancelled);
|
||||||
|
|
||||||
void
|
void
|
||||||
gesture_notify_hold_begin(struct libinput_device *device,
|
gesture_notify_hold_begin(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int finger_count);
|
int finger_count);
|
||||||
|
|
||||||
void
|
void
|
||||||
gesture_notify_hold_end(struct libinput_device *device,
|
gesture_notify_hold_end(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int finger_count,
|
int finger_count,
|
||||||
bool cancelled);
|
bool cancelled);
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_notify_axis(struct libinput_device *device,
|
tablet_notify_axis(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
enum libinput_tablet_tool_tip_state tip_state,
|
enum libinput_tablet_tool_tip_state tip_state,
|
||||||
unsigned char *changed_axes,
|
unsigned char *changed_axes,
|
||||||
|
|
@ -898,7 +904,7 @@ tablet_notify_axis(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_notify_proximity(struct libinput_device *device,
|
tablet_notify_proximity(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
enum libinput_tablet_tool_proximity_state state,
|
enum libinput_tablet_tool_proximity_state state,
|
||||||
unsigned char *changed_axes,
|
unsigned char *changed_axes,
|
||||||
|
|
@ -908,7 +914,7 @@ tablet_notify_proximity(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_notify_tip(struct libinput_device *device,
|
tablet_notify_tip(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
enum libinput_tablet_tool_tip_state tip_state,
|
enum libinput_tablet_tool_tip_state tip_state,
|
||||||
unsigned char *changed_axes,
|
unsigned char *changed_axes,
|
||||||
|
|
@ -918,7 +924,7 @@ tablet_notify_tip(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_notify_button(struct libinput_device *device,
|
tablet_notify_button(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
enum libinput_tablet_tool_tip_state tip_state,
|
enum libinput_tablet_tool_tip_state tip_state,
|
||||||
const struct tablet_axes *axes,
|
const struct tablet_axes *axes,
|
||||||
|
|
@ -929,40 +935,40 @@ tablet_notify_button(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_pad_notify_button(struct libinput_device *device,
|
tablet_pad_notify_button(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
pad_button_t button,
|
pad_button_t button,
|
||||||
enum libinput_button_state state,
|
enum libinput_button_state state,
|
||||||
struct libinput_tablet_pad_mode_group *group);
|
struct libinput_tablet_pad_mode_group *group);
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_pad_notify_dial(struct libinput_device *device,
|
tablet_pad_notify_dial(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
unsigned int number,
|
unsigned int number,
|
||||||
double value,
|
double value,
|
||||||
struct libinput_tablet_pad_mode_group *group);
|
struct libinput_tablet_pad_mode_group *group);
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_pad_notify_ring(struct libinput_device *device,
|
tablet_pad_notify_ring(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
unsigned int number,
|
unsigned int number,
|
||||||
double value,
|
double value,
|
||||||
enum libinput_tablet_pad_ring_axis_source source,
|
enum libinput_tablet_pad_ring_axis_source source,
|
||||||
struct libinput_tablet_pad_mode_group *group);
|
struct libinput_tablet_pad_mode_group *group);
|
||||||
void
|
void
|
||||||
tablet_pad_notify_strip(struct libinput_device *device,
|
tablet_pad_notify_strip(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
unsigned int number,
|
unsigned int number,
|
||||||
double value,
|
double value,
|
||||||
enum libinput_tablet_pad_strip_axis_source source,
|
enum libinput_tablet_pad_strip_axis_source source,
|
||||||
struct libinput_tablet_pad_mode_group *group);
|
struct libinput_tablet_pad_mode_group *group);
|
||||||
void
|
void
|
||||||
tablet_pad_notify_key(struct libinput_device *device,
|
tablet_pad_notify_key(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int32_t key,
|
int32_t key,
|
||||||
enum libinput_key_state state);
|
enum libinput_key_state state);
|
||||||
void
|
void
|
||||||
switch_notify_toggle(struct libinput_device *device,
|
switch_notify_toggle(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum libinput_switch sw,
|
enum libinput_switch sw,
|
||||||
enum libinput_switch_state state);
|
enum libinput_switch_state state);
|
||||||
|
|
||||||
|
|
|
||||||
158
src/libinput.c
158
src/libinput.c
|
|
@ -174,7 +174,7 @@ struct libinput_event_device_notify {
|
||||||
|
|
||||||
struct libinput_event_keyboard {
|
struct libinput_event_keyboard {
|
||||||
struct libinput_event base;
|
struct libinput_event base;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
uint32_t key;
|
uint32_t key;
|
||||||
uint32_t seat_key_count;
|
uint32_t seat_key_count;
|
||||||
enum libinput_key_state state;
|
enum libinput_key_state state;
|
||||||
|
|
@ -182,7 +182,7 @@ struct libinput_event_keyboard {
|
||||||
|
|
||||||
struct libinput_event_pointer {
|
struct libinput_event_pointer {
|
||||||
struct libinput_event base;
|
struct libinput_event base;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
struct normalized_coords delta;
|
struct normalized_coords delta;
|
||||||
struct device_float_coords delta_raw;
|
struct device_float_coords delta_raw;
|
||||||
struct device_coords absolute;
|
struct device_coords absolute;
|
||||||
|
|
@ -197,7 +197,7 @@ struct libinput_event_pointer {
|
||||||
|
|
||||||
struct libinput_event_touch {
|
struct libinput_event_touch {
|
||||||
struct libinput_event base;
|
struct libinput_event base;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
int32_t slot;
|
int32_t slot;
|
||||||
int32_t seat_slot;
|
int32_t seat_slot;
|
||||||
struct device_coords point;
|
struct device_coords point;
|
||||||
|
|
@ -205,7 +205,7 @@ struct libinput_event_touch {
|
||||||
|
|
||||||
struct libinput_event_gesture {
|
struct libinput_event_gesture {
|
||||||
struct libinput_event base;
|
struct libinput_event base;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
int finger_count;
|
int finger_count;
|
||||||
int cancelled;
|
int cancelled;
|
||||||
struct normalized_coords delta;
|
struct normalized_coords delta;
|
||||||
|
|
@ -219,7 +219,7 @@ struct libinput_event_tablet_tool {
|
||||||
uint32_t button;
|
uint32_t button;
|
||||||
enum libinput_button_state state;
|
enum libinput_button_state state;
|
||||||
uint32_t seat_button_count;
|
uint32_t seat_button_count;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
struct tablet_axes axes;
|
struct tablet_axes axes;
|
||||||
unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)];
|
unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)];
|
||||||
struct libinput_tablet_tool *tool;
|
struct libinput_tablet_tool *tool;
|
||||||
|
|
@ -235,7 +235,7 @@ struct libinput_event_tablet_pad {
|
||||||
struct libinput_event base;
|
struct libinput_event base;
|
||||||
unsigned int mode;
|
unsigned int mode;
|
||||||
struct libinput_tablet_pad_mode_group *mode_group;
|
struct libinput_tablet_pad_mode_group *mode_group;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
struct {
|
struct {
|
||||||
uint32_t number;
|
uint32_t number;
|
||||||
enum libinput_button_state state;
|
enum libinput_button_state state;
|
||||||
|
|
@ -262,7 +262,7 @@ struct libinput_event_tablet_pad {
|
||||||
|
|
||||||
struct libinput_event_switch {
|
struct libinput_event_switch {
|
||||||
struct libinput_event base;
|
struct libinput_event base;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
enum libinput_switch sw;
|
enum libinput_switch sw;
|
||||||
enum libinput_switch_state state;
|
enum libinput_switch_state state;
|
||||||
};
|
};
|
||||||
|
|
@ -347,7 +347,7 @@ log_msg_ratelimit(struct libinput *libinput,
|
||||||
priority,
|
priority,
|
||||||
"WARNING: log rate limit exceeded (%d msgs per %dms). Discarding future messages.\n",
|
"WARNING: log rate limit exceeded (%d msgs per %dms). Discarding future messages.\n",
|
||||||
ratelimit->burst,
|
ratelimit->burst,
|
||||||
us2ms(ratelimit->interval));
|
usec_to_millis(ratelimit->interval));
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT void
|
LIBINPUT_EXPORT void
|
||||||
|
|
@ -513,7 +513,7 @@ libinput_event_keyboard_get_time(struct libinput_event_keyboard *event)
|
||||||
0,
|
0,
|
||||||
LIBINPUT_EVENT_KEYBOARD_KEY);
|
LIBINPUT_EVENT_KEYBOARD_KEY);
|
||||||
|
|
||||||
return us2ms(event->time);
|
return usec_to_millis(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT uint64_t
|
LIBINPUT_EXPORT uint64_t
|
||||||
|
|
@ -524,7 +524,7 @@ libinput_event_keyboard_get_time_usec(struct libinput_event_keyboard *event)
|
||||||
0,
|
0,
|
||||||
LIBINPUT_EVENT_KEYBOARD_KEY);
|
LIBINPUT_EVENT_KEYBOARD_KEY);
|
||||||
|
|
||||||
return event->time;
|
return usec_as_uint64_t(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT uint32_t
|
LIBINPUT_EXPORT uint32_t
|
||||||
|
|
@ -574,7 +574,7 @@ libinput_event_pointer_get_time(struct libinput_event_pointer *event)
|
||||||
LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS,
|
LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS,
|
||||||
LIBINPUT_EVENT_POINTER_AXIS);
|
LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
|
||||||
return us2ms(event->time);
|
return usec_to_millis(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT uint64_t
|
LIBINPUT_EXPORT uint64_t
|
||||||
|
|
@ -591,7 +591,7 @@ libinput_event_pointer_get_time_usec(struct libinput_event_pointer *event)
|
||||||
LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS,
|
LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS,
|
||||||
LIBINPUT_EVENT_POINTER_AXIS);
|
LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
|
||||||
return event->time;
|
return usec_as_uint64_t(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT double
|
LIBINPUT_EXPORT double
|
||||||
|
|
@ -880,7 +880,7 @@ libinput_event_touch_get_time(struct libinput_event_touch *event)
|
||||||
LIBINPUT_EVENT_TOUCH_CANCEL,
|
LIBINPUT_EVENT_TOUCH_CANCEL,
|
||||||
LIBINPUT_EVENT_TOUCH_FRAME);
|
LIBINPUT_EVENT_TOUCH_FRAME);
|
||||||
|
|
||||||
return us2ms(event->time);
|
return usec_to_millis(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT uint64_t
|
LIBINPUT_EXPORT uint64_t
|
||||||
|
|
@ -895,7 +895,7 @@ libinput_event_touch_get_time_usec(struct libinput_event_touch *event)
|
||||||
LIBINPUT_EVENT_TOUCH_CANCEL,
|
LIBINPUT_EVENT_TOUCH_CANCEL,
|
||||||
LIBINPUT_EVENT_TOUCH_FRAME);
|
LIBINPUT_EVENT_TOUCH_FRAME);
|
||||||
|
|
||||||
return event->time;
|
return usec_as_uint64_t(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT int32_t
|
LIBINPUT_EXPORT int32_t
|
||||||
|
|
@ -999,7 +999,7 @@ libinput_event_gesture_get_time(struct libinput_event_gesture *event)
|
||||||
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
||||||
LIBINPUT_EVENT_GESTURE_HOLD_END);
|
LIBINPUT_EVENT_GESTURE_HOLD_END);
|
||||||
|
|
||||||
return us2ms(event->time);
|
return usec_to_millis(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT uint64_t
|
LIBINPUT_EXPORT uint64_t
|
||||||
|
|
@ -1017,7 +1017,7 @@ libinput_event_gesture_get_time_usec(struct libinput_event_gesture *event)
|
||||||
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
||||||
LIBINPUT_EVENT_GESTURE_HOLD_END);
|
LIBINPUT_EVENT_GESTURE_HOLD_END);
|
||||||
|
|
||||||
return event->time;
|
return usec_as_uint64_t(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT int
|
LIBINPUT_EXPORT int
|
||||||
|
|
@ -1580,7 +1580,7 @@ libinput_event_tablet_tool_get_time(struct libinput_event_tablet_tool *event)
|
||||||
LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
|
LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
|
||||||
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
||||||
|
|
||||||
return us2ms(event->time);
|
return usec_to_millis(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT uint64_t
|
LIBINPUT_EXPORT uint64_t
|
||||||
|
|
@ -1594,7 +1594,7 @@ libinput_event_tablet_tool_get_time_usec(struct libinput_event_tablet_tool *even
|
||||||
LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
|
LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
|
||||||
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
||||||
|
|
||||||
return event->time;
|
return usec_as_uint64_t(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT uint32_t
|
LIBINPUT_EXPORT uint32_t
|
||||||
|
|
@ -1782,7 +1782,7 @@ libinput_event_switch_get_time(struct libinput_event_switch *event)
|
||||||
0,
|
0,
|
||||||
LIBINPUT_EVENT_SWITCH_TOGGLE);
|
LIBINPUT_EVENT_SWITCH_TOGGLE);
|
||||||
|
|
||||||
return us2ms(event->time);
|
return usec_to_millis(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT uint64_t
|
LIBINPUT_EXPORT uint64_t
|
||||||
|
|
@ -1793,7 +1793,7 @@ libinput_event_switch_get_time_usec(struct libinput_event_switch *event)
|
||||||
0,
|
0,
|
||||||
LIBINPUT_EVENT_SWITCH_TOGGLE);
|
LIBINPUT_EVENT_SWITCH_TOGGLE);
|
||||||
|
|
||||||
return event->time;
|
return usec_as_uint64_t(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct libinput_source *
|
struct libinput_source *
|
||||||
|
|
@ -2193,8 +2193,8 @@ libinput_dispatch(struct libinput *libinput)
|
||||||
* timestamps */
|
* timestamps */
|
||||||
if ((++take_time_snapshot % 10) == 0)
|
if ((++take_time_snapshot % 10) == 0)
|
||||||
libinput->dispatch_time = libinput_now(libinput);
|
libinput->dispatch_time = libinput_now(libinput);
|
||||||
else if (libinput->dispatch_time)
|
else if (!usec_is_zero(libinput->dispatch_time))
|
||||||
libinput->dispatch_time = 0;
|
libinput->dispatch_time = usec_from_uint64_t(0);
|
||||||
|
|
||||||
count = epoll_wait(libinput->epoll_fd, ep, ARRAY_LENGTH(ep), 0);
|
count = epoll_wait(libinput->epoll_fd, ep, ARRAY_LENGTH(ep), 0);
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
|
|
@ -2222,7 +2222,7 @@ libinput_device_init_event_listener(struct libinput_event_listener *listener)
|
||||||
void
|
void
|
||||||
libinput_device_add_event_listener(struct libinput_device *device,
|
libinput_device_add_event_listener(struct libinput_device *device,
|
||||||
struct libinput_event_listener *listener,
|
struct libinput_event_listener *listener,
|
||||||
void (*notify_func)(uint64_t time,
|
void (*notify_func)(usec_t time,
|
||||||
struct libinput_event *event,
|
struct libinput_event *event,
|
||||||
void *notify_func_data),
|
void *notify_func_data),
|
||||||
void *notify_func_data)
|
void *notify_func_data)
|
||||||
|
|
@ -2324,7 +2324,7 @@ post_base_event(struct libinput_device *device,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
post_device_event(struct libinput_device *device,
|
post_device_event(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum libinput_event_type type,
|
enum libinput_event_type type,
|
||||||
struct libinput_event *event)
|
struct libinput_event *event)
|
||||||
{
|
{
|
||||||
|
|
@ -2431,7 +2431,7 @@ device_has_cap(struct libinput_device *device, enum libinput_device_capability c
|
||||||
|
|
||||||
void
|
void
|
||||||
keyboard_notify_key(struct libinput_device *device,
|
keyboard_notify_key(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
keycode_t keycode,
|
keycode_t keycode,
|
||||||
enum libinput_key_state state)
|
enum libinput_key_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -2457,7 +2457,7 @@ keyboard_notify_key(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
pointer_notify_motion(struct libinput_device *device,
|
pointer_notify_motion(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
const struct normalized_coords *delta,
|
const struct normalized_coords *delta,
|
||||||
const struct device_float_coords *raw)
|
const struct device_float_coords *raw)
|
||||||
{
|
{
|
||||||
|
|
@ -2482,7 +2482,7 @@ pointer_notify_motion(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
pointer_notify_motion_absolute(struct libinput_device *device,
|
pointer_notify_motion_absolute(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
const struct device_coords *point)
|
const struct device_coords *point)
|
||||||
{
|
{
|
||||||
struct libinput_event_pointer *motion_absolute_event;
|
struct libinput_event_pointer *motion_absolute_event;
|
||||||
|
|
@ -2505,7 +2505,7 @@ pointer_notify_motion_absolute(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
pointer_notify_button(struct libinput_device *device,
|
pointer_notify_button(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
button_code_t button,
|
button_code_t button,
|
||||||
enum libinput_button_state state)
|
enum libinput_button_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -2534,7 +2534,7 @@ pointer_notify_button(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
pointer_notify_axis_finger(struct libinput_device *device,
|
pointer_notify_axis_finger(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta)
|
const struct normalized_coords *delta)
|
||||||
{
|
{
|
||||||
|
|
@ -2570,7 +2570,7 @@ pointer_notify_axis_finger(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
pointer_notify_axis_continuous(struct libinput_device *device,
|
pointer_notify_axis_continuous(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta)
|
const struct normalized_coords *delta)
|
||||||
{
|
{
|
||||||
|
|
@ -2606,7 +2606,7 @@ pointer_notify_axis_continuous(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
pointer_notify_axis_legacy_wheel(struct libinput_device *device,
|
pointer_notify_axis_legacy_wheel(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta,
|
const struct normalized_coords *delta,
|
||||||
const struct discrete_coords *discrete)
|
const struct discrete_coords *discrete)
|
||||||
|
|
@ -2633,7 +2633,7 @@ pointer_notify_axis_legacy_wheel(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
pointer_notify_axis_wheel(struct libinput_device *device,
|
pointer_notify_axis_wheel(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
uint32_t axes,
|
uint32_t axes,
|
||||||
const struct normalized_coords *delta,
|
const struct normalized_coords *delta,
|
||||||
const struct wheel_v120 *v120)
|
const struct wheel_v120 *v120)
|
||||||
|
|
@ -2665,7 +2665,7 @@ pointer_notify_axis_wheel(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
touch_notify_touch_down(struct libinput_device *device,
|
touch_notify_touch_down(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int32_t slot,
|
int32_t slot,
|
||||||
int32_t seat_slot,
|
int32_t seat_slot,
|
||||||
const struct device_coords *point)
|
const struct device_coords *point)
|
||||||
|
|
@ -2689,7 +2689,7 @@ touch_notify_touch_down(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
touch_notify_touch_motion(struct libinput_device *device,
|
touch_notify_touch_motion(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int32_t slot,
|
int32_t slot,
|
||||||
int32_t seat_slot,
|
int32_t seat_slot,
|
||||||
const struct device_coords *point)
|
const struct device_coords *point)
|
||||||
|
|
@ -2716,7 +2716,7 @@ touch_notify_touch_motion(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
touch_notify_touch_up(struct libinput_device *device,
|
touch_notify_touch_up(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int32_t slot,
|
int32_t slot,
|
||||||
int32_t seat_slot)
|
int32_t seat_slot)
|
||||||
{
|
{
|
||||||
|
|
@ -2738,7 +2738,7 @@ touch_notify_touch_up(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
touch_notify_touch_cancel(struct libinput_device *device,
|
touch_notify_touch_cancel(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int32_t slot,
|
int32_t slot,
|
||||||
int32_t seat_slot)
|
int32_t seat_slot)
|
||||||
{
|
{
|
||||||
|
|
@ -2762,7 +2762,7 @@ touch_notify_touch_cancel(struct libinput_device *device,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
touch_notify_frame(struct libinput_device *device, uint64_t time)
|
touch_notify_frame(struct libinput_device *device, usec_t time)
|
||||||
{
|
{
|
||||||
struct libinput_event_touch *touch_event;
|
struct libinput_event_touch *touch_event;
|
||||||
|
|
||||||
|
|
@ -2780,7 +2780,7 @@ touch_notify_frame(struct libinput_device *device, uint64_t time)
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_notify_axis(struct libinput_device *device,
|
tablet_notify_axis(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
enum libinput_tablet_tool_tip_state tip_state,
|
enum libinput_tablet_tool_tip_state tip_state,
|
||||||
unsigned char *changed_axes,
|
unsigned char *changed_axes,
|
||||||
|
|
@ -2814,7 +2814,7 @@ tablet_notify_axis(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_notify_proximity(struct libinput_device *device,
|
tablet_notify_proximity(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
enum libinput_tablet_tool_proximity_state proximity_state,
|
enum libinput_tablet_tool_proximity_state proximity_state,
|
||||||
unsigned char *changed_axes,
|
unsigned char *changed_axes,
|
||||||
|
|
@ -2847,7 +2847,7 @@ tablet_notify_proximity(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_notify_tip(struct libinput_device *device,
|
tablet_notify_tip(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
enum libinput_tablet_tool_tip_state tip_state,
|
enum libinput_tablet_tool_tip_state tip_state,
|
||||||
unsigned char *changed_axes,
|
unsigned char *changed_axes,
|
||||||
|
|
@ -2878,7 +2878,7 @@ tablet_notify_tip(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_notify_button(struct libinput_device *device,
|
tablet_notify_button(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
struct libinput_tablet_tool *tool,
|
struct libinput_tablet_tool *tool,
|
||||||
enum libinput_tablet_tool_tip_state tip_state,
|
enum libinput_tablet_tool_tip_state tip_state,
|
||||||
const struct tablet_axes *axes,
|
const struct tablet_axes *axes,
|
||||||
|
|
@ -2915,7 +2915,7 @@ tablet_notify_button(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_pad_notify_button(struct libinput_device *device,
|
tablet_pad_notify_button(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
pad_button_t button,
|
pad_button_t button,
|
||||||
enum libinput_button_state state,
|
enum libinput_button_state state,
|
||||||
struct libinput_tablet_pad_mode_group *group)
|
struct libinput_tablet_pad_mode_group *group)
|
||||||
|
|
@ -2943,7 +2943,7 @@ tablet_pad_notify_button(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_pad_notify_dial(struct libinput_device *device,
|
tablet_pad_notify_dial(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
unsigned int number,
|
unsigned int number,
|
||||||
double value,
|
double value,
|
||||||
struct libinput_tablet_pad_mode_group *group)
|
struct libinput_tablet_pad_mode_group *group)
|
||||||
|
|
@ -2971,7 +2971,7 @@ tablet_pad_notify_dial(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_pad_notify_ring(struct libinput_device *device,
|
tablet_pad_notify_ring(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
unsigned int number,
|
unsigned int number,
|
||||||
double value,
|
double value,
|
||||||
enum libinput_tablet_pad_ring_axis_source source,
|
enum libinput_tablet_pad_ring_axis_source source,
|
||||||
|
|
@ -3001,7 +3001,7 @@ tablet_pad_notify_ring(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_pad_notify_strip(struct libinput_device *device,
|
tablet_pad_notify_strip(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
unsigned int number,
|
unsigned int number,
|
||||||
double value,
|
double value,
|
||||||
enum libinput_tablet_pad_strip_axis_source source,
|
enum libinput_tablet_pad_strip_axis_source source,
|
||||||
|
|
@ -3031,7 +3031,7 @@ tablet_pad_notify_strip(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
tablet_pad_notify_key(struct libinput_device *device,
|
tablet_pad_notify_key(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int32_t key,
|
int32_t key,
|
||||||
enum libinput_key_state state)
|
enum libinput_key_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -3053,7 +3053,7 @@ tablet_pad_notify_key(struct libinput_device *device,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gesture_notify(struct libinput_device *device,
|
gesture_notify(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum libinput_event_type type,
|
enum libinput_event_type type,
|
||||||
int finger_count,
|
int finger_count,
|
||||||
bool cancelled,
|
bool cancelled,
|
||||||
|
|
@ -3084,7 +3084,7 @@ gesture_notify(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
gesture_notify_swipe(struct libinput_device *device,
|
gesture_notify_swipe(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum libinput_event_type type,
|
enum libinput_event_type type,
|
||||||
int finger_count,
|
int finger_count,
|
||||||
const struct normalized_coords *delta,
|
const struct normalized_coords *delta,
|
||||||
|
|
@ -3095,7 +3095,7 @@ gesture_notify_swipe(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
gesture_notify_swipe_end(struct libinput_device *device,
|
gesture_notify_swipe_end(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int finger_count,
|
int finger_count,
|
||||||
bool cancelled)
|
bool cancelled)
|
||||||
{
|
{
|
||||||
|
|
@ -3114,7 +3114,7 @@ gesture_notify_swipe_end(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
gesture_notify_pinch(struct libinput_device *device,
|
gesture_notify_pinch(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum libinput_event_type type,
|
enum libinput_event_type type,
|
||||||
int finger_count,
|
int finger_count,
|
||||||
const struct normalized_coords *delta,
|
const struct normalized_coords *delta,
|
||||||
|
|
@ -3135,7 +3135,7 @@ gesture_notify_pinch(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
gesture_notify_pinch_end(struct libinput_device *device,
|
gesture_notify_pinch_end(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int finger_count,
|
int finger_count,
|
||||||
double scale,
|
double scale,
|
||||||
bool cancelled)
|
bool cancelled)
|
||||||
|
|
@ -3154,9 +3154,7 @@ gesture_notify_pinch_end(struct libinput_device *device,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gesture_notify_hold_begin(struct libinput_device *device,
|
gesture_notify_hold_begin(struct libinput_device *device, usec_t time, int finger_count)
|
||||||
uint64_t time,
|
|
||||||
int finger_count)
|
|
||||||
{
|
{
|
||||||
const struct normalized_coords zero = { 0.0, 0.0 };
|
const struct normalized_coords zero = { 0.0, 0.0 };
|
||||||
|
|
||||||
|
|
@ -3173,7 +3171,7 @@ gesture_notify_hold_begin(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
gesture_notify_hold_end(struct libinput_device *device,
|
gesture_notify_hold_end(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
int finger_count,
|
int finger_count,
|
||||||
bool cancelled)
|
bool cancelled)
|
||||||
{
|
{
|
||||||
|
|
@ -3192,7 +3190,7 @@ gesture_notify_hold_end(struct libinput_device *device,
|
||||||
|
|
||||||
void
|
void
|
||||||
switch_notify_toggle(struct libinput_device *device,
|
switch_notify_toggle(struct libinput_device *device,
|
||||||
uint64_t time,
|
usec_t time,
|
||||||
enum libinput_switch sw,
|
enum libinput_switch sw,
|
||||||
enum libinput_switch_state state)
|
enum libinput_switch_state state)
|
||||||
{
|
{
|
||||||
|
|
@ -3873,7 +3871,7 @@ libinput_event_tablet_pad_get_time(struct libinput_event_tablet_pad *event)
|
||||||
LIBINPUT_EVENT_TABLET_PAD_BUTTON,
|
LIBINPUT_EVENT_TABLET_PAD_BUTTON,
|
||||||
LIBINPUT_EVENT_TABLET_PAD_KEY);
|
LIBINPUT_EVENT_TABLET_PAD_KEY);
|
||||||
|
|
||||||
return us2ms(event->time);
|
return usec_to_millis(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT uint64_t
|
LIBINPUT_EXPORT uint64_t
|
||||||
|
|
@ -3888,7 +3886,7 @@ libinput_event_tablet_pad_get_time_usec(struct libinput_event_tablet_pad *event)
|
||||||
LIBINPUT_EVENT_TABLET_PAD_BUTTON,
|
LIBINPUT_EVENT_TABLET_PAD_BUTTON,
|
||||||
LIBINPUT_EVENT_TABLET_PAD_KEY);
|
LIBINPUT_EVENT_TABLET_PAD_KEY);
|
||||||
|
|
||||||
return event->time;
|
return usec_as_uint64_t(event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT struct libinput_event *
|
LIBINPUT_EXPORT struct libinput_event *
|
||||||
|
|
@ -4916,6 +4914,28 @@ libinput_device_config_dwt_get_default_enabled(struct libinput_device *device)
|
||||||
return device->config.dwt->get_default_enabled(device);
|
return device->config.dwt->get_default_enabled(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LIBINPUT_EXPORT enum libinput_config_status
|
||||||
|
libinput_device_config_dwt_set_timeout(struct libinput_device *device, uint32_t millis)
|
||||||
|
{
|
||||||
|
if (millis == 0)
|
||||||
|
return LIBINPUT_CONFIG_STATUS_INVALID;
|
||||||
|
|
||||||
|
if (!libinput_device_config_dwt_is_available(device))
|
||||||
|
return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
|
||||||
|
|
||||||
|
usec_t timeout = usec_from_millis(millis);
|
||||||
|
return device->config.dwt->set_timeout(device, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
LIBINPUT_EXPORT uint32_t
|
||||||
|
libinput_device_config_dwt_get_timeout(struct libinput_device *device)
|
||||||
|
{
|
||||||
|
if (!libinput_device_config_dwt_is_available(device))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return usec_to_millis(device->config.dwt->get_timeout(device));
|
||||||
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT int
|
LIBINPUT_EXPORT int
|
||||||
libinput_device_config_dwtp_is_available(struct libinput_device *device)
|
libinput_device_config_dwtp_is_available(struct libinput_device *device)
|
||||||
{
|
{
|
||||||
|
|
@ -4958,6 +4978,28 @@ libinput_device_config_dwtp_get_default_enabled(struct libinput_device *device)
|
||||||
return device->config.dwtp->get_default_enabled(device);
|
return device->config.dwtp->get_default_enabled(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LIBINPUT_EXPORT enum libinput_config_status
|
||||||
|
libinput_device_config_dwtp_set_timeout(struct libinput_device *device, uint32_t millis)
|
||||||
|
{
|
||||||
|
if (millis == 0)
|
||||||
|
return LIBINPUT_CONFIG_STATUS_INVALID;
|
||||||
|
|
||||||
|
if (!libinput_device_config_dwtp_is_available(device))
|
||||||
|
return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
|
||||||
|
|
||||||
|
usec_t timeout = usec_from_millis(millis);
|
||||||
|
return device->config.dwtp->set_timeout(device, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
LIBINPUT_EXPORT uint32_t
|
||||||
|
libinput_device_config_dwtp_get_timeout(struct libinput_device *device)
|
||||||
|
{
|
||||||
|
if (!libinput_device_config_dwtp_is_available(device))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return usec_to_millis(device->config.dwtp->get_timeout(device));
|
||||||
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT int
|
LIBINPUT_EXPORT int
|
||||||
libinput_device_config_rotation_is_available(struct libinput_device *device)
|
libinput_device_config_rotation_is_available(struct libinput_device *device)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
114
src/libinput.h
114
src/libinput.h
|
|
@ -736,6 +736,20 @@ enum libinput_switch {
|
||||||
* in tablet mode.
|
* in tablet mode.
|
||||||
*/
|
*/
|
||||||
LIBINPUT_SWITCH_TABLET_MODE,
|
LIBINPUT_SWITCH_TABLET_MODE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This switch indicates if the device keypad is exposed or not.
|
||||||
|
*
|
||||||
|
* If the switch is in state @ref LIBINPUT_SWITCH_STATE_OFF, the
|
||||||
|
* keypad is hidden. If the state is @ref LIBINPUT_SWITCH_STATE_ON,
|
||||||
|
* the keypad is exposed.
|
||||||
|
*
|
||||||
|
* All devices will remain accessible regardless of the state of this
|
||||||
|
* switch.
|
||||||
|
*
|
||||||
|
* @since 1.31
|
||||||
|
*/
|
||||||
|
LIBINPUT_SWITCH_KEYPAD_SLIDE,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -6668,6 +6682,8 @@ enum libinput_config_dwt_state {
|
||||||
* @see libinput_device_config_dwt_set_enabled
|
* @see libinput_device_config_dwt_set_enabled
|
||||||
* @see libinput_device_config_dwt_get_enabled
|
* @see libinput_device_config_dwt_get_enabled
|
||||||
* @see libinput_device_config_dwt_get_default_enabled
|
* @see libinput_device_config_dwt_get_default_enabled
|
||||||
|
* @see libinput_device_config_dwt_get_timeout
|
||||||
|
* @see libinput_device_config_dwt_set_timeout
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
libinput_device_config_dwt_is_available(struct libinput_device *device);
|
libinput_device_config_dwt_is_available(struct libinput_device *device);
|
||||||
|
|
@ -6692,6 +6708,8 @@ libinput_device_config_dwt_is_available(struct libinput_device *device);
|
||||||
* @see libinput_device_config_dwt_is_available
|
* @see libinput_device_config_dwt_is_available
|
||||||
* @see libinput_device_config_dwt_get_enabled
|
* @see libinput_device_config_dwt_get_enabled
|
||||||
* @see libinput_device_config_dwt_get_default_enabled
|
* @see libinput_device_config_dwt_get_default_enabled
|
||||||
|
* @see libinput_device_config_dwt_get_timeout
|
||||||
|
* @see libinput_device_config_dwt_set_timeout
|
||||||
*/
|
*/
|
||||||
enum libinput_config_status
|
enum libinput_config_status
|
||||||
libinput_device_config_dwt_set_enabled(struct libinput_device *device,
|
libinput_device_config_dwt_set_enabled(struct libinput_device *device,
|
||||||
|
|
@ -6700,7 +6718,7 @@ libinput_device_config_dwt_set_enabled(struct libinput_device *device,
|
||||||
/**
|
/**
|
||||||
* @ingroup config
|
* @ingroup config
|
||||||
*
|
*
|
||||||
* Check if the disable-while typing feature is currently enabled on this
|
* Check if the disable-while-typing feature is currently enabled on this
|
||||||
* device. If the device does not support disable-while-typing, this
|
* device. If the device does not support disable-while-typing, this
|
||||||
* function returns @ref LIBINPUT_CONFIG_DWT_DISABLED.
|
* function returns @ref LIBINPUT_CONFIG_DWT_DISABLED.
|
||||||
*
|
*
|
||||||
|
|
@ -6711,6 +6729,8 @@ libinput_device_config_dwt_set_enabled(struct libinput_device *device,
|
||||||
* @see libinput_device_config_dwt_is_available
|
* @see libinput_device_config_dwt_is_available
|
||||||
* @see libinput_device_config_dwt_set_enabled
|
* @see libinput_device_config_dwt_set_enabled
|
||||||
* @see libinput_device_config_dwt_get_default_enabled
|
* @see libinput_device_config_dwt_get_default_enabled
|
||||||
|
* @see libinput_device_config_dwt_get_timeout
|
||||||
|
* @see libinput_device_config_dwt_set_timeout
|
||||||
*/
|
*/
|
||||||
enum libinput_config_dwt_state
|
enum libinput_config_dwt_state
|
||||||
libinput_device_config_dwt_get_enabled(struct libinput_device *device);
|
libinput_device_config_dwt_get_enabled(struct libinput_device *device);
|
||||||
|
|
@ -6718,7 +6738,7 @@ libinput_device_config_dwt_get_enabled(struct libinput_device *device);
|
||||||
/**
|
/**
|
||||||
* @ingroup config
|
* @ingroup config
|
||||||
*
|
*
|
||||||
* Check if the disable-while typing feature is enabled on this device by
|
* Check if the disable-while-typing feature is enabled on this device by
|
||||||
* default. If the device does not support disable-while-typing, this
|
* default. If the device does not support disable-while-typing, this
|
||||||
* function returns @ref LIBINPUT_CONFIG_DWT_DISABLED.
|
* function returns @ref LIBINPUT_CONFIG_DWT_DISABLED.
|
||||||
*
|
*
|
||||||
|
|
@ -6729,10 +6749,51 @@ libinput_device_config_dwt_get_enabled(struct libinput_device *device);
|
||||||
* @see libinput_device_config_dwt_is_available
|
* @see libinput_device_config_dwt_is_available
|
||||||
* @see libinput_device_config_dwt_set_enabled
|
* @see libinput_device_config_dwt_set_enabled
|
||||||
* @see libinput_device_config_dwt_get_enabled
|
* @see libinput_device_config_dwt_get_enabled
|
||||||
|
* @see libinput_device_config_dwt_get_timeout
|
||||||
|
* @see libinput_device_config_dwt_set_timeout
|
||||||
*/
|
*/
|
||||||
enum libinput_config_dwt_state
|
enum libinput_config_dwt_state
|
||||||
libinput_device_config_dwt_get_default_enabled(struct libinput_device *device);
|
libinput_device_config_dwt_get_default_enabled(struct libinput_device *device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup config
|
||||||
|
*
|
||||||
|
* Set the disable-while-typing timeout. This timeout denotes the time
|
||||||
|
* in milliseconds between the last key event and the touchpad re-enabling.
|
||||||
|
*
|
||||||
|
* The timeout only takes effect if disable-while-typing is enabled. libinput
|
||||||
|
* implements implementation-defined minimum/maximum timeout values, setting
|
||||||
|
* a timeout outside of those returns @ref LIBINPUT_CONFIG_STATUS_INVALID.
|
||||||
|
* Normal use-cases should never hit these limits.
|
||||||
|
*
|
||||||
|
* @note The timeout is not the only condition for disable-while-typing, expiry of
|
||||||
|
* the timeout does not guarantee that the touchpad is re-enabled.
|
||||||
|
*
|
||||||
|
* @see libinput_device_config_dwt_is_available
|
||||||
|
* @see libinput_device_config_dwt_set_enabled
|
||||||
|
* @see libinput_device_config_dwt_get_enabled
|
||||||
|
* @see libinput_device_config_dwt_get_timeout
|
||||||
|
*
|
||||||
|
* @since 1.31
|
||||||
|
*/
|
||||||
|
enum libinput_config_status
|
||||||
|
libinput_device_config_dwt_set_timeout(struct libinput_device *device, uint32_t millis);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup config
|
||||||
|
*
|
||||||
|
* Get the current disable-while-typing timeout.
|
||||||
|
*
|
||||||
|
* @see libinput_device_config_dwt_is_available
|
||||||
|
* @see libinput_device_config_dwt_set_enabled
|
||||||
|
* @see libinput_device_config_dwt_get_enabled
|
||||||
|
* @see libinput_device_config_dwt_set_timeout
|
||||||
|
*
|
||||||
|
* @since 1.31
|
||||||
|
*/
|
||||||
|
uint32_t
|
||||||
|
libinput_device_config_dwt_get_timeout(struct libinput_device *device);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup config
|
* @ingroup config
|
||||||
*
|
*
|
||||||
|
|
@ -6760,6 +6821,8 @@ enum libinput_config_dwtp_state {
|
||||||
* @see libinput_device_config_dwtp_set_enabled
|
* @see libinput_device_config_dwtp_set_enabled
|
||||||
* @see libinput_device_config_dwtp_get_enabled
|
* @see libinput_device_config_dwtp_get_enabled
|
||||||
* @see libinput_device_config_dwtp_get_default_enabled
|
* @see libinput_device_config_dwtp_get_default_enabled
|
||||||
|
* @see libinput_device_config_dwtp_get_timeout
|
||||||
|
* @see libinput_device_config_dwtp_set_timeout
|
||||||
*
|
*
|
||||||
* @since 1.21
|
* @since 1.21
|
||||||
*/
|
*/
|
||||||
|
|
@ -6786,6 +6849,8 @@ libinput_device_config_dwtp_is_available(struct libinput_device *device);
|
||||||
* @see libinput_device_config_dwtp_is_available
|
* @see libinput_device_config_dwtp_is_available
|
||||||
* @see libinput_device_config_dwtp_get_enabled
|
* @see libinput_device_config_dwtp_get_enabled
|
||||||
* @see libinput_device_config_dwtp_get_default_enabled
|
* @see libinput_device_config_dwtp_get_default_enabled
|
||||||
|
* @see libinput_device_config_dwtp_get_timeout
|
||||||
|
* @see libinput_device_config_dwtp_set_timeout
|
||||||
*
|
*
|
||||||
* @since 1.21
|
* @since 1.21
|
||||||
*/
|
*/
|
||||||
|
|
@ -6796,7 +6861,7 @@ libinput_device_config_dwtp_set_enabled(struct libinput_device *device,
|
||||||
/**
|
/**
|
||||||
* @ingroup config
|
* @ingroup config
|
||||||
*
|
*
|
||||||
* Check if the disable-while trackpointing feature is currently enabled on
|
* Check if the disable-while-trackpointing feature is currently enabled on
|
||||||
* this device. If the device does not support disable-while-trackpointing,
|
* this device. If the device does not support disable-while-trackpointing,
|
||||||
* this function returns @ref LIBINPUT_CONFIG_DWTP_DISABLED.
|
* this function returns @ref LIBINPUT_CONFIG_DWTP_DISABLED.
|
||||||
*
|
*
|
||||||
|
|
@ -6807,6 +6872,8 @@ libinput_device_config_dwtp_set_enabled(struct libinput_device *device,
|
||||||
* @see libinput_device_config_dwtp_is_available
|
* @see libinput_device_config_dwtp_is_available
|
||||||
* @see libinput_device_config_dwtp_set_enabled
|
* @see libinput_device_config_dwtp_set_enabled
|
||||||
* @see libinput_device_config_dwtp_get_default_enabled
|
* @see libinput_device_config_dwtp_get_default_enabled
|
||||||
|
* @see libinput_device_config_dwtp_get_timeout
|
||||||
|
* @see libinput_device_config_dwtp_set_timeout
|
||||||
*
|
*
|
||||||
* @since 1.21
|
* @since 1.21
|
||||||
*/
|
*/
|
||||||
|
|
@ -6816,7 +6883,7 @@ libinput_device_config_dwtp_get_enabled(struct libinput_device *device);
|
||||||
/**
|
/**
|
||||||
* @ingroup config
|
* @ingroup config
|
||||||
*
|
*
|
||||||
* Check if the disable-while trackpointing feature is enabled on this device
|
* Check if the disable-while-trackpointing feature is enabled on this device
|
||||||
* by default. If the device does not support disable-while-trackpointing, this
|
* by default. If the device does not support disable-while-trackpointing, this
|
||||||
* function returns @ref LIBINPUT_CONFIG_DWTP_DISABLED.
|
* function returns @ref LIBINPUT_CONFIG_DWTP_DISABLED.
|
||||||
*
|
*
|
||||||
|
|
@ -6827,12 +6894,51 @@ libinput_device_config_dwtp_get_enabled(struct libinput_device *device);
|
||||||
* @see libinput_device_config_dwtp_is_available
|
* @see libinput_device_config_dwtp_is_available
|
||||||
* @see libinput_device_config_dwtp_set_enabled
|
* @see libinput_device_config_dwtp_set_enabled
|
||||||
* @see libinput_device_config_dwtp_get_enabled
|
* @see libinput_device_config_dwtp_get_enabled
|
||||||
|
* @see libinput_device_config_dwtp_get_timeout
|
||||||
|
* @see libinput_device_config_dwtp_set_timeout
|
||||||
*
|
*
|
||||||
* @since 1.21
|
* @since 1.21
|
||||||
*/
|
*/
|
||||||
enum libinput_config_dwtp_state
|
enum libinput_config_dwtp_state
|
||||||
libinput_device_config_dwtp_get_default_enabled(struct libinput_device *device);
|
libinput_device_config_dwtp_get_default_enabled(struct libinput_device *device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup config
|
||||||
|
*
|
||||||
|
* Set the disable-while-trackpointing timeout. This timeout denotes the time
|
||||||
|
* in milliseconds between the last trackpoint event and the touchpad re-enabling.
|
||||||
|
*
|
||||||
|
* The timeout only takes effect if disable-while-trackpointing is enabled.
|
||||||
|
*
|
||||||
|
* @note The timeout is not the only condition for disable-while-trackpointing, expiry
|
||||||
|
* of the timeout does not guarantee that the touchpad is re-enabled.
|
||||||
|
*
|
||||||
|
* @see libinput_device_config_dwtp_is_available
|
||||||
|
* @see libinput_device_config_dwtp_set_enabled
|
||||||
|
* @see libinput_device_config_dwtp_get_enabled
|
||||||
|
* @see libinput_device_config_dwtp_get_timeout
|
||||||
|
*
|
||||||
|
* @since 1.31
|
||||||
|
*/
|
||||||
|
enum libinput_config_status
|
||||||
|
libinput_device_config_dwtp_set_timeout(struct libinput_device *device,
|
||||||
|
uint32_t millis);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup config
|
||||||
|
*
|
||||||
|
* Get the current disable-while-trackpointing timeout.
|
||||||
|
*
|
||||||
|
* @see libinput_device_config_dwtp_is_available
|
||||||
|
* @see libinput_device_config_dwtp_set_enabled
|
||||||
|
* @see libinput_device_config_dwtp_get_enabled
|
||||||
|
* @see libinput_device_config_dwtp_set_timeout
|
||||||
|
*
|
||||||
|
* @since 1.31
|
||||||
|
*/
|
||||||
|
uint32_t
|
||||||
|
libinput_device_config_dwtp_get_timeout(struct libinput_device *device);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup config
|
* @ingroup config
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -380,3 +380,10 @@ LIBINPUT_1.30 {
|
||||||
libinput_plugin_system_append_path;
|
libinput_plugin_system_append_path;
|
||||||
libinput_plugin_system_load_plugins;
|
libinput_plugin_system_load_plugins;
|
||||||
} LIBINPUT_1.29;
|
} LIBINPUT_1.29;
|
||||||
|
|
||||||
|
LIBINPUT_1.31 {
|
||||||
|
libinput_device_config_dwt_get_timeout;
|
||||||
|
libinput_device_config_dwt_set_timeout;
|
||||||
|
libinput_device_config_dwtp_get_timeout;
|
||||||
|
libinput_device_config_dwtp_set_timeout;
|
||||||
|
} LIBINPUT_1.30;
|
||||||
|
|
|
||||||
|
|
@ -296,8 +296,6 @@ quirk_get_name(enum quirk q)
|
||||||
return "ModelTrackball";
|
return "ModelTrackball";
|
||||||
case QUIRK_MODEL_WACOM_TOUCHPAD:
|
case QUIRK_MODEL_WACOM_TOUCHPAD:
|
||||||
return "ModelWacomTouchpad";
|
return "ModelWacomTouchpad";
|
||||||
case QUIRK_MODEL_PRESSURE_PAD:
|
|
||||||
return "ModelPressurePad";
|
|
||||||
|
|
||||||
case QUIRK_ATTR_SIZE_HINT:
|
case QUIRK_ATTR_SIZE_HINT:
|
||||||
return "AttrSizeHint";
|
return "AttrSizeHint";
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,6 @@ enum quirk {
|
||||||
QUIRK_MODEL_LENOVO_T450_TOUCHPAD,
|
QUIRK_MODEL_LENOVO_T450_TOUCHPAD,
|
||||||
QUIRK_MODEL_LENOVO_X1GEN6_TOUCHPAD,
|
QUIRK_MODEL_LENOVO_X1GEN6_TOUCHPAD,
|
||||||
QUIRK_MODEL_LENOVO_X230,
|
QUIRK_MODEL_LENOVO_X230,
|
||||||
QUIRK_MODEL_PRESSURE_PAD,
|
|
||||||
QUIRK_MODEL_SCROLL_ON_MIDDLE_CLICK,
|
QUIRK_MODEL_SCROLL_ON_MIDDLE_CLICK,
|
||||||
QUIRK_MODEL_SYNAPTICS_SERIAL_TOUCHPAD,
|
QUIRK_MODEL_SYNAPTICS_SERIAL_TOUCHPAD,
|
||||||
QUIRK_MODEL_SYSTEM76_BONOBO,
|
QUIRK_MODEL_SYSTEM76_BONOBO,
|
||||||
|
|
|
||||||
73
src/timer.c
73
src/timer.c
|
|
@ -36,7 +36,7 @@ void
|
||||||
libinput_timer_init(struct libinput_timer *timer,
|
libinput_timer_init(struct libinput_timer *timer,
|
||||||
struct libinput *libinput,
|
struct libinput *libinput,
|
||||||
const char *timer_name,
|
const char *timer_name,
|
||||||
void (*timer_func)(uint64_t now, void *timer_func_data),
|
void (*timer_func)(usec_t now, void *timer_func_data),
|
||||||
void *timer_func_data)
|
void *timer_func_data)
|
||||||
{
|
{
|
||||||
timer->libinput = libinput;
|
timer->libinput = libinput;
|
||||||
|
|
@ -44,7 +44,7 @@ libinput_timer_init(struct libinput_timer *timer,
|
||||||
timer->timer_func = timer_func;
|
timer->timer_func = timer_func;
|
||||||
timer->timer_func_data = timer_func_data;
|
timer->timer_func_data = timer_func_data;
|
||||||
/* at most 5 "expiry in the past" log messages per hour */
|
/* at most 5 "expiry in the past" log messages per hour */
|
||||||
ratelimit_init(&libinput->timer.expiry_in_past_limit, s2us(60 * 60), 5);
|
ratelimit_init(&libinput->timer.expiry_in_past_limit, usec_from_hours(1), 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -66,16 +66,15 @@ libinput_timer_arm_timer_fd(struct libinput *libinput)
|
||||||
int r;
|
int r;
|
||||||
struct libinput_timer *timer;
|
struct libinput_timer *timer;
|
||||||
struct itimerspec its = { { 0, 0 }, { 0, 0 } };
|
struct itimerspec its = { { 0, 0 }, { 0, 0 } };
|
||||||
uint64_t earliest_expire = UINT64_MAX;
|
usec_t earliest_expire = usec_from_uint64_t(UINT64_MAX);
|
||||||
|
|
||||||
list_for_each(timer, &libinput->timer.list, link) {
|
list_for_each(timer, &libinput->timer.list, link) {
|
||||||
if (timer->expire < earliest_expire)
|
if (usec_cmp(timer->expire, earliest_expire) < 0)
|
||||||
earliest_expire = timer->expire;
|
earliest_expire = timer->expire;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (earliest_expire != UINT64_MAX) {
|
if (usec_ne(earliest_expire, UINT64_MAX)) {
|
||||||
its.it_value.tv_sec = earliest_expire / ms2us(1000);
|
its.it_value = usec_to_timespec(earliest_expire);
|
||||||
its.it_value.tv_nsec = (earliest_expire % ms2us(1000)) * 1000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
r = timerfd_settime(libinput->timer.fd, TFD_TIMER_ABSTIME, &its, NULL);
|
r = timerfd_settime(libinput->timer.fd, TFD_TIMER_ABSTIME, &its, NULL);
|
||||||
|
|
@ -88,33 +87,38 @@ libinput_timer_arm_timer_fd(struct libinput *libinput)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
libinput_timer_set_flags(struct libinput_timer *timer, uint64_t expire, uint32_t flags)
|
libinput_timer_set_flags(struct libinput_timer *timer, usec_t expire, uint32_t flags)
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
/* We only warn if we're more than 20ms behind */
|
/* We only warn if we're more than 20ms behind */
|
||||||
const uint64_t timer_warning_limit = ms2us(20);
|
const usec_t timer_warning_limit = usec_from_millis(20);
|
||||||
uint64_t now = libinput_now(timer->libinput);
|
usec_t now = libinput_now(timer->libinput);
|
||||||
if (expire < now) {
|
if (usec_cmp(expire, now) < 0) {
|
||||||
|
usec_t tdelta = usec_delta(now, expire);
|
||||||
if ((flags & TIMER_FLAG_ALLOW_NEGATIVE) == 0 &&
|
if ((flags & TIMER_FLAG_ALLOW_NEGATIVE) == 0 &&
|
||||||
now - expire > timer_warning_limit)
|
usec_cmp(tdelta, timer_warning_limit) > 0)
|
||||||
log_bug_client_ratelimit(
|
log_bug_client_ratelimit(
|
||||||
timer->libinput,
|
timer->libinput,
|
||||||
&timer->libinput->timer.expiry_in_past_limit,
|
&timer->libinput->timer.expiry_in_past_limit,
|
||||||
"timer %s: scheduled expiry is in the past (-%dms), your system is too slow\n",
|
"timer %s: scheduled expiry is in the past (-%dms), your system is too slow\n",
|
||||||
timer->timer_name,
|
timer->timer_name,
|
||||||
us2ms(now - expire));
|
usec_to_millis(tdelta));
|
||||||
} else if ((expire - now) > ms2us(5000)) {
|
} else {
|
||||||
log_bug_libinput(timer->libinput,
|
usec_t tdelta = usec_delta(expire, now);
|
||||||
"timer %s: offset more than 5s, now %d expire %d\n",
|
if (usec_cmp(tdelta, usec_from_millis(5000)) > 0) {
|
||||||
timer->timer_name,
|
log_bug_libinput(
|
||||||
us2ms(now),
|
timer->libinput,
|
||||||
us2ms(expire));
|
"timer %s: offset more than 5s, now %d expire %d\n",
|
||||||
|
timer->timer_name,
|
||||||
|
usec_to_millis(now),
|
||||||
|
usec_to_millis(expire));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
assert(expire);
|
assert(usec_ne(expire, 0));
|
||||||
|
|
||||||
if (!timer->expire)
|
if (usec_is_zero(timer->expire))
|
||||||
list_insert(&timer->libinput->timer.list, &timer->link);
|
list_insert(&timer->libinput->timer.list, &timer->link);
|
||||||
|
|
||||||
timer->expire = expire;
|
timer->expire = expire;
|
||||||
|
|
@ -122,7 +126,7 @@ libinput_timer_set_flags(struct libinput_timer *timer, uint64_t expire, uint32_t
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
libinput_timer_set(struct libinput_timer *timer, uint64_t expire)
|
libinput_timer_set(struct libinput_timer *timer, usec_t expire)
|
||||||
{
|
{
|
||||||
libinput_timer_set_flags(timer, expire, TIMER_FLAG_NONE);
|
libinput_timer_set_flags(timer, expire, TIMER_FLAG_NONE);
|
||||||
}
|
}
|
||||||
|
|
@ -130,25 +134,25 @@ libinput_timer_set(struct libinput_timer *timer, uint64_t expire)
|
||||||
void
|
void
|
||||||
libinput_timer_cancel(struct libinput_timer *timer)
|
libinput_timer_cancel(struct libinput_timer *timer)
|
||||||
{
|
{
|
||||||
if (!timer->expire)
|
if (usec_is_zero(timer->expire))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
timer->expire = 0;
|
timer->expire = usec_from_uint64_t(0);
|
||||||
list_remove(&timer->link);
|
list_remove(&timer->link);
|
||||||
libinput_timer_arm_timer_fd(timer->libinput);
|
libinput_timer_arm_timer_fd(timer->libinput);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
libinput_timer_handler(struct libinput *libinput, uint64_t now)
|
libinput_timer_handler(struct libinput *libinput, usec_t now)
|
||||||
{
|
{
|
||||||
struct libinput_timer *timer;
|
struct libinput_timer *timer;
|
||||||
|
|
||||||
restart:
|
restart:
|
||||||
list_for_each_safe(timer, &libinput->timer.list, link) {
|
list_for_each_safe(timer, &libinput->timer.list, link) {
|
||||||
if (timer->expire == 0)
|
if (usec_is_zero(timer->expire))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (timer->expire <= now) {
|
if (usec_cmp(timer->expire, now) <= 0) {
|
||||||
/* Clear the timer before calling timer_func,
|
/* Clear the timer before calling timer_func,
|
||||||
as timer_func may re-arm it */
|
as timer_func may re-arm it */
|
||||||
libinput_timer_cancel(timer);
|
libinput_timer_cancel(timer);
|
||||||
|
|
@ -171,7 +175,7 @@ static void
|
||||||
libinput_timer_dispatch(void *data)
|
libinput_timer_dispatch(void *data)
|
||||||
{
|
{
|
||||||
struct libinput *libinput = data;
|
struct libinput *libinput = data;
|
||||||
uint64_t now;
|
usec_t now;
|
||||||
uint64_t discard;
|
uint64_t discard;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|
@ -183,7 +187,7 @@ libinput_timer_dispatch(void *data)
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
|
||||||
now = libinput_now(libinput);
|
now = libinput_now(libinput);
|
||||||
if (now == 0)
|
if (usec_is_zero(now))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
libinput_timer_handler(libinput, now);
|
libinput_timer_handler(libinput, now);
|
||||||
|
|
@ -243,23 +247,24 @@ libinput_timer_subsys_destroy(struct libinput *libinput)
|
||||||
* before this time. If so, trigger the timer func.
|
* before this time. If so, trigger the timer func.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
libinput_timer_flush(struct libinput *libinput, uint64_t now)
|
libinput_timer_flush(struct libinput *libinput, usec_t now)
|
||||||
{
|
{
|
||||||
if (libinput->timer.next_expiry == 0 || libinput->timer.next_expiry > now)
|
if (usec_is_zero(libinput->timer.next_expiry) ||
|
||||||
|
usec_cmp(libinput->timer.next_expiry, now) > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
libinput_timer_handler(libinput, now);
|
libinput_timer_handler(libinput, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
usec_t
|
||||||
libinput_now(struct libinput *libinput)
|
libinput_now(struct libinput *libinput)
|
||||||
{
|
{
|
||||||
uint64_t now;
|
usec_t now;
|
||||||
int rc = now_in_us(&now);
|
int rc = now_in_us(&now);
|
||||||
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
log_error(libinput, "clock_gettime failed: %s\n", strerror(-rc));
|
log_error(libinput, "clock_gettime failed: %s\n", strerror(-rc));
|
||||||
return 0;
|
return usec_from_uint64_t(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return now;
|
return now;
|
||||||
|
|
|
||||||
14
src/timer.h
14
src/timer.h
|
|
@ -36,8 +36,8 @@ struct libinput_timer {
|
||||||
struct libinput *libinput;
|
struct libinput *libinput;
|
||||||
char *timer_name;
|
char *timer_name;
|
||||||
struct list link;
|
struct list link;
|
||||||
uint64_t expire; /* in absolute us CLOCK_MONOTONIC */
|
usec_t expire; /* in absolute us CLOCK_MONOTONIC */
|
||||||
void (*timer_func)(uint64_t now, void *timer_func_data);
|
void (*timer_func)(usec_t now, void *timer_func_data);
|
||||||
void *timer_func_data;
|
void *timer_func_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ void
|
||||||
libinput_timer_init(struct libinput_timer *timer,
|
libinput_timer_init(struct libinput_timer *timer,
|
||||||
struct libinput *libinput,
|
struct libinput *libinput,
|
||||||
const char *timer_name,
|
const char *timer_name,
|
||||||
void (*timer_func)(uint64_t now, void *timer_func_data),
|
void (*timer_func)(usec_t now, void *timer_func_data),
|
||||||
void *timer_func_data);
|
void *timer_func_data);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -53,7 +53,7 @@ libinput_timer_destroy(struct libinput_timer *timer);
|
||||||
|
|
||||||
/* Set timer expire time, in absolute us CLOCK_MONOTONIC */
|
/* Set timer expire time, in absolute us CLOCK_MONOTONIC */
|
||||||
void
|
void
|
||||||
libinput_timer_set(struct libinput_timer *timer, uint64_t expire);
|
libinput_timer_set(struct libinput_timer *timer, usec_t expire);
|
||||||
|
|
||||||
enum timer_flags {
|
enum timer_flags {
|
||||||
TIMER_FLAG_NONE = 0,
|
TIMER_FLAG_NONE = 0,
|
||||||
|
|
@ -61,7 +61,7 @@ enum timer_flags {
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
libinput_timer_set_flags(struct libinput_timer *timer, uint64_t expire, uint32_t flags);
|
libinput_timer_set_flags(struct libinput_timer *timer, usec_t expire, uint32_t flags);
|
||||||
|
|
||||||
void
|
void
|
||||||
libinput_timer_cancel(struct libinput_timer *timer);
|
libinput_timer_cancel(struct libinput_timer *timer);
|
||||||
|
|
@ -73,9 +73,9 @@ void
|
||||||
libinput_timer_subsys_destroy(struct libinput *libinput);
|
libinput_timer_subsys_destroy(struct libinput *libinput);
|
||||||
|
|
||||||
void
|
void
|
||||||
libinput_timer_flush(struct libinput *libinput, uint64_t now);
|
libinput_timer_flush(struct libinput *libinput, usec_t now);
|
||||||
|
|
||||||
uint64_t
|
usec_t
|
||||||
libinput_now(struct libinput *libinput);
|
libinput_now(struct libinput *libinput);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,10 @@
|
||||||
#include "util-time.h"
|
#include "util-time.h"
|
||||||
|
|
||||||
static inline struct input_event
|
static inline struct input_event
|
||||||
input_event_init(uint64_t time, unsigned int type, unsigned int code, int value)
|
input_event_init(usec_t time, unsigned int type, unsigned int code, int value)
|
||||||
{
|
{
|
||||||
struct input_event ev;
|
struct input_event ev;
|
||||||
struct timeval tval = us2tv(time);
|
struct timeval tval = usec_to_timeval(time);
|
||||||
|
|
||||||
ev.input_event_sec = tval.tv_sec;
|
ev.input_event_sec = tval.tv_sec;
|
||||||
ev.input_event_usec = tval.tv_usec;
|
ev.input_event_usec = tval.tv_usec;
|
||||||
|
|
@ -49,7 +49,7 @@ input_event_init(uint64_t time, unsigned int type, unsigned int code, int value)
|
||||||
return ev;
|
return ev;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t
|
static inline usec_t
|
||||||
input_event_time(const struct input_event *e)
|
input_event_time(const struct input_event *e)
|
||||||
{
|
{
|
||||||
struct timeval tval;
|
struct timeval tval;
|
||||||
|
|
@ -57,13 +57,13 @@ input_event_time(const struct input_event *e)
|
||||||
tval.tv_sec = e->input_event_sec;
|
tval.tv_sec = e->input_event_sec;
|
||||||
tval.tv_usec = e->input_event_usec;
|
tval.tv_usec = e->input_event_usec;
|
||||||
|
|
||||||
return tv2us(&tval);
|
return usec_from_timeval(&tval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
input_event_set_time(struct input_event *e, uint64_t time)
|
input_event_set_time(struct input_event *e, usec_t time)
|
||||||
{
|
{
|
||||||
struct timeval tval = us2tv(time);
|
struct timeval tval = usec_to_timeval(time);
|
||||||
|
|
||||||
e->input_event_sec = tval.tv_sec;
|
e->input_event_sec = tval.tv_sec;
|
||||||
e->input_event_usec = tval.tv_usec;
|
e->input_event_usec = tval.tv_usec;
|
||||||
|
|
|
||||||
|
|
@ -976,6 +976,9 @@ print_switch_event(struct libinput_event *ev, const struct libinput_print_option
|
||||||
case LIBINPUT_SWITCH_TABLET_MODE:
|
case LIBINPUT_SWITCH_TABLET_MODE:
|
||||||
which = "tablet-mode";
|
which = "tablet-mode";
|
||||||
break;
|
break;
|
||||||
|
case LIBINPUT_SWITCH_KEYPAD_SLIDE:
|
||||||
|
which = "keypad-slide";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "util-macros.h"
|
#include "util-macros.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -40,9 +42,9 @@
|
||||||
* - int foo(foo f);
|
* - int foo(foo f);
|
||||||
* - foo_t foo_from_int(int);
|
* - foo_t foo_from_int(int);
|
||||||
* - foo_t foo_copy(foo_t f);
|
* - foo_t foo_copy(foo_t f);
|
||||||
* - foo_t foo_min(foo_t a, foo b);
|
* - foo_t foo_min(foo_t a, foo_t b);
|
||||||
* - foo_t foo_max(foo_t a, foo b);
|
* - foo_t foo_max(foo_t a, foo_t b);
|
||||||
* - foo_t foo_cmp(foo_t a, foo b);
|
* - int foo_cmp(foo_t a, foo_t b);
|
||||||
* - bool foo_eq(foo_t a, int b);
|
* - bool foo_eq(foo_t a, int b);
|
||||||
* - bool foo_ne(foo_t a, int b);
|
* - bool foo_ne(foo_t a, int b);
|
||||||
* - bool foo_le(foo_t a, int b);
|
* - bool foo_le(foo_t a, int b);
|
||||||
|
|
@ -102,10 +104,10 @@
|
||||||
static inline int name_##_cmp(name_##_t a, name_##_t b) { \
|
static inline int name_##_cmp(name_##_t a, name_##_t b) { \
|
||||||
return a.v < b.v ? -1 : (a.v > b.v ? 1 : 0); \
|
return a.v < b.v ? -1 : (a.v > b.v ? 1 : 0); \
|
||||||
}; \
|
}; \
|
||||||
static inline int name_##_eq(name_##_t a, type_ b) { return a.v == b; }\
|
static inline bool name_##_eq(name_##_t a, type_ b) { return a.v == b; }\
|
||||||
static inline int name_##_ne(name_##_t a, type_ b) { return a.v != b; }\
|
static inline bool name_##_ne(name_##_t a, type_ b) { return a.v != b; }\
|
||||||
static inline int name_##_le(name_##_t a, type_ b) { return a.v <= b; }\
|
static inline bool name_##_le(name_##_t a, type_ b) { return a.v <= b; }\
|
||||||
static inline int name_##_lt(name_##_t a, type_ b) { return a.v < b; }\
|
static inline bool name_##_lt(name_##_t a, type_ b) { return a.v < b; }\
|
||||||
static inline int name_##_ge(name_##_t a, type_ b) { return a.v >= b; }\
|
static inline bool name_##_ge(name_##_t a, type_ b) { return a.v >= b; }\
|
||||||
static inline int name_##_gt(name_##_t a, type_ b) { return a.v > b; }\
|
static inline bool name_##_gt(name_##_t a, type_ b) { return a.v > b; }\
|
||||||
struct __useless_struct_to_allow_trailing_semicolon__
|
struct __useless_struct_to_allow_trailing_semicolon__
|
||||||
|
|
|
||||||
|
|
@ -471,8 +471,14 @@ parse_input_prop_property(const char *prop,
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
int val = libevdev_property_from_name(s);
|
int val = libevdev_property_from_name(s);
|
||||||
if (val == -1)
|
if (val == -1) {
|
||||||
goto out;
|
/* Remove once we require libevdev 1.13.6 */
|
||||||
|
if (streq(s, "INPUT_PROP_PRESSUREPAD")) {
|
||||||
|
val = INPUT_PROP_PRESSUREPAD;
|
||||||
|
} else {
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
prop = (unsigned int)val;
|
prop = (unsigned int)val;
|
||||||
}
|
}
|
||||||
props[idx].prop = prop;
|
props[idx].prop = prop;
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,10 @@
|
||||||
#include "util-time.h"
|
#include "util-time.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
ratelimit_init(struct ratelimit *r, uint64_t ival_us, unsigned int burst)
|
ratelimit_init(struct ratelimit *r, usec_t ival_us, unsigned int burst)
|
||||||
{
|
{
|
||||||
r->interval = ival_us;
|
r->interval = ival_us;
|
||||||
r->begin = 0;
|
r->begin = usec_from_millis(0);
|
||||||
r->burst = burst;
|
r->burst = burst;
|
||||||
r->num = 0;
|
r->num = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -56,15 +56,15 @@ enum ratelimit_state
|
||||||
ratelimit_test(struct ratelimit *r)
|
ratelimit_test(struct ratelimit *r)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
uint64_t utime;
|
|
||||||
|
|
||||||
if (r->interval <= 0 || r->burst <= 0)
|
if (usec_is_zero(r->interval) || r->burst <= 0)
|
||||||
return RATELIMIT_PASS;
|
return RATELIMIT_PASS;
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
utime = s2us(ts.tv_sec) + ns2us(ts.tv_nsec);
|
usec_t utime = usec_from_timespec(&ts);
|
||||||
|
|
||||||
if (r->begin <= 0 || r->begin + r->interval < utime) {
|
if (usec_is_zero(r->begin) ||
|
||||||
|
usec_cmp(usec_add(r->begin, r->interval), utime) < 0) {
|
||||||
/* reset counter */
|
/* reset counter */
|
||||||
r->begin = utime;
|
r->begin = utime;
|
||||||
r->num = 1;
|
r->num = 1;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "util-time.h"
|
||||||
|
|
||||||
enum ratelimit_state {
|
enum ratelimit_state {
|
||||||
RATELIMIT_EXCEEDED,
|
RATELIMIT_EXCEEDED,
|
||||||
RATELIMIT_THRESHOLD,
|
RATELIMIT_THRESHOLD,
|
||||||
|
|
@ -35,13 +37,13 @@ enum ratelimit_state {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ratelimit {
|
struct ratelimit {
|
||||||
uint64_t interval;
|
usec_t interval;
|
||||||
uint64_t begin;
|
usec_t begin;
|
||||||
unsigned int burst;
|
unsigned int burst;
|
||||||
unsigned int num;
|
unsigned int num;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
ratelimit_init(struct ratelimit *r, uint64_t ival_us, unsigned int burst);
|
ratelimit_init(struct ratelimit *r, usec_t ival_us, unsigned int burst);
|
||||||
enum ratelimit_state
|
enum ratelimit_state
|
||||||
ratelimit_test(struct ratelimit *r);
|
ratelimit_test(struct ratelimit *r);
|
||||||
|
|
|
||||||
230
src/util-time.h
230
src/util-time.h
|
|
@ -28,11 +28,153 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "util-macros.h"
|
#include "util-macros.h"
|
||||||
|
#include "util-newtype.h"
|
||||||
|
|
||||||
|
DECLARE_NEWTYPE(usec, uint64_t);
|
||||||
|
|
||||||
|
static inline usec_t
|
||||||
|
usec_from_millis(uint32_t millis)
|
||||||
|
{
|
||||||
|
return usec_from_uint64_t(millis * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline usec_t
|
||||||
|
usec_from_seconds(uint32_t secs)
|
||||||
|
{
|
||||||
|
return usec_from_millis(secs * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline usec_t
|
||||||
|
usec_from_hours(uint32_t hours)
|
||||||
|
{
|
||||||
|
return usec_from_seconds(hours * 3600);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t
|
||||||
|
usec_to_millis(usec_t us)
|
||||||
|
{
|
||||||
|
return usec_as_uint64_t(us) / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t
|
||||||
|
usec_to_seconds(usec_t us)
|
||||||
|
{
|
||||||
|
return usec_as_uint64_t(us) / 1000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t
|
||||||
|
usec_to_minutes(usec_t us)
|
||||||
|
{
|
||||||
|
return usec_to_seconds(us) / 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t
|
||||||
|
usec_to_hours(usec_t us)
|
||||||
|
{
|
||||||
|
return usec_to_minutes(us) / 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline usec_t
|
||||||
|
usec_add_millis(usec_t us, uint32_t millis)
|
||||||
|
{
|
||||||
|
return usec_from_uint64_t(usec_as_uint64_t(us) + millis * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline usec_t
|
||||||
|
usec_delta(usec_t later, usec_t earlier)
|
||||||
|
{
|
||||||
|
return usec_from_uint64_t(later.v - earlier.v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline double
|
||||||
|
us2ms_f(usec_t us)
|
||||||
|
{
|
||||||
|
return (double)usec_as_uint64_t(us) / 1000.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline usec_t
|
||||||
|
usec_from_timeval(const struct timeval *tv)
|
||||||
|
{
|
||||||
|
return usec_from_uint64_t(tv->tv_sec * 1000000 + tv->tv_usec);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline usec_t
|
||||||
|
usec_from_timespec(const struct timespec *tp)
|
||||||
|
{
|
||||||
|
return usec_from_uint64_t(tp->tv_sec * 1000000 + tp->tv_nsec / 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline usec_t
|
||||||
|
usec_from_now(void)
|
||||||
|
{
|
||||||
|
struct timespec ts = { 0, 0 };
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
|
||||||
|
return usec_from_timespec(&ts);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct timeval
|
||||||
|
usec_to_timeval(usec_t time)
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
uint64_t time_us = usec_as_uint64_t(time);
|
||||||
|
uint64_t one_sec_us = usec_as_uint64_t(usec_from_millis(1000));
|
||||||
|
|
||||||
|
tv.tv_sec = time_us / one_sec_us;
|
||||||
|
tv.tv_usec = time_us % one_sec_us;
|
||||||
|
|
||||||
|
return tv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct timespec
|
||||||
|
usec_to_timespec(usec_t time)
|
||||||
|
{
|
||||||
|
struct timespec ts;
|
||||||
|
uint64_t time_us = usec_as_uint64_t(time);
|
||||||
|
uint64_t one_sec_us = usec_as_uint64_t(usec_from_millis(1000));
|
||||||
|
|
||||||
|
ts.tv_sec = time_us / one_sec_us;
|
||||||
|
ts.tv_nsec = (time_us % one_sec_us) * 1000;
|
||||||
|
|
||||||
|
return ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline usec_t
|
||||||
|
usec_add(usec_t a, usec_t b)
|
||||||
|
{
|
||||||
|
return usec_from_uint64_t(usec_as_uint64_t(a) + usec_as_uint64_t(b));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline usec_t
|
||||||
|
usec_sub(usec_t a, usec_t b)
|
||||||
|
{
|
||||||
|
return usec_from_uint64_t(usec_as_uint64_t(a) - usec_as_uint64_t(b));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline usec_t
|
||||||
|
usec_div(usec_t a, uint64_t b)
|
||||||
|
{
|
||||||
|
return usec_from_uint64_t(usec_as_uint64_t(a) / b);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline usec_t
|
||||||
|
usec_mul(usec_t a, double b)
|
||||||
|
{
|
||||||
|
return usec_from_uint64_t(usec_as_uint64_t(a) * b);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
usec_is_zero(usec_t a)
|
||||||
|
{
|
||||||
|
return usec_as_uint64_t(a) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
msleep(unsigned int ms)
|
msleep(unsigned int ms)
|
||||||
|
|
@ -40,94 +182,18 @@ msleep(unsigned int ms)
|
||||||
usleep(ms * 1000);
|
usleep(ms * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t
|
|
||||||
us(uint64_t us)
|
|
||||||
{
|
|
||||||
return us;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint64_t
|
|
||||||
ns2us(uint64_t ns)
|
|
||||||
{
|
|
||||||
return us(ns / 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint64_t
|
|
||||||
ms2us(uint64_t ms)
|
|
||||||
{
|
|
||||||
return us(ms * 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint32_t
|
|
||||||
ms2s(uint64_t ms)
|
|
||||||
{
|
|
||||||
return ms / 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint64_t
|
|
||||||
s2us(uint64_t s)
|
|
||||||
{
|
|
||||||
return ms2us(s * 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint64_t
|
|
||||||
h2us(uint64_t h)
|
|
||||||
{
|
|
||||||
return s2us(h * 3600);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint32_t
|
|
||||||
us2ms(uint64_t us)
|
|
||||||
{
|
|
||||||
return (uint32_t)(us / 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint32_t
|
|
||||||
us2s(uint64_t us)
|
|
||||||
{
|
|
||||||
return ms2s(us2ms(us));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline double
|
|
||||||
us2ms_f(uint64_t us)
|
|
||||||
{
|
|
||||||
return (double)us / 1000.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint64_t
|
|
||||||
tv2us(const struct timeval *tv)
|
|
||||||
{
|
|
||||||
return s2us(tv->tv_sec) + tv->tv_usec;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint64_t
|
|
||||||
tp2us(const struct timespec *tp)
|
|
||||||
{
|
|
||||||
return s2us(tp->tv_sec) + ns2us(tp->tv_nsec);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct timeval
|
|
||||||
us2tv(uint64_t time)
|
|
||||||
{
|
|
||||||
struct timeval tv;
|
|
||||||
|
|
||||||
tv.tv_sec = time / ms2us(1000);
|
|
||||||
tv.tv_usec = time % ms2us(1000);
|
|
||||||
|
|
||||||
return tv;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
now_in_us(uint64_t *us)
|
now_in_us(usec_t *us)
|
||||||
{
|
{
|
||||||
struct timespec ts = { 0, 0 };
|
struct timespec ts = { 0, 0 };
|
||||||
|
|
||||||
if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
|
if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
|
||||||
*us = 0;
|
*us = usec_from_uint64_t(0);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
*us = s2us(ts.tv_sec) + ns2us(ts.tv_nsec);
|
*us = usec_from_timespec(&ts);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -140,7 +206,7 @@ struct human_time {
|
||||||
* Converts a time delta in µs to a human-readable time like "2h" or "4d"
|
* Converts a time delta in µs to a human-readable time like "2h" or "4d"
|
||||||
*/
|
*/
|
||||||
static inline struct human_time
|
static inline struct human_time
|
||||||
to_human_time(uint64_t us)
|
to_human_time(usec_t us)
|
||||||
{
|
{
|
||||||
struct human_time t;
|
struct human_time t;
|
||||||
struct c {
|
struct c {
|
||||||
|
|
@ -151,7 +217,7 @@ to_human_time(uint64_t us)
|
||||||
{ "us", 1, 5000 }, { "ms", 1000, 5000 }, { "s", 1000, 120 },
|
{ "us", 1, 5000 }, { "ms", 1000, 5000 }, { "s", 1000, 120 },
|
||||||
{ "min", 60, 120 }, { "h", 60, 48 }, { "d", 24, ~0 },
|
{ "min", 60, 120 }, { "h", 60, 48 }, { "d", 24, ~0 },
|
||||||
};
|
};
|
||||||
uint64_t value = us;
|
uint64_t value = usec_as_uint64_t(us);
|
||||||
|
|
||||||
ARRAY_FOR_EACH(conversion, c) {
|
ARRAY_FOR_EACH(conversion, c) {
|
||||||
value = value / c->change_from_previous;
|
value = value / c->change_from_previous;
|
||||||
|
|
|
||||||
56
test/litest-device-keypad-slide-switch.c
Normal file
56
test/litest-device-keypad-slide-switch.c
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2025 Sicelo A. Mhlongo <absicsz@gmail.com>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice (including the next
|
||||||
|
* paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
* Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "litest-int.h"
|
||||||
|
#include "litest.h"
|
||||||
|
|
||||||
|
static struct input_id input_id = {
|
||||||
|
.bustype = 0x19,
|
||||||
|
.vendor = 0x0,
|
||||||
|
.product = 0x5,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* clang-format off */
|
||||||
|
static int events[] = {
|
||||||
|
EV_SW, SW_KEYPAD_SLIDE,
|
||||||
|
EV_SW, SW_CAMERA_LENS_COVER,
|
||||||
|
EV_KEY, KEY_CAMERA_FOCUS,
|
||||||
|
-1, -1,
|
||||||
|
};
|
||||||
|
/* clang-format on */
|
||||||
|
|
||||||
|
TEST_DEVICE(LITEST_KEYPAD_SLIDE_SWITCH,
|
||||||
|
.features = LITEST_SWITCH,
|
||||||
|
.interface = NULL,
|
||||||
|
|
||||||
|
.name = "Keypad Slide Switch",
|
||||||
|
.id = &input_id,
|
||||||
|
.events = events,
|
||||||
|
.absinfo = NULL,
|
||||||
|
|
||||||
|
.udev_properties = {
|
||||||
|
{ "ID_INPUT_SWITCH", "1" },
|
||||||
|
{ NULL },
|
||||||
|
}, )
|
||||||
|
|
@ -79,8 +79,8 @@ struct litest_runner_test {
|
||||||
int timerfd;
|
int timerfd;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint64_t start_millis;
|
usec_t start_usec;
|
||||||
uint64_t end_millis;
|
usec_t end_usec;
|
||||||
} times;
|
} times;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ struct litest_runner {
|
||||||
struct {
|
struct {
|
||||||
time_t start;
|
time_t start;
|
||||||
time_t end;
|
time_t end;
|
||||||
uint64_t start_millis;
|
usec_t start_usec;
|
||||||
} times;
|
} times;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -123,7 +123,8 @@ static void
|
||||||
close_pipes(int fds[_FD_LAST])
|
close_pipes(int fds[_FD_LAST])
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _FD_LAST; i++) {
|
for (int i = 0; i < _FD_LAST; i++) {
|
||||||
fsync(fds[i]);
|
if (fds[i] != -1)
|
||||||
|
fsync(fds[i]);
|
||||||
xclose(&fds[i]);
|
xclose(&fds[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -441,9 +442,9 @@ litest_runner_test_collect_child(struct litest_runner_test *t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t now = 0;
|
usec_t now = usec_from_uint64_t(0);
|
||||||
now_in_us(&now);
|
now_in_us(&now);
|
||||||
t->times.end_millis = us2ms(now);
|
t->times.end_usec = now;
|
||||||
|
|
||||||
if (RUNNING_ON_VALGRIND) {
|
if (RUNNING_ON_VALGRIND) {
|
||||||
_autofree_ char *filename = valgrind_logfile(t->pid);
|
_autofree_ char *filename = valgrind_logfile(t->pid);
|
||||||
|
|
@ -627,9 +628,9 @@ litest_runner_run_test(struct litest_runner *runner, struct litest_runner_test *
|
||||||
|
|
||||||
t->result = LITEST_SYSTEM_ERROR;
|
t->result = LITEST_SYSTEM_ERROR;
|
||||||
|
|
||||||
uint64_t now = 0;
|
usec_t now = usec_from_uint64_t(0);
|
||||||
now_in_us(&now);
|
now_in_us(&now);
|
||||||
t->times.start_millis = us2ms(now);
|
t->times.start_usec = now;
|
||||||
|
|
||||||
if (runner->max_forks == 0) {
|
if (runner->max_forks == 0) {
|
||||||
if (use_jmpbuf && setjmp(jmpbuf) == 0) {
|
if (use_jmpbuf && setjmp(jmpbuf) == 0) {
|
||||||
|
|
@ -771,12 +772,14 @@ litest_runner_log_test_result(struct litest_runner *runner,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usec_t delta = usec_delta(t->times.end_usec, t->times.start_usec);
|
||||||
|
usec_t total_delta = usec_delta(t->times.end_usec, runner->times.start_usec);
|
||||||
fprintf(runner->fp,
|
fprintf(runner->fp,
|
||||||
" duration: %" PRIu64 " # (ms), total test run time: %02" PRIu32
|
" duration: %d # (ms), total test run time: %02" PRIu32
|
||||||
":%02" PRIu32 "\n",
|
":%02" PRIu32 "\n",
|
||||||
t->times.end_millis - t->times.start_millis,
|
usec_to_millis(delta),
|
||||||
(ms2s(t->times.end_millis - runner->times.start_millis)) / 60,
|
usec_to_minutes(total_delta),
|
||||||
(ms2s(t->times.end_millis - runner->times.start_millis)) % 60);
|
usec_to_seconds(total_delta) % 60);
|
||||||
|
|
||||||
status = litest_runner_result_as_str(t->result);
|
status = litest_runner_result_as_str(t->result);
|
||||||
fprintf(runner->fp,
|
fprintf(runner->fp,
|
||||||
|
|
@ -920,9 +923,9 @@ litest_runner_check_finished_tests(struct litest_runner *runner)
|
||||||
if (r == -EAGAIN)
|
if (r == -EAGAIN)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint64_t now = 0;
|
usec_t now = usec_from_uint64_t(0);
|
||||||
now_in_us(&now);
|
now_in_us(&now);
|
||||||
running->times.end_millis = us2ms(now);
|
running->times.end_usec = now;
|
||||||
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
litest_runner_test_update_errno(running, -r);
|
litest_runner_test_update_errno(running, -r);
|
||||||
|
|
@ -984,10 +987,10 @@ litest_runner_run_tests(struct litest_runner *runner)
|
||||||
|
|
||||||
setup_sighandler(SIGINT);
|
setup_sighandler(SIGINT);
|
||||||
|
|
||||||
uint64_t now = 0;
|
usec_t now = usec_from_uint64_t(0);
|
||||||
now_in_us(&now);
|
now_in_us(&now);
|
||||||
|
|
||||||
runner->times.start_millis = us2ms(now);
|
runner->times.start_usec = now;
|
||||||
runner->times.start = time(NULL);
|
runner->times.start = time(NULL);
|
||||||
ltime = localtime(&runner->times.start);
|
ltime = localtime(&runner->times.start);
|
||||||
strftime(timestamp, sizeof(timestamp), "%FT%H:%M", ltime);
|
strftime(timestamp, sizeof(timestamp), "%FT%H:%M", ltime);
|
||||||
|
|
|
||||||
|
|
@ -3323,6 +3323,9 @@ litest_switch_action(struct litest_device *dev,
|
||||||
case LIBINPUT_SWITCH_TABLET_MODE:
|
case LIBINPUT_SWITCH_TABLET_MODE:
|
||||||
code = SW_TABLET_MODE;
|
code = SW_TABLET_MODE;
|
||||||
break;
|
break;
|
||||||
|
case LIBINPUT_SWITCH_KEYPAD_SLIDE:
|
||||||
|
code = SW_KEYPAD_SLIDE;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
litest_abort_msg("Invalid switch %d", sw);
|
litest_abort_msg("Invalid switch %d", sw);
|
||||||
break;
|
break;
|
||||||
|
|
@ -3510,9 +3513,9 @@ _litest_wait_for_event_of_type(struct libinput *li, const char *func, int lineno
|
||||||
fds.revents = 0;
|
fds.revents = 0;
|
||||||
|
|
||||||
const int timeout = 2000;
|
const int timeout = 2000;
|
||||||
uint64_t expiry = 0;
|
usec_t expiry = usec_from_uint64_t(0);
|
||||||
int rc = now_in_us(&expiry);
|
int rc = now_in_us(&expiry);
|
||||||
expiry += ms2us(timeout);
|
expiry = usec_add_millis(expiry, timeout);
|
||||||
litest_assert_errno_success(rc);
|
litest_assert_errno_success(rc);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
@ -3527,9 +3530,9 @@ _litest_wait_for_event_of_type(struct libinput *li, const char *func, int lineno
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == LIBINPUT_EVENT_NONE) {
|
if (type == LIBINPUT_EVENT_NONE) {
|
||||||
uint64_t now;
|
usec_t now;
|
||||||
now_in_us(&now);
|
now_in_us(&now);
|
||||||
if (now > expiry) {
|
if (usec_cmp(now, expiry) > 0) {
|
||||||
_litest_abort_msg(
|
_litest_abort_msg(
|
||||||
NULL,
|
NULL,
|
||||||
lineno,
|
lineno,
|
||||||
|
|
|
||||||
|
|
@ -499,6 +499,7 @@ enum litest_device_type {
|
||||||
/* Switches */
|
/* Switches */
|
||||||
LITEST_LID_SWITCH,
|
LITEST_LID_SWITCH,
|
||||||
LITEST_LID_SWITCH_SURFACE3,
|
LITEST_LID_SWITCH_SURFACE3,
|
||||||
|
LITEST_KEYPAD_SLIDE_SWITCH,
|
||||||
LITEST_TABLET_MODE_UNRELIABLE,
|
LITEST_TABLET_MODE_UNRELIABLE,
|
||||||
|
|
||||||
/* Special devices */
|
/* Special devices */
|
||||||
|
|
|
||||||
|
|
@ -528,6 +528,12 @@ START_TEST(event_conversion_switch)
|
||||||
|
|
||||||
litest_switch_action(dev, LIBINPUT_SWITCH_LID, LIBINPUT_SWITCH_STATE_ON);
|
litest_switch_action(dev, LIBINPUT_SWITCH_LID, LIBINPUT_SWITCH_STATE_ON);
|
||||||
litest_switch_action(dev, LIBINPUT_SWITCH_LID, LIBINPUT_SWITCH_STATE_OFF);
|
litest_switch_action(dev, LIBINPUT_SWITCH_LID, LIBINPUT_SWITCH_STATE_OFF);
|
||||||
|
litest_switch_action(dev,
|
||||||
|
LIBINPUT_SWITCH_KEYPAD_SLIDE,
|
||||||
|
LIBINPUT_SWITCH_STATE_ON);
|
||||||
|
litest_switch_action(dev,
|
||||||
|
LIBINPUT_SWITCH_KEYPAD_SLIDE,
|
||||||
|
LIBINPUT_SWITCH_STATE_OFF);
|
||||||
litest_dispatch(li);
|
litest_dispatch(li);
|
||||||
|
|
||||||
while ((event = libinput_get_event(li))) {
|
while ((event = libinput_get_event(li))) {
|
||||||
|
|
@ -899,6 +905,7 @@ TEST_COLLECTION(misc)
|
||||||
litest_add_for_device(event_conversion_tablet, LITEST_WACOM_CINTIQ_12WX_PEN);
|
litest_add_for_device(event_conversion_tablet, LITEST_WACOM_CINTIQ_12WX_PEN);
|
||||||
litest_add_for_device(event_conversion_tablet_pad, LITEST_WACOM_INTUOS5_PAD);
|
litest_add_for_device(event_conversion_tablet_pad, LITEST_WACOM_INTUOS5_PAD);
|
||||||
litest_add_for_device(event_conversion_switch, LITEST_LID_SWITCH);
|
litest_add_for_device(event_conversion_switch, LITEST_LID_SWITCH);
|
||||||
|
litest_add_for_device(event_conversion_switch, LITEST_KEYPAD_SLIDE_SWITCH);
|
||||||
|
|
||||||
litest_add_deviceless(context_ref_counting);
|
litest_add_deviceless(context_ref_counting);
|
||||||
litest_add_deviceless(config_status_string);
|
litest_add_deviceless(config_status_string);
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,7 @@ START_TEST(lua_test_libinput_now)
|
||||||
LIBINPUT_PLUGIN_SYSTEM_FLAG_NONE);
|
LIBINPUT_PLUGIN_SYSTEM_FLAG_NONE);
|
||||||
litest_drain_events(li);
|
litest_drain_events(li);
|
||||||
|
|
||||||
uint64_t test_now;
|
usec_t test_now;
|
||||||
int rc = now_in_us(&test_now);
|
int rc = now_in_us(&test_now);
|
||||||
litest_assert_neg_errno_success(rc);
|
litest_assert_neg_errno_success(rc);
|
||||||
|
|
||||||
|
|
@ -290,10 +290,12 @@ START_TEST(lua_test_libinput_now)
|
||||||
|
|
||||||
uint64_t plugin_now = strtoull(tokens[1], NULL, 10);
|
uint64_t plugin_now = strtoull(tokens[1], NULL, 10);
|
||||||
|
|
||||||
litest_assert_int_le(plugin_now, test_now);
|
litest_assert_int_le(plugin_now, usec_as_uint64_t(test_now));
|
||||||
/* Even a slow test runner hopefully doesn't take >300ms to get to the
|
/* Even a slow test runner hopefully doesn't take >300ms to get to the
|
||||||
* log print */
|
* log print */
|
||||||
litest_assert_int_gt(plugin_now, test_now - ms2us(300));
|
litest_assert_int_gt(
|
||||||
|
plugin_now,
|
||||||
|
usec_as_uint64_t(usec_sub(test_now, usec_from_millis(300))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
@ -308,12 +310,12 @@ START_TEST(lua_test_libinput_timer)
|
||||||
_autofree_ char *timeout =
|
_autofree_ char *timeout =
|
||||||
strdup_printf("%s%" PRIu64,
|
strdup_printf("%s%" PRIu64,
|
||||||
streq(mode, "absolute") ? "libinput:now() + " : "",
|
streq(mode, "absolute") ? "libinput:now() + " : "",
|
||||||
ms2us(100));
|
usec_as_uint64_t(usec_from_millis(100)));
|
||||||
_autofree_ char *reschedule_timeout =
|
_autofree_ char *reschedule_timeout =
|
||||||
strdup_printf("libinput:timer_set_%s(%s%" PRIu64 ")\n",
|
strdup_printf("libinput:timer_set_%s(%s%" PRIu64 ")\n",
|
||||||
mode,
|
mode,
|
||||||
streq(mode, "absolute") ? "t + " : "",
|
streq(mode, "absolute") ? "t + " : "",
|
||||||
ms2us(100));
|
usec_as_uint64_t(usec_from_millis(100)));
|
||||||
_autofree_ char *lua = strdup_printf(
|
_autofree_ char *lua = strdup_printf(
|
||||||
"libinput:register({1})\n"
|
"libinput:register({1})\n"
|
||||||
"libinput:connect(\"timer-expired\",\n"
|
"libinput:connect(\"timer-expired\",\n"
|
||||||
|
|
@ -343,7 +345,7 @@ START_TEST(lua_test_libinput_timer)
|
||||||
msleep(100);
|
msleep(100);
|
||||||
libinput_dispatch(li);
|
libinput_dispatch(li);
|
||||||
|
|
||||||
uint64_t test_now;
|
usec_t test_now;
|
||||||
int rc = now_in_us(&test_now);
|
int rc = now_in_us(&test_now);
|
||||||
litest_assert_neg_errno_success(rc);
|
litest_assert_neg_errno_success(rc);
|
||||||
|
|
||||||
|
|
@ -358,10 +360,13 @@ START_TEST(lua_test_libinput_timer)
|
||||||
litest_assert_int_eq(nelem, 2U);
|
litest_assert_int_eq(nelem, 2U);
|
||||||
|
|
||||||
uint64_t plugin_now = strtoull(tokens[1], NULL, 10);
|
uint64_t plugin_now = strtoull(tokens[1], NULL, 10);
|
||||||
litest_assert_int_le(plugin_now, test_now);
|
litest_assert_int_le(plugin_now, usec_as_uint64_t(test_now));
|
||||||
/* Even a slow test runner hopefully doesn't take >300ms between
|
/* Even a slow test runner hopefully doesn't take >300ms between
|
||||||
* dispatch and now_in_us */
|
* dispatch and now_in_us */
|
||||||
litest_assert_int_gt(plugin_now, test_now - ms2us(300));
|
litest_assert_int_gt(
|
||||||
|
plugin_now,
|
||||||
|
usec_as_uint64_t(
|
||||||
|
usec_sub(test_now, usec_from_millis(300))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reschedule) {
|
if (!reschedule) {
|
||||||
|
|
@ -547,7 +552,7 @@ START_TEST(lua_frame_handler)
|
||||||
_destroy_(litest_device) *device = litest_add_device(li, LITEST_MOUSE);
|
_destroy_(litest_device) *device = litest_add_device(li, LITEST_MOUSE);
|
||||||
litest_drain_events(li);
|
litest_drain_events(li);
|
||||||
|
|
||||||
uint64_t before, after;
|
usec_t before, after;
|
||||||
now_in_us(&before);
|
now_in_us(&before);
|
||||||
msleep(1);
|
msleep(1);
|
||||||
litest_button_click_debounced(device, li, BTN_LEFT, 1);
|
litest_button_click_debounced(device, li, BTN_LEFT, 1);
|
||||||
|
|
@ -580,8 +585,8 @@ START_TEST(lua_frame_handler)
|
||||||
char *strtime = split[nelems - 1];
|
char *strtime = split[nelems - 1];
|
||||||
uint64_t timestamp = 0;
|
uint64_t timestamp = 0;
|
||||||
litest_assert(safe_atou64(strtime, ×tamp));
|
litest_assert(safe_atou64(strtime, ×tamp));
|
||||||
litest_assert_int_gt(timestamp, before);
|
litest_assert_int_gt(timestamp, usec_as_uint64_t(before));
|
||||||
litest_assert_int_lt(timestamp, after);
|
litest_assert_int_lt(timestamp, usec_as_uint64_t(after));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,20 @@ START_TEST(switch_has_tablet_mode_switch)
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(switch_has_keypad_slide_switch)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
|
||||||
|
if (!libevdev_has_event_code(dev->evdev, EV_SW, SW_KEYPAD_SLIDE))
|
||||||
|
return LITEST_NOT_APPLICABLE;
|
||||||
|
|
||||||
|
litest_assert_int_eq(
|
||||||
|
libinput_device_switch_has_switch(dev->libinput_device,
|
||||||
|
LIBINPUT_SWITCH_KEYPAD_SLIDE),
|
||||||
|
1);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
START_TEST(switch_toggle)
|
START_TEST(switch_toggle)
|
||||||
{
|
{
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
|
|
@ -638,6 +652,9 @@ START_TEST(switch_suspend_with_keyboard)
|
||||||
case LIBINPUT_SWITCH_TABLET_MODE:
|
case LIBINPUT_SWITCH_TABLET_MODE:
|
||||||
sw = litest_add_device(li, LITEST_THINKPAD_EXTRABUTTONS);
|
sw = litest_add_device(li, LITEST_THINKPAD_EXTRABUTTONS);
|
||||||
break;
|
break;
|
||||||
|
case LIBINPUT_SWITCH_KEYPAD_SLIDE:
|
||||||
|
sw = litest_add_device(li, LITEST_KEYPAD_SLIDE_SWITCH);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
@ -1352,13 +1369,20 @@ TEST_COLLECTION(switch)
|
||||||
litest_add(switch_has_cap, LITEST_SWITCH, LITEST_ANY);
|
litest_add(switch_has_cap, LITEST_SWITCH, LITEST_ANY);
|
||||||
litest_add(switch_has_lid_switch, LITEST_SWITCH, LITEST_ANY);
|
litest_add(switch_has_lid_switch, LITEST_SWITCH, LITEST_ANY);
|
||||||
litest_add(switch_has_tablet_mode_switch, LITEST_SWITCH, LITEST_ANY);
|
litest_add(switch_has_tablet_mode_switch, LITEST_SWITCH, LITEST_ANY);
|
||||||
|
litest_add(switch_has_keypad_slide_switch, LITEST_SWITCH, LITEST_ANY);
|
||||||
litest_add(switch_not_down_on_init, LITEST_SWITCH, LITEST_ANY);
|
litest_add(switch_not_down_on_init, LITEST_SWITCH, LITEST_ANY);
|
||||||
|
|
||||||
litest_with_parameters(params, "switch", 'I', 2, litest_named_i32(LIBINPUT_SWITCH_LID, "lid"),
|
litest_with_parameters(params, "switch", 'I', 3, litest_named_i32(LIBINPUT_SWITCH_LID, "lid"),
|
||||||
litest_named_i32(LIBINPUT_SWITCH_TABLET_MODE, "tablet_mode")) {
|
litest_named_i32(LIBINPUT_SWITCH_TABLET_MODE, "tablet_mode"),
|
||||||
|
litest_named_i32(LIBINPUT_SWITCH_KEYPAD_SLIDE, "keypad_slide")) {
|
||||||
litest_add_parametrized(switch_toggle, LITEST_SWITCH, LITEST_ANY, params);
|
litest_add_parametrized(switch_toggle, LITEST_SWITCH, LITEST_ANY, params);
|
||||||
litest_add_parametrized(switch_toggle_double, LITEST_SWITCH, LITEST_ANY, params);
|
litest_add_parametrized(switch_toggle_double, LITEST_SWITCH, LITEST_ANY, params);
|
||||||
litest_add_parametrized(switch_down_on_init, LITEST_SWITCH, LITEST_ANY, params);
|
litest_add_parametrized(switch_down_on_init, LITEST_SWITCH, LITEST_ANY, params);
|
||||||
|
litest_add_parametrized(switch_not_down_on_init, LITEST_SWITCH, LITEST_ANY, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
litest_with_parameters(params, "switch", 'I', 2, litest_named_i32(LIBINPUT_SWITCH_LID, "lid"),
|
||||||
|
litest_named_i32(LIBINPUT_SWITCH_TABLET_MODE, "tablet_mode")) {
|
||||||
litest_add_parametrized(switch_disable_touchpad, LITEST_SWITCH, LITEST_ANY, params);
|
litest_add_parametrized(switch_disable_touchpad, LITEST_SWITCH, LITEST_ANY, params);
|
||||||
litest_add_parametrized(switch_disable_touchpad_during_touch, LITEST_SWITCH, LITEST_ANY, params);
|
litest_add_parametrized(switch_disable_touchpad_during_touch, LITEST_SWITCH, LITEST_ANY, params);
|
||||||
litest_add_parametrized(switch_disable_touchpad_edge_scroll, LITEST_SWITCH, LITEST_ANY, params);
|
litest_add_parametrized(switch_disable_touchpad_edge_scroll, LITEST_SWITCH, LITEST_ANY, params);
|
||||||
|
|
|
||||||
|
|
@ -7722,6 +7722,51 @@ START_TEST(tablet_eraser_button_disabled)
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(tablet_eraser_button_config_after_device_removal)
|
||||||
|
{
|
||||||
|
_litest_context_destroy_ struct libinput *li = litest_create_context();
|
||||||
|
struct litest_device *tablet = litest_add_device(li, LITEST_ELAN_TABLET);
|
||||||
|
struct axis_replacement axes[] = {
|
||||||
|
{ ABS_DISTANCE, 10 },
|
||||||
|
{ ABS_PRESSURE, 0 },
|
||||||
|
{ -1, -1 },
|
||||||
|
};
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
litest_tablet_set_tool_type(tablet, BTN_TOOL_RUBBER);
|
||||||
|
litest_tablet_proximity_in(tablet, 10, 10, axes);
|
||||||
|
|
||||||
|
litest_dispatch(li);
|
||||||
|
auto event = libinput_get_event(li);
|
||||||
|
auto tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
||||||
|
auto tool = libinput_event_tablet_tool_get_tool(tev);
|
||||||
|
libinput_tablet_tool_ref(tool);
|
||||||
|
libinput_event_destroy(event);
|
||||||
|
|
||||||
|
litest_device_destroy(tablet);
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
/* Tool isn't associated with a device but config should take effect anyway */
|
||||||
|
auto status = libinput_tablet_tool_config_eraser_button_set_mode(
|
||||||
|
tool,
|
||||||
|
LIBINPUT_CONFIG_ERASER_BUTTON_BUTTON);
|
||||||
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
status =
|
||||||
|
libinput_tablet_tool_config_eraser_button_set_button(tool, BTN_STYLUS2);
|
||||||
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
|
||||||
|
litest_assert_enum_eq(libinput_tablet_tool_config_eraser_button_get_mode(tool),
|
||||||
|
LIBINPUT_CONFIG_ERASER_BUTTON_BUTTON);
|
||||||
|
litest_assert_int_eq(libinput_tablet_tool_config_eraser_button_get_button(tool),
|
||||||
|
(unsigned)BTN_STYLUS2);
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
libinput_tablet_tool_unref(tool);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
TEST_COLLECTION(tablet)
|
TEST_COLLECTION(tablet)
|
||||||
{
|
{
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
|
|
@ -7886,6 +7931,8 @@ TEST_COLLECTION(tablet_eraser)
|
||||||
"with-motion-events", 'b') {
|
"with-motion-events", 'b') {
|
||||||
litest_add_parametrized(tablet_eraser_button_disabled, LITEST_TABLET, LITEST_TOTEM|LITEST_FORCED_PROXOUT, params);
|
litest_add_parametrized(tablet_eraser_button_disabled, LITEST_TABLET, LITEST_TOTEM|LITEST_FORCED_PROXOUT, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
litest_add_no_device(tablet_eraser_button_config_after_device_removal);
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3651,7 +3651,7 @@ START_TEST(touchpad_state_after_syn_dropped_2fg_change)
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(touchpad_dwt)
|
START_TEST(touchpad_dwt_single_key)
|
||||||
{
|
{
|
||||||
struct litest_device *touchpad = litest_current_device();
|
struct litest_device *touchpad = litest_current_device();
|
||||||
struct litest_device *keyboard;
|
struct litest_device *keyboard;
|
||||||
|
|
@ -3674,7 +3674,7 @@ START_TEST(touchpad_dwt)
|
||||||
|
|
||||||
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY);
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY);
|
||||||
|
|
||||||
litest_timeout_dwt_short(li);
|
litest_timeout_dwt_long(li);
|
||||||
|
|
||||||
/* after timeout - motion events*/
|
/* after timeout - motion events*/
|
||||||
litest_touch_down(touchpad, 0, 50, 50);
|
litest_touch_down(touchpad, 0, 50, 50);
|
||||||
|
|
@ -3975,6 +3975,7 @@ START_TEST(touchpad_dwt_type)
|
||||||
struct litest_device *keyboard;
|
struct litest_device *keyboard;
|
||||||
struct libinput *li = touchpad->libinput;
|
struct libinput *li = touchpad->libinput;
|
||||||
int i;
|
int i;
|
||||||
|
uint32_t timeout = litest_test_param_get_u32(test_env->params, "timeout");
|
||||||
|
|
||||||
if (!has_disable_while_typing(touchpad))
|
if (!has_disable_while_typing(touchpad))
|
||||||
return LITEST_NOT_APPLICABLE;
|
return LITEST_NOT_APPLICABLE;
|
||||||
|
|
@ -3984,6 +3985,13 @@ START_TEST(touchpad_dwt_type)
|
||||||
litest_disable_hold_gestures(touchpad->libinput_device);
|
litest_disable_hold_gestures(touchpad->libinput_device);
|
||||||
litest_drain_events(li);
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
auto status = libinput_device_config_dwt_set_timeout(
|
||||||
|
touchpad->libinput_device,
|
||||||
|
timeout);
|
||||||
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
litest_keyboard_key(keyboard, KEY_A, true);
|
litest_keyboard_key(keyboard, KEY_A, true);
|
||||||
litest_keyboard_key(keyboard, KEY_A, false);
|
litest_keyboard_key(keyboard, KEY_A, false);
|
||||||
|
|
@ -3997,7 +4005,12 @@ START_TEST(touchpad_dwt_type)
|
||||||
litest_touch_up(touchpad, 0);
|
litest_touch_up(touchpad, 0);
|
||||||
litest_assert_empty_queue(li);
|
litest_assert_empty_queue(li);
|
||||||
|
|
||||||
litest_timeout_dwt_long(li);
|
if (timeout) {
|
||||||
|
litest_timeout(li, timeout);
|
||||||
|
} else {
|
||||||
|
litest_timeout_dwt_long(li);
|
||||||
|
}
|
||||||
|
|
||||||
litest_touch_down(touchpad, 0, 50, 50);
|
litest_touch_down(touchpad, 0, 50, 50);
|
||||||
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5);
|
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5);
|
||||||
litest_touch_up(touchpad, 0);
|
litest_touch_up(touchpad, 0);
|
||||||
|
|
@ -4499,6 +4512,9 @@ START_TEST(touchpad_dwt_config_default_on)
|
||||||
state = libinput_device_config_dwt_get_default_enabled(device);
|
state = libinput_device_config_dwt_get_default_enabled(device);
|
||||||
litest_assert_enum_eq(state, LIBINPUT_CONFIG_DWT_ENABLED);
|
litest_assert_enum_eq(state, LIBINPUT_CONFIG_DWT_ENABLED);
|
||||||
|
|
||||||
|
uint32_t timeout = libinput_device_config_dwt_get_timeout(device);
|
||||||
|
litest_assert_int_eq(timeout, 500U);
|
||||||
|
|
||||||
status = libinput_device_config_dwt_set_enabled(device,
|
status = libinput_device_config_dwt_set_enabled(device,
|
||||||
LIBINPUT_CONFIG_DWT_ENABLED);
|
LIBINPUT_CONFIG_DWT_ENABLED);
|
||||||
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
|
@ -4508,6 +4524,22 @@ START_TEST(touchpad_dwt_config_default_on)
|
||||||
|
|
||||||
status = libinput_device_config_dwt_set_enabled(device, 3);
|
status = libinput_device_config_dwt_set_enabled(device, 3);
|
||||||
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
|
||||||
|
|
||||||
|
/* Configurable even if disabled */
|
||||||
|
status = libinput_device_config_dwt_set_timeout(device, 600);
|
||||||
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
timeout = libinput_device_config_dwt_get_timeout(device);
|
||||||
|
litest_assert_int_eq(timeout, 600U);
|
||||||
|
|
||||||
|
/* Too short, too long */
|
||||||
|
status = libinput_device_config_dwt_set_timeout(device, 99);
|
||||||
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
|
||||||
|
timeout = libinput_device_config_dwt_get_timeout(device);
|
||||||
|
litest_assert_int_eq(timeout, 600U);
|
||||||
|
status = libinput_device_config_dwt_set_timeout(device, 5001);
|
||||||
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
|
||||||
|
timeout = libinput_device_config_dwt_get_timeout(device);
|
||||||
|
litest_assert_int_eq(timeout, 600U);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
@ -7160,7 +7192,8 @@ TEST_COLLECTION(touchpad)
|
||||||
TEST_COLLECTION(touchpad_dwt)
|
TEST_COLLECTION(touchpad_dwt)
|
||||||
{
|
{
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
litest_add(touchpad_dwt, LITEST_TOUCHPAD, LITEST_ANY);
|
litest_add(touchpad_dwt_single_key, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
|
|
||||||
litest_add_for_device(touchpad_dwt_ext_and_int_keyboard, LITEST_SYNAPTICS_I2C);
|
litest_add_for_device(touchpad_dwt_ext_and_int_keyboard, LITEST_SYNAPTICS_I2C);
|
||||||
litest_add(touchpad_dwt_enable_touch, LITEST_TOUCHPAD, LITEST_ANY);
|
litest_add(touchpad_dwt_enable_touch, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
litest_add(touchpad_dwt_touch_hold, LITEST_TOUCHPAD, LITEST_ANY);
|
litest_add(touchpad_dwt_touch_hold, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
|
|
@ -7168,7 +7201,9 @@ TEST_COLLECTION(touchpad_dwt)
|
||||||
litest_add(touchpad_dwt_key_hold_timeout, LITEST_TOUCHPAD, LITEST_ANY);
|
litest_add(touchpad_dwt_key_hold_timeout, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
litest_add(touchpad_dwt_key_hold_timeout_existing_touch, LITEST_TOUCHPAD, LITEST_ANY);
|
litest_add(touchpad_dwt_key_hold_timeout_existing_touch, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
litest_add(touchpad_dwt_key_hold_timeout_existing_touch_cornercase, LITEST_TOUCHPAD, LITEST_ANY);
|
litest_add(touchpad_dwt_key_hold_timeout_existing_touch_cornercase, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
litest_add(touchpad_dwt_type, LITEST_TOUCHPAD, LITEST_ANY);
|
litest_with_parameters(params, "timeout", 'u', 4, 0, 120, 300, 900) {
|
||||||
|
litest_add_parametrized(touchpad_dwt_type, LITEST_TOUCHPAD, LITEST_ANY, params);
|
||||||
|
}
|
||||||
litest_add(touchpad_dwt_type_short_timeout, LITEST_TOUCHPAD, LITEST_ANY);
|
litest_add(touchpad_dwt_type_short_timeout, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
litest_add(touchpad_dwt_shift_combo_triggers_dwt, LITEST_TOUCHPAD, LITEST_ANY);
|
litest_add(touchpad_dwt_shift_combo_triggers_dwt, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
litest_add(touchpad_dwt_modifier_no_dwt, LITEST_TOUCHPAD, LITEST_ANY);
|
litest_add(touchpad_dwt_modifier_no_dwt, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
|
|
|
||||||
|
|
@ -283,12 +283,25 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_both)
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
enable_dwtp(struct litest_device *dev)
|
enable_dwtp_with_timeout(struct litest_device *dev, uint32_t timeout)
|
||||||
{
|
{
|
||||||
enum libinput_config_status status, expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
enum libinput_config_status status, expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||||
status = libinput_device_config_dwtp_set_enabled(dev->libinput_device,
|
status = libinput_device_config_dwtp_set_enabled(dev->libinput_device,
|
||||||
LIBINPUT_CONFIG_DWTP_ENABLED);
|
LIBINPUT_CONFIG_DWTP_ENABLED);
|
||||||
litest_assert_enum_eq(status, expected);
|
litest_assert_enum_eq(status, expected);
|
||||||
|
|
||||||
|
if (timeout) {
|
||||||
|
auto status =
|
||||||
|
libinput_device_config_dwtp_set_timeout(dev->libinput_device,
|
||||||
|
timeout);
|
||||||
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
enable_dwtp(struct litest_device *dev)
|
||||||
|
{
|
||||||
|
enable_dwtp_with_timeout(dev, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|
@ -305,11 +318,12 @@ START_TEST(trackpoint_palmdetect)
|
||||||
struct litest_device *trackpoint = litest_current_device();
|
struct litest_device *trackpoint = litest_current_device();
|
||||||
struct libinput *li = trackpoint->libinput;
|
struct libinput *li = trackpoint->libinput;
|
||||||
int i;
|
int i;
|
||||||
|
uint32_t timeout = litest_test_param_get_u32(test_env->params, "timeout");
|
||||||
|
|
||||||
_destroy_(litest_device) *touchpad =
|
_destroy_(litest_device) *touchpad =
|
||||||
litest_add_device(li, LITEST_SYNAPTICS_I2C);
|
litest_add_device(li, LITEST_SYNAPTICS_I2C);
|
||||||
if (has_disable_while_trackpointing(touchpad))
|
if (has_disable_while_trackpointing(touchpad))
|
||||||
enable_dwtp(touchpad);
|
enable_dwtp_with_timeout(touchpad, timeout);
|
||||||
|
|
||||||
litest_disable_hold_gestures(touchpad->libinput_device);
|
litest_disable_hold_gestures(touchpad->libinput_device);
|
||||||
litest_drain_events(li);
|
litest_drain_events(li);
|
||||||
|
|
@ -327,7 +341,11 @@ START_TEST(trackpoint_palmdetect)
|
||||||
litest_touch_up(touchpad, 0);
|
litest_touch_up(touchpad, 0);
|
||||||
litest_assert_empty_queue(li);
|
litest_assert_empty_queue(li);
|
||||||
|
|
||||||
litest_timeout_trackpoint(li);
|
if (timeout) {
|
||||||
|
litest_timeout(li, timeout);
|
||||||
|
} else {
|
||||||
|
litest_timeout_trackpoint(li);
|
||||||
|
}
|
||||||
|
|
||||||
litest_touch_down(touchpad, 0, 30, 30);
|
litest_touch_down(touchpad, 0, 30, 30);
|
||||||
litest_touch_move_to(touchpad, 0, 30, 30, 80, 80, 10);
|
litest_touch_move_to(touchpad, 0, 30, 30, 80, 80, 10);
|
||||||
|
|
@ -472,7 +490,9 @@ TEST_COLLECTION(trackpoint)
|
||||||
litest_add(trackpoint_topsoftbuttons_left_handed_touchpad, LITEST_TOPBUTTONPAD, LITEST_ANY);
|
litest_add(trackpoint_topsoftbuttons_left_handed_touchpad, LITEST_TOPBUTTONPAD, LITEST_ANY);
|
||||||
litest_add(trackpoint_topsoftbuttons_left_handed_both, LITEST_TOPBUTTONPAD, LITEST_ANY);
|
litest_add(trackpoint_topsoftbuttons_left_handed_both, LITEST_TOPBUTTONPAD, LITEST_ANY);
|
||||||
|
|
||||||
litest_add(trackpoint_palmdetect, LITEST_POINTINGSTICK, LITEST_ANY);
|
litest_with_parameters(params, "timeout", 'u', 4, 0, 120, 300, 900) {
|
||||||
|
litest_add_parametrized(trackpoint_palmdetect, LITEST_POINTINGSTICK, LITEST_ANY, params);
|
||||||
|
}
|
||||||
litest_add(trackpoint_palmdetect_dwtp_disabled, LITEST_POINTINGSTICK, LITEST_ANY);
|
litest_add(trackpoint_palmdetect_dwtp_disabled, LITEST_POINTINGSTICK, LITEST_ANY);
|
||||||
litest_add(trackpoint_palmdetect_resume_touch, LITEST_POINTINGSTICK, LITEST_ANY);
|
litest_add(trackpoint_palmdetect_resume_touch, LITEST_POINTINGSTICK, LITEST_ANY);
|
||||||
litest_add(trackpoint_palmdetect_require_min_events, LITEST_POINTINGSTICK, LITEST_ANY);
|
litest_add(trackpoint_palmdetect_require_min_events, LITEST_POINTINGSTICK, LITEST_ANY);
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
START_TEST(auto_test)
|
START_TEST(auto_test)
|
||||||
{
|
{
|
||||||
/* This one is just a compile test */
|
/* This one is just a compile test */
|
||||||
auto tv = us2tv(0);
|
auto tv = usec_to_timeval(usec_from_uint64_t(0));
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
litest_assert_int_eq(tv.tv_sec, 0);
|
litest_assert_int_eq(tv.tv_sec, 0);
|
||||||
}
|
}
|
||||||
|
|
@ -605,7 +605,7 @@ START_TEST(ratelimit_helpers)
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
/* 10 attempts every 1000ms */
|
/* 10 attempts every 1000ms */
|
||||||
ratelimit_init(&rl, ms2us(1000), 10);
|
ratelimit_init(&rl, usec_from_millis(1000), 10);
|
||||||
|
|
||||||
for (j = 0; j < 3; ++j) {
|
for (j = 0; j < 3; ++j) {
|
||||||
/* a burst of 9 attempts must succeed */
|
/* a burst of 9 attempts must succeed */
|
||||||
|
|
@ -1165,12 +1165,125 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(time_conversion)
|
START_TEST(time_conversion)
|
||||||
{
|
{
|
||||||
litest_assert_int_eq(us(10), 10U);
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_uint64_t(0)), 0U);
|
||||||
litest_assert_int_eq(ns2us(10000), 10U);
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_uint64_t(12345)), 12345U);
|
||||||
litest_assert_int_eq(ms2us(10), 10000U);
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_uint64_t(999999)), 999999U);
|
||||||
litest_assert_int_eq(s2us(1), 1000000U);
|
|
||||||
litest_assert_int_eq(h2us(2), s2us(2 * 60 * 60));
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_millis(0)), 0U);
|
||||||
litest_assert_int_eq(us2ms(10000), 10U);
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_millis(1)), 1000U);
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_millis(10)), 10000U);
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_millis(1000)), 1000000U);
|
||||||
|
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_seconds(0)), 0U);
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_seconds(1)), 1000000U);
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_seconds(10)), 10000000U);
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_seconds(60)), 60000000U);
|
||||||
|
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_hours(0)), 0ULL);
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_hours(1)), 3600000000ULL);
|
||||||
|
|
||||||
|
{
|
||||||
|
struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_timeval(&tv)), 0U);
|
||||||
|
|
||||||
|
tv.tv_sec = 1;
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_timeval(&tv)),
|
||||||
|
1000000U);
|
||||||
|
|
||||||
|
tv.tv_sec = 1;
|
||||||
|
tv.tv_usec = 234567;
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_timeval(&tv)),
|
||||||
|
1234567U);
|
||||||
|
|
||||||
|
tv.tv_sec = 0;
|
||||||
|
tv.tv_usec = 999999;
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_timeval(&tv)), 999999U);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
struct timespec ts = { .tv_sec = 0, .tv_nsec = 0 };
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_timespec(&ts)), 0U);
|
||||||
|
|
||||||
|
ts.tv_sec = 1;
|
||||||
|
ts.tv_nsec = 0;
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_timespec(&ts)),
|
||||||
|
1000000U);
|
||||||
|
|
||||||
|
ts.tv_sec = 1;
|
||||||
|
ts.tv_nsec = 234567000;
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_timespec(&ts)),
|
||||||
|
1234567U);
|
||||||
|
|
||||||
|
ts.tv_sec = 0;
|
||||||
|
ts.tv_nsec = 999999000;
|
||||||
|
litest_assert_int_eq(usec_as_uint64_t(usec_from_timespec(&ts)),
|
||||||
|
999999U);
|
||||||
|
}
|
||||||
|
|
||||||
|
litest_assert_int_eq(usec_to_millis(usec_from_uint64_t(0)), 0U);
|
||||||
|
litest_assert_int_eq(usec_to_millis(usec_from_uint64_t(1000)), 1U);
|
||||||
|
litest_assert_int_eq(usec_to_millis(usec_from_uint64_t(10000)), 10U);
|
||||||
|
litest_assert_int_eq(usec_to_millis(usec_from_uint64_t(123456)), 123U);
|
||||||
|
litest_assert_int_eq(usec_to_millis(usec_from_uint64_t(999)), 0U);
|
||||||
|
|
||||||
|
litest_assert_int_eq(usec_to_seconds(usec_from_uint64_t(0)), 0U);
|
||||||
|
litest_assert_int_eq(usec_to_seconds(usec_from_uint64_t(1000000)), 1U);
|
||||||
|
litest_assert_int_eq(usec_to_seconds(usec_from_uint64_t(5000000)), 5U);
|
||||||
|
litest_assert_int_eq(usec_to_seconds(usec_from_uint64_t(60000000)), 60U);
|
||||||
|
litest_assert_int_eq(usec_to_seconds(usec_from_uint64_t(999999)), 0U);
|
||||||
|
|
||||||
|
litest_assert_int_eq(usec_to_minutes(usec_from_uint64_t(0)), 0U);
|
||||||
|
litest_assert_int_eq(usec_to_minutes(usec_from_uint64_t(60000000)), 1U);
|
||||||
|
litest_assert_int_eq(usec_to_minutes(usec_from_uint64_t(120000000)), 2U);
|
||||||
|
litest_assert_int_eq(usec_to_minutes(usec_from_uint64_t(3600000000)), 60U);
|
||||||
|
litest_assert_int_eq(usec_to_minutes(usec_from_uint64_t(59999999)), 0U);
|
||||||
|
|
||||||
|
litest_assert_int_eq(usec_to_hours(usec_from_uint64_t(0)), 0U);
|
||||||
|
litest_assert_int_eq(usec_to_hours(usec_from_uint64_t(3600000000)), 1U);
|
||||||
|
litest_assert_int_eq(usec_to_hours(usec_from_uint64_t(7200000000)), 2U);
|
||||||
|
litest_assert_int_eq(usec_to_hours(usec_from_uint64_t(86400000000)), 24U);
|
||||||
|
litest_assert_int_eq(usec_to_hours(usec_from_uint64_t(3599999999)), 0U);
|
||||||
|
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
|
tv = usec_to_timeval(usec_from_uint64_t(0));
|
||||||
|
litest_assert_int_eq(tv.tv_sec, 0);
|
||||||
|
litest_assert_int_eq(tv.tv_usec, 0);
|
||||||
|
|
||||||
|
tv = usec_to_timeval(usec_from_uint64_t(1000000));
|
||||||
|
litest_assert_int_eq(tv.tv_sec, 1);
|
||||||
|
litest_assert_int_eq(tv.tv_usec, 0);
|
||||||
|
|
||||||
|
tv = usec_to_timeval(usec_from_uint64_t(1234567));
|
||||||
|
litest_assert_int_eq(tv.tv_sec, 1);
|
||||||
|
litest_assert_int_eq(tv.tv_usec, 234567);
|
||||||
|
|
||||||
|
tv = usec_to_timeval(usec_from_uint64_t(999999));
|
||||||
|
litest_assert_int_eq(tv.tv_sec, 0);
|
||||||
|
litest_assert_int_eq(tv.tv_usec, 999999);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
struct timespec ts;
|
||||||
|
|
||||||
|
ts = usec_to_timespec(usec_from_uint64_t(0));
|
||||||
|
litest_assert_int_eq(ts.tv_sec, 0);
|
||||||
|
litest_assert_int_eq(ts.tv_nsec, 0);
|
||||||
|
|
||||||
|
ts = usec_to_timespec(usec_from_uint64_t(1000000));
|
||||||
|
litest_assert_int_eq(ts.tv_sec, 1);
|
||||||
|
litest_assert_int_eq(ts.tv_nsec, 0);
|
||||||
|
|
||||||
|
ts = usec_to_timespec(usec_from_uint64_t(1234567));
|
||||||
|
litest_assert_int_eq(ts.tv_sec, 1);
|
||||||
|
litest_assert_int_eq(ts.tv_nsec, 234567000);
|
||||||
|
|
||||||
|
ts = usec_to_timespec(usec_from_uint64_t(999999));
|
||||||
|
litest_assert_int_eq(ts.tv_sec, 0);
|
||||||
|
litest_assert_int_eq(ts.tv_nsec, 999999000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
@ -1178,23 +1291,23 @@ START_TEST(human_time)
|
||||||
{
|
{
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
struct ht_tests {
|
struct ht_tests {
|
||||||
uint64_t interval;
|
usec_t interval;
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
const char *unit;
|
const char *unit;
|
||||||
} tests[] = {
|
} tests[] = {
|
||||||
{ 0, 0, "us" },
|
{ usec_from_uint64_t(0), 0, "us" },
|
||||||
{ 123, 123, "us" },
|
{ usec_from_uint64_t(123), 123, "us" },
|
||||||
{ ms2us(5), 5, "ms" },
|
{ usec_from_millis(5), 5, "ms" },
|
||||||
{ ms2us(100), 100, "ms" },
|
{ usec_from_millis(100), 100, "ms" },
|
||||||
{ s2us(5), 5, "s" },
|
{ usec_from_seconds(5), 5, "s" },
|
||||||
{ s2us(100), 100, "s" },
|
{ usec_from_seconds(100), 100, "s" },
|
||||||
{ s2us(120), 2, "min" },
|
{ usec_from_seconds(120), 2, "min" },
|
||||||
{ 5 * s2us(60), 5, "min" },
|
{ usec_mul(usec_from_seconds(60), 5), 5, "min" },
|
||||||
{ 120 * s2us(60), 2, "h" },
|
{ usec_mul(usec_from_seconds(60), 120), 2, "h" },
|
||||||
{ 5 * 60 * s2us(60), 5, "h" },
|
{ usec_mul(usec_from_seconds(60), 5 * 60), 5, "h" },
|
||||||
{ 48 * 60 * s2us(60), 2, "d" },
|
{ usec_mul(usec_from_seconds(60), 48 * 60), 2, "d" },
|
||||||
{ 1000 * 24 * 60 * s2us(60), 1000, "d" },
|
{ usec_mul(usec_from_seconds(60), 1000 * 24 * 60), 1000, "d" },
|
||||||
{ 0, 0, NULL },
|
{ usec_from_uint64_t(0), 0, NULL },
|
||||||
};
|
};
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
for (int i = 0; tests[i].unit != NULL; i++) {
|
for (int i = 0; tests[i].unit != NULL; i++) {
|
||||||
|
|
@ -3006,7 +3119,8 @@ START_TEST(evdev_frames)
|
||||||
litest_assert_int_eq(evdev_frame_get_count(frame), 2U);
|
litest_assert_int_eq(evdev_frame_get_count(frame), 2U);
|
||||||
|
|
||||||
/* We never appended a timestamp */
|
/* We never appended a timestamp */
|
||||||
litest_assert_int_eq(evdev_frame_get_time(frame), 0U);
|
litest_assert(usec_cmp(evdev_frame_get_time(frame),
|
||||||
|
usec_from_uint64_t(0)) == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
struct evdev_event events[] = {
|
struct evdev_event events[] = {
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ struct record_context {
|
||||||
int timeout;
|
int timeout;
|
||||||
bool show_keycodes;
|
bool show_keycodes;
|
||||||
|
|
||||||
uint64_t offset;
|
usec_t offset;
|
||||||
|
|
||||||
/* The first device to be added */
|
/* The first device to be added */
|
||||||
struct record_device *first_device;
|
struct record_device *first_device;
|
||||||
|
|
@ -222,10 +222,11 @@ iprintf(FILE *fp, enum indent indent, const char *format, ...)
|
||||||
assert(rc != -1 && (unsigned int)rc > indent);
|
assert(rc != -1 && (unsigned int)rc > indent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t
|
static usec_t
|
||||||
time_offset(struct record_context *ctx, uint64_t time)
|
time_offset(struct record_context *ctx, usec_t time)
|
||||||
{
|
{
|
||||||
return ctx->offset ? time - ctx->offset : 0;
|
return !usec_is_zero(ctx->offset) ? usec_sub(time, ctx->offset)
|
||||||
|
: usec_from_uint64_t(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -234,7 +235,7 @@ print_evdev_event(struct record_device *dev, struct input_event *ev)
|
||||||
const char *tname, *cname;
|
const char *tname, *cname;
|
||||||
bool was_modified = false;
|
bool was_modified = false;
|
||||||
char desc[1024];
|
char desc[1024];
|
||||||
uint64_t time = input_event_time(ev) - dev->ctx->offset;
|
usec_t time = usec_sub(input_event_time(ev), dev->ctx->offset);
|
||||||
|
|
||||||
input_event_set_time(ev, time);
|
input_event_set_time(ev, time);
|
||||||
|
|
||||||
|
|
@ -252,19 +253,17 @@ print_evdev_event(struct record_device *dev, struct input_event *ev)
|
||||||
cname,
|
cname,
|
||||||
ev->value);
|
ev->value);
|
||||||
} else if (ev->type == EV_SYN) {
|
} else if (ev->type == EV_SYN) {
|
||||||
static unsigned long last_ms = 0;
|
static usec_t last_time = { 0 };
|
||||||
unsigned long time, dt;
|
|
||||||
|
|
||||||
time = us2ms(input_event_time(ev));
|
usec_t time = input_event_time(ev);
|
||||||
dt = time - last_ms;
|
usec_t dt = usec_delta(time, last_time);
|
||||||
last_ms = time;
|
|
||||||
|
|
||||||
snprintf(desc,
|
snprintf(desc,
|
||||||
sizeof(desc),
|
sizeof(desc),
|
||||||
"------------ %s (%d) ---------- %+ldms",
|
"------------ %s (%d) ---------- %+dms",
|
||||||
cname,
|
cname,
|
||||||
ev->value,
|
ev->value,
|
||||||
dt);
|
usec_to_millis(dt));
|
||||||
} else if (ev->type == EV_ABS) {
|
} else if (ev->type == EV_ABS) {
|
||||||
int oldval = 0;
|
int oldval = 0;
|
||||||
enum { DELTA, SLOT_DELTA, NO_DELTA } want = DELTA;
|
enum { DELTA, SLOT_DELTA, NO_DELTA } want = DELTA;
|
||||||
|
|
@ -378,9 +377,8 @@ handle_evdev_frame(struct record_device *d)
|
||||||
iprintf(d->fp, I_EVENTTYPE, "- evdev:\n");
|
iprintf(d->fp, I_EVENTTYPE, "- evdev:\n");
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (d->ctx->offset == 0) {
|
if (usec_is_zero(d->ctx->offset)) {
|
||||||
uint64_t time = input_event_time(&e);
|
d->ctx->offset = input_event_time(&e);
|
||||||
d->ctx->offset = time;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print_evdev_event(d, &e);
|
print_evdev_event(d, &e);
|
||||||
|
|
@ -445,7 +443,7 @@ print_key_event(struct record_device *dev, struct libinput_event *e)
|
||||||
struct libinput_event_keyboard *k = libinput_event_get_keyboard_event(e);
|
struct libinput_event_keyboard *k = libinput_event_get_keyboard_event(e);
|
||||||
enum libinput_key_state state;
|
enum libinput_key_state state;
|
||||||
uint32_t key;
|
uint32_t key;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
const char *type;
|
const char *type;
|
||||||
|
|
||||||
switch (libinput_event_get_type(e)) {
|
switch (libinput_event_get_type(e)) {
|
||||||
|
|
@ -456,7 +454,9 @@ print_key_event(struct record_device *dev, struct libinput_event *e)
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
time = time_offset(dev->ctx, libinput_event_keyboard_get_time_usec(k));
|
time = time_offset(
|
||||||
|
dev->ctx,
|
||||||
|
usec_from_uint64_t(libinput_event_keyboard_get_time_usec(k)));
|
||||||
state = libinput_event_keyboard_get_key_state(k);
|
state = libinput_event_keyboard_get_key_state(k);
|
||||||
|
|
||||||
key = libinput_event_keyboard_get_key(k);
|
key = libinput_event_keyboard_get_key(k);
|
||||||
|
|
@ -465,9 +465,9 @@ print_key_event(struct record_device *dev, struct libinput_event *e)
|
||||||
|
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s, key: %d, state: %s}\n",
|
"- {time: %d.%06ld, type: %s, key: %d, state: %s}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
key,
|
key,
|
||||||
state == LIBINPUT_KEY_STATE_PRESSED ? "pressed" : "released");
|
state == LIBINPUT_KEY_STATE_PRESSED ? "pressed" : "released");
|
||||||
|
|
@ -481,7 +481,7 @@ print_motion_event(struct record_device *dev, struct libinput_event *e)
|
||||||
y = libinput_event_pointer_get_dy(p);
|
y = libinput_event_pointer_get_dy(p);
|
||||||
double uax = libinput_event_pointer_get_dx_unaccelerated(p),
|
double uax = libinput_event_pointer_get_dx_unaccelerated(p),
|
||||||
uay = libinput_event_pointer_get_dy_unaccelerated(p);
|
uay = libinput_event_pointer_get_dy_unaccelerated(p);
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
const char *type;
|
const char *type;
|
||||||
|
|
||||||
switch (libinput_event_get_type(e)) {
|
switch (libinput_event_get_type(e)) {
|
||||||
|
|
@ -492,12 +492,13 @@ print_motion_event(struct record_device *dev, struct libinput_event *e)
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
time = time_offset(dev->ctx, libinput_event_pointer_get_time_usec(p));
|
time = time_offset(dev->ctx,
|
||||||
|
usec_from_uint64_t(libinput_event_pointer_get_time_usec(p)));
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s, delta: [%6.2f, %6.2f], unaccel: [%6.2f, %6.2f]}\n",
|
"- {time: %d.%06ld, type: %s, delta: [%6.2f, %6.2f], unaccel: [%6.2f, %6.2f]}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
|
|
@ -513,7 +514,7 @@ print_absmotion_event(struct record_device *dev, struct libinput_event *e)
|
||||||
y = libinput_event_pointer_get_absolute_y(p);
|
y = libinput_event_pointer_get_absolute_y(p);
|
||||||
double tx = libinput_event_pointer_get_absolute_x_transformed(p, 100),
|
double tx = libinput_event_pointer_get_absolute_x_transformed(p, 100),
|
||||||
ty = libinput_event_pointer_get_absolute_y_transformed(p, 100);
|
ty = libinput_event_pointer_get_absolute_y_transformed(p, 100);
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
const char *type;
|
const char *type;
|
||||||
|
|
||||||
switch (libinput_event_get_type(e)) {
|
switch (libinput_event_get_type(e)) {
|
||||||
|
|
@ -524,13 +525,14 @@ print_absmotion_event(struct record_device *dev, struct libinput_event *e)
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
time = time_offset(dev->ctx, libinput_event_pointer_get_time_usec(p));
|
time = time_offset(dev->ctx,
|
||||||
|
usec_from_uint64_t(libinput_event_pointer_get_time_usec(p)));
|
||||||
|
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s, point: [%6.2f, %6.2f], transformed: [%6.2f, %6.2f]}\n",
|
"- {time: %d.%06ld, type: %s, point: [%6.2f, %6.2f], transformed: [%6.2f, %6.2f]}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
|
|
@ -544,7 +546,7 @@ print_pointer_button_event(struct record_device *dev, struct libinput_event *e)
|
||||||
struct libinput_event_pointer *p = libinput_event_get_pointer_event(e);
|
struct libinput_event_pointer *p = libinput_event_get_pointer_event(e);
|
||||||
enum libinput_button_state state;
|
enum libinput_button_state state;
|
||||||
int button;
|
int button;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
const char *type;
|
const char *type;
|
||||||
|
|
||||||
switch (libinput_event_get_type(e)) {
|
switch (libinput_event_get_type(e)) {
|
||||||
|
|
@ -555,15 +557,16 @@ print_pointer_button_event(struct record_device *dev, struct libinput_event *e)
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
time = time_offset(dev->ctx, libinput_event_pointer_get_time_usec(p));
|
time = time_offset(dev->ctx,
|
||||||
|
usec_from_uint64_t(libinput_event_pointer_get_time_usec(p)));
|
||||||
button = libinput_event_pointer_get_button(p);
|
button = libinput_event_pointer_get_button(p);
|
||||||
state = libinput_event_pointer_get_button_state(p);
|
state = libinput_event_pointer_get_button_state(p);
|
||||||
|
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s, button: %d, state: %s, seat_count: %u}\n",
|
"- {time: %d.%06ld, type: %s, button: %d, state: %s, seat_count: %u}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
button,
|
button,
|
||||||
state == LIBINPUT_BUTTON_STATE_PRESSED ? "pressed" : "released",
|
state == LIBINPUT_BUTTON_STATE_PRESSED ? "pressed" : "released",
|
||||||
|
|
@ -574,7 +577,7 @@ static void
|
||||||
print_pointer_axis_event(struct record_device *dev, struct libinput_event *e)
|
print_pointer_axis_event(struct record_device *dev, struct libinput_event *e)
|
||||||
{
|
{
|
||||||
struct libinput_event_pointer *p = libinput_event_get_pointer_event(e);
|
struct libinput_event_pointer *p = libinput_event_get_pointer_event(e);
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
const char *type, *source;
|
const char *type, *source;
|
||||||
double h = 0, v = 0;
|
double h = 0, v = 0;
|
||||||
int hd = 0, vd = 0;
|
int hd = 0, vd = 0;
|
||||||
|
|
@ -587,7 +590,8 @@ print_pointer_axis_event(struct record_device *dev, struct libinput_event *e)
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
time = time_offset(dev->ctx, libinput_event_pointer_get_time_usec(p));
|
time = time_offset(dev->ctx,
|
||||||
|
usec_from_uint64_t(libinput_event_pointer_get_time_usec(p)));
|
||||||
if (libinput_event_pointer_has_axis(p,
|
if (libinput_event_pointer_has_axis(p,
|
||||||
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) {
|
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) {
|
||||||
h = libinput_event_pointer_get_axis_value(
|
h = libinput_event_pointer_get_axis_value(
|
||||||
|
|
@ -625,9 +629,9 @@ print_pointer_axis_event(struct record_device *dev, struct libinput_event *e)
|
||||||
|
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s, axes: [%2.2f, %2.2f], discrete: [%d, %d], source: %s}\n",
|
"- {time: %d.%06ld, type: %s, axes: [%2.2f, %2.2f], discrete: [%d, %d], source: %s}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
h,
|
h,
|
||||||
v,
|
v,
|
||||||
|
|
@ -644,7 +648,7 @@ print_touch_event(struct record_device *dev, struct libinput_event *e)
|
||||||
const char *type;
|
const char *type;
|
||||||
double x, y;
|
double x, y;
|
||||||
double tx, ty;
|
double tx, ty;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
int32_t slot, seat_slot;
|
int32_t slot, seat_slot;
|
||||||
|
|
||||||
switch (etype) {
|
switch (etype) {
|
||||||
|
|
@ -667,7 +671,8 @@ print_touch_event(struct record_device *dev, struct libinput_event *e)
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
time = time_offset(dev->ctx, libinput_event_touch_get_time_usec(t));
|
time = time_offset(dev->ctx,
|
||||||
|
usec_from_uint64_t(libinput_event_touch_get_time_usec(t)));
|
||||||
|
|
||||||
if (etype != LIBINPUT_EVENT_TOUCH_FRAME) {
|
if (etype != LIBINPUT_EVENT_TOUCH_FRAME) {
|
||||||
slot = libinput_event_touch_get_slot(t);
|
slot = libinput_event_touch_get_slot(t);
|
||||||
|
|
@ -679,8 +684,8 @@ print_touch_event(struct record_device *dev, struct libinput_event *e)
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s}\n",
|
"- {time: %ld.%06ld, type: %s}\n",
|
||||||
(long)(time / (int)1e6),
|
(long)(usec_as_uint64_t(time) / (int)1e6),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type);
|
type);
|
||||||
break;
|
break;
|
||||||
case LIBINPUT_EVENT_TOUCH_DOWN:
|
case LIBINPUT_EVENT_TOUCH_DOWN:
|
||||||
|
|
@ -691,10 +696,10 @@ print_touch_event(struct record_device *dev, struct libinput_event *e)
|
||||||
ty = libinput_event_touch_get_y_transformed(t, 100);
|
ty = libinput_event_touch_get_y_transformed(t, 100);
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s, slot: %d, seat_slot: %d, "
|
"- {time: %d.%06ld, type: %s, slot: %d, seat_slot: %d, "
|
||||||
"point: [%6.2f, %6.2f], transformed: [%6.2f, %6.2f]}\n",
|
"point: [%6.2f, %6.2f], transformed: [%6.2f, %6.2f]}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
slot,
|
slot,
|
||||||
seat_slot,
|
seat_slot,
|
||||||
|
|
@ -707,9 +712,9 @@ print_touch_event(struct record_device *dev, struct libinput_event *e)
|
||||||
case LIBINPUT_EVENT_TOUCH_CANCEL:
|
case LIBINPUT_EVENT_TOUCH_CANCEL:
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s, slot: %d, seat_slot: %d}\n",
|
"- {time: %d.%06ld, type: %s, slot: %d, seat_slot: %d}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
slot,
|
slot,
|
||||||
seat_slot);
|
seat_slot);
|
||||||
|
|
@ -725,7 +730,7 @@ print_gesture_event(struct record_device *dev, struct libinput_event *e)
|
||||||
enum libinput_event_type etype = libinput_event_get_type(e);
|
enum libinput_event_type etype = libinput_event_get_type(e);
|
||||||
struct libinput_event_gesture *g = libinput_event_get_gesture_event(e);
|
struct libinput_event_gesture *g = libinput_event_get_gesture_event(e);
|
||||||
const char *type;
|
const char *type;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
|
|
||||||
switch (etype) {
|
switch (etype) {
|
||||||
case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN:
|
case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN:
|
||||||
|
|
@ -750,7 +755,8 @@ print_gesture_event(struct record_device *dev, struct libinput_event *e)
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
time = time_offset(dev->ctx, libinput_event_gesture_get_time_usec(g));
|
time = time_offset(dev->ctx,
|
||||||
|
usec_from_uint64_t(libinput_event_gesture_get_time_usec(g)));
|
||||||
|
|
||||||
switch (etype) {
|
switch (etype) {
|
||||||
case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN:
|
case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN:
|
||||||
|
|
@ -761,8 +767,8 @@ print_gesture_event(struct record_device *dev, struct libinput_event *e)
|
||||||
"- {time: %ld.%06ld, type: %s, nfingers: %d, "
|
"- {time: %ld.%06ld, type: %s, nfingers: %d, "
|
||||||
"delta: [%6.2f, %6.2f], unaccel: [%6.2f, %6.2f], "
|
"delta: [%6.2f, %6.2f], unaccel: [%6.2f, %6.2f], "
|
||||||
"angle_delta: %6.2f, scale: %6.2f}\n",
|
"angle_delta: %6.2f, scale: %6.2f}\n",
|
||||||
(long)(time / (int)1e6),
|
(long)(usec_as_uint64_t(time) / (int)1e6),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
libinput_event_gesture_get_finger_count(g),
|
libinput_event_gesture_get_finger_count(g),
|
||||||
libinput_event_gesture_get_dx(g),
|
libinput_event_gesture_get_dx(g),
|
||||||
|
|
@ -777,10 +783,10 @@ print_gesture_event(struct record_device *dev, struct libinput_event *e)
|
||||||
case LIBINPUT_EVENT_GESTURE_SWIPE_END:
|
case LIBINPUT_EVENT_GESTURE_SWIPE_END:
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s, nfingers: %d, "
|
"- {time: %d.%06ld, type: %s, nfingers: %d, "
|
||||||
"delta: [%6.2f, %6.2f], unaccel: [%6.2f, %6.2f]}\n",
|
"delta: [%6.2f, %6.2f], unaccel: [%6.2f, %6.2f]}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
libinput_event_gesture_get_finger_count(g),
|
libinput_event_gesture_get_finger_count(g),
|
||||||
libinput_event_gesture_get_dx(g),
|
libinput_event_gesture_get_dx(g),
|
||||||
|
|
@ -877,7 +883,7 @@ print_tablet_tool_proximity_event(struct record_device *dev, struct libinput_eve
|
||||||
{
|
{
|
||||||
struct libinput_event_tablet_tool *t = libinput_event_get_tablet_tool_event(e);
|
struct libinput_event_tablet_tool *t = libinput_event_get_tablet_tool_event(e);
|
||||||
struct libinput_tablet_tool *tool = libinput_event_tablet_tool_get_tool(t);
|
struct libinput_tablet_tool *tool = libinput_event_tablet_tool_get_tool(t);
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
const char *type, *tool_type;
|
const char *type, *tool_type;
|
||||||
char caps[10] = { 0 };
|
char caps[10] = { 0 };
|
||||||
enum libinput_tablet_tool_proximity_state prox;
|
enum libinput_tablet_tool_proximity_state prox;
|
||||||
|
|
@ -919,7 +925,9 @@ print_tablet_tool_proximity_event(struct record_device *dev, struct libinput_eve
|
||||||
}
|
}
|
||||||
|
|
||||||
prox = libinput_event_tablet_tool_get_proximity_state(t);
|
prox = libinput_event_tablet_tool_get_proximity_state(t);
|
||||||
time = time_offset(dev->ctx, libinput_event_tablet_tool_get_time_usec(t));
|
time = time_offset(
|
||||||
|
dev->ctx,
|
||||||
|
usec_from_uint64_t(libinput_event_tablet_tool_get_time_usec(t)));
|
||||||
_autofree_ char *axes = buffer_tablet_axes(t);
|
_autofree_ char *axes = buffer_tablet_axes(t);
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
|
|
@ -939,10 +947,10 @@ print_tablet_tool_proximity_event(struct record_device *dev, struct libinput_eve
|
||||||
|
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s, proximity: %s, tool-type: %s, serial: %" PRIu64
|
"- {time: %d.%06ld, type: %s, proximity: %s, tool-type: %s, serial: %" PRIu64
|
||||||
", axes: %s, %s}\n",
|
", axes: %s, %s}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
prox ? "in" : "out",
|
prox ? "in" : "out",
|
||||||
tool_type,
|
tool_type,
|
||||||
|
|
@ -955,7 +963,7 @@ static void
|
||||||
print_tablet_tool_button_event(struct record_device *dev, struct libinput_event *e)
|
print_tablet_tool_button_event(struct record_device *dev, struct libinput_event *e)
|
||||||
{
|
{
|
||||||
struct libinput_event_tablet_tool *t = libinput_event_get_tablet_tool_event(e);
|
struct libinput_event_tablet_tool *t = libinput_event_get_tablet_tool_event(e);
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
const char *type;
|
const char *type;
|
||||||
uint32_t button;
|
uint32_t button;
|
||||||
enum libinput_button_state state;
|
enum libinput_button_state state;
|
||||||
|
|
@ -970,13 +978,15 @@ print_tablet_tool_button_event(struct record_device *dev, struct libinput_event
|
||||||
|
|
||||||
button = libinput_event_tablet_tool_get_button(t);
|
button = libinput_event_tablet_tool_get_button(t);
|
||||||
state = libinput_event_tablet_tool_get_button_state(t);
|
state = libinput_event_tablet_tool_get_button_state(t);
|
||||||
time = time_offset(dev->ctx, libinput_event_tablet_tool_get_time_usec(t));
|
time = time_offset(
|
||||||
|
dev->ctx,
|
||||||
|
usec_from_uint64_t(libinput_event_tablet_tool_get_time_usec(t)));
|
||||||
|
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s, button: %d, state: %s}\n",
|
"- {time: %d.%06ld, type: %s, button: %d, state: %s}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
button,
|
button,
|
||||||
state ? "pressed" : "released");
|
state ? "pressed" : "released");
|
||||||
|
|
@ -986,7 +996,7 @@ static void
|
||||||
print_tablet_tool_event(struct record_device *dev, struct libinput_event *e)
|
print_tablet_tool_event(struct record_device *dev, struct libinput_event *e)
|
||||||
{
|
{
|
||||||
struct libinput_event_tablet_tool *t = libinput_event_get_tablet_tool_event(e);
|
struct libinput_event_tablet_tool *t = libinput_event_get_tablet_tool_event(e);
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
const char *type;
|
const char *type;
|
||||||
enum libinput_tablet_tool_tip_state tip;
|
enum libinput_tablet_tool_tip_state tip;
|
||||||
char btn_buffer[30] = { 0 };
|
char btn_buffer[30] = { 0 };
|
||||||
|
|
@ -1019,14 +1029,16 @@ print_tablet_tool_event(struct record_device *dev, struct libinput_event *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
tip = libinput_event_tablet_tool_get_tip_state(t);
|
tip = libinput_event_tablet_tool_get_tip_state(t);
|
||||||
time = time_offset(dev->ctx, libinput_event_tablet_tool_get_time_usec(t));
|
time = time_offset(
|
||||||
|
dev->ctx,
|
||||||
|
usec_from_uint64_t(libinput_event_tablet_tool_get_time_usec(t)));
|
||||||
_autofree_ char *axes = buffer_tablet_axes(t);
|
_autofree_ char *axes = buffer_tablet_axes(t);
|
||||||
|
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s%s, tip: %s, %s}\n",
|
"- {time: %d.%06ld, type: %s%s, tip: %s, %s}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
btn_buffer, /* may be empty string */
|
btn_buffer, /* may be empty string */
|
||||||
tip ? "down" : "up",
|
tip ? "down" : "up",
|
||||||
|
|
@ -1041,7 +1053,7 @@ print_tablet_pad_button_event(struct record_device *dev, struct libinput_event *
|
||||||
enum libinput_button_state state;
|
enum libinput_button_state state;
|
||||||
unsigned int button, mode;
|
unsigned int button, mode;
|
||||||
const char *type;
|
const char *type;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
|
|
||||||
switch (libinput_event_get_type(e)) {
|
switch (libinput_event_get_type(e)) {
|
||||||
case LIBINPUT_EVENT_TABLET_PAD_BUTTON:
|
case LIBINPUT_EVENT_TABLET_PAD_BUTTON:
|
||||||
|
|
@ -1051,7 +1063,9 @@ print_tablet_pad_button_event(struct record_device *dev, struct libinput_event *
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
time = time_offset(dev->ctx, libinput_event_tablet_pad_get_time_usec(p));
|
time = time_offset(
|
||||||
|
dev->ctx,
|
||||||
|
usec_from_uint64_t(libinput_event_tablet_pad_get_time_usec(p)));
|
||||||
button = libinput_event_tablet_pad_get_button_number(p),
|
button = libinput_event_tablet_pad_get_button_number(p),
|
||||||
state = libinput_event_tablet_pad_get_button_state(p);
|
state = libinput_event_tablet_pad_get_button_state(p);
|
||||||
mode = libinput_event_tablet_pad_get_mode(p);
|
mode = libinput_event_tablet_pad_get_mode(p);
|
||||||
|
|
@ -1059,9 +1073,9 @@ print_tablet_pad_button_event(struct record_device *dev, struct libinput_event *
|
||||||
|
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s, button: %d, state: %s, mode: %d, is-toggle: %s}\n",
|
"- {time: %d.%06ld, type: %s, button: %d, state: %s, mode: %d, is-toggle: %s}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
button,
|
button,
|
||||||
state == LIBINPUT_BUTTON_STATE_PRESSED ? "pressed" : "released",
|
state == LIBINPUT_BUTTON_STATE_PRESSED ? "pressed" : "released",
|
||||||
|
|
@ -1077,7 +1091,7 @@ print_tablet_pad_ringstrip_event(struct record_device *dev, struct libinput_even
|
||||||
const char *source = NULL;
|
const char *source = NULL;
|
||||||
unsigned int mode, number;
|
unsigned int mode, number;
|
||||||
const char *type;
|
const char *type;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
double pos;
|
double pos;
|
||||||
|
|
||||||
switch (libinput_event_get_type(e)) {
|
switch (libinput_event_get_type(e)) {
|
||||||
|
|
@ -1113,14 +1127,16 @@ print_tablet_pad_ringstrip_event(struct record_device *dev, struct libinput_even
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
time = time_offset(dev->ctx, libinput_event_tablet_pad_get_time_usec(p));
|
time = time_offset(
|
||||||
|
dev->ctx,
|
||||||
|
usec_from_uint64_t(libinput_event_tablet_pad_get_time_usec(p)));
|
||||||
mode = libinput_event_tablet_pad_get_mode(p);
|
mode = libinput_event_tablet_pad_get_mode(p);
|
||||||
|
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s, number: %d, position: %.2f, source: %s, mode: %d}\n",
|
"- {time: %d.%06ld, type: %s, number: %d, position: %.2f, source: %s, mode: %d}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
number,
|
number,
|
||||||
pos,
|
pos,
|
||||||
|
|
@ -1135,7 +1151,7 @@ print_switch_event(struct record_device *dev, struct libinput_event *e)
|
||||||
enum libinput_switch_state state;
|
enum libinput_switch_state state;
|
||||||
uint32_t sw;
|
uint32_t sw;
|
||||||
const char *type;
|
const char *type;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
|
|
||||||
switch (libinput_event_get_type(e)) {
|
switch (libinput_event_get_type(e)) {
|
||||||
case LIBINPUT_EVENT_SWITCH_TOGGLE:
|
case LIBINPUT_EVENT_SWITCH_TOGGLE:
|
||||||
|
|
@ -1145,15 +1161,16 @@ print_switch_event(struct record_device *dev, struct libinput_event *e)
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
time = time_offset(dev->ctx, libinput_event_switch_get_time_usec(s));
|
time = time_offset(dev->ctx,
|
||||||
|
usec_from_uint64_t(libinput_event_switch_get_time_usec(s)));
|
||||||
sw = libinput_event_switch_get_switch(s);
|
sw = libinput_event_switch_get_switch(s);
|
||||||
state = libinput_event_switch_get_switch_state(s);
|
state = libinput_event_switch_get_switch_state(s);
|
||||||
|
|
||||||
iprintf(dev->fp,
|
iprintf(dev->fp,
|
||||||
I_EVENT,
|
I_EVENT,
|
||||||
"- {time: %ld.%06ld, type: %s, switch: %d, state: %s}\n",
|
"- {time: %d.%06ld, type: %s, switch: %d, state: %s}\n",
|
||||||
(long)(time / (int)1e6),
|
usec_to_seconds(time),
|
||||||
(long)(time % (int)1e6),
|
(long)(usec_as_uint64_t(time) % (int)1e6),
|
||||||
type,
|
type,
|
||||||
sw,
|
sw,
|
||||||
state == LIBINPUT_SWITCH_STATE_ON ? "on" : "off");
|
state == LIBINPUT_SWITCH_STATE_ON ? "on" : "off");
|
||||||
|
|
@ -1231,7 +1248,7 @@ handle_hidraw(struct hidraw *hidraw)
|
||||||
unsigned char report[4096];
|
unsigned char report[4096];
|
||||||
const char *sep = "";
|
const char *sep = "";
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
uint64_t time;
|
usec_t time;
|
||||||
|
|
||||||
int rc = read(hidraw->fd, report, sizeof(report));
|
int rc = read(hidraw->fd, report, sizeof(report));
|
||||||
if (rc <= 0)
|
if (rc <= 0)
|
||||||
|
|
@ -1239,23 +1256,28 @@ handle_hidraw(struct hidraw *hidraw)
|
||||||
|
|
||||||
/* hidraw doesn't give us a timestamps, we have to make them up */
|
/* hidraw doesn't give us a timestamps, we have to make them up */
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
time = s2us(ts.tv_sec) + ns2us(ts.tv_nsec);
|
time = usec_from_timespec(&ts);
|
||||||
|
|
||||||
/* The first evdev event is guaranteed to have an event time earlier
|
/* The first evdev event is guaranteed to have an event time earlier
|
||||||
than now, so we don't set the offset here, we rely on the evdev
|
than now, so we don't set the offset here, we rely on the evdev
|
||||||
events to do so. This potentially leaves us with multiple hidraw
|
events to do so. This potentially leaves us with multiple hidraw
|
||||||
events at timestap 0 but it's too niche to worry about. */
|
events at timestap 0 but it's too niche to worry about. */
|
||||||
if (d->ctx->offset == 0)
|
if (usec_is_zero(d->ctx->offset))
|
||||||
time = 0;
|
time = usec_from_uint64_t(0);
|
||||||
else
|
else
|
||||||
time = time_offset(d->ctx, time);
|
time = time_offset(d->ctx, time);
|
||||||
|
|
||||||
iprintf(d->fp, I_EVENTTYPE, "- hid:\n");
|
{
|
||||||
iprintf(d->fp,
|
iprintf(d->fp, I_EVENTTYPE, "- hid:\n");
|
||||||
I_EVENT,
|
uint64_t time_sec = usec_to_seconds(time);
|
||||||
"time: [%3" PRIu64 ", %6" PRIu64 "]\n",
|
uint64_t time_usec =
|
||||||
time / s2us(1),
|
usec_as_uint64_t(time) % usec_as_uint64_t(usec_from_seconds(1));
|
||||||
time % s2us(1));
|
iprintf(d->fp,
|
||||||
|
I_EVENT,
|
||||||
|
"time: [%3" PRIu64 ", %6" PRIu64 "]\n",
|
||||||
|
time_sec,
|
||||||
|
time_usec);
|
||||||
|
}
|
||||||
iprintf(d->fp, I_EVENT, "%s: [", hidraw->name);
|
iprintf(d->fp, I_EVENT, "%s: [", hidraw->name);
|
||||||
|
|
||||||
for (int byte = 0; byte < rc; byte++) {
|
for (int byte = 0; byte < rc; byte++) {
|
||||||
|
|
@ -2233,7 +2255,7 @@ mainloop(struct record_context *ctx)
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
ctx->offset = s2us(ts.tv_sec) + ns2us(ts.tv_nsec);
|
ctx->offset = usec_from_timespec(&ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ print_ptraccel_deltas(struct motion_filter *filter, double step)
|
||||||
{
|
{
|
||||||
struct device_float_coords motion;
|
struct device_float_coords motion;
|
||||||
struct normalized_coords accel;
|
struct normalized_coords accel;
|
||||||
uint64_t time = 0;
|
usec_t time = usec_from_uint64_t(0);
|
||||||
double i;
|
double i;
|
||||||
|
|
||||||
printf("# gnuplot:\n");
|
printf("# gnuplot:\n");
|
||||||
|
|
@ -54,7 +54,8 @@ print_ptraccel_deltas(struct motion_filter *filter, double step)
|
||||||
for (i = 0.0; i < 15.0; i += step) { // NOLINT: security.FloatLoopCounter
|
for (i = 0.0; i < 15.0; i += step) { // NOLINT: security.FloatLoopCounter
|
||||||
motion.x = i;
|
motion.x = i;
|
||||||
motion.y = 0;
|
motion.y = 0;
|
||||||
time += us(12500); /* pretend 80Hz data */
|
time = usec_add(time,
|
||||||
|
usec_from_uint64_t(12500)); /* pretend 80Hz data */
|
||||||
|
|
||||||
accel = filter_dispatch(filter, &motion, NULL, time);
|
accel = filter_dispatch(filter, &motion, NULL, time);
|
||||||
|
|
||||||
|
|
@ -70,7 +71,7 @@ print_ptraccel_movement(struct motion_filter *filter,
|
||||||
{
|
{
|
||||||
struct device_float_coords motion;
|
struct device_float_coords motion;
|
||||||
struct normalized_coords accel;
|
struct normalized_coords accel;
|
||||||
uint64_t time = 0;
|
usec_t time = usec_from_uint64_t(0);
|
||||||
double dx;
|
double dx;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -98,7 +99,8 @@ print_ptraccel_movement(struct motion_filter *filter,
|
||||||
for (i = 0; i < nevents; i++) {
|
for (i = 0; i < nevents; i++) {
|
||||||
motion.x = dx;
|
motion.x = dx;
|
||||||
motion.y = 0;
|
motion.y = 0;
|
||||||
time += us(12500); /* pretend 80Hz data */
|
time = usec_add(time,
|
||||||
|
usec_from_uint64_t(12500)); /* pretend 80Hz data */
|
||||||
|
|
||||||
accel = filter_dispatch(filter, &motion, NULL, time);
|
accel = filter_dispatch(filter, &motion, NULL, time);
|
||||||
|
|
||||||
|
|
@ -114,7 +116,7 @@ print_ptraccel_sequence(struct motion_filter *filter, int nevents, double *delta
|
||||||
{
|
{
|
||||||
struct device_float_coords motion;
|
struct device_float_coords motion;
|
||||||
struct normalized_coords accel;
|
struct normalized_coords accel;
|
||||||
uint64_t time = 0;
|
usec_t time = usec_from_uint64_t(0);
|
||||||
double *dx;
|
double *dx;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -131,7 +133,8 @@ print_ptraccel_sequence(struct motion_filter *filter, int nevents, double *delta
|
||||||
for (i = 0; i < nevents; i++, dx++) {
|
for (i = 0; i < nevents; i++, dx++) {
|
||||||
motion.x = *dx;
|
motion.x = *dx;
|
||||||
motion.y = 0;
|
motion.y = 0;
|
||||||
time += us(12500); /* pretend 80Hz data */
|
time = usec_add(time,
|
||||||
|
usec_from_uint64_t(12500)); /* pretend 80Hz data */
|
||||||
|
|
||||||
accel = filter_dispatch(filter, &motion, NULL, time);
|
accel = filter_dispatch(filter, &motion, NULL, time);
|
||||||
|
|
||||||
|
|
@ -162,7 +165,8 @@ print_accel_func(struct motion_filter *filter, accel_profile_func_t profile, int
|
||||||
mmps += 1) {
|
mmps += 1) {
|
||||||
double units_per_us = mmps_to_upus(mmps, dpi);
|
double units_per_us = mmps_to_upus(mmps, dpi);
|
||||||
double units_per_ms = units_per_us * 1000.0;
|
double units_per_ms = units_per_us * 1000.0;
|
||||||
double result = profile(filter, NULL, units_per_us, 0 /* time */);
|
double result =
|
||||||
|
profile(filter, NULL, units_per_us, usec_from_uint64_t(0));
|
||||||
printf("%.8f\t%.4f\t%.8f\t%.8f\n",
|
printf("%.8f\t%.4f\t%.8f\t%.8f\n",
|
||||||
mmps,
|
mmps,
|
||||||
result,
|
result,
|
||||||
|
|
@ -357,10 +361,11 @@ main(int argc, char **argv)
|
||||||
use_averaging);
|
use_averaging);
|
||||||
profile = pointer_accel_profile_linear_low_dpi;
|
profile = pointer_accel_profile_linear_low_dpi;
|
||||||
} else if (streq(filter_type, "touchpad")) {
|
} else if (streq(filter_type, "touchpad")) {
|
||||||
filter = create_pointer_accelerator_filter_touchpad(dpi,
|
filter = create_pointer_accelerator_filter_touchpad(
|
||||||
0,
|
dpi,
|
||||||
0,
|
usec_from_uint64_t(0),
|
||||||
use_averaging);
|
usec_from_uint64_t(0),
|
||||||
|
use_averaging);
|
||||||
profile = touchpad_accel_profile_linear;
|
profile = touchpad_accel_profile_linear;
|
||||||
} else if (streq(filter_type, "x230")) {
|
} else if (streq(filter_type, "x230")) {
|
||||||
filter = create_pointer_accelerator_filter_lenovo_x230(dpi,
|
filter = create_pointer_accelerator_filter_lenovo_x230(dpi,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue