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

#900 in GUI

Download history 61371/week @ 2024-11-25 64610/week @ 2024-12-02 63665/week @ 2024-12-09 65868/week @ 2024-12-16 44695/week @ 2024-12-23 49987/week @ 2024-12-30 73709/week @ 2025-01-06 76565/week @ 2025-01-13 75120/week @ 2025-01-20 79322/week @ 2025-01-27 95342/week @ 2025-02-03 275609/week @ 2025-02-10 276752/week @ 2025-02-17 329530/week @ 2025-02-24 354686/week @ 2025-03-03 327074/week @ 2025-03-10

1,299,271 downloads per month
Used in 550 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

~5–14MB
~190K SLoC