#wayland #windowing #calloop #event-loop #callloop

calloop-wayland-source

A wayland-rs client event source for callloop

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

#1030 in GUI

Download history 82119/week @ 2025-01-29 122001/week @ 2025-02-05 276173/week @ 2025-02-12 328091/week @ 2025-02-19 350677/week @ 2025-02-26 336603/week @ 2025-03-05 334482/week @ 2025-03-12 286991/week @ 2025-03-19 288066/week @ 2025-03-26 248209/week @ 2025-04-02 242414/week @ 2025-04-09 195049/week @ 2025-04-16 220242/week @ 2025-04-23 234514/week @ 2025-04-30 208084/week @ 2025-05-07 169135/week @ 2025-05-14

866,701 downloads per month
Used in 606 crates (5 directly)

MIT license

13KB
144 lines

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.
}

calloop-wayland-source

Use EventQueue from the wayland-client with the calloop.

Dependencies

~5–14MB
~189K SLoC