diff --git a/meson.build b/meson.build index 5c88a4840..2c2f0dc83 100644 --- a/meson.build +++ b/meson.build @@ -34,6 +34,7 @@ pixman = dependency('pixman-1') xkbcommon = dependency('xkbcommon') libdl = meson.get_compiler('cpp').find_library('dl') json = dependency('nlohmann_json', version: '>= 3.11.2') +udev = dependency('libudev') # We're not to use system wlroots: So we'll use the subproject if get_option('use_system_wlroots').disabled() diff --git a/src/api/wayfire/config-backend.hpp b/src/api/wayfire/config-backend.hpp index 8a47601e7..54db71bb6 100644 --- a/src/api/wayfire/config-backend.hpp +++ b/src/api/wayfire/config-backend.hpp @@ -49,7 +49,7 @@ class config_backend_t * described in input-device.xml */ virtual std::shared_ptr get_input_device_section( - wlr_input_device *device); + std::string const & prefix, wlr_input_device *device); virtual ~config_backend_t() = default; diff --git a/src/api/wayfire/debug.hpp b/src/api/wayfire/debug.hpp index d1abe6f76..fccfff942 100644 --- a/src/api/wayfire/debug.hpp +++ b/src/api/wayfire/debug.hpp @@ -42,29 +42,31 @@ namespace log enum class logging_category : size_t { // Transactions - general - TXN = 0, + TXN = 0, // Transactions - individual objects - TXNI = 1, + TXNI = 1, // Views - events - VIEWS = 2, + VIEWS = 2, // Wlroots messages - WLR = 3, + WLR = 3, // Direct scanout - SCANOUT = 4, + SCANOUT = 4, // Pointer events - POINTER = 5, + POINTER = 5, // Workspace set events - WSET = 6, + WSET = 6, // Keyboard-related events - KBD = 7, + KBD = 7, // Xwayland-related events - XWL = 8, + XWL = 8, // Layer-shell-related events - LSHELL = 9, + LSHELL = 9, // Input-Method-related events - IM = 10, + IM = 10, // Rendering-related events - RENDER = 11, + RENDER = 11, + // Input-device-related events + INPUT_DEVICES = 12, TOTAL, }; diff --git a/src/api/wayfire/input-device.hpp b/src/api/wayfire/input-device.hpp index ce051d80b..c86dc7384 100644 --- a/src/api/wayfire/input-device.hpp +++ b/src/api/wayfire/input-device.hpp @@ -21,6 +21,12 @@ class input_device_t */ bool set_enabled(bool enabled = true); + /** + * Calibrate a touch device with a matrix. This function does nothing + * if called with a device that is not a touch device. + */ + void calibrate_touch_device(std::string const & cal); + /** * @return true if the compositor should receive events from the device */ diff --git a/src/core/core.cpp b/src/core/core.cpp index 329890433..8778fd18e 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -228,7 +228,7 @@ void wf::compositor_core_impl_t::post_init() seat->focus_output(wo); // Refresh device mappings when we have all outputs and devices - input->refresh_device_mappings(); + input->configure_input_devices(); // Start processing cursor events seat->priv->cursor->setup_listeners(); diff --git a/src/core/plugin.cpp b/src/core/plugin.cpp index 6d7d8917d..614e11217 100644 --- a/src/core/plugin.cpp +++ b/src/core/plugin.cpp @@ -5,6 +5,7 @@ #include "wayfire/signal-definitions.hpp" #include #include +#include void wf::plugin_interface_t::fini() {} @@ -27,18 +28,71 @@ std::shared_ptr wf::config_backend_t::get_output_section( return config.get_section(name); } +static struct udev_property_and_desc +{ + char const *property_name; + char const *description; +} properties_and_descs[] = +{ + {"ID_PATH", "stable physical connection path"}, + {"ID_SERIAL", "stable vendor+pn+sn info"}, + {"LIBINPUT_DEVICE_GROUP", "stable libinput info"}, + // sometimes it contains info "by path", sometimes "by id" + {"DEVPATH", "unstable devpath"}, + // used for debugging, to find DEVPATH and match the right + // device in `udevadm info --tree` +}; + std::shared_ptr wf::config_backend_t::get_input_device_section( - wlr_input_device *device) + std::string const & prefix, wlr_input_device *device) { - std::string name = nonull(device->name); - name = "input-device:" + name; auto& config = wf::get_core().config; - if (!config.get_section(name)) + std::shared_ptr section; + + if (wlr_input_device_is_libinput(device)) { - config.merge_section( - config.get_section("input-device")->clone_with_name(name)); + auto libinput_dev = wlr_libinput_get_device_handle(device); + if (libinput_dev) + { + udev_device *udev_dev = libinput_device_get_udev_device(libinput_dev); + if (udev_dev) + { + for (struct udev_property_and_desc const & pd : properties_and_descs) + { + const char *value = udev_device_get_property_value(udev_dev, pd.property_name); + if (value == nullptr) + { + continue; + } + + std::string name = prefix + ":" + nonull(value); + LOGC(INPUT_DEVICES, "Checking for config section [", name, "] ", + pd.property_name, " (", pd.description, ")"); + section = config.get_section(name); + if (section) + { + LOGC(INPUT_DEVICES, "Using config section [", name, "] for ", nonull(device->name)); + return section; + } + } + } + } } + std::string name = nonull(device->name); + name = prefix + ":" + name; + LOGC(INPUT_DEVICES, "Checking for config section [", name, "]"); + section = config.get_section(name); + if (section) + { + LOGC(INPUT_DEVICES, "Using config section [", name, "]"); + return section; + } + + config.merge_section( + config.get_section(prefix)->clone_with_name(name)); + + LOGC(INPUT_DEVICES, "Using config section [", name, "]"); return config.get_section(name); } diff --git a/src/core/seat/input-manager.cpp b/src/core/seat/input-manager.cpp index ebf413668..e198717f2 100644 --- a/src/core/seat/input-manager.cpp +++ b/src/core/seat/input-manager.cpp @@ -52,10 +52,52 @@ void wf::input_manager_t::handle_new_input(wlr_input_device *dev) data.device = nonstd::make_observer(input_devices.back().get()); wf::get_core().emit(&data); - refresh_device_mappings(); + configure_input_devices(); } -void wf::input_manager_t::refresh_device_mappings() +void wf::input_manager_t::configure_input_device(std::unique_ptr & device) +{ + auto dev = device->get_wlr_handle(); + auto cursor = wf::get_core().get_wlr_cursor(); + auto section = + wf::get_core().config_backend->get_input_device_section("input-device", dev); + + auto mapped_output = section->get_option("output")->get_value_str(); + if (mapped_output.empty()) + { + if (dev->type == WLR_INPUT_DEVICE_POINTER) + { + mapped_output = nonull(wlr_pointer_from_input_device( + dev)->output_name); + } else if (dev->type == WLR_INPUT_DEVICE_TOUCH) + { + mapped_output = + nonull(wlr_touch_from_input_device(dev)->output_name); + } else + { + mapped_output = nonull(dev->name); + } + } + + auto cal = section->get_option("calibration")->get_value_str(); + if (!cal.empty()) + { + device->calibrate_touch_device(cal); + } + + auto wo = wf::get_core().output_layout->find_output(mapped_output); + if (wo) + { + LOGD("Mapping input ", dev->name, " to output ", wo->to_string(), "."); + wlr_cursor_map_input_to_output(cursor, dev, wo->handle); + } else + { + LOGD("Mapping input ", dev->name, " to output null."); + wlr_cursor_map_input_to_output(cursor, dev, nullptr); + } +} + +void wf::input_manager_t::configure_input_devices() { // Might trigger motion events which we want to avoid at other stages auto state = wf::get_core().get_current_state(); @@ -64,40 +106,9 @@ void wf::input_manager_t::refresh_device_mappings() return; } - auto cursor = wf::get_core().get_wlr_cursor(); for (auto& device : this->input_devices) { - wlr_input_device *dev = device->get_wlr_handle(); - auto section = - wf::get_core().config_backend->get_input_device_section(dev); - - auto mapped_output = section->get_option("output")->get_value_str(); - if (mapped_output.empty()) - { - if (dev->type == WLR_INPUT_DEVICE_POINTER) - { - mapped_output = nonull(wlr_pointer_from_input_device( - dev)->output_name); - } else if (dev->type == WLR_INPUT_DEVICE_TOUCH) - { - mapped_output = - nonull(wlr_touch_from_input_device(dev)->output_name); - } else - { - mapped_output = nonull(dev->name); - } - } - - auto wo = wf::get_core().output_layout->find_output(mapped_output); - if (wo) - { - LOGD("Mapping input ", dev->name, " to output ", wo->to_string(), "."); - wlr_cursor_map_input_to_output(cursor, dev, wo->handle); - } else - { - LOGD("Mapping input ", dev->name, " to output null."); - wlr_cursor_map_input_to_output(cursor, dev, nullptr); - } + configure_input_device(device); } } @@ -141,8 +152,6 @@ void load_locked_mods_from_config(xkb_mod_mask_t& locked_mods) wf::input_manager_t::input_manager_t() { - wf::pointing_device_t::config.load(); - load_locked_mods_from_config(locked_mods); input_device_created.set_callback([&] (void *data) @@ -170,7 +179,7 @@ wf::input_manager_t::input_manager_t() ev->output->set_inhibited(true); } - refresh_device_mappings(); + configure_input_devices(); }); wf::get_core().output_layout->connect(&output_added); } diff --git a/src/core/seat/input-manager.hpp b/src/core/seat/input-manager.hpp index 54392396e..a41becef8 100644 --- a/src/core/seat/input-manager.hpp +++ b/src/core/seat/input-manager.hpp @@ -37,11 +37,17 @@ class input_manager_t */ uint32_t locked_mods = 0; + /** + * Map a single input device to output as specified in the + * config file or by hints in the wlroots backend. + */ + void configure_input_device(std::unique_ptr & device); + /** * Go through all input devices and map them to outputs as specified in the * config file or by hints in the wlroots backend. */ - void refresh_device_mappings(); + void configure_input_devices(); input_manager_t(); ~input_manager_t() = default; diff --git a/src/core/seat/keyboard.cpp b/src/core/seat/keyboard.cpp index ad3ab71b1..51a964dea 100644 --- a/src/core/seat/keyboard.cpp +++ b/src/core/seat/keyboard.cpp @@ -121,14 +121,18 @@ void wf::keyboard_t::setup_listeners() wf::keyboard_t::keyboard_t(wlr_input_device *dev) : handle(wlr_keyboard_from_input_device(dev)), device(dev) { - model.load_option("input/xkb_model"); - variant.load_option("input/xkb_variant"); - layout.load_option("input/xkb_layout"); - options.load_option("input/xkb_options"); - rules.load_option("input/xkb_rules"); - - repeat_rate.load_option("input/kb_repeat_rate"); - repeat_delay.load_option("input/kb_repeat_delay"); + auto section = + wf::get_core().config_backend->get_input_device_section("input", dev); + auto section_name = section->get_name(); + + model.load_option(section_name + "/xkb_model"); + variant.load_option(section_name + "/xkb_variant"); + layout.load_option(section_name + "/xkb_layout"); + options.load_option(section_name + "/xkb_options"); + rules.load_option(section_name + "/xkb_rules"); + + repeat_rate.load_option(section_name + "/kb_repeat_rate"); + repeat_delay.load_option(section_name + "/kb_repeat_delay"); // When the configuration options change, mark them as dirty. // They are applied at the config-reloaded signal. diff --git a/src/core/seat/pointer.cpp b/src/core/seat/pointer.cpp index 943dbeb4b..f4a5daf9d 100644 --- a/src/core/seat/pointer.cpp +++ b/src/core/seat/pointer.cpp @@ -355,9 +355,8 @@ void wf::pointer_t::handle_pointer_axis(wlr_pointer_axis_event *ev, } /* Calculate speed settings */ - double mult = ev->source == WL_POINTER_AXIS_SOURCE_FINGER ? - wf::pointing_device_t::config.touchpad_scroll_speed : - wf::pointing_device_t::config.mouse_scroll_speed; + wf::pointing_device_t *pd = (wf::pointing_device_t*)ev->pointer->base.data; + double mult = pd->get_scroll_speed(&ev->pointer->base, ev->source == WL_POINTER_AXIS_SOURCE_FINGER); ev->delta *= mult; ev->delta_discrete *= mult; diff --git a/src/core/seat/pointing-device.cpp b/src/core/seat/pointing-device.cpp index 725d5dc37..a533934de 100644 --- a/src/core/seat/pointing-device.cpp +++ b/src/core/seat/pointing-device.cpp @@ -3,32 +3,37 @@ wf::pointing_device_t::pointing_device_t(wlr_input_device *dev) : input_device_impl_t(dev) { + dev->data = this; + load_options(); update_options(); } -wf::pointing_device_t::config_t wf::pointing_device_t::config; -void wf::pointing_device_t::config_t::load() +void wf::pointing_device_t::load_options() { - left_handed_mode.load_option("input/left_handed_mode"); - middle_emulation.load_option("input/middle_emulation"); - - mouse_scroll_speed.load_option("input/mouse_scroll_speed"); - mouse_cursor_speed.load_option("input/mouse_cursor_speed"); - touchpad_cursor_speed.load_option("input/touchpad_cursor_speed"); - touchpad_scroll_speed.load_option("input/touchpad_scroll_speed"); - - mouse_natural_scroll_enabled.load_option("input/mouse_natural_scroll"); - touchpad_tap_enabled.load_option("input/tap_to_click"); - touchpad_dwt_enabled.load_option("input/disable_touchpad_while_typing"); - touchpad_dwmouse_enabled.load_option("input/disable_touchpad_while_mouse"); - touchpad_natural_scroll_enabled.load_option("input/natural_scroll"); - touchpad_drag_lock_enabled.load_option("input/drag_lock"); - - mouse_accel_profile.load_option("input/mouse_accel_profile"); - touchpad_accel_profile.load_option("input/touchpad_accel_profile"); - - touchpad_click_method.load_option("input/click_method"); - touchpad_scroll_method.load_option("input/scroll_method"); + auto section = + wf::get_core().config_backend->get_input_device_section("input", get_wlr_handle()); + auto section_name = section->get_name(); + + left_handed_mode.load_option(section_name + "/left_handed_mode"); + middle_emulation.load_option(section_name + "/middle_emulation"); + + mouse_scroll_speed.load_option(section_name + "/mouse_scroll_speed"); + mouse_cursor_speed.load_option(section_name + "/mouse_cursor_speed"); + touchpad_cursor_speed.load_option(section_name + "/touchpad_cursor_speed"); + touchpad_scroll_speed.load_option(section_name + "/touchpad_scroll_speed"); + + mouse_natural_scroll_enabled.load_option(section_name + "/mouse_natural_scroll"); + touchpad_tap_enabled.load_option(section_name + "/tap_to_click"); + touchpad_dwt_enabled.load_option(section_name + "/disable_touchpad_while_typing"); + touchpad_dwmouse_enabled.load_option(section_name + "/disable_touchpad_while_mouse"); + touchpad_natural_scroll_enabled.load_option(section_name + "/natural_scroll"); + touchpad_drag_lock_enabled.load_option(section_name + "/drag_lock"); + + mouse_accel_profile.load_option(section_name + "/mouse_accel_profile"); + touchpad_accel_profile.load_option(section_name + "/touchpad_accel_profile"); + + touchpad_click_method.load_option(section_name + "/click_method"); + touchpad_scroll_method.load_option(section_name + "/scroll_method"); } static void set_libinput_accel_profile(libinput_device *dev, std::string name) @@ -63,10 +68,10 @@ void wf::pointing_device_t::update_options() auto dev = wlr_libinput_get_device_handle(get_wlr_handle()); assert(dev); - libinput_device_config_left_handed_set(dev, config.left_handed_mode); + libinput_device_config_left_handed_set(dev, left_handed_mode); libinput_device_config_middle_emulation_set_enabled(dev, - config.middle_emulation ? + middle_emulation ? LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED : LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); @@ -74,82 +79,93 @@ void wf::pointing_device_t::update_options() if (libinput_device_config_tap_get_finger_count(dev) > 0) { libinput_device_config_accel_set_speed(dev, - config.touchpad_cursor_speed); + touchpad_cursor_speed); - set_libinput_accel_profile(dev, config.touchpad_accel_profile); + set_libinput_accel_profile(dev, touchpad_accel_profile); libinput_device_config_tap_set_enabled(dev, - config.touchpad_tap_enabled ? + touchpad_tap_enabled ? LIBINPUT_CONFIG_TAP_ENABLED : LIBINPUT_CONFIG_TAP_DISABLED); - if ((std::string)config.touchpad_click_method == "default") + if ((std::string)touchpad_click_method == "default") { libinput_device_config_click_set_method(dev, libinput_device_config_click_get_default_method(dev)); - } else if ((std::string)config.touchpad_click_method == "none") + } else if ((std::string)touchpad_click_method == "none") { libinput_device_config_click_set_method(dev, LIBINPUT_CONFIG_CLICK_METHOD_NONE); - } else if ((std::string)config.touchpad_click_method == "button-areas") + } else if ((std::string)touchpad_click_method == "button-areas") { libinput_device_config_click_set_method(dev, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); - } else if ((std::string)config.touchpad_click_method == "clickfinger") + } else if ((std::string)touchpad_click_method == "clickfinger") { libinput_device_config_click_set_method(dev, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); } - if ((std::string)config.touchpad_scroll_method == "default") + if ((std::string)touchpad_scroll_method == "default") { libinput_device_config_scroll_set_method(dev, libinput_device_config_scroll_get_default_method(dev)); - } else if ((std::string)config.touchpad_scroll_method == "none") + } else if ((std::string)touchpad_scroll_method == "none") { libinput_device_config_scroll_set_method(dev, LIBINPUT_CONFIG_SCROLL_NO_SCROLL); - } else if ((std::string)config.touchpad_scroll_method == "two-finger") + } else if ((std::string)touchpad_scroll_method == "two-finger") { libinput_device_config_scroll_set_method(dev, LIBINPUT_CONFIG_SCROLL_2FG); - } else if ((std::string)config.touchpad_scroll_method == "edge") + } else if ((std::string)touchpad_scroll_method == "edge") { libinput_device_config_scroll_set_method(dev, LIBINPUT_CONFIG_SCROLL_EDGE); - } else if ((std::string)config.touchpad_scroll_method == "on-button-down") + } else if ((std::string)touchpad_scroll_method == "on-button-down") { libinput_device_config_scroll_set_method(dev, LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); } libinput_device_config_dwt_set_enabled(dev, - config.touchpad_dwt_enabled ? + touchpad_dwt_enabled ? LIBINPUT_CONFIG_DWT_ENABLED : LIBINPUT_CONFIG_DWT_DISABLED); libinput_device_config_send_events_set_mode(dev, - config.touchpad_dwmouse_enabled ? + touchpad_dwmouse_enabled ? LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE : LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); libinput_device_config_tap_set_drag_lock_enabled(dev, - config.touchpad_drag_lock_enabled ? + touchpad_drag_lock_enabled ? LIBINPUT_CONFIG_DRAG_LOCK_ENABLED : LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); if (libinput_device_config_scroll_has_natural_scroll(dev) > 0) { libinput_device_config_scroll_set_natural_scroll_enabled(dev, - (bool)config.touchpad_natural_scroll_enabled); + (bool)touchpad_natural_scroll_enabled); } } else { libinput_device_config_accel_set_speed(dev, - config.mouse_cursor_speed); - set_libinput_accel_profile(dev, config.mouse_accel_profile); + mouse_cursor_speed); + set_libinput_accel_profile(dev, mouse_accel_profile); if (libinput_device_config_scroll_has_natural_scroll(dev) > 0) { libinput_device_config_scroll_set_natural_scroll_enabled(dev, - (bool)config.mouse_natural_scroll_enabled); + (bool)mouse_natural_scroll_enabled); } } } + +double wf::pointing_device_t::get_scroll_speed(wlr_input_device *dev, bool touchpad) +{ + if ((touchpad && (dev->type != WLR_INPUT_DEVICE_TABLET_PAD)) || + (!touchpad && (dev->type != WLR_INPUT_DEVICE_POINTER))) + { + return 1.0; + } + + return touchpad ? touchpad_scroll_speed : mouse_scroll_speed; +} diff --git a/src/core/seat/pointing-device.hpp b/src/core/seat/pointing-device.hpp index 1a74e376a..7c9f17260 100644 --- a/src/core/seat/pointing-device.hpp +++ b/src/core/seat/pointing-device.hpp @@ -10,29 +10,28 @@ struct pointing_device_t : public input_device_impl_t pointing_device_t(wlr_input_device *dev); virtual ~pointing_device_t() = default; + void load_options(); void update_options() override; - static struct config_t - { - wf::option_wrapper_t left_handed_mode; - wf::option_wrapper_t middle_emulation; - wf::option_wrapper_t mouse_cursor_speed; - wf::option_wrapper_t mouse_scroll_speed; - wf::option_wrapper_t tablet_motion_mode; - wf::option_wrapper_t touchpad_cursor_speed; - wf::option_wrapper_t touchpad_scroll_speed; - wf::option_wrapper_t touchpad_click_method; - wf::option_wrapper_t touchpad_scroll_method; - wf::option_wrapper_t touchpad_accel_profile; - wf::option_wrapper_t mouse_accel_profile; - wf::option_wrapper_t touchpad_tap_enabled; - wf::option_wrapper_t touchpad_dwt_enabled; - wf::option_wrapper_t touchpad_dwmouse_enabled; - wf::option_wrapper_t touchpad_natural_scroll_enabled; - wf::option_wrapper_t mouse_natural_scroll_enabled; - wf::option_wrapper_t touchpad_drag_lock_enabled; - void load(); - } config; + double get_scroll_speed(wlr_input_device *dev, bool touchpad); + + wf::option_wrapper_t left_handed_mode; + wf::option_wrapper_t middle_emulation; + wf::option_wrapper_t mouse_cursor_speed; + wf::option_wrapper_t mouse_scroll_speed; + wf::option_wrapper_t tablet_motion_mode; + wf::option_wrapper_t touchpad_cursor_speed; + wf::option_wrapper_t touchpad_scroll_speed; + wf::option_wrapper_t touchpad_click_method; + wf::option_wrapper_t touchpad_scroll_method; + wf::option_wrapper_t touchpad_accel_profile; + wf::option_wrapper_t mouse_accel_profile; + wf::option_wrapper_t touchpad_tap_enabled; + wf::option_wrapper_t touchpad_dwt_enabled; + wf::option_wrapper_t touchpad_dwmouse_enabled; + wf::option_wrapper_t touchpad_natural_scroll_enabled; + wf::option_wrapper_t mouse_natural_scroll_enabled; + wf::option_wrapper_t touchpad_drag_lock_enabled; }; } diff --git a/src/core/seat/seat.cpp b/src/core/seat/seat.cpp index 072cf0c30..f02ac9eb4 100644 --- a/src/core/seat/seat.cpp +++ b/src/core/seat/seat.cpp @@ -578,6 +578,41 @@ bool input_device_t::is_enabled() return mode == LIBINPUT_CONFIG_SEND_EVENTS_ENABLED; } +void input_device_t::calibrate_touch_device(std::string const & cal) +{ + wlr_input_device *dev = handle; + if (!wlr_input_device_is_libinput(dev) || (dev->type != WLR_INPUT_DEVICE_TOUCH)) + { + return; + } + + float m[6]; + auto libinput_dev = wlr_libinput_get_device_handle(dev); + if (sscanf(cal.c_str(), "%f %f %f %f %f %f", + &m[0], &m[1], &m[2], &m[3], &m[4], &m[5]) == 6) + { + enum libinput_config_status status; + + status = libinput_device_config_calibration_set_matrix(libinput_dev, m); + if (status != LIBINPUT_CONFIG_STATUS_SUCCESS) + { + LOGE("Failed to apply calibration for ", nonull(dev->name)); + LOGE(" ", m[0], " ", m[1], " ", m[2], " ", m[3], " ", m[4], " ", m[5]); + } else + { + LOGI("Calibrated input device successfully: ", nonull(dev->name)); + LOGI(" ", m[0], " ", m[1], " ", m[2], " ", m[3], " ", m[4], " ", m[5]); + } + } else + { + LOGE("Incorrect calibration configuration for ", nonull(dev->name)); + LOGI("Setting default matrix calibration: "); + libinput_device_config_calibration_get_default_matrix(libinput_dev, m); + LOGI(" ", m[0], " ", m[1], " ", m[2], " ", m[3], " ", m[4], " ", m[5]); + libinput_device_config_calibration_set_matrix(libinput_dev, m); + } +} + input_device_t::input_device_t(wlr_input_device *handle) { this->handle = handle; diff --git a/src/main.cpp b/src/main.cpp index 4073616d9..ac7c283ae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -234,6 +234,10 @@ void parse_extended_debugging(const std::vector& categories) { LOGD("Enabling extended debugging for render events"); wf::log::enabled_categories.set((size_t)wf::log::logging_category::RENDER, 1); + } else if (cat == "input-devices") + { + LOGD("Enabling extended debugging for input-devices"); + wf::log::enabled_categories.set((size_t)wf::log::logging_category::INPUT_DEVICES, 1); } else { LOGE("Unrecognized debugging category \"", cat, "\""); diff --git a/src/meson.build b/src/meson.build index a58372345..01166f767 100644 --- a/src/meson.build +++ b/src/meson.build @@ -64,7 +64,8 @@ wayfire_sources = ['geometry.cpp', wayfire_dependencies = [wayland_server, wlroots, xkbcommon, libinput, pixman, drm, egl, glesv2, glm, wf_protos, libdl, - wfconfig, libinotify, backtrace, wfutils, xcb, wftouch, json] + wfconfig, libinotify, backtrace, wfutils, xcb, + wftouch, json, udev] if conf_data.get('BUILD_WITH_IMAGEIO') wayfire_dependencies += [jpeg, png]