-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input device updates #2510
base: master
Are you sure you want to change the base?
Input device updates #2510
Conversation
soreau
commented
Nov 6, 2024
•
edited
Loading
edited
- Adds the ability to configure input devices that might have matching names
- Refactor so hotplugging a device only refreshes the configuration for that device, not all devices
- Add calibration option for touch devices
- Add a way to configure multiple keyboards and mice with different settings
91db71d
to
fcc81c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+10 for the idea. I was thinking of whether we can make this work fully dynamically (currently if you want to add a section, you have to restart Wayfire) but I don't think this can be done easily.
Thanks for the review! However, I don't think it is true that you need to restart wayfire, but only hot(re)plug the input device in question. Of course this might not be completely optimal, but a full restart is not needed as far as I understand. |
fcc81c1
to
f98446b
Compare
This patch adds additional checks for input-device sections in the config file. It checks for ID_PATH, ID_SERIAL, LIBINPUT_DEVICE_GROUP then falls back to the device name and finally the global input-device section. In addition, debug information can be printed using '-d input-devices'. This makes it so users can match devices, especially identical devices lacking many of the usual differentiating properties.
Before, hotplugging a new device would refresh all input to output mappings. Hotplugging an output will still refresh all input device mappings.
This adds a calibration option so that touch input devices can be calibrated via wayfire configuration.
f98446b
to
748b554
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I'll test to see whether this doesn't break my setup and merge if it doesn't (shouldn't by the looks of it). Feel free to update the wiki :)
Btw. has someone on matrix/irc tested this with multiple devices etc? I am fairly certain we can close some issues with this PR.
auto wo = wf::get_core().output_layout->find_output(mapped_output); | ||
if (wo) | ||
{ | ||
LOGD("Mapping input ", dev->name, " to output ", wo->to_string(), "."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be LOGC(INPUT_DEVICE)? we can leave it like this if you think it is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think leaving it this way makes it easier to see without the additional noise of -d input-devices
and it is the same as it was before, so users can still use -d
alone to see this particular output logged.
I am not sure but @zougloub might be interested in testing. |
I think this fixes at least #2481 right? |
Yes, it should. |
…ions This patch checks for additional configuration sections so keyboards and mice can be matched by name or with udev properties. Running wayfire with '-d input-devices' will log the sections that are being checked, for reference. This allows multiple keyboards and mice to be configured differently, whereas before, all keyboards used the common configuration in the [input] section. To be clear, no additional configuration is required. If no matching configuration section is found for the device, [input] options will be used.
748b554
to
6e7125f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more things I found on a second review ..
* if called with a device that is not a touch device. | ||
*/ | ||
void calibrate_touch_device(std::string const & cal); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have to be in the public API? I don't think it fits, it should be enough to put it in the input_device_impl_t
subclass.
wf::pointing_device_t::config.mouse_scroll_speed; | ||
bool touchpad = ev->source == WLR_AXIS_SOURCE_FINGER; | ||
double mult = 1.0; | ||
for (const auto& device : wf::get_core_impl().input->input_devices) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't iterate over all devices here. I think we should be able to set the custom data pointer on the wlr_pointer struct (or wlr_input_device) to the Wayfire object (wf::pointing_device_t
), and once we have gotten this, we should add a function on pointing_device_t
which gives us the scroll multiplier used for that device.