mirror of
https://github.com/labwc/labwc.git
synced 2026-02-05 04:06:33 -05:00
Merge 650a2e196f into edf3624dac
This commit is contained in:
commit
9d5b4947ac
5 changed files with 49 additions and 2 deletions
|
|
@ -1090,7 +1090,8 @@ Note: To rotate touch events with output rotation, use the libinput
|
|||
## TABLET TOOL
|
||||
|
||||
```
|
||||
<tabletTool motion="absolute" relativeMotionSensitivity="1" />
|
||||
<tabletTool motion="absolute" relativeMotionSensitivity="1"
|
||||
minPressure="0" maxPressure="1" />
|
||||
```
|
||||
|
||||
*<tabletTool motion="">* [absolute|relative]
|
||||
|
|
@ -1105,6 +1106,16 @@ Note: To rotate touch events with output rotation, use the libinput
|
|||
speed, using a value greater than 1.0 increases the speed of the
|
||||
cursor. The default is "1.0".
|
||||
|
||||
*<tabletTool minPressure="">*
|
||||
*<tabletTool maxPressure="">*
|
||||
The pressure range of a tablet tool can be controlled by adjusting
|
||||
*minPressure* and *maxPressure*. Setting the minimum pressure to
|
||||
a value greater than zero requires more pressure for the tip
|
||||
threshold, setting the maximum pressure to a value less than 1.0
|
||||
requires less pressure for the user before the maximum is reached.
|
||||
The default is 0 for the minimum pressure and 1.0 for the maximum
|
||||
pressure.
|
||||
|
||||
## LIBINPUT
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -573,8 +573,11 @@
|
|||
*relativeMotionSensitivity* controls the speed of the cursor. Using
|
||||
a value lower than 1.0 decreases the speed, using a value greater than
|
||||
1.0 increases the speed of the cursor.
|
||||
The pressure range of a tablet tool can be controlled by adjusting
|
||||
*minPressure* and *maxPressure*.
|
||||
-->
|
||||
<tabletTool motion="absolute" relativeMotionSensitivity="1.0" />
|
||||
<tabletTool motion="absolute"relativeMotionSensitivity="1.0"
|
||||
minPressure="0" maxPressure="1.0" />
|
||||
|
||||
<!--
|
||||
The *category* attribute is optional and can be set to touch, touchpad,
|
||||
|
|
|
|||
|
|
@ -139,6 +139,8 @@ struct rcxml {
|
|||
struct tablet_tool_config {
|
||||
enum lab_motion motion;
|
||||
double relative_motion_sensitivity;
|
||||
double min_pressure;
|
||||
double max_pressure;
|
||||
} tablet_tool;
|
||||
|
||||
/* libinput */
|
||||
|
|
|
|||
|
|
@ -1353,6 +1353,12 @@ entry(xmlNode *node, char *nodename, char *content)
|
|||
} else if (!strcasecmp(nodename, "relativeMotionSensitivity.tabletTool")) {
|
||||
rc.tablet_tool.relative_motion_sensitivity =
|
||||
tablet_get_dbl_if_positive(content, "relativeMotionSensitivity");
|
||||
} else if (!strcasecmp(nodename, "minPressure.tabletTool")) {
|
||||
rc.tablet_tool.min_pressure =
|
||||
tablet_get_dbl_if_positive(content, "minPressure");
|
||||
} else if (!strcasecmp(nodename, "maxPressure.tabletTool")) {
|
||||
rc.tablet_tool.max_pressure =
|
||||
tablet_get_dbl_if_positive(content, "maxPressure");
|
||||
} else if (!strcasecmp(nodename, "ignoreButtonReleasePeriod.menu")) {
|
||||
rc.menu_ignore_button_release_period = atoi(content);
|
||||
} else if (!strcasecmp(nodename, "showIcons.menu")) {
|
||||
|
|
@ -1473,6 +1479,8 @@ rcxml_init(void)
|
|||
tablet_load_default_button_mappings();
|
||||
rc.tablet_tool.motion = LAB_MOTION_ABSOLUTE;
|
||||
rc.tablet_tool.relative_motion_sensitivity = 1.0;
|
||||
rc.tablet_tool.min_pressure = 0.0;
|
||||
rc.tablet_tool.max_pressure = 1.0;
|
||||
|
||||
rc.repeat_rate = 25;
|
||||
rc.repeat_delay = 600;
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@
|
|||
#include "input/tablet.h"
|
||||
#include <stdlib.h>
|
||||
#include <linux/input-event-codes.h>
|
||||
#include "wlr/backend/libinput.h"
|
||||
#include <wlr/types/wlr_cursor.h>
|
||||
#include <wlr/types/wlr_tablet_tool.h>
|
||||
#include <wlr/types/wlr_tablet_v2.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include <wlr/types/wlr_scene.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "common/macros.h"
|
||||
#include "common/mem.h"
|
||||
#include "common/scene-helpers.h"
|
||||
|
|
@ -336,6 +338,27 @@ handle_tablet_tool_proximity(struct wl_listener *listener, void *data)
|
|||
tool = tablet_tool_create(tablet->seat, ev->tool);
|
||||
}
|
||||
|
||||
struct libinput_tablet_tool *libinput_tool =
|
||||
wlr_libinput_get_tablet_tool_handle(tool->tool_v2->wlr_tool);
|
||||
|
||||
/*
|
||||
* Configure tool pressure range using libinput. Note that a runtime change
|
||||
* needs two proximity-in events. First one is for applying the pressure range
|
||||
* here and second one until it is effectively applied, probably because of
|
||||
* how lininput applies pressure range changes internally.
|
||||
*/
|
||||
if (libinput_tablet_tool_config_pressure_range_is_available(libinput_tool) > 0
|
||||
&& rc.tablet_tool.min_pressure >= 0.0
|
||||
&& rc.tablet_tool.max_pressure <= 1.0) {
|
||||
double min = libinput_tablet_tool_config_pressure_range_get_minimum(libinput_tool);
|
||||
double max = libinput_tablet_tool_config_pressure_range_get_maximum(libinput_tool);
|
||||
if (min != rc.tablet_tool.min_pressure || max != rc.tablet_tool.max_pressure) {
|
||||
wlr_log(WLR_INFO, "tablet tool pressure range configured");
|
||||
libinput_tablet_tool_config_pressure_range_set(libinput_tool,
|
||||
rc.tablet_tool.min_pressure, rc.tablet_tool.max_pressure);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Enforce mouse emulation when the current tool is a tablet mouse.
|
||||
* Client support for tablet mouses in tablet mode is often incomplete
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue