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

@ -71,6 +71,7 @@ type X11rbConnection = x11rb::xcb_ffi::XCBConnection;
type X11Source = Generic<BorrowedFd<'static>>;
#[derive(Debug)]
struct WakeSender<T> {
sender: Sender<T>,
waker: Ping,
@ -91,6 +92,7 @@ impl<T> WakeSender<T> {
}
}
#[derive(Debug)]
struct PeekableReceiver<T> {
recv: Receiver<T>,
first: Option<T>,
@ -127,6 +129,7 @@ impl<T> PeekableReceiver<T> {
}
}
#[derive(Debug)]
pub struct ActiveEventLoop {
xconn: Arc<XConnection>,
wm_delete_window: xproto::Atom,
@ -144,6 +147,7 @@ pub struct ActiveEventLoop {
device_events: Cell<DeviceEvents>,
}
#[derive(Debug)]
pub struct EventLoop {
loop_running: bool,
event_loop: Loop<'static, EventLoopState>,
@ -157,6 +161,7 @@ pub struct EventLoop {
type ActivationToken = (WindowId, crate::event_loop::AsyncRequestSerial);
#[derive(Debug)]
struct EventLoopState {
/// The latest readiness state for the x11 file descriptor
x11_readiness: Readiness,
@ -762,7 +767,7 @@ impl Deref for DeviceInfo<'_> {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct EventLoopProxy {
ping: Ping,
}