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: Rework PointerFocus to operate directly on WlSurface #380

Merged
merged 3 commits into from
Mar 26, 2024

Conversation

Drakulix
Copy link
Member

@Drakulix Drakulix commented Mar 25, 2024

Continuation of #322 to eventually bump smithay again.

This takes about half of @ids1024 original approach, by leaving the KeyboardFocusTarget as is and adjusting the PointerFocusTarget to go all the way and split up CosmicMapped focus into iced-UI and surfaces.

Reasoning:

  • The smithay changes actually don't require us to adjust the keyboard focus and I don't think consolidating into a single WlSurface variant is a good idea, as we are loosing context. The old PR spent quite a bit of code to reconstruct toplevel-surfaces. Let's simply not do that.
  • The new pointer focus logic is meant to fix inconsistencies when wrapping multiple elements, regarding grabs, which suddently can't differentiate anymore between the individual elements (which in particular problematic for touch input). We have our fair share of weird workarounds and hacks in CosmicWindow and especially in CosmicStack to make the window unaware of the decorations and provide proper wl_poiinter events. All of this is brittle and in some parts even straight up buggy (for admittedly rare input combinations). Lets split the focus in the actual window surface(s) and the decorations to fix this.

Remaining TODOs:

@Drakulix Drakulix mentioned this pull request Mar 25, 2024
@ids1024
Copy link
Member

ids1024 commented Mar 25, 2024

Seems good. I'm inclined to agree that consolidating things under a single KeyboardFocusTarget::WlSurface doesn't work out that well. Keeping them separate makes it easier to match on what the keyboard focus is, to prevent surface types that shouldn't get keyboard focus from getting it, etc. It makes TryFrom<PointerFocusTarget> a little harder to implement, but that needs to get the parent of subsurfaces anyway and perhaps then shouldn't be defined as TryFrom.

We can still make the keyboard target code less redundant with Smithay/smithay#1334. Then adding a variant or a new trait isn't too painful.

@ids1024
Copy link
Member

ids1024 commented Mar 26, 2024

SSDs still don't handle touch events, but it looks like that's expected. That can be added later.

Copy link
Member

@ids1024 ids1024 left a comment

Choose a reason for hiding this comment

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

The changes all seem reasonable, and everything that I've tested is working fine.

@Drakulix
Copy link
Member Author

SSDs still don't handle touch events, but it looks like that's expected. That can be added later.

Yeah, that requires implementing the TouchTarget for them and properly supporting TouchGrabs. Left that out for now, as I don't have a touchscreen to test that anyway.

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