Skip to content

Conversation

@jgcodes2020
Copy link

@jgcodes2020 jgcodes2020 commented May 29, 2025

  • Tested on all platforms changed (CI compiles on all platforms, nothing seems to have changed functionality-wise on Linux)
  • Added an entry to the changelog module if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality

Updated version of #3942 (split out Surface from Window) with the backend split in place. This is needed to implement popups and subsurfaces, as their behaviours do not match.

Remaining questions

  • What exactly should be included in Surface?
    • e.g. on most platforms, all surfaces may receive keyboard focus, but on Wayland, subsurfaces cannot
  • How should up/downcasting to Surface be handled? I've included a really primitive solution, but there could be better ways.

Copy link
Member

@kchibisov kchibisov left a comment

Choose a reason for hiding this comment

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

I'm not sure about the cursor part of the API yet, those should likely end up platform specific.

I think the option to get size should be present, not sure about the option to set request a size change, but I think it's also generally available.

Monitor stuff I'd also drop, except for current_monitor. Like the rest doesn't really make much sense and just are carried from old winit. pre_present_notify is fine.

For downcasting, I'd do the same as macos_handler, though, the backend itself will implement the cast if it makes sense.

Copy link
Member

@kchibisov kchibisov left a comment

Choose a reason for hiding this comment

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

See above.

@kchibisov
Copy link
Member

What exactly should be included in Surface?
e.g. on most platforms, all surfaces may receive keyboard focus, but on Wayland, subsurfaces cannot

In general, that can be emulated on platforms where it's not possible, like Wayland, just by setting the e.g. what to include in the event, etc. I'd leave this for the future discussions when we'd come to adding subsurfaces.

@jgcodes2020 jgcodes2020 mentioned this pull request Jul 10, 2025
5 tasks
@jgcodes2020 jgcodes2020 marked this pull request as ready for review July 10, 2025 16:53
@jgcodes2020 jgcodes2020 requested a review from kchibisov July 10, 2025 16:58
@jgcodes2020
Copy link
Author

@kchibisov mind taking a look at this?

@kchibisov
Copy link
Member

I'm not sure much got addressed from what I've requested before, e.g. wrt to cursor APIs, etc. We've also discussed with other maintainers the state of this and inclined to go with it after a batch of 0.31 changes, since we were not entirely sure what should be in Surface API. I'd not that at the current state of things this API is not really needed and as for the downstream, the RawWindowHandle suffice.

@MarijnS95
Copy link
Member

MarijnS95 commented Jul 14, 2025

Should be worth mentioning #3928 here (so that others can find it via that issue too) which describes how to implement this Surface abstraction but doesn't summarize the referenced issues that need them.

For my use-case having a generic subsurface implementation in winit is important, but I would like to play around with a proof-of-concept subsurface backend first before committing everyone to use this proposed trait abstraction.

EDIT: Note that the linked issue doesn't mention nor compare Android, which is a popular backend of winit and where subusrfaces are essential.

@madsmtm madsmtm added this to the Version 0.32.0 milestone Sep 4, 2025
@madsmtm madsmtm added the S - api Design and usability label Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S - api Design and usability

Development

Successfully merging this pull request may close these issues.

4 participants