Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libinput for openSUSE:Factory checked in at 2024-08-20 16:12:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libinput (Old) and /work/SRC/openSUSE:Factory/.libinput.new.2698 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libinput" Tue Aug 20 16:12:50 2024 rev:120 rq:1194659 version:1.26.2 Changes: -------- --- /work/SRC/openSUSE:Factory/libinput/libinput.changes 2024-06-07 15:02:18.269450845 +0200 +++ /work/SRC/openSUSE:Factory/.libinput.new.2698/libinput.changes 2024-08-20 16:13:03.277317236 +0200 @@ -1,0 +2,6 @@ +Mon Aug 19 07:40:24 UTC 2024 - Jan Engelhardt <jeng...@inai.de> + +- Update to release 1.26.2 + * Added quirks for the LG Gram 14 and the Minisvorum V3 + +------------------------------------------------------------------- Old: ---- libinput-1.26.0.tar.gz New: ---- _scmsync.obsinfo build.specials.obscpio libinput-1.26.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libinput.spec ++++++ --- /var/tmp/diff_new_pack.DEvXG1/_old 2024-08-20 16:13:04.109351797 +0200 +++ /var/tmp/diff_new_pack.DEvXG1/_new 2024-08-20 16:13:04.113351963 +0200 @@ -37,7 +37,7 @@ %define lname libinput10 %define pname libinput Name: libinput%{?xsuffix} -Version: 1.26.0 +Version: 1.26.2 Release: 0 Summary: Input device and event processing library License: MIT ++++++ _scmsync.obsinfo ++++++ mtime: 1724053860 commit: f353a5bf6d120393ffc3474fd4f6e74cc03902301bd8332a5beea121f2caa611 url: https://src.opensuse.org/jengelh/libinput revision: master ++++++ libinput-1.26.0.tar.gz -> libinput-1.26.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/.gitlab-ci/libinput.spec.in new/libinput-1.26.2/.gitlab-ci/libinput.spec.in --- old/libinput-1.26.0/.gitlab-ci/libinput.spec.in 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/.gitlab-ci/libinput.spec.in 2024-08-19 01:26:22.000000000 +0200 @@ -111,6 +111,7 @@ %{_libexecdir}/libinput/libinput-record %{_libexecdir}/libinput/libinput-replay %{_libexecdir}/libinput/libinput-analyze +%{_libexecdir}/libinput/libinput-analyze-buttons %{_libexecdir}/libinput/libinput-analyze-per-slot-delta %{_libexecdir}/libinput/libinput-analyze-recording %{_libexecdir}/libinput/libinput-analyze-touch-down-state @@ -129,6 +130,7 @@ %{_mandir}/man1/libinput-record.1* %{_mandir}/man1/libinput-replay.1* %{_mandir}/man1/libinput-analyze.1* +%{_mandir}/man1/libinput-analyze-buttons.1* %{_mandir}/man1/libinput-analyze-per-slot-delta.1* %{_mandir}/man1/libinput-analyze-recording.1* %{_mandir}/man1/libinput-analyze-touch-down-state.1* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/.triage-policies.yml new/libinput-1.26.2/.triage-policies.yml --- old/libinput-1.26.0/.triage-policies.yml 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/.triage-policies.yml 2024-08-19 01:26:22.000000000 +0200 @@ -3,6 +3,37 @@ # one we have on the main branch at the time) # # Note that for adding labels, the label must first created in the project. + +# Re-used in issues and mrs +.close_needinfo: &close_needinfo + name: "Close stale needinfo bugs" + conditions: + labels: + - "bugbot::needinfo-timeout" + actions: + remove_labels: + - "bugbot::needinfo-timeout" + comment: | + I'm closing this bug because some information we requested a while ago was never supplied and + we're not able to continue without this information. + Please feel free to re-open. + status: "close" + +.remind_needinfo: &remind_needinfo + name: "Remind users of needinfo bugs" + conditions: + labels: + - "bugbot::needinfo-reminder" + actions: + labels: + - "waiting on reporter" + remove_labels: + - "bugbot::needinfo-reminder" + comment: | + Hi. This is a friendly reminder that the maintainers are waiting on some information by + you (or maybe someone cc'd on this bug). If the information is not provided we may not + be able to proceed with this issue or merge request. Please check the recent comments, thanks. + resource_rules: issues: rules: @@ -63,6 +94,8 @@ The [libinput documentation](https://wayland.freedesktop.org/libinput/doc/latest/contributing.html) also has more details on how to get started. status: "close" + - *close_needinfo + - *remind_needinfo merge_requests: rules: - name: "Remind contributor of commit rules" @@ -79,3 +112,5 @@ Please see [our docs for commit messages](https://wayland.freedesktop.org/libinput/doc/latest/contributing.html#commit-messages) and [our docs for submitting code](https://wayland.freedesktop.org/libinput/doc/latest/contributing.html#submitting-code) that explain how to amend and force-push to this repo. + - *close_needinfo + - *remind_needinfo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/doc/user/device-quirks.rst new/libinput-1.26.2/doc/user/device-quirks.rst --- old/libinput-1.26.0/doc/user/device-quirks.rst 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/doc/user/device-quirks.rst 2024-08-19 01:26:22.000000000 +0200 @@ -10,10 +10,10 @@ so-called model quirks to provide that information. Model quirks are usually installed under ``/usr/share/libinput/<filename>.quirks`` and are standard ``.ini`` files. A file may contain multiple section headers (``[some -identifier]``) followed by one or more ``MatchFoo=Bar`` directives, followed by -at least one of ``ModelFoo=1`` or ``AttrFoo=bar`` directive. See the -``quirks/README.md`` file in the libinput source repository for more details on -their contents. +identifier]``) followed by one or more :ref:`MatchFoo=Bar <device-quirks-matches>` +directives, followed by at least one of ``ModelFoo=1`` or ``AttrFoo=bar`` directive. +See the ``quirks/README.md`` file in the libinput source repository for more +details on their contents. .. warning:: Model quirks are internal API and may change at any time. No backwards-compatibility is guaranteed. @@ -151,6 +151,10 @@ Unlike in traditional touchpads, whose pressure value equals contact size, on pressure pads pressure is a real physical axis. Indicates that the device is a pressure pad. +ModelTouchpadPhantomClicks + Some laptops are prone to registering touchpad clicks when the case is + bent. Indicates that clicks should be ignored if no fingers are on the + touchpad. AttrSizeHint=NxM, AttrResolutionHint=N Hints at the width x height of the device in mm, or the resolution of the x/y axis in units/mm. These may only be used where they apply to @@ -197,3 +201,34 @@ AttrTabletSmoothing=1|0 Enables (1) or disables (0) input smoothing for tablet devices. Smoothing is enabled by default, except on AES devices. + +.. _device-quirks-matches: + +------------------------------------------------------------------------------ +List of currently available matches +------------------------------------------------------------------------------ + +``Match*`` statements are how quirks are assigned to a device. Quirks with multiple +match statements must match all of those to apply. + +.. warning:: Quirks are internal API and may change at any time for any reason. + No guarantee is given that any ``Match`` statement below works on + your version of libinput. + +MatchName, MatchUniq + Match on the ``NAME`` or ``UNIQ`` udev property on this device. These properties + are typically derived from the device's kernel name or uniq but may be overridden + by a udev rule. These matches use ``fnmatch()`` globs. +MatchBus + A lower-case bus name. Currently supported are ``usb``, ``bluetooth``, ``ps2``, + ``rmi``, ``i2c``, and ``spi``. +MatchVendor, MatchProduct, MatchVersion + The hexadecmial 4-digit vendor ID, product ID or driver version as exported, without + a ``0x`` prefix. +MatchDMIModalias, MatchDeviceTree + An ``fnmatch()`` glob for the DMI modalias or the DeviceTree ``compatible`` string. + See ``/sys/class/dmi/id/modalias`` and ``/sys/firmware/devicetree/base/compatible``. +MatchUdevType + One of ``touchpad``, ``mouse``, ``pointingstick``, ``keyboard``, ``joystick``, + ``tablet``, ``tablet-pad``. Matches the corresponding ``ID_INPUT_*`` udev + property. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/doc/user/pointer-acceleration.rst new/libinput-1.26.2/doc/user/pointer-acceleration.rst --- old/libinput-1.26.0/doc/user/pointer-acceleration.rst 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/doc/user/pointer-acceleration.rst 2024-08-19 01:26:22.000000000 +0200 @@ -172,7 +172,7 @@ libinput attempts to normalize unit data to the best of its abilities, see :ref:`trackpoint_multiplier`. Beyond this, it is not possible to have -consistent behavior across different touchpad devices. +consistent behavior across different trackpoint devices. .. figure:: ptraccel-trackpoint.svg :align: center diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/meson.build new/libinput-1.26.2/meson.build --- old/libinput-1.26.0/meson.build 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/meson.build 2024-08-19 01:26:22.000000000 +0200 @@ -1,5 +1,5 @@ project('libinput', 'c', - version : '1.26.0', + version : '1.26.2', license : 'MIT/Expat', default_options : [ 'c_std=gnu99', 'warning_level=2' ], meson_version : '>= 0.56.0') @@ -517,6 +517,7 @@ ) src_python_tools = files( + 'tools/libinput-analyze-buttons.py', 'tools/libinput-analyze-per-slot-delta.py', 'tools/libinput-analyze-recording.py', 'tools/libinput-analyze-touch-down-state.py', @@ -990,6 +991,7 @@ src_man += files( 'tools/libinput.man', 'tools/libinput-analyze.man', + 'tools/libinput-analyze-buttons.man', 'tools/libinput-analyze-per-slot-delta.man', 'tools/libinput-analyze-recording.man', 'tools/libinput-analyze-touch-down-state.man', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/quirks/30-vendor-razer.quirks new/libinput-1.26.2/quirks/30-vendor-razer.quirks --- old/libinput-1.26.0/quirks/30-vendor-razer.quirks 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/quirks/30-vendor-razer.quirks 2024-08-19 01:26:22.000000000 +0200 @@ -261,6 +261,13 @@ MatchProduct=0x028C AttrKeyboardIntegration=internal +[RazerBlade142023 Keyboard] +MatchUdevType=keyboard +MatchBus=usb +MatchVendor=0x1532 +MatchProduct=0x029D +AttrKeyboardIntegration=internal + [RazerBlade152023 Keyboard] MatchUdevType=keyboard MatchBus=usb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/quirks/50-system-lg.quirks new/libinput-1.26.2/quirks/50-system-lg.quirks --- old/libinput-1.26.0/quirks/50-system-lg.quirks 1970-01-01 01:00:00.000000000 +0100 +++ new/libinput-1.26.2/quirks/50-system-lg.quirks 2024-08-19 01:26:22.000000000 +0200 @@ -0,0 +1,6 @@ +# Do not edit this file, it will be overwritten on update + +[LG gram 14 2023 Touchpad] +MatchName=* Touchpad +MatchDMIModalias=dmi:*svnLGElectronics:pn14Z90R-G.AA79G:* +ModelTouchpadPhantomClicks=1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/quirks/50-system-minisforum.quirks new/libinput-1.26.2/quirks/50-system-minisforum.quirks --- old/libinput-1.26.0/quirks/50-system-minisforum.quirks 1970-01-01 01:00:00.000000000 +0100 +++ new/libinput-1.26.2/quirks/50-system-minisforum.quirks 2024-08-19 01:26:22.000000000 +0200 @@ -0,0 +1,11 @@ +# Do not edit this file, it will be overwritten on update + +[Minisforum V3 volume keys] +MatchName=AT Translated Set 2 keyboard +MatchDMIModalias=dmi:*svnMicroComputer(HK)TechLimited:pnV3:* +ModelTabletModeNoSuspend=1 + +[Minisforum V3 touchpad dwt] +MatchName=USB Keyboard +MatchDMIModalias=dmi:*svnMicroComputer(HK)TechLimited:pnV3:* +AttrKeyboardIntegration=internal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/src/evdev-mt-touchpad.c new/libinput-1.26.2/src/evdev-mt-touchpad.c --- old/libinput-1.26.0/src/evdev-mt-touchpad.c 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/src/evdev-mt-touchpad.c 2024-08-19 01:26:22.000000000 +0200 @@ -2249,6 +2249,12 @@ } static inline bool +tp_key_is_shift(unsigned int keycode) +{ + return keycode == KEY_LEFTSHIFT || keycode == KEY_RIGHTSHIFT; +} + +static inline bool tp_key_is_modifier(unsigned int keycode) { switch (keycode) { @@ -2320,10 +2326,14 @@ return; /* modifier keys don't trigger disable-while-typing so things like - * ctrl+zoom or ctrl+click are possible */ + * ctrl+zoom or ctrl+click are possible. + * The exception is shift which we don't trigger DWT for on its own + * but we do trigger DWT for once we type some other key. + */ is_modifier = tp_key_is_modifier(key); if (is_modifier) { - long_set_bit(tp->dwt.mod_mask, key); + if (!tp_key_is_shift(key)) + long_set_bit(tp->dwt.mod_mask, key); return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/src/evdev-tablet-pad.c new/libinput-1.26.2/src/evdev-tablet-pad.c --- old/libinput-1.26.0/src/evdev-tablet-pad.c 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/src/evdev-tablet-pad.c 2024-08-19 01:26:22.000000000 +0200 @@ -111,7 +111,7 @@ break; case REL_WHEEL: if (!pad->dials.has_hires_dial) { - pad->dials.dial1 = e->value * 120; + pad->dials.dial1 = -1 * e->value * 120; pad->changed_axes |= PAD_AXIS_DIAL1; pad_set_status(pad, PAD_AXES_UPDATED); } @@ -124,12 +124,12 @@ } break; case REL_WHEEL_HI_RES: - pad->dials.dial1 = e->value; + pad->dials.dial1 = -1 * e->value; pad->changed_axes |= PAD_AXIS_DIAL1; pad_set_status(pad, PAD_AXES_UPDATED); break; case REL_HWHEEL_HI_RES: - pad->dials.dial2 = e->value * 120; + pad->dials.dial2 = e->value; pad->changed_axes |= PAD_AXIS_DIAL2; pad_set_status(pad, PAD_AXES_UPDATED); break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/src/evdev-tablet.c new/libinput-1.26.2/src/evdev-tablet.c --- old/libinput-1.26.0/src/evdev-tablet.c 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/src/evdev-tablet.c 2024-08-19 01:26:22.000000000 +0200 @@ -2496,9 +2496,10 @@ static void tablet_init_calibration(struct tablet_dispatch *tablet, - struct evdev_device *device) + struct evdev_device *device, + bool is_display_tablet) { - if (libevdev_has_property(device->evdev, INPUT_PROP_DIRECT)) + if (is_display_tablet || libevdev_has_property(device->evdev, INPUT_PROP_DIRECT)) evdev_init_calibration(device, &tablet->calibration); } @@ -2585,11 +2586,12 @@ tablet_change_to_left_handed); } -static bool -tablet_is_aes(struct evdev_device *device, - struct tablet_dispatch *tablet) +static void +tablet_lookup_libwacom(struct evdev_device *device, + struct tablet_dispatch *tablet, + bool *is_aes, + bool *is_display_tablet) { - bool is_aes = false; #if HAVE_LIBWACOM const char *devnode; WacomDeviceDatabase *db; @@ -2598,6 +2600,18 @@ int nstyli; int vid = evdev_device_get_id_vendor(device); + db = tablet_libinput_context(tablet)->libwacom.db; + if (!db) + return; + + devnode = udev_device_get_devnode(device->udev_device); + libwacom_device = libwacom_new_from_path(db, devnode, WFALLBACK_NONE, NULL); + if (!libwacom_device) + return; + + *is_display_tablet = !!(libwacom_get_integration_flags(libwacom_device) + & (WACOM_DEVICE_INTEGRATED_SYSTEM|WACOM_DEVICE_INTEGRATED_DISPLAY)); + /* Wacom-specific check for whether smoothing is required: * libwacom keeps all the AES pens in a single group, so any device * that supports AES pens will list all AES pens. 0x11 is one of the @@ -2605,35 +2619,24 @@ * is an AES tablet */ if (vid != VENDOR_ID_WACOM) - goto out; - - db = tablet_libinput_context(tablet)->libwacom.db; - if (!db) - goto out; - - devnode = udev_device_get_devnode(device->udev_device); - libwacom_device = libwacom_new_from_path(db, devnode, WFALLBACK_NONE, NULL); - if (!libwacom_device) - goto out; + return; stylus_ids = libwacom_get_supported_styli(libwacom_device, &nstyli); for (int i = 0; i < nstyli; i++) { if (stylus_ids[i] == 0x11) { - is_aes = true; + *is_aes = true; break; } } libwacom_destroy(libwacom_device); - -out: #endif - return is_aes; } static void tablet_init_smoothing(struct evdev_device *device, - struct tablet_dispatch *tablet) + struct tablet_dispatch *tablet, + bool is_aes) { size_t history_size = ARRAY_LENGTH(tablet->history.samples); struct quirks_context *quirks = NULL; @@ -2647,7 +2650,7 @@ * AttrTabletSmoothing can override this, if necessary. */ if (!q || !quirks_get_bool(q, QUIRK_ATTR_TABLET_SMOOTHING, &use_smoothing)) - use_smoothing = !tablet_is_aes(device, tablet); + use_smoothing = !is_aes; /* Setting the history size to 1 means we never do any actual smoothing. */ if (!use_smoothing) @@ -2752,6 +2755,10 @@ if (tablet_reject_device(device)) return -1; + bool is_aes = false; + bool is_display_tablet = false; + tablet_lookup_libwacom(device, tablet, &is_aes, &is_display_tablet); + if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_PEN)) { libevdev_enable_event_code(evdev, EV_KEY, BTN_TOOL_PEN, NULL); tablet->quirks.proximity_out_forced = true; @@ -2765,7 +2772,7 @@ } tablet_fix_tilt(tablet, device); - tablet_init_calibration(tablet, device); + tablet_init_calibration(tablet, device, is_display_tablet); tablet_init_proximity_threshold(tablet, device); rc = tablet_init_accel(tablet, device); if (rc != 0) @@ -2773,7 +2780,7 @@ evdev_init_sendevents(device, &tablet->base); tablet_init_left_handed(device); - tablet_init_smoothing(device, tablet); + tablet_init_smoothing(device, tablet, is_aes); for (axis = LIBINPUT_TABLET_TOOL_AXIS_X; axis <= LIBINPUT_TABLET_TOOL_AXIS_MAX; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/src/libinput.c new/libinput-1.26.2/src/libinput.c --- old/libinput-1.26.0/src/libinput.c 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/src/libinput.c 2024-08-19 01:26:22.000000000 +0200 @@ -1505,7 +1505,7 @@ LIBINPUT_EXPORT double libinput_event_tablet_tool_get_x_transformed(struct libinput_event_tablet_tool *event, - uint32_t width) + uint32_t width) { struct evdev_device *device = evdev_device(event->base.device); @@ -1524,7 +1524,7 @@ LIBINPUT_EXPORT double libinput_event_tablet_tool_get_y_transformed(struct libinput_event_tablet_tool *event, - uint32_t height) + uint32_t height) { struct evdev_device *device = evdev_device(event->base.device); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/src/libinput.h new/libinput-1.26.2/src/libinput.h --- old/libinput-1.26.0/src/libinput.h 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/src/libinput.h 2024-08-19 01:26:22.000000000 +0200 @@ -4615,6 +4615,10 @@ * - libinput_device_config_dwt_set_enabled() * - Touchscreens: * - libinput_device_config_calibration_set_matrix() + * - Tablets: + * - libinput_device_config_calibration_set_matrix() + * - libinput_tablet_tool_config_pressure_range_set() + * - libinput_device_config_left_handed_set() * - Pointer devices (mice, trackballs, touchpads): * - libinput_device_config_accel_set_speed() * - libinput_device_config_accel_set_profile() @@ -6581,7 +6585,7 @@ * @see libinput_tablet_tool_config_pressure_range_get_default_minimum * @see libinput_tablet_tool_config_pressure_range_get_default_maximum * - * @since 1.25 + * @since 1.26 */ int libinput_tablet_tool_config_pressure_range_is_available(struct libinput_tablet_tool *tool); @@ -6594,11 +6598,11 @@ * pressure of the given minimum value maps into a logical pressure of 0.0 (as * returned by libinput_event_tablet_tool_get_pressure()) and the hardware * pressure of the given maximum value is mapped into the logical pressure - * of 1.0 (as returned by . libinput_event_tablet_tool_get_pressure()) + * of 1.0 (as returned by libinput_event_tablet_tool_get_pressure()) * * The minimum value must be less than the maximum value, libinput may - * libinput may require the values to have a specific distance to each other, - * i.e. that (maximium - minimum > N) for an implementation-defined value of N. + * require the values to have a specific distance to each other, + * i.e. that (maximum - minimum > N) for an implementation-defined value of N. * * @param tool The libinput tool * @param minimum The minimum pressure value in the range [0.0, 1.0) @@ -6611,6 +6615,8 @@ * @see libinput_tablet_tool_config_pressure_range_get_maximum * @see libinput_tablet_tool_config_pressure_range_get_default_minimum * @see libinput_tablet_tool_config_pressure_range_get_default_maximum + * + * @since 1.26 */ enum libinput_config_status libinput_tablet_tool_config_pressure_range_set(struct libinput_tablet_tool *tool, @@ -6633,6 +6639,8 @@ * @see libinput_tablet_tool_config_pressure_range_get_maximum * @see libinput_tablet_tool_config_pressure_range_get_default_minimum * @see libinput_tablet_tool_config_pressure_range_get_default_maximum + * + * @since 1.26 */ double libinput_tablet_tool_config_pressure_range_get_minimum(struct libinput_tablet_tool *tool); @@ -6653,6 +6661,8 @@ * @see libinput_tablet_tool_config_pressure_range_get_minimum * @see libinput_tablet_tool_config_pressure_range_get_default_maximum * @see libinput_tablet_tool_config_pressure_range_get_default_maximum + * + * @since 1.26 */ double libinput_tablet_tool_config_pressure_range_get_maximum(struct libinput_tablet_tool *tool); @@ -6673,6 +6683,8 @@ * @see libinput_tablet_tool_config_pressure_range_get_minimum * @see libinput_tablet_tool_config_pressure_range_get_maximum * @see libinput_tablet_tool_config_pressure_range_get_default_maximum + * + * @since 1.26 */ double libinput_tablet_tool_config_pressure_range_get_default_minimum(struct libinput_tablet_tool *tool); @@ -6693,6 +6705,8 @@ * @see libinput_tablet_tool_config_pressure_range_get_maximum * @see libinput_tablet_tool_config_pressure_range_get_maximum * @see libinput_tablet_tool_config_pressure_range_get_default_maximum + * + * @since 1.26 */ double libinput_tablet_tool_config_pressure_range_get_default_maximum(struct libinput_tablet_tool *tool); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/test/test-pad.c new/libinput-1.26.2/test/test-pad.c --- old/libinput-1.26.0/test/test-pad.c 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/test/test-pad.c 2024-08-19 01:26:22.000000000 +0200 @@ -497,7 +497,7 @@ expected_ndials = 2; ndials = libinput_device_tablet_pad_get_num_dials(device); - ck_assert_int_ge(ndials, expected_ndials); + ck_assert_int_eq(ndials, expected_ndials); } END_TEST @@ -526,7 +526,16 @@ struct libinput_event_tablet_pad *pev = litest_is_pad_dial_event(ev, 0); double v120 = libinput_event_tablet_pad_get_dial_delta_v120(pev); - ck_assert_double_ge(v120, 120.0 * direction); + switch (code) { + case REL_WHEEL: /* inverted */ + ck_assert_double_eq(v120, -120.0 * direction); + break; + case REL_DIAL: + ck_assert_double_eq(v120, 120.0 * direction); + break; + default: + ck_abort(); + } libinput_event_destroy(ev); } } @@ -556,7 +565,7 @@ struct libinput_event_tablet_pad *pev = litest_is_pad_dial_event(ev, 0); double v120 = libinput_event_tablet_pad_get_dial_delta_v120(pev); - ck_assert_double_ge(v120, increment); + ck_assert_double_eq(v120, -increment); /* REL_WHEEL is inverted */ libinput_event_destroy(ev); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/test/test-tablet.c new/libinput-1.26.2/test/test-tablet.c --- old/libinput-1.26.0/test/test-tablet.c 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/test/test-tablet.c 2024-08-19 01:26:22.000000000 +0200 @@ -32,6 +32,10 @@ #include <stdbool.h> #include <stdarg.h> +#if HAVE_LIBWACOM +#include <libwacom/libwacom.h> +#endif + #include "libinput-util.h" #include "evdev-tablet.h" #include "litest.h" @@ -3677,6 +3681,28 @@ } END_TEST +static bool +device_has_calibration(struct litest_device *dev) +{ + bool has_calibration = libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT); + + if (has_calibration) + return true; +#if HAVE_LIBWACOM + WacomDeviceDatabase *db = libwacom_database_new(); + if (db) { + WacomDevice *d = libwacom_new_from_path(db, libevdev_uinput_get_devnode(dev->uinput), WFALLBACK_NONE, NULL); + if (d) { + has_calibration = !!(libwacom_get_integration_flags(d) & (WACOM_DEVICE_INTEGRATED_SYSTEM|WACOM_DEVICE_INTEGRATED_DISPLAY)); + libwacom_destroy(d); + } + libwacom_database_destroy(db); + } +#endif + + return has_calibration; +} + START_TEST(tablet_calibration_has_matrix) { struct litest_device *dev = litest_current_device(); @@ -3686,7 +3712,7 @@ float calibration[6] = {1, 0, 0, 0, 1, 0}; int has_calibration; - has_calibration = libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT); + has_calibration = device_has_calibration(dev); rc = libinput_device_config_calibration_has_matrix(d); ck_assert_int_eq(rc, has_calibration); @@ -3719,11 +3745,9 @@ { ABS_PRESSURE, 10 }, { -1, -1 } }; - int has_calibration; double x, y, dx, dy, mdx, mdy; - has_calibration = libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT); - if (!has_calibration) + if (!device_has_calibration(dev)) return; litest_drain_events(li); @@ -3804,11 +3828,9 @@ { ABS_PRESSURE, 0 }, { -1, -1 } }; - int has_calibration; double x, y; - has_calibration = libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT); - if (!has_calibration) + if (!device_has_calibration(dev)) return; litest_drain_events(li); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/test/test-touchpad.c new/libinput-1.26.2/test/test-touchpad.c --- old/libinput-1.26.0/test/test-touchpad.c 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/test/test-touchpad.c 2024-08-19 01:26:22.000000000 +0200 @@ -4259,6 +4259,50 @@ } END_TEST +START_TEST(touchpad_dwt_shift_combo_triggers_dwt) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + unsigned int modifiers[] = { + KEY_LEFTSHIFT, + KEY_RIGHTSHIFT, + }; + + if (!has_disable_while_typing(touchpad)) + return; + + keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_disable_tap(touchpad->libinput_device); + litest_disable_hold_gestures(touchpad->libinput_device); + litest_drain_events(li); + + ARRAY_FOR_EACH(modifiers, key) { + litest_keyboard_key(keyboard, *key, true); + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_keyboard_key(keyboard, *key, false); + libinput_dispatch(li); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); + litest_touch_up(touchpad, 0); + litest_assert_empty_queue(li); + } + + litest_timeout_dwt_long(); + libinput_dispatch(li); + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); + litest_touch_up(touchpad, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_delete_device(keyboard); +} +END_TEST + START_TEST(touchpad_dwt_modifier_combo_no_dwt) { struct litest_device *touchpad = litest_current_device(); @@ -4269,8 +4313,6 @@ KEY_RIGHTCTRL, KEY_LEFTALT, KEY_RIGHTALT, - KEY_LEFTSHIFT, - KEY_RIGHTSHIFT, KEY_FN, KEY_CAPSLOCK, KEY_TAB, @@ -4318,8 +4360,6 @@ KEY_RIGHTCTRL, KEY_LEFTALT, KEY_RIGHTALT, - KEY_LEFTSHIFT, - KEY_RIGHTSHIFT, KEY_FN, KEY_CAPSLOCK, KEY_TAB, @@ -4371,8 +4411,6 @@ KEY_RIGHTCTRL, KEY_LEFTALT, KEY_RIGHTALT, - KEY_LEFTSHIFT, - KEY_RIGHTSHIFT, KEY_FN, KEY_CAPSLOCK, KEY_TAB, @@ -7372,6 +7410,7 @@ litest_add(touchpad_dwt_key_hold_timeout_existing_touch_cornercase, LITEST_TOUCHPAD, LITEST_ANY); litest_add(touchpad_dwt_type, 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_modifier_no_dwt, LITEST_TOUCHPAD, LITEST_ANY); litest_add(touchpad_dwt_modifier_combo_no_dwt, LITEST_TOUCHPAD, LITEST_ANY); litest_add(touchpad_dwt_modifier_combo_dwt_after, LITEST_TOUCHPAD, LITEST_ANY); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/tools/libinput-analyze-buttons.man new/libinput-1.26.2/tools/libinput-analyze-buttons.man --- old/libinput-1.26.0/tools/libinput-analyze-buttons.man 1970-01-01 01:00:00.000000000 +0100 +++ new/libinput-1.26.2/tools/libinput-analyze-buttons.man 2024-08-19 01:26:22.000000000 +0200 @@ -0,0 +1,26 @@ +.TH libinput-analyze-buttons "1" +.SH NAME +libinput\-analyze\-buttons \- analyze the button states of a recording +.SH SYNOPSIS +.B libinput analyze buttons [\-\-help] [options] \fIrecording.yml\fI +.SH DESCRIPTION +.PP +The +.B "libinput analyze buttons" +tool analyzes a recording made with +.B "libinput record" +and prints information about the button states. +.PP +This is a debugging tool only, its output may change at any time. Do not +rely on the output. +.SH OPTIONS +.TP 8 +.B \-\-help +Print help +.TP 8 +.B \-\-threshold=<ms> +Color any delta time less than the threshold in red. +.SH LIBINPUT +Part of the +.B libinput(1) +suite diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/tools/libinput-analyze-buttons.py new/libinput-1.26.2/tools/libinput-analyze-buttons.py --- old/libinput-1.26.0/tools/libinput-analyze-buttons.py 1970-01-01 01:00:00.000000000 +0100 +++ new/libinput-1.26.2/tools/libinput-analyze-buttons.py 2024-08-19 01:26:22.000000000 +0200 @@ -0,0 +1,222 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 +# vim: set expandtab shiftwidth=4: +# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */ +# +# Copyright © 2024 Red Hat, Inc. +# +# 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. +# +# Prints the data from a libinput recording in a table format to ease +# debugging. +# +# Input is a libinput record yaml file + +from dataclasses import dataclass +import argparse +import os +import sys +import yaml +import libevdev + +COLOR_RESET = "\x1b[0m" +COLOR_RED = "\x1b[6;31m" + + +def micros(e: libevdev.InputEvent): + return e.usec + e.sec * 1_000_000 + + +@dataclass +class Timestamp: + sec: int + usec: int + + @property + def micros(self) -> int: + return self.usec + self.sec * 1_000_000 + + +@dataclass +class ButtonFrame: + delta_ms: int # delta time to last button (not evdev!) frame + evdev_delta_ms: int # delta time to last evdev frame + events: list[libevdev.InputEvent] # BTN_ events only + + @property + def timestamp(self) -> Timestamp: + e = self.events[0] + return Timestamp(e.sec, e.usec) + + def value(self, code: libevdev.EventCode) -> bool | None: + for e in self.events: + if e.matches(code): + return e.value + return None + + def values(self, codes: list[libevdev.EventCode]) -> list[bool | None]: + return [self.value(code) for code in codes] + + +def frames(events): + last_timestamp = None + current_frame = None + last_frame = None + for e in events: + if last_timestamp is None: + last_timestamp = micros(e) + if e.type == libevdev.EV_SYN: + last_timestamp = micros(e) + if current_frame is not None: + yield current_frame + last_frame = current_frame + current_frame = None + elif e.type == libevdev.EV_KEY: + if e.code.name.startswith("BTN_") and not e.code.name.startswith( + "BTN_TOOL_" + ): + timestamp = micros(e) + evdev_delta = (timestamp - last_timestamp) // 1000 + + if last_frame is not None: + delta = (timestamp - last_frame.timestamp.micros) // 1000 + else: + delta = 0 + + if current_frame is None: + current_frame = ButtonFrame( + delta_ms=delta, evdev_delta_ms=evdev_delta, events=[e] + ) + else: + current_frame.events.append(e) + + +def main(argv): + parser = argparse.ArgumentParser(description="Display button events in a recording") + parser.add_argument( + "--threshold", + type=int, + default=25, + help="Mark any time delta above this threshold (in ms)", + ) + parser.add_argument( + "path", metavar="recording", nargs=1, help="Path to libinput-record YAML file" + ) + args = parser.parse_args() + isatty = os.isatty(sys.stdout.fileno()) + if not isatty: + global COLOR_RESET + global COLOR_RED + COLOR_RESET = "" + COLOR_RED = "" + + yml = yaml.safe_load(open(args.path[0])) + if yml["ndevices"] > 1: + print(f"WARNING: Using only first {yml['ndevices']} devices in recording") + device = yml["devices"][0] + if not device["events"]: + print("No events found in recording") + sys.exit(1) + + def events(): + """ + Yields the next event in the recording + """ + for event in device["events"]: + for evdev in event.get("evdev", []): + yield libevdev.InputEvent( + code=libevdev.evbit(evdev[2], evdev[3]), + value=evdev[4], + sec=evdev[0], + usec=evdev[1], + ) + + # These are the buttons we possibly care about, but we filter to the ones + # found on this device anyway + buttons = [ + libevdev.EV_KEY.BTN_LEFT, + libevdev.EV_KEY.BTN_MIDDLE, + libevdev.EV_KEY.BTN_RIGHT, + libevdev.EV_KEY.BTN_SIDE, + libevdev.EV_KEY.BTN_EXTRA, + libevdev.EV_KEY.BTN_FORWARD, + libevdev.EV_KEY.BTN_BACK, + libevdev.EV_KEY.BTN_TASK, + libevdev.EV_KEY.BTN_TOUCH, + libevdev.EV_KEY.BTN_STYLUS, + libevdev.EV_KEY.BTN_STYLUS2, + libevdev.EV_KEY.BTN_STYLUS3, + libevdev.EV_KEY.BTN_0, + libevdev.EV_KEY.BTN_1, + libevdev.EV_KEY.BTN_2, + libevdev.EV_KEY.BTN_3, + libevdev.EV_KEY.BTN_4, + libevdev.EV_KEY.BTN_5, + libevdev.EV_KEY.BTN_6, + libevdev.EV_KEY.BTN_7, + libevdev.EV_KEY.BTN_8, + libevdev.EV_KEY.BTN_9, + ] + + def filter_buttons(buttons): + return filter( + lambda c: c in buttons, + map(lambda c: libevdev.evbit("EV_KEY", c), device["evdev"]["codes"][1]), + ) + + buttons = list(filter_buttons(buttons)) + + # all BTN_STYLUS will have a header of S - meh + btn_headers = " â ".join(b.name[4] for b in buttons) + print(f"{'Timestamp':^13s} â {'Delta':^8s} â {btn_headers}") + last_btn_vals = [None] * len(buttons) + + def btnchar(b, last): + if b == 1: + return "â¬" + if b == 0: + return "â´" + return "â" if last else " " + + for frame in frames(events()): + ts = frame.timestamp + if frame.timestamp.micros > 0 and frame.delta_ms < args.threshold: + color = COLOR_RED + else: + color = "" + btn_vals = frame.values(buttons) + btn_strs = " â ".join( + [btnchar(b, last) for b, last in zip(btn_vals, last_btn_vals)] + ) + + last_btn_vals = [ + b if b is not None else last for b, last in zip(btn_vals, last_btn_vals) + ] + + print( + f"{color}{ts.sec:6d}.{ts.usec:06d} â {frame.delta_ms:6d}ms â {btn_strs}{COLOR_RESET}" + ) + + +if __name__ == "__main__": + try: + main(sys.argv) + except BrokenPipeError: + pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/tools/libinput-analyze.man new/libinput-1.26.2/tools/libinput-analyze.man --- old/libinput-1.26.0/tools/libinput-analyze.man 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/tools/libinput-analyze.man 2024-08-19 01:26:22.000000000 +0200 @@ -22,6 +22,9 @@ .SH FEATURES Features that can be analyzed include .TP 8 +.B libinput\-analyze\-buttons(1) +analyze the button states of a recording +.TP 8 .B libinput\-analyze\-per-slot-delta(1) analyze the delta per event per slot .TP 8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/tools/libinput-debug-events.c new/libinput-1.26.2/tools/libinput-debug-events.c --- old/libinput-1.26.0/tools/libinput-debug-events.c 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/tools/libinput-debug-events.c 2024-08-19 01:26:22.000000000 +0200 @@ -940,9 +940,15 @@ case LIBINPUT_EVENT_TABLET_TOOL_AXIS: print_tablet_axis_event(ev); break; - case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: + case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: { + struct libinput_event_tablet_tool *tev = + libinput_event_get_tablet_tool_event(ev); + struct libinput_tablet_tool *tool = + libinput_event_tablet_tool_get_tool(tev); + tools_tablet_tool_apply_config(tool, &options); print_proximity_event(ev); break; + } case LIBINPUT_EVENT_TABLET_TOOL_TIP: print_tablet_tip_event(ev); break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/tools/libinput-debug-events.man new/libinput-1.26.2/tools/libinput-debug-events.man --- old/libinput-1.26.0/tools/libinput-debug-events.man 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/tools/libinput-debug-events.man 2024-08-19 01:26:22.000000000 +0200 @@ -125,6 +125,9 @@ .TP 8 .B \-\-set\-rotation\-angle=<degrees> Set the rotation angle in degrees (0 to 360). +.TP 8 +.B \-\-set\-pressure\-range=<min>:<max> +Set the tablet tool pressure range to min:max. min and max must be in range [0.0, 1.0]. .SH NOTES .PP Events shown by this tool may not correspond to the events seen by a diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/tools/libinput-debug-gui.c new/libinput-1.26.2/tools/libinput-debug-gui.c --- old/libinput-1.26.0/tools/libinput-debug-gui.c 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/tools/libinput-debug-gui.c 2024-08-19 01:26:22.000000000 +0200 @@ -487,6 +487,7 @@ outline_height = 1.0 * height/width * normalized_width; outline_width = normalized_width; + cairo_set_source_rgb(cr, .2, .2, .8); x = 1.0 * (w->evdev.x - ax->minimum)/width * outline_width; y = 1.0 * (w->evdev.y - ay->minimum)/height * outline_height; x += center_x - outline_width/2; @@ -1655,6 +1656,7 @@ handle_event_tablet(struct libinput_event *ev, struct window *w) { struct libinput_event_tablet_tool *t = libinput_event_get_tablet_tool_event(ev); + struct libinput_tablet_tool *tool = libinput_event_tablet_tool_get_tool(t); double x, y; struct point point; int idx; @@ -1667,6 +1669,7 @@ switch (libinput_event_get_type(ev)) { case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: + tools_tablet_tool_apply_config(tool, &w->options); if (libinput_event_tablet_tool_get_proximity_state(t) == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT) { w->tool.x_in = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/tools/libinput-debug-tablet.c new/libinput-1.26.2/tools/libinput-debug-tablet.c --- old/libinput-1.26.0/tools/libinput-debug-tablet.c 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/tools/libinput-debug-tablet.c 2024-08-19 01:26:22.000000000 +0200 @@ -381,9 +381,15 @@ case LIBINPUT_EVENT_TABLET_TOOL_AXIS: handle_tablet_axis_event(ctx, ev); break; - case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: + case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: { + struct libinput_event_tablet_tool *tev = + libinput_event_get_tablet_tool_event(ev); + struct libinput_tablet_tool *tool = + libinput_event_tablet_tool_get_tool(tev); + tools_tablet_tool_apply_config(tool, &options); handle_tablet_proximity_event(ctx, ev); break; + } case LIBINPUT_EVENT_TABLET_TOOL_TIP: handle_tablet_tip_event(ctx, ev); break; @@ -555,6 +561,12 @@ backend = BACKEND_UDEV; seat_or_device[0] = optarg; break; + default: + if (tools_parse_option(c, optarg, &options) != 0) { + usage(); + return EXIT_INVALID_USAGE; + } + break; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/tools/shared.c new/libinput-1.26.2/tools/shared.c --- old/libinput-1.26.0/tools/shared.c 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/tools/shared.c 2024-08-19 01:26:22.000000000 +0200 @@ -39,6 +39,7 @@ #include <libevdev/libevdev.h> #include "builddir.h" +#include "libinput.h" #include "shared.h" #include "util-macros.h" #include "util-strings.h" @@ -120,6 +121,10 @@ options->custom_npoints = ARRAY_LENGTH(points); options->custom_type = LIBINPUT_ACCEL_TYPE_FALLBACK; options->custom_step = 1.0; + options->pressure_range[0] = 0.0; + options->pressure_range[1] = 1.0; + options->calibration[0] = 1.0; + options->calibration[4] = 1.0; } int @@ -335,6 +340,39 @@ fprintf(stderr, "Invalid --set-rotation-angle value\n"); return 1; } + break; + case OPT_PRESSURE_RANGE: { + if (!optarg) + return 1; + + size_t npoints = 0; + double *range = double_array_from_string(optarg, ":", &npoints); + if (npoints != 2 || range[0] < 0.0 || range[1] > 1.0 || range[0] >= range[1]) { + free(range); + fprintf(stderr, "Invalid pressure range, must be in format \"min:max\"\n"); + return 1; + } + options->pressure_range[0] = range[0]; + options->pressure_range[1] = range[1]; + free(range); + break; + } + case OPT_CALIBRATION: { + if (!optarg) + return 1; + + size_t npoints = 0; + double *matrix = double_array_from_string(optarg, " ", &npoints); + if (npoints != 6) { + free(matrix); + fprintf(stderr, "Invalid calibration matrix, must be 6 space-separated values\n"); + return 1; + } + for (size_t i = 0; i < 6; i++) + options->calibration[i] = matrix[i]; + free(matrix); + break; + } } return 0; } @@ -547,6 +585,18 @@ if (options->angle != 0) libinput_device_config_rotation_set_angle(device, options->angle % 360); + + if (libinput_device_config_calibration_has_matrix(device)) + libinput_device_config_calibration_set_matrix(device, options->calibration); +} + +void +tools_tablet_tool_apply_config(struct libinput_tablet_tool *tool, + struct tools_options *options) +{ + libinput_tablet_tool_config_pressure_range_set(tool, + options->pressure_range[0], + options->pressure_range[1]); } static char* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.26.0/tools/shared.h new/libinput-1.26.2/tools/shared.h --- old/libinput-1.26.0/tools/shared.h 2024-06-06 06:09:40.000000000 +0200 +++ new/libinput-1.26.2/tools/shared.h 2024-08-19 01:26:22.000000000 +0200 @@ -64,6 +64,8 @@ OPT_CUSTOM_STEP, OPT_CUSTOM_TYPE, OPT_ROTATION_ANGLE, + OPT_PRESSURE_RANGE, + OPT_CALIBRATION, }; #define CONFIGURATION_OPTIONS \ @@ -97,7 +99,9 @@ { "set-custom-points", required_argument, 0, OPT_CUSTOM_POINTS },\ { "set-custom-step", required_argument, 0, OPT_CUSTOM_STEP },\ { "set-custom-type", required_argument, 0, OPT_CUSTOM_TYPE },\ - { "set-rotation-angle", required_argument, 0, OPT_ROTATION_ANGLE } + { "set-rotation-angle", required_argument, 0, OPT_ROTATION_ANGLE }, \ + { "set-pressure-range", required_argument, 0, OPT_PRESSURE_RANGE }, \ + { "set-calibration", required_argument, 0, OPT_CALIBRATION } enum tools_backend { BACKEND_NONE, @@ -130,6 +134,8 @@ size_t custom_npoints; double *custom_points; unsigned int angle; + double pressure_range[2]; + float calibration[6]; }; void tools_init_options(struct tools_options *options); @@ -142,6 +148,8 @@ bool *grab); void tools_device_apply_config(struct libinput_device *device, struct tools_options *options); +void tools_tablet_tool_apply_config(struct libinput_tablet_tool *tool, + struct tools_options *options); int tools_exec_command(const char *prefix, int argc, char **argv); bool find_touchpad_device(char *path, size_t path_len);