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

@ -1,5 +1,5 @@
use std::sync::MutexGuard;
use std::{io, ptr};
use std::{fmt, io, ptr};
use bitflags::bitflags;
use windows_sys::Win32::Foundation::{HWND, RECT};
@ -23,6 +23,7 @@ use crate::platform_impl::platform::{event_loop, util, Fullscreen, SelectedCurso
use crate::window::{Theme, WindowAttributes};
/// Contains information about states and the window that the callback is going to use.
#[derive(Debug)]
pub(crate) struct WindowState {
pub mouse: MouseProperties,
@ -65,7 +66,13 @@ pub struct SavedWindow {
pub placement: WINDOWPLACEMENT,
}
#[derive(Clone)]
impl fmt::Debug for SavedWindow {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SavedWindow").finish_non_exhaustive()
}
}
#[derive(Clone, Debug)]
pub struct MouseProperties {
pub(crate) selected_cursor: SelectedCursor,
pub capture_count: u32,
@ -129,7 +136,7 @@ bitflags! {
}
}
#[derive(Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Hash)]
pub enum ImeState {
Disabled,
Enabled,