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

including some libinput boiler plate? #31

Open
m-col opened this issue May 22, 2021 · 9 comments
Open

including some libinput boiler plate? #31

m-col opened this issue May 22, 2021 · 9 comments
Labels
enhancement New feature or request

Comments

@m-col
Copy link
Collaborator

m-col commented May 22, 2021

Compositers generally allow for a smalll amount of user configuration of the input devices via libinput. Example settings are tap-to-click, point accelleration etc, see https://wayland.freedesktop.org/libinput/doc/latest/configuration.html

Example usage by a wlroots compositer is to set these options to a device when the device is added via the backend's new input event, e.g.:

    if (wlr_input_device_is_libinput(device)) {
	struct libinput_device *ldev = wlr_libinput_get_device_handle(device);
	if (libinput_device_config_tap_get_finger_count(ldev) > 1) {
	   libinput_device_config_tap_set_enabled(ldev, LIBINPUT_CONFIG_TAP_ENABLED);
	}
    }
    wlr_cursor_attach_input_device(wimp.cursor, device);

Here there are a couple wlroots functions but also functions from libinput. Do you think it would make sense to also include some of these libinput device configuring functions in the lib, perhaps exposed methods to InputDevice?

@m-col
Copy link
Collaborator Author

m-col commented May 23, 2021

The options exposed by sway are here: https://github.com/swaywm/sway/blob/master/sway/config/input.c#L22

@m-col
Copy link
Collaborator Author

m-col commented May 23, 2021

This is pretty much the list of things that users reasonably would want to configure https://github.com/wayland-project/libinput/blob/master/src/libinput.h#L4315-L4330

@m-col
Copy link
Collaborator Author

m-col commented Jun 1, 2021

I've been playing around with adding a small CFFI interface to libinput within Qtile, but I'm coming up with a problem with using it with pywlroots' cffi. It seems as though the issue should be resolved simply by doing ffi_builder.include(pywlroots_ffi_builder), but then oddly the libinput ffi has trouble compiling. Perhaps you might be able to spot an error in how pywlroots is being included? My ffi build script is here: https://github.com/m-col/qtile/blob/libinput/libqtile/backend/wayland/libinput_ffi_build.py

This script shows all the parts above that would be required for full coverage of all available input configuration options that people might use/expect from a compositor, so if you think they are better off in pywlroots then it's simply a cut-paste job.

@flacjacket flacjacket added the enhancement New feature or request label Jul 17, 2021
@m-col
Copy link
Collaborator Author

m-col commented Nov 14, 2021

Over on qtile/qtile#2548 I'm trying to build another CFFI module that imports the source from pywlroots much like it does from pywayland and python-xkbcommon. The problem is that wlroots.ffi_build.py requires some files in its repository that aren't packaged. Do you think we could move the include folder into the python module and package it, or might there be a better solution?

@m-col
Copy link
Collaborator Author

m-col commented Feb 13, 2022

The libinput wrapping module in Qtile is merged, so I'd be happy to close this and keep it as 'out of scope' for pywlroots.

@Shinyzenith
Copy link
Contributor

Shinyzenith commented Jun 27, 2022

I would like to try and implement some libinput boilerplate in Keyboard.py and Pointer.py.

@flacjacket Are you open to such patches? Or would it be considered out of scope?

@flacjacket
Copy link
Owner

Yeah, that would be great! If there are things that make sense to package to use with wlroots, that would be fine to add in.

@m-col
Copy link
Collaborator Author

m-col commented Jul 2, 2022

If it's the same things that Qtile has that you're trying to add support for in your compositor, taking out Qtile's code and incorporating it into these classes might be a good solution. Qtile can also drop its own code and interface with libinput this way.

@Shinyzenith
Copy link
Contributor

Shinyzenith commented Jul 2, 2022

If it's the same things that Qtile has that you're trying to add support for in your compositor, taking out Qtile's code and incorporating it into these classes might be a good solution. Qtile can also drop its own code and interface with libinput this way.

Yep I am currently just copy pasting qtiles libinput ffi generator and having it incorporated into wlroots would save me 1 build step 🤣. I was thinking of just incorporating qtiles code into wlroots.

I'll get start on this as soon as possible!

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

No branches or pull requests

3 participants