mirror of
https://github.com/swaywm/sway.git
synced 2025-01-16 16:11:11 +01:00
input/libinput: only reset supported options
This adds checks to the input_manager_libinput_reset_* functions to only attempt resetting supported options on reload. This should have no functional difference to the user, but will remove several `Failed to apply libinput config: Unsupported configuration option` lines from the log that can be noisy and potential red herrings.
This commit is contained in:
parent
152e30c374
commit
32265d9136
1 changed files with 130 additions and 106 deletions
|
@ -307,13 +307,17 @@ static void input_manager_libinput_reset_touch(
|
||||||
input_device->identifier, send_events);
|
input_device->identifier, send_events);
|
||||||
log_libinput_config_status(libinput_device_config_send_events_set_mode(
|
log_libinput_config_status(libinput_device_config_send_events_set_mode(
|
||||||
libinput_device, send_events));
|
libinput_device, send_events));
|
||||||
|
|
||||||
|
if (libinput_device_config_calibration_has_matrix(libinput_device)) {
|
||||||
float m[6];
|
float m[6];
|
||||||
libinput_device_config_calibration_get_default_matrix(libinput_device, m);
|
libinput_device_config_calibration_get_default_matrix(libinput_device, m);
|
||||||
sway_log(SWAY_DEBUG, "libinput_reset_touch(%s) calibration_set_matrix(%f %f %f %f %f %f)",
|
sway_log(SWAY_DEBUG, "libinput_reset_touch(%s) calibration_set_matrix("
|
||||||
input_device->identifier, m[0], m[1], m[2], m[3], m[4], m[5]);
|
"%f %f %f %f %f %f)", input_device->identifier, m[0], m[1],
|
||||||
|
m[2], m[3], m[4], m[5]);
|
||||||
log_libinput_config_status(libinput_device_config_calibration_set_matrix(
|
log_libinput_config_status(libinput_device_config_calibration_set_matrix(
|
||||||
libinput_device, m));
|
libinput_device, m));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void input_manager_libinput_config_pointer(
|
static void input_manager_libinput_config_pointer(
|
||||||
struct sway_input_device *input_device) {
|
struct sway_input_device *input_device) {
|
||||||
|
@ -434,23 +438,33 @@ static void input_manager_libinput_reset_pointer(
|
||||||
struct libinput_device *libinput_device =
|
struct libinput_device *libinput_device =
|
||||||
wlr_libinput_get_device_handle(wlr_device);
|
wlr_libinput_get_device_handle(wlr_device);
|
||||||
|
|
||||||
enum libinput_config_accel_profile accel_profile =
|
uint32_t send_events =
|
||||||
libinput_device_config_accel_get_default_profile(libinput_device);
|
libinput_device_config_send_events_get_default_mode(libinput_device);
|
||||||
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) accel_set_profile(%d)",
|
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) send_events_set_mode(%d)",
|
||||||
input_device->identifier, accel_profile);
|
input_device->identifier, send_events);
|
||||||
log_libinput_config_status(libinput_device_config_accel_set_profile(
|
log_libinput_config_status(libinput_device_config_send_events_set_mode(
|
||||||
libinput_device, accel_profile));
|
libinput_device, send_events));
|
||||||
|
|
||||||
enum libinput_config_click_method click_method =
|
if (libinput_device_config_tap_get_finger_count(libinput_device) > 0) {
|
||||||
libinput_device_config_click_get_default_method(libinput_device);
|
enum libinput_config_tap_state tap =
|
||||||
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) click_set_method(%d)",
|
libinput_device_config_tap_get_default_enabled(libinput_device);
|
||||||
input_device->identifier, click_method);
|
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_enabled(%d)",
|
||||||
log_libinput_config_status(libinput_device_config_click_set_method(
|
input_device->identifier, tap);
|
||||||
libinput_device, click_method));
|
log_libinput_config_status(libinput_device_config_tap_set_enabled(
|
||||||
|
libinput_device, tap));
|
||||||
|
|
||||||
|
enum libinput_config_tap_button_map tap_button_map =
|
||||||
|
libinput_device_config_tap_get_button_map(libinput_device);
|
||||||
|
sway_log(SWAY_DEBUG,
|
||||||
|
"libinput_reset_pointer(%s) tap_set_button_map(%d)",
|
||||||
|
input_device->identifier, tap_button_map);
|
||||||
|
log_libinput_config_status(libinput_device_config_tap_set_button_map(
|
||||||
|
libinput_device, tap_button_map));
|
||||||
|
|
||||||
enum libinput_config_drag_state drag =
|
enum libinput_config_drag_state drag =
|
||||||
libinput_device_config_tap_get_default_drag_enabled(libinput_device);
|
libinput_device_config_tap_get_default_drag_enabled(libinput_device);
|
||||||
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_drag_enabled(%d)",
|
sway_log(SWAY_DEBUG,
|
||||||
|
"libinput_reset_pointer(%s) tap_set_drag_enabled(%d)",
|
||||||
input_device->identifier, drag);
|
input_device->identifier, drag);
|
||||||
log_libinput_config_status(libinput_device_config_tap_set_drag_enabled(
|
log_libinput_config_status(libinput_device_config_tap_set_drag_enabled(
|
||||||
libinput_device, drag));
|
libinput_device, drag));
|
||||||
|
@ -464,32 +478,25 @@ static void input_manager_libinput_reset_pointer(
|
||||||
log_libinput_config_status(
|
log_libinput_config_status(
|
||||||
libinput_device_config_tap_set_drag_lock_enabled(
|
libinput_device_config_tap_set_drag_lock_enabled(
|
||||||
libinput_device, drag_lock));
|
libinput_device, drag_lock));
|
||||||
|
}
|
||||||
|
|
||||||
enum libinput_config_dwt_state dwt =
|
if (libinput_device_config_accel_is_available(libinput_device)) {
|
||||||
libinput_device_config_dwt_get_default_enabled(libinput_device);
|
double pointer_accel =
|
||||||
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) dwt_set_enabled(%d)",
|
libinput_device_config_accel_get_default_speed(libinput_device);
|
||||||
input_device->identifier, dwt);
|
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) accel_set_speed(%f)",
|
||||||
log_libinput_config_status(libinput_device_config_dwt_set_enabled(
|
input_device->identifier, pointer_accel);
|
||||||
libinput_device, dwt));
|
log_libinput_config_status(libinput_device_config_accel_set_speed(
|
||||||
|
libinput_device, pointer_accel));
|
||||||
|
|
||||||
int left_handed =
|
enum libinput_config_accel_profile accel_profile =
|
||||||
libinput_device_config_left_handed_get_default(libinput_device);
|
libinput_device_config_accel_get_default_profile(libinput_device);
|
||||||
sway_log(SWAY_DEBUG,
|
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) accel_set_profile(%d)",
|
||||||
"libinput_reset_pointer(%s) left_handed_set_enabled(%d)",
|
input_device->identifier, accel_profile);
|
||||||
input_device->identifier, left_handed);
|
log_libinput_config_status(libinput_device_config_accel_set_profile(
|
||||||
log_libinput_config_status(libinput_device_config_left_handed_set(
|
libinput_device, accel_profile));
|
||||||
libinput_device, left_handed));
|
}
|
||||||
|
|
||||||
enum libinput_config_middle_emulation_state middle_emulation =
|
|
||||||
libinput_device_config_middle_emulation_get_default_enabled(
|
|
||||||
libinput_device);
|
|
||||||
sway_log(SWAY_DEBUG,
|
|
||||||
"libinput_reset_pointer(%s) middle_emulation_set_enabled(%d)",
|
|
||||||
input_device->identifier, middle_emulation);
|
|
||||||
log_libinput_config_status(
|
|
||||||
libinput_device_config_middle_emulation_set_enabled(
|
|
||||||
libinput_device, middle_emulation));
|
|
||||||
|
|
||||||
|
if (libinput_device_config_scroll_has_natural_scroll(libinput_device)) {
|
||||||
int natural_scroll =
|
int natural_scroll =
|
||||||
libinput_device_config_scroll_get_default_natural_scroll_enabled(
|
libinput_device_config_scroll_get_default_natural_scroll_enabled(
|
||||||
libinput_device);
|
libinput_device);
|
||||||
|
@ -499,21 +506,42 @@ static void input_manager_libinput_reset_pointer(
|
||||||
log_libinput_config_status(
|
log_libinput_config_status(
|
||||||
libinput_device_config_scroll_set_natural_scroll_enabled(
|
libinput_device_config_scroll_set_natural_scroll_enabled(
|
||||||
libinput_device, natural_scroll));
|
libinput_device, natural_scroll));
|
||||||
|
}
|
||||||
|
|
||||||
double pointer_accel =
|
if (libinput_device_config_left_handed_is_available(libinput_device)) {
|
||||||
libinput_device_config_accel_get_default_speed(libinput_device);
|
int left_handed =
|
||||||
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) accel_set_speed(%f)",
|
libinput_device_config_left_handed_get_default(libinput_device);
|
||||||
input_device->identifier, pointer_accel);
|
sway_log(SWAY_DEBUG,
|
||||||
log_libinput_config_status(libinput_device_config_accel_set_speed(
|
"libinput_reset_pointer(%s) left_handed_set_enabled(%d)",
|
||||||
libinput_device, pointer_accel));
|
input_device->identifier, left_handed);
|
||||||
|
log_libinput_config_status(libinput_device_config_left_handed_set(
|
||||||
|
libinput_device, left_handed));
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t scroll_button =
|
uint32_t click = libinput_device_config_click_get_methods(libinput_device);
|
||||||
libinput_device_config_scroll_get_default_button(libinput_device);
|
if ((click & ~LIBINPUT_CONFIG_CLICK_METHOD_NONE) != 0) {
|
||||||
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) scroll_set_button(%d)",
|
enum libinput_config_click_method click_method =
|
||||||
input_device->identifier, scroll_button);
|
libinput_device_config_click_get_default_method(libinput_device);
|
||||||
log_libinput_config_status(libinput_device_config_scroll_set_button(
|
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) click_set_method(%d)",
|
||||||
libinput_device, scroll_button));
|
input_device->identifier, click_method);
|
||||||
|
log_libinput_config_status(libinput_device_config_click_set_method(
|
||||||
|
libinput_device, click_method));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (libinput_device_config_middle_emulation_is_available(libinput_device)) {
|
||||||
|
enum libinput_config_middle_emulation_state middle_emulation =
|
||||||
|
libinput_device_config_middle_emulation_get_default_enabled(
|
||||||
|
libinput_device);
|
||||||
|
sway_log(SWAY_DEBUG,
|
||||||
|
"libinput_reset_pointer(%s) middle_emulation_set_enabled(%d)",
|
||||||
|
input_device->identifier, middle_emulation);
|
||||||
|
log_libinput_config_status(
|
||||||
|
libinput_device_config_middle_emulation_set_enabled(
|
||||||
|
libinput_device, middle_emulation));
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t scroll = libinput_device_config_scroll_get_methods(libinput_device);
|
||||||
|
if ((scroll & ~LIBINPUT_CONFIG_SCROLL_NO_SCROLL) != 0) {
|
||||||
enum libinput_config_scroll_method scroll_method =
|
enum libinput_config_scroll_method scroll_method =
|
||||||
libinput_device_config_scroll_get_default_method(libinput_device);
|
libinput_device_config_scroll_get_default_method(libinput_device);
|
||||||
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) scroll_set_method(%d)",
|
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) scroll_set_method(%d)",
|
||||||
|
@ -521,26 +549,22 @@ static void input_manager_libinput_reset_pointer(
|
||||||
log_libinput_config_status(libinput_device_config_scroll_set_method(
|
log_libinput_config_status(libinput_device_config_scroll_set_method(
|
||||||
libinput_device, scroll_method));
|
libinput_device, scroll_method));
|
||||||
|
|
||||||
uint32_t send_events =
|
uint32_t scroll_button =
|
||||||
libinput_device_config_send_events_get_default_mode(libinput_device);
|
libinput_device_config_scroll_get_default_button(libinput_device);
|
||||||
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) send_events_set_mode(%d)",
|
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) scroll_set_button(%d)",
|
||||||
input_device->identifier, send_events);
|
input_device->identifier, scroll_button);
|
||||||
log_libinput_config_status(libinput_device_config_send_events_set_mode(
|
log_libinput_config_status(libinput_device_config_scroll_set_button(
|
||||||
libinput_device, send_events));
|
libinput_device, scroll_button));
|
||||||
|
}
|
||||||
|
|
||||||
enum libinput_config_tap_state tap =
|
if (libinput_device_config_dwt_is_available(libinput_device)) {
|
||||||
libinput_device_config_tap_get_default_enabled(libinput_device);
|
enum libinput_config_dwt_state dwt =
|
||||||
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_enabled(%d)",
|
libinput_device_config_dwt_get_default_enabled(libinput_device);
|
||||||
input_device->identifier, tap);
|
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) dwt_set_enabled(%d)",
|
||||||
log_libinput_config_status(libinput_device_config_tap_set_enabled(
|
input_device->identifier, dwt);
|
||||||
libinput_device, tap));
|
log_libinput_config_status(libinput_device_config_dwt_set_enabled(
|
||||||
|
libinput_device, dwt));
|
||||||
enum libinput_config_tap_button_map tap_button_map =
|
}
|
||||||
libinput_device_config_tap_get_button_map(libinput_device);
|
|
||||||
sway_log(SWAY_DEBUG, "libinput_reset_pointer(%s) tap_set_button_map(%d)",
|
|
||||||
input_device->identifier, tap_button_map);
|
|
||||||
log_libinput_config_status(libinput_device_config_tap_set_button_map(
|
|
||||||
libinput_device, tap_button_map));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_device_destroy(struct wl_listener *listener, void *data) {
|
static void handle_device_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
|
Loading…
Reference in a new issue