@@ -7,21 +7,15 @@ use std::env;
77use std:: os:: unix:: io:: { AsFd , AsRawFd , BorrowedFd , RawFd } ;
88use std:: time:: Duration ;
99
10- #[ cfg( x11_platform) ]
11- use dpi:: Size ;
1210pub ( crate ) use winit_common:: xkb:: { physicalkey_to_scancode, scancode_to_physicalkey} ;
1311use winit_core:: application:: ApplicationHandler ;
1412use winit_core:: error:: { EventLoopError , NotSupportedError } ;
1513use winit_core:: event_loop:: pump_events:: PumpStatus ;
1614use winit_core:: event_loop:: ActiveEventLoop ;
17- use winit_core:: window:: ActivationToken ;
1815#[ cfg( wayland_platform) ]
1916pub ( crate ) use winit_wayland as wayland;
20-
21- #[ cfg( x11_platform) ]
22- use crate :: platform:: x11:: WindowType as XWindowType ;
2317#[ cfg( x11_platform) ]
24- pub ( crate ) mod x11;
18+ pub ( crate ) use winit_x11 as x11;
2519
2620#[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
2721pub ( crate ) enum Backend {
@@ -37,59 +31,6 @@ pub(crate) struct PlatformSpecificEventLoopAttributes {
3731 pub ( crate ) any_thread : bool ,
3832}
3933
40- #[ derive( Debug , Clone , PartialEq , Eq ) ]
41- pub struct ApplicationName {
42- pub general : String ,
43- pub instance : String ,
44- }
45-
46- impl ApplicationName {
47- #[ allow( dead_code) ]
48- pub fn new ( general : String , instance : String ) -> Self {
49- Self { general, instance }
50- }
51- }
52-
53- #[ derive( Clone , Debug , PartialEq ) ]
54- pub struct PlatformSpecificWindowAttributes {
55- pub name : Option < ApplicationName > ,
56- pub activation_token : Option < ActivationToken > ,
57- #[ cfg( x11_platform) ]
58- pub x11 : X11WindowAttributes ,
59- }
60-
61- #[ derive( Clone , Debug , PartialEq ) ]
62- #[ cfg( x11_platform) ]
63- pub struct X11WindowAttributes {
64- pub visual_id : Option < x11rb:: protocol:: xproto:: Visualid > ,
65- pub screen_id : Option < i32 > ,
66- pub base_size : Option < Size > ,
67- pub override_redirect : bool ,
68- pub x11_window_types : Vec < XWindowType > ,
69-
70- /// The parent window to embed this window into.
71- pub embed_window : Option < x11rb:: protocol:: xproto:: Window > ,
72- }
73-
74- #[ cfg_attr( not( x11_platform) , allow( clippy:: derivable_impls) ) ]
75- impl Default for PlatformSpecificWindowAttributes {
76- fn default ( ) -> Self {
77- Self {
78- name : None ,
79- activation_token : None ,
80- #[ cfg( x11_platform) ]
81- x11 : X11WindowAttributes {
82- visual_id : None ,
83- screen_id : None ,
84- base_size : None ,
85- override_redirect : false ,
86- x11_window_types : vec ! [ XWindowType :: Normal ] ,
87- embed_window : None ,
88- } ,
89- }
90- }
91- }
92-
9334/// `x11_or_wayland!(match expr; Enum(foo) => foo.something())`
9435/// expands to the equivalent of
9536/// ```ignore
@@ -242,14 +183,6 @@ impl AsRawFd for EventLoop {
242183 }
243184}
244185
245- /// Returns the minimum `Option<Duration>`, taking into account that `None`
246- /// equates to an infinite timeout, not a zero timeout (so can't just use
247- /// `Option::min`)
248- #[ allow( dead_code) ]
249- fn min_timeout ( a : Option < Duration > , b : Option < Duration > ) -> Option < Duration > {
250- a. map_or ( b, |a_timeout| b. map_or ( Some ( a_timeout) , |b_timeout| Some ( a_timeout. min ( b_timeout) ) ) )
251- }
252-
253186#[ cfg( target_os = "linux" ) ]
254187fn is_main_thread ( ) -> bool {
255188 rustix:: thread:: gettid ( ) == rustix:: process:: getpid ( )
0 commit comments