Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Input device updates #2510

wants to merge 4 commits into from

Conversation

soreau
Copy link
Member

@soreau soreau commented Nov 6, 2024

  • 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

@soreau soreau force-pushed the input-device-updates branch 3 times, most recently from 91db71d to fcc81c1 Compare November 6, 2024 08:42
Copy link
Member

@ammen99 ammen99 left a 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.

src/core/plugin.cpp Outdated Show resolved Hide resolved
src/core/plugin.cpp Outdated Show resolved Hide resolved
src/core/seat/input-manager.hpp Outdated Show resolved Hide resolved
src/api/wayfire/config-backend.hpp Show resolved Hide resolved
src/core/seat/keyboard.cpp Show resolved Hide resolved
@soreau
Copy link
Member Author

soreau commented Nov 12, 2024

+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.

@soreau soreau force-pushed the input-device-updates branch 2 times, most recently from f98446b to 748b554 Compare November 22, 2024 04:52
Copy link
Member

@ammen99 ammen99 left a 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.

src/core/seat/input-manager.cpp Show resolved Hide resolved
@soreau
Copy link
Member Author

soreau commented Nov 24, 2024

Btw. has someone on matrix/irc tested this with multiple devices etc? I am fairly certain we can close some issues with this PR.

I am not sure but @zougloub might be interested in testing.

@ammen99
Copy link
Member

ammen99 commented Nov 24, 2024

I think this fixes at least #2481 right?

@soreau
Copy link
Member Author

soreau commented Nov 24, 2024

I think this fixes at least #2481 right?

Yes, it should.

@soreau soreau force-pushed the input-device-updates branch from 748b554 to 6e7125f Compare November 25, 2024 18:29
Copy link
Member

@ammen99 ammen99 left a 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 ..

src/api/wayfire/input-device.hpp Show resolved Hide resolved
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)
Copy link
Member

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.

Copy link
Member Author

@soreau soreau Dec 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have rebased on master and force-pushed the top commit to implement this. Can you please review and test?

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.
…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.
@soreau soreau force-pushed the input-device-updates branch from 6e7125f to d2a11a7 Compare December 25, 2024 06:52
@soreau
Copy link
Member Author

soreau commented Dec 25, 2024

@zougloub If you want to test this before it's merged, now would be a good time. It should be 'ready'. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants