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

#766 in GUI

Download history 63219/week @ 2024-07-30 68479/week @ 2024-08-06 67446/week @ 2024-08-13 63785/week @ 2024-08-20 69084/week @ 2024-08-27 71399/week @ 2024-09-03 66414/week @ 2024-09-10 69843/week @ 2024-09-17 77622/week @ 2024-09-24 73940/week @ 2024-10-01 73340/week @ 2024-10-08 71019/week @ 2024-10-15 70731/week @ 2024-10-22 71953/week @ 2024-10-29 75788/week @ 2024-11-05 65578/week @ 2024-11-12

296,060 downloads per month
Used in 435 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–14MB
~171K SLoC