Properly implement Debug for Window and EventLoop types (#3297)

For EventLoop, EventLoopBuilder, EventLoopProxy and by requiring it as
a supertrait of Window and ActiveEventLoop.

It is especially useful for user to be able to know that Window is Debug.
This commit is contained in:
Mads Marquart 2025-03-03 08:40:04 +01:00 committed by GitHub
parent 39c0862198
commit be1baf164c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 152 additions and 42 deletions

View file

@ -45,6 +45,7 @@ pub(crate) enum Event {
}
/// The Wayland event loop.
#[derive(Debug)]
pub struct EventLoop {
/// Has `run` or `run_on_demand` been called or a call to `pump_events` that starts the loop
loop_running: bool,
@ -546,6 +547,7 @@ impl AsRawFd for EventLoop {
}
}
#[derive(Debug)]
pub struct ActiveEventLoop {
/// Event loop proxy
event_loop_proxy: CoreEventLoopProxy,
@ -665,6 +667,7 @@ impl rwh_06::HasDisplayHandle for ActiveEventLoop {
}
}
#[derive(Debug)]
pub struct OwnedDisplayHandle {
pub(crate) connection: Connection,
}

View file

@ -7,6 +7,7 @@ use sctk::reexports::calloop::ping::Ping;
use crate::event_loop::{EventLoopProxy as CoreEventLoopProxy, EventLoopProxyProvider};
/// A handle that can be sent across the threads and used to wake up the `EventLoop`.
#[derive(Debug)]
pub struct EventLoopProxy {
ping: Ping,
}

View file

@ -8,7 +8,7 @@ use crate::window::WindowId;
/// An event loop's sink to deliver events from the Wayland event callbacks
/// to the winit's user.
#[derive(Default)]
#[derive(Default, Debug)]
pub struct EventSink {
pub(crate) window_events: Vec<Event>,
}