#wayland #event-source #events #calloop #windowing #event-loop #client

calloop-wayland-source

A wayland-rs client event source for callloop

3 releases (breaking)

0.3.0 Mar 1, 2024
0.2.0 Sep 20, 2023
0.1.0 Jul 20, 2023

#865 in GUI

Download history 30848/week @ 2024-04-03 32891/week @ 2024-04-10 38392/week @ 2024-04-17 38267/week @ 2024-04-24 39646/week @ 2024-05-01 38094/week @ 2024-05-08 37856/week @ 2024-05-15 39603/week @ 2024-05-22 41383/week @ 2024-05-29 45718/week @ 2024-06-05 58919/week @ 2024-06-12 56303/week @ 2024-06-19 58485/week @ 2024-06-26 53986/week @ 2024-07-03 57537/week @ 2024-07-10 56561/week @ 2024-07-17

236,651 downloads per month
Used in 347 crates (2 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
~180K SLoC