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

Basic Touch Support #185

Merged
merged 2 commits into from
Feb 28, 2024
Merged

Basic Touch Support #185

merged 2 commits into from
Feb 28, 2024

Conversation

cmeissl
Copy link
Contributor

@cmeissl cmeissl commented Feb 11, 2024

decided to give it a try despite being unfinished in smithay.
lacks testing, proper output selection, doesn't work properly with output transform,...
but hey, touch seems to work so far on my laptop :)

based on Smithay/smithay#1326 merged

So, with the touch refactor merged in smithay it is time to finally finish basic touch support in niri

@cmeissl cmeissl force-pushed the feature/touch branch 3 times, most recently from e91a1c2 to 63e8fb1 Compare February 13, 2024 20:23
@cmeissl cmeissl force-pushed the feature/touch branch 5 times, most recently from 799bffd to 00932a7 Compare February 24, 2024 18:33
@cmeissl cmeissl marked this pull request as ready for review February 24, 2024 18:38
@@ -171,6 +172,9 @@ impl State {
let desc = TabletDescriptor::from(&device);
tablet_seat.add_tablet::<Self>(&self.niri.display_handle, &desc);
}
if device.has_capability(DeviceCapability::Touch) && self.niri.seat.get_touch().is_none() {
self.niri.seat.add_touch();
Copy link
Owner

Choose a reason for hiding this comment

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

Do we need to remove it in on_device_removed()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can, yeah. Added some tracking for touch devices and to remove touch support when the last touch device has been removed.

let under = self
.niri
.surface_under_and_global_space(touch_location)
.map(|under| under.surface);
Copy link
Owner

Choose a reason for hiding this comment

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

We probably want to activate window / output under touch here, just like we do for mouse and tablet clicks?

Copy link
Contributor Author

@cmeissl cmeissl Feb 27, 2024

Choose a reason for hiding this comment

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

I initially intended on adding that through bindings on global gestures. But I guess for now we can just activate the window similar to pointer button. One important difference is that I added a check if there is a touch grab and in this case not activate a window. I added that to prevent stealing the window on multiple touches.

Copy link
Owner

@YaLTeR YaLTeR left a comment

Choose a reason for hiding this comment

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

Don't have a touch device to test, but code wise looks good.

@YaLTeR YaLTeR merged commit 7196971 into YaLTeR:main Feb 28, 2024
8 checks passed
@YaLTeR
Copy link
Owner

YaLTeR commented Feb 28, 2024

Thanks!

@YaLTeR YaLTeR mentioned this pull request Feb 28, 2024
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