... |
... |
@@ -166,6 +166,7 @@ struct xf86libinput { |
166
|
166
|
unsigned char btnmap[MAX_BUTTONS + 1];
|
167
|
167
|
|
168
|
168
|
BOOL horiz_scrolling_enabled;
|
|
169
|
+ BOOL hires_scrolling_enabled;
|
169
|
170
|
|
170
|
171
|
float rotation_angle;
|
171
|
172
|
struct bezier_control_point pressurecurve[4];
|
... |
... |
@@ -264,7 +265,7 @@ xf86libinput_is_subdevice(InputInfoPtr pInfo) |
264
|
265
|
char *source;
|
265
|
266
|
BOOL is_subdevice;
|
266
|
267
|
|
267
|
|
- source = xf86SetStrOption(pInfo->options, "_source", "");
|
|
268
|
+ source = xf86CheckStrOption(pInfo->options, "_source", "");
|
268
|
269
|
is_subdevice = streq(source, "_driver/libinput");
|
269
|
270
|
free(source);
|
270
|
271
|
|
... |
... |
@@ -1660,21 +1661,22 @@ get_wheel_scroll_value(struct xf86libinput *driver_data, |
1660
|
1661
|
enum libinput_pointer_axis axis)
|
1661
|
1662
|
{
|
1662
|
1663
|
#if HAVE_LIBINPUT_AXIS_VALUE_V120
|
1663
|
|
- return get_wheel_120_value(driver_data, event, axis);
|
1664
|
|
-#else
|
1665
|
|
- return guess_wheel_scroll_value(driver_data, event, axis);
|
|
1664
|
+ if (driver_data->options.hires_scrolling_enabled)
|
|
1665
|
+ return get_wheel_120_value(driver_data, event, axis);
|
1666
|
1666
|
#endif
|
|
1667
|
+ return guess_wheel_scroll_value(driver_data, event, axis);
|
1667
|
1668
|
}
|
1668
|
1669
|
|
1669
|
1670
|
static inline double
|
1670
|
|
-get_finger_or_continuous_scroll_value(struct libinput_event_pointer *event,
|
|
1671
|
+get_finger_or_continuous_scroll_value(struct xf86libinput *driver_data,
|
|
1672
|
+ struct libinput_event_pointer *event,
|
1671
|
1673
|
enum libinput_pointer_axis axis)
|
1672
|
1674
|
{
|
1673
|
1675
|
#if HAVE_LIBINPUT_AXIS_VALUE_V120
|
1674
|
|
- return libinput_event_pointer_get_scroll_value(event, axis);
|
1675
|
|
-#else
|
1676
|
|
- return libinput_event_pointer_get_axis_value(event, axis);
|
|
1676
|
+ if (driver_data->options.hires_scrolling_enabled)
|
|
1677
|
+ return libinput_event_pointer_get_scroll_value(event, axis);
|
1677
|
1678
|
#endif
|
|
1679
|
+ return libinput_event_pointer_get_axis_value(event, axis);
|
1678
|
1680
|
}
|
1679
|
1681
|
|
1680
|
1682
|
static inline bool
|
... |
... |
@@ -1703,7 +1705,10 @@ calculate_axis_value(struct xf86libinput *driver_data, |
1703
|
1705
|
double dist = driver_data->options.scroll_pixel_distance;
|
1704
|
1706
|
assert(dist != 0.0);
|
1705
|
1707
|
|
1706
|
|
- value = get_finger_or_continuous_scroll_value(event, axis);
|
|
1708
|
+ value = get_finger_or_continuous_scroll_value(driver_data,
|
|
1709
|
+ event,
|
|
1710
|
+ axis);
|
|
1711
|
+
|
1707
|
1712
|
/* We need to scale this value into our scroll increment range
|
1708
|
1713
|
* because that one is constant for the lifetime of the
|
1709
|
1714
|
* device. The user may change the ScrollPixelDistance
|
... |
... |
@@ -2404,6 +2409,7 @@ xf86libinput_handle_event(struct libinput_event *event) |
2404
|
2409
|
struct libinput_device *device;
|
2405
|
2410
|
enum libinput_event_type type;
|
2406
|
2411
|
InputInfoPtr pInfo;
|
|
2412
|
+ struct xf86libinput *driver_data;
|
2407
|
2413
|
enum event_handling event_handling = EVENT_HANDLED;
|
2408
|
2414
|
|
2409
|
2415
|
type = libinput_event_get_type(event);
|
... |
... |
@@ -2414,6 +2420,8 @@ xf86libinput_handle_event(struct libinput_event *event) |
2414
|
2420
|
if (!pInfo || !pInfo->dev->public.on)
|
2415
|
2421
|
goto out;
|
2416
|
2422
|
|
|
2423
|
+ driver_data = pInfo->private;
|
|
2424
|
+
|
2417
|
2425
|
switch (type) {
|
2418
|
2426
|
case LIBINPUT_EVENT_NONE:
|
2419
|
2427
|
case LIBINPUT_EVENT_DEVICE_ADDED:
|
... |
... |
@@ -2437,28 +2445,40 @@ xf86libinput_handle_event(struct libinput_event *event) |
2437
|
2445
|
libinput_event_get_keyboard_event(event));
|
2438
|
2446
|
break;
|
2439
|
2447
|
case LIBINPUT_EVENT_POINTER_AXIS:
|
2440
|
|
-#if !HAVE_LIBINPUT_AXIS_VALUE_V120
|
2441
|
|
- /* ignore POINTER_AXIS where we have libinput 1.19 and higher */
|
|
2448
|
+#if HAVE_LIBINPUT_AXIS_VALUE_V120
|
|
2449
|
+ /* ignore POINTER_AXIS where we have libinput 1.19 and
|
|
2450
|
+ higher and high-resolution scroll is enabled */
|
|
2451
|
+ if (driver_data->options.hires_scrolling_enabled)
|
|
2452
|
+ break;
|
|
2453
|
+#endif
|
|
2454
|
+
|
2442
|
2455
|
xf86libinput_handle_axis(pInfo,
|
2443
|
2456
|
event,
|
2444
|
|
- libinput_event_pointer_get_axis_source(event));
|
2445
|
|
-#endif
|
|
2457
|
+ libinput_event_pointer_get_axis_source(
|
|
2458
|
+ libinput_event_get_pointer_event(event)
|
|
2459
|
+ ));
|
2446
|
2460
|
break;
|
2447
|
2461
|
#if HAVE_LIBINPUT_AXIS_VALUE_V120
|
2448
|
2462
|
case LIBINPUT_EVENT_POINTER_SCROLL_WHEEL:
|
2449
|
|
- xf86libinput_handle_axis(pInfo,
|
2450
|
|
- event,
|
2451
|
|
- LIBINPUT_POINTER_AXIS_SOURCE_WHEEL);
|
|
2463
|
+ if (driver_data->options.hires_scrolling_enabled) {
|
|
2464
|
+ xf86libinput_handle_axis(pInfo,
|
|
2465
|
+ event,
|
|
2466
|
+ LIBINPUT_POINTER_AXIS_SOURCE_WHEEL);
|
|
2467
|
+ }
|
2452
|
2468
|
break;
|
2453
|
2469
|
case LIBINPUT_EVENT_POINTER_SCROLL_FINGER:
|
2454
|
|
- xf86libinput_handle_axis(pInfo,
|
2455
|
|
- event,
|
2456
|
|
- LIBINPUT_POINTER_AXIS_SOURCE_FINGER);
|
|
2470
|
+ if (driver_data->options.hires_scrolling_enabled) {
|
|
2471
|
+ xf86libinput_handle_axis(pInfo,
|
|
2472
|
+ event,
|
|
2473
|
+ LIBINPUT_POINTER_AXIS_SOURCE_FINGER);
|
|
2474
|
+ }
|
2457
|
2475
|
break;
|
2458
|
2476
|
case LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS:
|
2459
|
|
- xf86libinput_handle_axis(pInfo,
|
2460
|
|
- event,
|
2461
|
|
- LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS);
|
|
2477
|
+ if (driver_data->options.hires_scrolling_enabled) {
|
|
2478
|
+ xf86libinput_handle_axis(pInfo,
|
|
2479
|
+ event,
|
|
2480
|
+ LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS);
|
|
2481
|
+ }
|
2462
|
2482
|
break;
|
2463
|
2483
|
#endif
|
2464
|
2484
|
case LIBINPUT_EVENT_TOUCH_FRAME:
|
... |
... |
@@ -3196,6 +3216,15 @@ xf86libinput_parse_horiz_scroll_option(InputInfoPtr pInfo) |
3196
|
3216
|
return xf86SetBoolOption(pInfo->options, "HorizontalScrolling", TRUE);
|
3197
|
3217
|
}
|
3198
|
3218
|
|
|
3219
|
+static inline BOOL
|
|
3220
|
+xf86libinput_parse_hirescroll_option(InputInfoPtr pInfo,
|
|
3221
|
+ struct libinput_device *device)
|
|
3222
|
+{
|
|
3223
|
+ return xf86SetBoolOption(pInfo->options,
|
|
3224
|
+ "HighResolutionWheelScrolling",
|
|
3225
|
+ TRUE);
|
|
3226
|
+}
|
|
3227
|
+
|
3199
|
3228
|
static inline double
|
3200
|
3229
|
xf86libinput_parse_rotation_angle_option(InputInfoPtr pInfo,
|
3201
|
3230
|
struct libinput_device *device)
|
... |
... |
@@ -3358,6 +3387,7 @@ xf86libinput_parse_options(InputInfoPtr pInfo, |
3358
|
3387
|
if (driver_data->capabilities & CAP_POINTER) {
|
3359
|
3388
|
xf86libinput_parse_draglock_option(pInfo, driver_data);
|
3360
|
3389
|
options->horiz_scrolling_enabled = xf86libinput_parse_horiz_scroll_option(pInfo);
|
|
3390
|
+ options->hires_scrolling_enabled = xf86libinput_parse_hirescroll_option(pInfo, device);
|
3361
|
3391
|
}
|
3362
|
3392
|
|
3363
|
3393
|
xf86libinput_parse_pressurecurve_option(pInfo,
|
... |
... |
@@ -3641,7 +3671,7 @@ xf86libinput_pre_init(InputDriverPtr drv, |
3641
|
3671
|
goto fail;
|
3642
|
3672
|
}
|
3643
|
3673
|
|
3644
|
|
- /* We ref the device above, then remove it. It get's
|
|
3674
|
+ /* We ref the device above, then remove it. It gets
|
3645
|
3675
|
re-added with the same path in DEVICE_ON, we hope
|
3646
|
3676
|
it doesn't change until then */
|
3647
|
3677
|
libinput_device_ref(device);
|
... |
... |
@@ -3835,6 +3865,7 @@ static Atom prop_draglock; |
3835
|
3865
|
static Atom prop_horiz_scroll;
|
3836
|
3866
|
static Atom prop_pressurecurve;
|
3837
|
3867
|
static Atom prop_area_ratio;
|
|
3868
|
+static Atom prop_hires_scroll;
|
3838
|
3869
|
|
3839
|
3870
|
/* general properties */
|
3840
|
3871
|
static Atom prop_float;
|
... |
... |
@@ -4406,7 +4437,7 @@ LibinputSetPropertyScrollButtonLock(DeviceIntPtr dev, |
4406
|
4437
|
struct xf86libinput *driver_data = pInfo->private;
|
4407
|
4438
|
BOOL enabled;
|
4408
|
4439
|
|
4409
|
|
- if (val->format != 8 || val->type != XA_INTEGER || val->size != 1)
|
|
4440
|
+ if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
4410
|
4441
|
return BadMatch;
|
4411
|
4442
|
|
4412
|
4443
|
enabled = *(BOOL*)val->data;
|
... |
... |
@@ -4615,7 +4646,7 @@ LibinputSetPropertyHorizScroll(DeviceIntPtr dev, |
4615
|
4646
|
struct xf86libinput *driver_data = pInfo->private;
|
4616
|
4647
|
BOOL enabled;
|
4617
|
4648
|
|
4618
|
|
- if (val->format != 8 || val->type != XA_INTEGER || val->size != 1)
|
|
4649
|
+ if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
4619
|
4650
|
return BadMatch;
|
4620
|
4651
|
|
4621
|
4652
|
enabled = *(BOOL*)val->data;
|
... |
... |
@@ -4642,7 +4673,7 @@ LibinputSetPropertyScrollPixelDistance(DeviceIntPtr dev, |
4642
|
4673
|
struct xf86libinput *driver_data = pInfo->private;
|
4643
|
4674
|
uint32_t dist;
|
4644
|
4675
|
|
4645
|
|
- if (val->format != 32 || val->type != XA_CARDINAL || val->size != 1)
|
|
4676
|
+ if (val->format != 32 || val->size != 1 || val->type != XA_CARDINAL)
|
4646
|
4677
|
return BadMatch;
|
4647
|
4678
|
|
4648
|
4679
|
dist = *(BOOL*)val->data;
|
... |
... |
@@ -4794,6 +4825,33 @@ LibinputSetPropertyAreaRatio(DeviceIntPtr dev, |
4794
|
4825
|
return Success;
|
4795
|
4826
|
}
|
4796
|
4827
|
|
|
4828
|
+static inline int
|
|
4829
|
+LibinputSetPropertyHighResolutionScroll(DeviceIntPtr dev,
|
|
4830
|
+ Atom atom,
|
|
4831
|
+ XIPropertyValuePtr val,
|
|
4832
|
+ BOOL checkonly)
|
|
4833
|
+{
|
|
4834
|
+ InputInfoPtr pInfo = dev->public.devicePrivate;
|
|
4835
|
+ struct xf86libinput *driver_data = pInfo->private;
|
|
4836
|
+ BOOL enabled;
|
|
4837
|
+
|
|
4838
|
+ if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
|
4839
|
+ return BadMatch;
|
|
4840
|
+
|
|
4841
|
+ enabled = *(BOOL*)val->data;
|
|
4842
|
+ if (checkonly) {
|
|
4843
|
+ if (enabled != 0 && enabled != 1)
|
|
4844
|
+ return BadValue;
|
|
4845
|
+
|
|
4846
|
+ if (!xf86libinput_check_device(dev, atom))
|
|
4847
|
+ return BadMatch;
|
|
4848
|
+ } else {
|
|
4849
|
+ driver_data->options.hires_scrolling_enabled = enabled;
|
|
4850
|
+ }
|
|
4851
|
+
|
|
4852
|
+ return Success;
|
|
4853
|
+}
|
|
4854
|
+
|
4797
|
4855
|
static int
|
4798
|
4856
|
LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
4799
|
4857
|
BOOL checkonly)
|
... |
... |
@@ -4854,6 +4912,8 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val, |
4854
|
4912
|
rc = LibinputSetPropertyPressureCurve(dev, atom, val, checkonly);
|
4855
|
4913
|
else if (atom == prop_area_ratio)
|
4856
|
4914
|
rc = LibinputSetPropertyAreaRatio(dev, atom, val, checkonly);
|
|
4915
|
+ else if (atom == prop_hires_scroll)
|
|
4916
|
+ rc = LibinputSetPropertyHighResolutionScroll(dev, atom, val, checkonly);
|
4857
|
4917
|
else if (atom == prop_device || atom == prop_product_id ||
|
4858
|
4918
|
atom == prop_tap_default ||
|
4859
|
4919
|
atom == prop_tap_drag_default ||
|
... |
... |
@@ -5122,7 +5182,7 @@ LibinputInitAccelProperty(DeviceIntPtr dev, |
5122
|
5182
|
|
5123
|
5183
|
if (profile_mask & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE)
|
5124
|
5184
|
profiles[0] = TRUE;
|
5125
|
|
- if (profile_mask & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE)
|
|
5185
|
+ if (profile_mask & LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT)
|
5126
|
5186
|
profiles[1] = TRUE;
|
5127
|
5187
|
|
5128
|
5188
|
prop_accel_profiles_available = LibinputMakeProperty(dev,
|
... |
... |
@@ -5808,6 +5868,22 @@ LibinputInitTabletAreaRatioProperty(DeviceIntPtr dev, |
5808
|
5868
|
2, data);
|
5809
|
5869
|
}
|
5810
|
5870
|
|
|
5871
|
+static void
|
|
5872
|
+LibinputInitHighResolutionScrollProperty(DeviceIntPtr dev,
|
|
5873
|
+ struct xf86libinput *driver_data,
|
|
5874
|
+ struct libinput_device *device)
|
|
5875
|
+{
|
|
5876
|
+ BOOL enabled = driver_data->options.hires_scrolling_enabled;
|
|
5877
|
+
|
|
5878
|
+ if ((driver_data->capabilities & CAP_POINTER) == 0)
|
|
5879
|
+ return;
|
|
5880
|
+
|
|
5881
|
+ prop_hires_scroll = LibinputMakeProperty(dev,
|
|
5882
|
+ LIBINPUT_PROP_HIRES_WHEEL_SCROLL_ENABLED,
|
|
5883
|
+ XA_INTEGER, 8,
|
|
5884
|
+ 1, &enabled);
|
|
5885
|
+}
|
|
5886
|
+
|
5811
|
5887
|
static void
|
5812
|
5888
|
LibinputInitProperty(DeviceIntPtr dev)
|
5813
|
5889
|
{
|
... |
... |
@@ -5867,4 +5943,5 @@ LibinputInitProperty(DeviceIntPtr dev) |
5867
|
5943
|
LibinputInitScrollPixelDistanceProperty(dev, driver_data, device);
|
5868
|
5944
|
LibinputInitPressureCurveProperty(dev, driver_data);
|
5869
|
5945
|
LibinputInitTabletAreaRatioProperty(dev, driver_data);
|
|
5946
|
+ LibinputInitHighResolutionScrollProperty(dev, driver_data, device);
|
5870
|
5947
|
}
|