Comments (9)
I originally suggested something like this in #94, although its usefulness would be limited since it can't really be used in hardware acceleration... although maybe it could be used in softbuffer
?
The question then becomes "how do we get the RustConnection
to fit into a RawDisplayHandle
?" The only answer I can come up with that doesn't involve raw-window-handle
taking on extra dependencies would be to have the variant contain an *const dyn Any
that can explicitly be downcasted to an *const RustConnection
. The disadvantage of this would be that, if the program uses multiple versions of x11rb
, that there could be a version mismatch between the windowing system and the rendering framework, which would cause confusing bugs.
The way I would prefer, from a softbuffer
standpoint, would be to just have another constructor on the Context
type that takes an x11rb::RequestConnection
to circumvent this entire issue.
from raw-window-handle.
Between this and #102, it makes me wonder if there is a niche in the ecosystem for a more opinionated window handle type. Maybe an enum between the "raw" window handle defined in this crate (maybe even the WindowHandle
type to make it safer) and other more well-defined types?
from raw-window-handle.
My current stance is that this library should only expose the C window handles accepted by OpenGL and Vulkan. Other handles should be passed through other methods. Closing for now.
from raw-window-handle.
Somewhat related: In #134 we're doing exactly this, exposing a pure Rust handle, without a stable ABI.
So we could probably adapt the same solution to this.
from raw-window-handle.
I would argue that #134 is an extenuating circumstance, since there are no other good ways to pass your canvas object to the underlying graphics APIs. Even the data attribute hack can only accommodate types currently registered in the DOM. So our hand is forced into exposing wasm-bindgen
, even in an unstable way.
My stance on pure Rust desktop handles is the same as above. The expense of keeping pointers to them is greater than the possible benefits of letting softbuffer
draw to them. Unless Mesa allows for x11rb
or wayland-rs
handles to be passed to EGL, it's probably a bad idea to include them.
from raw-window-handle.
#134 is an extenuating circumstance
Yeah I probably exaggerated above, but I do think they share similarities, and that the solution we choose for wasm-bindgen
could be adapted for x11rb
/wayland-rs
as well.
our hand is forced into exposing
wasm-bindgen
, even in an unstable way.
Well, we're never forced, we could also take the choice you've done for this issue, and just... Not support web handles at all, until they get a stable ABI that we can use. But nobody wants that, and so we take another route ;)
from raw-window-handle.
The core issue is that raw-window-handle
exists mostly as a layer between the graphics APIs (glutin
, wgpu
) and the windowing system (winit
, SDL, glfw
). Which in turn mostly deals with C pointers. Unless you happen to have a friend on the OpenGL ARB it's going to be difficult to pass a wayland-rs
pure Rust implementation to glutin
or wgpu
. So the main use-case is really only softbuffer
.
On the other hand, the graphics APIs as they are currently exposed to Rust take wasm_bindgen::JsValue
or wrappers around JsValue
. Hence the exposure of JsValue
.
It might be nice to have some kind of other, broader crate with a more expansive window handle type, for crates that don't wrap around graphics APIs. But for a lot of existing crates that use raw-window-handle
, like winit
, do not want to have x11rb
as a public dependency.
from raw-window-handle.
Makes sense. I'll leave this open anyhow until we figure out #134, but will probably close it after that.
from raw-window-handle.
As of rust-windowing/softbuffer#171 softbuffer can create a context and run without a C connection.
This issue was discussed in our weekly winit maintainer's meeting and it was decided that it's out of scope for raw-window-handle
, especially since it's possible to work with just the window ID's. Closing this as not planned.
from raw-window-handle.
Related Issues (20)
- Does `RawWindowHandle` need to be `Copy`? HOT 3
- Should X display/connection handles be nullable? HOT 4
- Proposal: Remove `Copy` from `RawDisplayHandle` HOT 3
- Proposal: Make the error type implementor-selectable? HOT 2
- Follow the Rust API Guidelines HOT 2
- Take `self` instead of `&self` in raw window handles? HOT 9
- Figure out missing display handle implementations HOT 6
- Add tests for Rust subleties HOT 2
- Add relevant categories to `Cargo.toml`
- Improve documentation
- Question: Why are we exposing canvas elements instead of just any node? HOT 2
- What is the right way of handling web handles? HOT 2
- Add a bitset that allows libraries to state what types of raw window/display handles are supported HOT 1
- Add safe constructors for display and window handles HOT 3
- Remove `WebWindowHandle`? HOT 2
- Make safe `WindowHandle` s to imilictly ref-count HOT 27
- Info about sdl HOT 2
- Support DirectFB in RawWindowHandle and RawDisplayHandle? HOT 1
- Change Windows `HANDLE` types back to `*mut c_void` **again** :weary:? HOT 4
- Add Windows `IDCompositionVisual` and its `HANDLE`?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raw-window-handle.