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.

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

auto wo = wf::get_core().output_layout->find_output(mapped_output);
if (wo)
{
LOGD("Mapping input ", dev->name, " to output ", wo->to_string(), ".");
Copy link
Member

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

Copy link
Member Author

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.

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

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

* if called with a device that is not a touch device.
*/
void calibrate_touch_device(std::string const & cal);

Copy link
Member

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

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