rust-windowing / winit Goto Github PK
View Code? Open in Web Editor NEWWindow handling library in pure Rust
Home Page: https://docs.rs/winit/
License: Apache License 2.0
Window handling library in pure Rust
Home Page: https://docs.rs/winit/
License: Apache License 2.0
PRs that were merged in glutin but not in winit:
Original: rust-windowing/glutin#461
You provided a possibility to create/show/hide/resize window:
pub fn hide(&self) { self.window.hide() }
But I sure that 'pub fn close' method is also can be provided.
Original: rust-windowing/glutin#621
Original: rust-windowing/glutin#89
Original: rust-windowing/glutin#543
Original: rust-windowing/glutin#554
Original: rust-windowing/glutin#625
Original: rust-windowing/glutin#592
Original: rust-windowing/glutin#509
Original: rust-windowing/glutin#520
Original: rust-windowing/glutin#558
Original: rust-windowing/glutin#175
Original: rust-windowing/glutin#724
Original: rust-windowing/glutin#681
Original: rust-windowing/glutin#661
Original: rust-windowing/glutin#662
Also related to #34, except that this is more about documentation.
Original: rust-windowing/glutin#201
The README file is still the one from glutin.
Original: rust-windowing/glutin#771
Original: rust-windowing/glutin#672
Original: rust-windowing/glutin#678
Original: rust-windowing/glutin#478
Original: rust-windowing/glutin#727
Original: rust-windowing/glutin#618
Winit's and glutin's current API look like this:
impl Window {
pub fn wait_events(&self) -> impl Iterator<Item = Event> { ... }
pub fn poll_events(&self) -> impl Iterator<Item = Event> { ... }
}
I suggest that instead you'd have to register your window to what's called an events loop. Then, you'd call a method on the events loop to run it. Running the events loop would process events received by the operating system, and call a callback previously registered on the window.
This is essentially the same approach as the future-rs
library, except that we're not using future-rs directly because it's not totally stable. I'd like to eventually publish winit 1.0 (in, like, the next nine months or so), and it's unlikely that future-rs publishes its 1.0 before winit.
Example usage with the new API (just to give an overview, the details are not important at the moment):
let events_loop = EventsLoop::new();
let window = WindowBuilder::new().with_title("hello").build(&events_loop).unwrap();
window.set_callback(|event| match event { ... });
loop {
events_loop.run_once(); // calls the closure passed to set_callback earlier
}
I've always been a bit wary about callbacks because they are often too "magical", like you don't know which thread calls them and at what moment. But the fact that it's the run()
method of the events loop that calls the callbacks means that it's a good design in my opinion.
This approach would have some benefits over the current system:
Window
object in Rust from the actual window. The actual window could be stored in the EventsLoop
for example.EventsLoop
to run on the main thread for OSX while still allowing the Window
objects to be shared between threads. This has been a huge safety hole in glutin since the beginning.set_resize_callback
function of MacOS would be gone.WindowProxy
would be gone in favor of an "EventsLoopProxy
".Original: rust-windowing/glutin#619
Original: rust-windowing/glutin#663
Original: rust-windowing/glutin#544
Original: rust-windowing/glutin#720
Original: rust-windowing/glutin#445
Original: rust-windowing/glutin#259
Original: rust-windowing/glutin#774
It looks like winit
doesn't resize wayland window after start (resize_callback
function have not been called).
I've checked glutin
example on wayland and it works well. Then I checked the difference beetween api/wayland/window.rs
in winit
and glutin
and found out that there is no resize
calls in winit
. For example: glutin and winit. It seems to me that there should be some code to resize surface
, but I haven't find any API in wayland-client
to do so.
Original: rust-windowing/glutin#47
Original: rust-windowing/glutin#570
Original: rust-windowing/glutin#471
Original: rust-windowing/glutin#266
Original: rust-windowing/glutin#438
Original: rust-windowing/glutin#557
Original: rust-windowing/glutin#468
Not sure if still relevant.
In some cases (if the compositor supports it), the wayland backend can have access to both LineDelta
and PixelDelta
values for a given scroll event.
In this case, what should be done ?
PixelDelta
event ?LineDelta
event ?MouseWheel
event so that it may provide both values ?Original: rust-windowing/glutin#496
Original: rust-windowing/glutin#775
Original: rust-windowing/glutin#379
Original: rust-windowing/glutin#594
Original: rust-windowing/glutin#555
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.