4
4
5
5
use accesskit:: { ActionHandler , ActionRequest , TreeUpdate } ;
6
6
#[ cfg( any(
7
- target_os = "linux" ,
8
- target_os = "dragonfly" ,
9
- target_os = "freebsd" ,
10
- target_os = "netbsd" ,
11
- target_os = "openbsd" ,
7
+ all(
8
+ feature = "accesskit_unix" ,
9
+ any(
10
+ target_os = "linux" ,
11
+ target_os = "dragonfly" ,
12
+ target_os = "freebsd" ,
13
+ target_os = "netbsd" ,
14
+ target_os = "openbsd"
15
+ )
16
+ ) ,
12
17
target_os = "windows"
13
18
) ) ]
14
19
use std:: sync:: { Mutex , MutexGuard } ;
@@ -29,32 +34,47 @@ pub struct ActionRequestEvent {
29
34
struct WinitActionHandler < T : From < ActionRequestEvent > + Send + ' static > {
30
35
window_id : WindowId ,
31
36
#[ cfg( any(
32
- target_os = "linux" ,
33
- target_os = "dragonfly" ,
34
- target_os = "freebsd" ,
35
- target_os = "netbsd" ,
36
- target_os = "openbsd" ,
37
+ all(
38
+ feature = "accesskit_unix" ,
39
+ any(
40
+ target_os = "linux" ,
41
+ target_os = "dragonfly" ,
42
+ target_os = "freebsd" ,
43
+ target_os = "netbsd" ,
44
+ target_os = "openbsd"
45
+ )
46
+ ) ,
37
47
target_os = "windows"
38
48
) ) ]
39
49
proxy : Mutex < EventLoopProxy < T > > ,
40
50
#[ cfg( not( any(
41
- target_os = "linux" ,
42
- target_os = "dragonfly" ,
43
- target_os = "freebsd" ,
44
- target_os = "netbsd" ,
45
- target_os = "openbsd" ,
51
+ all(
52
+ feature = "accesskit_unix" ,
53
+ any(
54
+ target_os = "linux" ,
55
+ target_os = "dragonfly" ,
56
+ target_os = "freebsd" ,
57
+ target_os = "netbsd" ,
58
+ target_os = "openbsd"
59
+ )
60
+ ) ,
46
61
target_os = "windows"
47
62
) ) ) ]
48
63
proxy : EventLoopProxy < T > ,
49
64
}
50
65
51
66
impl < T : From < ActionRequestEvent > + Send + ' static > WinitActionHandler < T > {
52
67
#[ cfg( any(
53
- target_os = "linux" ,
54
- target_os = "dragonfly" ,
55
- target_os = "freebsd" ,
56
- target_os = "netbsd" ,
57
- target_os = "openbsd" ,
68
+ all(
69
+ feature = "accesskit_unix" ,
70
+ any(
71
+ target_os = "linux" ,
72
+ target_os = "dragonfly" ,
73
+ target_os = "freebsd" ,
74
+ target_os = "netbsd" ,
75
+ target_os = "openbsd"
76
+ )
77
+ ) ,
58
78
target_os = "windows"
59
79
) ) ]
60
80
fn new ( window_id : WindowId , proxy : EventLoopProxy < T > ) -> Self {
@@ -64,34 +84,49 @@ impl<T: From<ActionRequestEvent> + Send + 'static> WinitActionHandler<T> {
64
84
}
65
85
}
66
86
#[ cfg( not( any(
67
- target_os = "linux" ,
68
- target_os = "dragonfly" ,
69
- target_os = "freebsd" ,
70
- target_os = "netbsd" ,
71
- target_os = "openbsd" ,
87
+ all(
88
+ feature = "accesskit_unix" ,
89
+ any(
90
+ target_os = "linux" ,
91
+ target_os = "dragonfly" ,
92
+ target_os = "freebsd" ,
93
+ target_os = "netbsd" ,
94
+ target_os = "openbsd"
95
+ )
96
+ ) ,
72
97
target_os = "windows"
73
98
) ) ) ]
74
99
fn new ( window_id : WindowId , proxy : EventLoopProxy < T > ) -> Self {
75
100
Self { window_id, proxy }
76
101
}
77
102
78
103
#[ cfg( any(
79
- target_os = "linux" ,
80
- target_os = "dragonfly" ,
81
- target_os = "freebsd" ,
82
- target_os = "netbsd" ,
83
- target_os = "openbsd" ,
104
+ all(
105
+ feature = "accesskit_unix" ,
106
+ any(
107
+ target_os = "linux" ,
108
+ target_os = "dragonfly" ,
109
+ target_os = "freebsd" ,
110
+ target_os = "netbsd" ,
111
+ target_os = "openbsd"
112
+ )
113
+ ) ,
84
114
target_os = "windows"
85
115
) ) ]
86
116
fn proxy ( & self ) -> MutexGuard < ' _ , EventLoopProxy < T > > {
87
117
self . proxy . lock ( ) . unwrap ( )
88
118
}
89
119
#[ cfg( not( any(
90
- target_os = "linux" ,
91
- target_os = "dragonfly" ,
92
- target_os = "freebsd" ,
93
- target_os = "netbsd" ,
94
- target_os = "openbsd" ,
120
+ all(
121
+ feature = "accesskit_unix" ,
122
+ any(
123
+ target_os = "linux" ,
124
+ target_os = "dragonfly" ,
125
+ target_os = "freebsd" ,
126
+ target_os = "netbsd" ,
127
+ target_os = "openbsd"
128
+ )
129
+ ) ,
95
130
target_os = "windows"
96
131
) ) ) ]
97
132
fn proxy ( & self ) -> & EventLoopProxy < T > {
@@ -136,23 +171,29 @@ impl Adapter {
136
171
Self { adapter }
137
172
}
138
173
139
- #[ cfg( all(
140
- not( target_os = "linux" ) ,
141
- not( target_os = "dragonfly" ) ,
142
- not( target_os = "freebsd" ) ,
143
- not( target_os = "netbsd" ) ,
144
- not( target_os = "openbsd" )
145
- ) ) ]
174
+ #[ cfg( not( all(
175
+ feature = "accesskit_unix" ,
176
+ any(
177
+ target_os = "linux" ,
178
+ target_os = "dragonfly" ,
179
+ target_os = "freebsd" ,
180
+ target_os = "netbsd" ,
181
+ target_os = "openbsd"
182
+ )
183
+ ) ) ) ]
146
184
#[ must_use]
147
185
pub fn on_event ( & self , _window : & Window , _event : & WindowEvent ) -> bool {
148
186
true
149
187
}
150
- #[ cfg( any(
151
- target_os = "linux" ,
152
- target_os = "dragonfly" ,
153
- target_os = "freebsd" ,
154
- target_os = "netbsd" ,
155
- target_os = "openbsd"
188
+ #[ cfg( all(
189
+ feature = "accesskit_unix" ,
190
+ any(
191
+ target_os = "linux" ,
192
+ target_os = "dragonfly" ,
193
+ target_os = "freebsd" ,
194
+ target_os = "netbsd" ,
195
+ target_os = "openbsd"
196
+ )
156
197
) ) ]
157
198
#[ must_use]
158
199
pub fn on_event ( & self , window : & Window , event : & WindowEvent ) -> bool {
0 commit comments