rust-windowing / rust-windowing/softbuffer

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

Open
#298 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
506
Forks
85
PR merge metrics
No merged PRs in 30d

Description

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>>;

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Surface and Context definitions and inspecting how their raw-window-handle type parameters are used. Compare that API with the trait-based Window model described in the issue, then verify that callers can name both types without the workaround; the issue does not mention specific files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.