Wayland: rework the event loop & expose readiness signal (#298)

* wayland: don't create a second event_queue

As each EventsLoop has its own context, this is no longer necessary.

* wayland: buffer events rather than direct dispatch

Changes the behavior of the event loop to first internally
buffer the events generated by the wayland handlers, and then
dispatch them to the client's closure.

- It simplifies the event loop logic
- It makes it possible for the user to call window methods such as
  `set_title()` or `set_inner_size()` without causing a deadlock

* wayland: add is_ready() & fix protocol errors

Adds a `is_ready()` method to the windows to advertize
when it is legal to start drawing, and fix a few wayland
protocol mishandling in the process.
This commit is contained in:
Victor Berger 2017-09-27 16:31:46 +02:00 committed by tomaka
parent df7e349c70
commit 515595153d
6 changed files with 130 additions and 141 deletions

View file

@ -325,7 +325,7 @@ impl EventsLoop {
pub fn new_wayland() -> Result<EventsLoop, ()> {
wayland::WaylandContext::init()
.map(|ctx| EventsLoop::Wayland(wayland::EventsLoop::new(Arc::new(ctx))))
.map(|ctx| EventsLoop::Wayland(wayland::EventsLoop::new(ctx)))
.ok_or(())
}