backends: Add support for tablet tool pressure ranges
Introduced in libinput 1.26 this feature allows restricting the tablet tool pressure range to a subset of its physical range. The use-case is either to require some higher-than-usual minimum pressure before the pen reacts, or lower-than-usual pressure to reach the maximum logical pressure. libinput takes a [0.0, 1.0] normalized range which we expose as percent in the gsettings. The wacom driver doesn't have an exact equivalent but it has a Threshold setting (range [1, 2048]) that defines when a button is generated for tip down. See gsettings-desktop-schemas!84 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3794>
This commit is contained in:

committed by
Carlos Garnacho

parent
d65c89d8b9
commit
d9ead043c7
@ -117,7 +117,8 @@ meta_input_device_tool_native_new (struct libinput_tablet_tool *tool,
|
||||
|
||||
void
|
||||
meta_input_device_tool_native_set_pressure_curve_in_impl (ClutterInputDeviceTool *tool,
|
||||
double curve[4])
|
||||
double curve[4],
|
||||
double range[2])
|
||||
{
|
||||
MetaInputDeviceToolNative *evdev_tool;
|
||||
graphene_point_t p1, p2;
|
||||
@ -141,6 +142,8 @@ meta_input_device_tool_native_set_pressure_curve_in_impl (ClutterInputDeviceTool
|
||||
evdev_tool->pressure_curve[1] = p2;
|
||||
init_pressurecurve (evdev_tool);
|
||||
}
|
||||
|
||||
libinput_tablet_tool_config_pressure_range_set (evdev_tool->tool, range[0], range[1]);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -53,7 +53,8 @@ GDesktopStylusButtonAction meta_input_device_tool_native_get_button_code_in_impl
|
||||
uint32_t button);
|
||||
|
||||
void meta_input_device_tool_native_set_pressure_curve_in_impl (ClutterInputDeviceTool *tool,
|
||||
double curve[4]);
|
||||
double curve[4],
|
||||
double range[2]);
|
||||
void meta_input_device_tool_native_set_button_code_in_impl (ClutterInputDeviceTool *tool,
|
||||
uint32_t button,
|
||||
GDesktopStylusButtonAction evcode);
|
||||
|
@ -696,16 +696,21 @@ static void
|
||||
meta_input_settings_native_set_stylus_pressure (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *tool,
|
||||
const gint curve[4])
|
||||
const gint curve[4],
|
||||
const gdouble range[2])
|
||||
{
|
||||
gdouble pressure_curve[4];
|
||||
gdouble pressure_range[2];
|
||||
|
||||
pressure_curve[0] = (gdouble) curve[0] / 100;
|
||||
pressure_curve[1] = (gdouble) curve[1] / 100;
|
||||
pressure_curve[2] = (gdouble) curve[2] / 100;
|
||||
pressure_curve[3] = (gdouble) curve[3] / 100;
|
||||
|
||||
meta_input_device_tool_native_set_pressure_curve_in_impl (tool, pressure_curve);
|
||||
pressure_range[0] = (gdouble) range[0];
|
||||
pressure_range[1] = (gdouble) range[1];
|
||||
|
||||
meta_input_device_tool_native_set_pressure_curve_in_impl (tool, pressure_curve, pressure_range);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user