1use winit_core::event_loop::ActiveEventLoop as CoreActiveEventLoop;
4use winit_core::window::{PlatformWindowAttributes, Window as CoreWindow};
5
6pub use self::event_loop::{ActiveEventLoop, EventLoop, PlatformSpecificEventLoopAttributes};
7pub use self::window::Window;
8
9macro_rules! os_error {
10 ($error:expr $(,)?) => {{ winit_core::error::OsError::new(line!(), file!(), $error) }};
11}
12
13mod cursor;
14mod dnd;
15mod event_loop;
16mod icon;
17mod keysym;
18mod monitor;
19mod sink;
20mod wayland;
21mod window;
22mod x11;
23
24pub trait ActiveEventLoopExtGtk4 {
26 fn is_gtk4(&self) -> bool;
28}
29
30impl ActiveEventLoopExtGtk4 for dyn CoreActiveEventLoop + '_ {
31 #[inline]
32 fn is_gtk4(&self) -> bool {
33 self.cast_ref::<ActiveEventLoop>().is_some()
34 }
35}
36
37pub trait EventLoopExtGtk4 {
39 fn is_gtk4(&self) -> bool;
41}
42
43pub trait EventLoopBuilderExtGtk4 {
45 fn with_gtk4(&mut self) -> &mut Self;
47
48 fn with_any_thread(&mut self, any_thread: bool) -> &mut Self;
50
51 fn with_application_id(&mut self, application_id: String) -> &mut Self;
53}
54
55pub trait WindowExtGtk4 {
59 fn gtk_window(&self) -> Option<gtk4::ApplicationWindow>;
63}
64
65impl WindowExtGtk4 for dyn CoreWindow + '_ {
66 #[inline]
67 fn gtk_window(&self) -> Option<gtk4::ApplicationWindow> {
68 Some(self.cast_ref::<Window>()?.gtk_window())
69 }
70}
71
72#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
78pub struct WindowAttributesGtk4 {}
79
80impl PlatformWindowAttributes for WindowAttributesGtk4 {
81 fn box_clone(&self) -> Box<dyn PlatformWindowAttributes> {
82 Box::new(self.clone())
83 }
84}