mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
Add click method libinput option (#1416)
<libinput>
<device>
<clickMethod>none|buttonAreas|clickfinger</clickMethod>
</device>
</libinput>
This commit is contained in:
parent
17bad48d87
commit
8be9c38460
6 changed files with 53 additions and 1 deletions
|
|
@ -592,6 +592,7 @@ extending outward from the snapped edge.
|
||||||
<dragLock></dragLock>
|
<dragLock></dragLock>
|
||||||
<middleEmulation></middleEmulation>
|
<middleEmulation></middleEmulation>
|
||||||
<disableWhileTyping></disableWhileTyping>
|
<disableWhileTyping></disableWhileTyping>
|
||||||
|
<clickMethod></clickMethod>
|
||||||
</device>
|
</device>
|
||||||
</libinput>
|
</libinput>
|
||||||
```
|
```
|
||||||
|
|
@ -667,6 +668,22 @@ extending outward from the snapped edge.
|
||||||
any motion events while a keyboard is typing, and for a short while
|
any motion events while a keyboard is typing, and for a short while
|
||||||
after as well.
|
after as well.
|
||||||
|
|
||||||
|
*<libinput><device><clickMethod>* [none|buttonAreas|clickfinger]
|
||||||
|
Configure the method by which physical clicks on a touchpad are mapped to
|
||||||
|
mouse-button events.
|
||||||
|
|
||||||
|
The click methods available are:
|
||||||
|
- *buttonAreas* - The bottom of the touchpad is divided into distinct
|
||||||
|
regions corresponding to left, middle and right buttons; clicking within
|
||||||
|
the region will trigger the corresponding event. Clicking the main area
|
||||||
|
further up produces a left button event.
|
||||||
|
- *clickfinger* - Clicking with one, two or three finger(s) will produce
|
||||||
|
left, right or middle button event without regard to the location of a
|
||||||
|
click.
|
||||||
|
- *none* - Physical clicks will not produce button events.
|
||||||
|
|
||||||
|
The default method depends on the touchpad hardware.
|
||||||
|
|
||||||
## WINDOW RULES
|
## WINDOW RULES
|
||||||
|
|
||||||
Two types of window rules are supported, actions and properties. They are
|
Two types of window rules are supported, actions and properties. They are
|
||||||
|
|
|
||||||
|
|
@ -465,13 +465,14 @@
|
||||||
non-touch, default or the name of a device. You can obtain device names by
|
non-touch, default or the name of a device. You can obtain device names by
|
||||||
running *libinput list-devices* as root or member of the input group.
|
running *libinput list-devices* as root or member of the input group.
|
||||||
|
|
||||||
Tap is set to *yes* be default. All others are left blank in order to use
|
Tap is set to *yes* by default. All others are left blank in order to use
|
||||||
device defaults.
|
device defaults.
|
||||||
|
|
||||||
All values are [yes|no] except for:
|
All values are [yes|no] except for:
|
||||||
- pointerSpeed [-1.0 to 1.0]
|
- pointerSpeed [-1.0 to 1.0]
|
||||||
- accelProfile [flat|adaptive]
|
- accelProfile [flat|adaptive]
|
||||||
- tapButtonMap [lrm|lmr]
|
- tapButtonMap [lrm|lmr]
|
||||||
|
- clickMethod [none|buttonAreas|clickfinger]
|
||||||
-->
|
-->
|
||||||
<libinput>
|
<libinput>
|
||||||
<device category="default">
|
<device category="default">
|
||||||
|
|
@ -485,6 +486,7 @@
|
||||||
<dragLock></dragLock>
|
<dragLock></dragLock>
|
||||||
<middleEmulation></middleEmulation>
|
<middleEmulation></middleEmulation>
|
||||||
<disableWhileTyping></disableWhileTyping>
|
<disableWhileTyping></disableWhileTyping>
|
||||||
|
<clickMethod></clickMethod>
|
||||||
</device>
|
</device>
|
||||||
</libinput>
|
</libinput>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ struct libinput_category {
|
||||||
int accel_profile; /* -1 or libinput_config_accel_profile */
|
int accel_profile; /* -1 or libinput_config_accel_profile */
|
||||||
int middle_emu; /* -1 or libinput_config_middle_emulation_state */
|
int middle_emu; /* -1 or libinput_config_middle_emulation_state */
|
||||||
int dwt; /* -1 or libinput_config_dwt_state */
|
int dwt; /* -1 or libinput_config_dwt_state */
|
||||||
|
int click_method; /* -1 or libinput_config_click_method */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum lab_libinput_device_type get_device_type(const char *s);
|
enum lab_libinput_device_type get_device_type(const char *s);
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ libinput_category_init(struct libinput_category *l)
|
||||||
l->accel_profile = -1;
|
l->accel_profile = -1;
|
||||||
l->middle_emu = -1;
|
l->middle_emu = -1;
|
||||||
l->dwt = -1;
|
l->dwt = -1;
|
||||||
|
l->click_method = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum lab_libinput_device_type
|
enum lab_libinput_device_type
|
||||||
|
|
|
||||||
|
|
@ -563,6 +563,19 @@ fill_libinput_category(char *nodename, char *content)
|
||||||
current_libinput_category->dwt = ret
|
current_libinput_category->dwt = ret
|
||||||
? LIBINPUT_CONFIG_DWT_ENABLED
|
? LIBINPUT_CONFIG_DWT_ENABLED
|
||||||
: LIBINPUT_CONFIG_DWT_DISABLED;
|
: LIBINPUT_CONFIG_DWT_DISABLED;
|
||||||
|
} else if (!strcasecmp(nodename, "clickMethod")) {
|
||||||
|
if (!strcasecmp(content, "none")) {
|
||||||
|
current_libinput_category->click_method =
|
||||||
|
LIBINPUT_CONFIG_CLICK_METHOD_NONE;
|
||||||
|
} else if (!strcasecmp(content, "clickfinger")) {
|
||||||
|
current_libinput_category->click_method =
|
||||||
|
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
|
||||||
|
} else if (!strcasecmp(content, "buttonAreas")) {
|
||||||
|
current_libinput_category->click_method =
|
||||||
|
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
|
||||||
|
} else {
|
||||||
|
wlr_log(WLR_ERROR, "invalid clickMethod");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
18
src/seat.c
18
src/seat.c
|
|
@ -189,6 +189,24 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
|
||||||
wlr_log(WLR_INFO, "dwt configured");
|
wlr_log(WLR_INFO, "dwt configured");
|
||||||
libinput_device_config_dwt_set_enabled(libinput_dev, dc->dwt);
|
libinput_device_config_dwt_set_enabled(libinput_dev, dc->dwt);
|
||||||
}
|
}
|
||||||
|
if ((libinput_device_config_click_get_methods(libinput_dev)
|
||||||
|
& dc->click_method) == 0
|
||||||
|
|| dc->click_method < 0) {
|
||||||
|
wlr_log(WLR_INFO, "click method not configured");
|
||||||
|
} else {
|
||||||
|
wlr_log(WLR_INFO, "click method configured");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note, the documentation claims that:
|
||||||
|
* > [...] The device may require changing to a neutral state
|
||||||
|
* > first before activating the new method.
|
||||||
|
*
|
||||||
|
* However, just setting the method seems to work without
|
||||||
|
* issues.
|
||||||
|
*/
|
||||||
|
|
||||||
|
libinput_device_config_click_set_method(libinput_dev, dc->click_method);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_output *
|
static struct wlr_output *
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue