4 releases (breaking)

0.4.0 Aug 23, 2024
0.3.0 Mar 1, 2024
0.2.0 Sep 20, 2023
0.1.0 Jul 20, 2023

#808 in GUI

Download history 63771/week @ 2024-08-17 68314/week @ 2024-08-24 70697/week @ 2024-08-31 68138/week @ 2024-09-07 68908/week @ 2024-09-14 75421/week @ 2024-09-21 74312/week @ 2024-09-28 74840/week @ 2024-10-05 72724/week @ 2024-10-12 68652/week @ 2024-10-19 69838/week @ 2024-10-26 79023/week @ 2024-11-02 66636/week @ 2024-11-09 62404/week @ 2024-11-16 60200/week @ 2024-11-23 65291/week @ 2024-11-30

268,072 downloads per month
Used in 445 crates (5 directly)

MIT license

13KB
144 lines

calloop-wayland-source

Use EventQueue from the wayland-client with the calloop.


lib.rs:

Utilities for using an EventQueue from wayland-client with an event loop that performs polling with calloop.

Example

use calloop::EventLoop;
use calloop_wayland_source::WaylandSource;
use wayland_client::{Connection, QueueHandle};

// Create a Wayland connection and a queue.
let connection = Connection::connect_to_env().unwrap();
let event_queue = connection.new_event_queue();
let queue_handle = event_queue.handle();

// Create the calloop event loop to drive everytihng.
let mut event_loop: EventLoop<()> = EventLoop::try_new().unwrap();
let loop_handle = event_loop.handle();

// Insert the wayland source into the calloop's event loop.
WaylandSource::new(connection, event_queue).insert(loop_handle).unwrap();

// This will start dispatching the event loop and processing pending wayland requests.
while let Ok(_) = event_loop.dispatch(None, &mut ()) {
    // Your logic here.
}

Dependencies

~4–13MB
~171K SLoC