Skip to content

Context, Surface should not be generic over raw-window-handle types #298

@dhardy

Description

@dhardy

Since the next winit version makes Window a trait it is no longer possible to write the type of a Surface or Context without some shenanigans.

For example, I was able to make the following work:

/// Any handle supporting both [`HasDisplayHandle`] and [`HasWindowHandle`]
pub trait HasDisplayAndWindowHandle: HasDisplayHandle + HasWindowHandle + 'static {}
impl<W: HasDisplayHandle + HasWindowHandle + 'static> HasDisplayAndWindowHandle for W {}

type Surface = softbuffer::Surface<Arc<dyn HasDisplayAndWindowHandle>, Arc<dyn HasDisplayAndWindowHandle>>;

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions