1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
use std::time::Duration;
use Extent2;
use Vec2;
use Timeout;
#[derive(Debug, Default, Copy, Clone, PartialEq)]
pub struct VKey;
#[derive(Debug, Default, Copy, Clone, PartialEq)]
pub struct Key;
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum Click {
Single,
Double,
}
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum MouseButton {
Left,
Middle,
Right,
Extra1,
Extra2,
Extra3,
Other(u32),
}
#[derive(Debug, Clone, PartialEq)]
pub enum Event {
AudioOutputDeviceAdded,
AudioOutputDeviceRemoved,
AudioCaptureDeviceAdded,
AudioCaptureDeviceRemoved,
ControllerAxisMotion { axis_id: u32, axis: Vec2<i32> },
ControllerButtonPressed { controller_id: u32, button: u32 },
ControllerButtonReleased { controller_id: u32, button: u32 },
ControllerTrackballMotion { controller_id: u32, ball_index: u8, motion: Vec2<i32> },
ControllerAdded { controller_id: u32, },
ControllerRemoved { controller_id: u32, },
ControllerRemapped { controller_id: u32, },
DollarGesture { touch_device_id: u32, gesture_id: u32, finger_count: u8, error: f32, normalized_center: Vec2<f32> },
DragAndDropBegin,
DragAndDropCancel,
DragAndDropFile { file_path: String, },
DragAndDropText { text: String, },
DragAndDropRawData { text: Vec<u8>, },
FingerPressed { touch_id: u32, finger_id: u32, normalized_position: Vec2<f32>, pressure: f32 },
FingerReleased { touch_id: u32, finger_id: u32, normalized_position: Vec2<f32>, pressure: f32 },
FingerMotion { touch_id: u32, finger_id: u32, normalized_motion: Vec2<f32>, pressure: f32 },
KeyPressed { window_id: Option<u32>, is_repeat: bool, vkey: VKey, key: Key, },
KeyReleased { window_id: Option<u32>, is_repeat: bool, vkey: VKey, key: Key, },
MouseButtonPressed { window_id: Option<u32>, mouse: u32, click: Click, button: MouseButton, },
MouseButtonReleased { window_id: Option<u32>, mouse: u32, click: Click, button: MouseButton, },
MouseMotion { window_id: Option<u32>, mouse: u32, new_position: Vec2<i32> },
MouseScroll { window_id: Option<u32>, mouse: u32, scroll: Vec2<i32>, },
MultiGesture { touch_id: u32, theta: f32, dist: f32, normalized_center: Vec2<f32>, finger_count: u8 },
WindowShown { window_id: u32, },
WindowHidden { window_id: u32, },
WindowShouldRedrawItself { window_id: u32, },
WindowMoved { window_id: u32, position: Extent2<u32>, },
WindowResized { window_id: u32, size: Extent2<u32>, by_user: bool, },
WindowMinimized { window_id: u32, },
WindowMaximized { window_id: u32, },
WindowRestored { window_id: u32, },
WindowGainedMouseFocus { window_id: u32, },
WindowLostMouseFocus { window_id: u32, },
WindowGainedKeyboardFocus { window_id: u32, },
WindowLostKeyboardFocus { window_id: u32, },
WindowCloseRequested { window_id: u32, },
Quit,
AppTerminating,
AppLowMemory,
AppEnteringBackground,
AppEnteredBackground,
AppEnteringForeground,
AppEnteredForeground,
KeymapChanged,
ClipboardChanged,
RenderTargetReset,
DisplayLost,
TextInput,
}
#[derive(Debug, Hash)]
pub struct Clipboard {
raw_data: Vec<u8>,
}
impl Clipboard {
pub fn get_raw_buffer<'a>(&'a self) -> &'a [u8] {
&self.raw_data
}
pub fn overwrite_with_utf8(&mut self, _s: &str) {
unimplemented!()
}
}
#[derive(Debug, Hash)]
pub struct TextInput {
raw_data: Vec<u8>,
}
impl TextInput {
pub fn start(&mut self) -> TextInputRecording { unimplemented!() }
}
pub struct TextInputRecording<'a> {
_text_input: &'a TextInput,
}
impl<'a> TextInputRecording<'a> {
pub fn get_raw_buffer(&'a self) -> &'a [u8] {
unimplemented!()
}
}
pub mod queue {
use super::*;
#[derive(Debug)]
pub struct EventQueue {}
#[derive(Debug)]
pub struct PeekIter<'a> {
_queue: &'a EventQueue,
}
#[derive(Debug)]
pub struct PollIter<'a> {
_queue: &'a mut EventQueue,
}
#[derive(Debug)]
pub struct WaitIter<'a> {
_queue: &'a mut EventQueue,
_timeout: Timeout,
}
impl<'a> Iterator for PollIter<'a> {
type Item = Event;
fn next(&mut self) -> Option<Self::Item> {
unimplemented!()
}
}
impl<'a> Iterator for WaitIter<'a> {
type Item = Event;
fn next(&mut self) -> Option<Self::Item> {
unimplemented!()
}
}
impl<'a> Iterator for PeekIter<'a> {
type Item = &'a Event;
fn next(&mut self) -> Option<Self::Item> {
unimplemented!()
}
}
impl<'a> EventQueue {
pub fn push(&mut self, _event: Event) { unimplemented!() }
pub fn poll(&'a mut self) -> PollIter<'a> {
PollIter { _queue: self }
}
pub fn wait<T: Into<Timeout>>(&'a mut self, timeout: T) -> WaitIter<'a> {
WaitIter { _queue: self, _timeout: timeout.into() }
}
pub fn peek(&'a self) -> PeekIter<'a> {
PeekIter { _queue: self }
}
}
}
pub use self::queue::EventQueue;