Skip to content

Udata *Data types wrap user provided U instead of having a *DataExt trait#524

Draft
ids1024 wants to merge 2 commits into
Smithay:masterfrom
ids1024:udata
Draft

Udata *Data types wrap user provided U instead of having a *DataExt trait#524
ids1024 wants to merge 2 commits into
Smithay:masterfrom
ids1024:udata

Conversation

@ids1024
Copy link
Copy Markdown
Member

@ids1024 ids1024 commented May 11, 2026

For #519, we need to remove the *DataExt traits, and instead make *Data wrap U so we can provide blanket implementations of the future wayland_client::Dispatch

This probably doesn't need to be merged before #519, which can then be based on this, but it seems good to keep these changes in clean separate commits, and verify everything works here. May as well have a draft PR before this part is done.

The various get_keyboard_* methods are made a bit more redundant in implementation here, but maybe they could now use a builder pattern.

This is a breaking change to code that uses .data::<...> to get the udata, since the type has changed. Though maybe it would be best to replace use of that with helper from_resource() methods as smithay has for a couple things.

Presumably the type argument for the `LoopHandle` is expected to match
the the `D` type used for wayland-rs dispatch? Unless the calloop event
loop isn't being used to dispatch Wayland events.

Without `keyboard:` specified in `delegate_keyboard!`, this did use
`KeyboardData<$ty>`, so in that case these are assumed to match.
@ids1024 ids1024 force-pushed the udata branch 2 times, most recently from a2aad61 to 31f09f6 Compare May 12, 2026 19:45
WIP surface udata

fix macro

macro

WIP pointer

macro

WIP DataSourceData

macro

did earlier version not actually provide any way to implement dispatch
for custom type here?

constructor and accessors

pub constructors

touch

WIP activation

not compiling types in example?

should be fine to get rid of trait and just rely on immutable wrapper
struct.

WIP don't make `delegate_activation!` generic

Not compiling... can that work?

see how that works with new wayland-rs.

input method

should fix custom data types
previously was seemingly broken for delegating dispatch, constructing
with custom data, or commit() aaccessing `.data`

input-method-v3
@ids1024
Copy link
Copy Markdown
Member Author

ids1024 commented May 13, 2026

Changing the *Data types this way seems good overall, though it's awkward that the breaking change isn't caught by the compiler since .data::<_> will fail at runtime.

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.

1 participant