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
193
194
195
196
197
198
//! Platform-neutral event vocabulary.
//!
//! Fluor's hosts (`host-winit` on desktop, `host-android` on Android, future `host-bare` on ferros) all translate their platform input into these types at the boundary, then dispatch the unified values into [`FluorApp::on_event`] and widget capability traits. Apps and widgets never see winit or Android types — they speak fluor.
//!
//! Designed so the translation is mechanical: winit → fluor on desktop is a small match table inside `host::desktop` (or wherever `DesktopShell` lives); Android JNI → fluor on Android is the equivalent in `host::android::events`.
//!
//! Naming mirrors winit's where the concepts overlap (KeyEvent / ModifiersState / ElementState / MouseButton) so the porting cost from winit-based code is low. New concepts that winit doesn't model (multi-touch points, gesture deltas, pen pressure) belong here directly and aren't constrained to a winit-shaped hole.
extern crate alloc;
use String;
use crateCoord;
// ============================================================================ Top-level event ============================================================
/// A platform-neutral window event delivered to [`crate::host::app::FluorApp::on_event`].
///
/// Hosts translate platform input (winit `WindowEvent`, Android JNI input) into these arms at the boundary. Variants cover only the cases consumers actually match on today — adding new arms requires updating every host's translation table, so we keep the enum tight and grow it deliberately.
// ============================================================================ Element state / mouse button ===============================================
/// Press / release transition for buttons and keys.
/// Mouse button. Touch on Android arrives as `Left` at the primary touch point; non-`Left` mouse buttons are desktop-only today.
// ============================================================================ Scroll delta ===============================================================
/// Direction + magnitude of a scroll event. Hosts pick whichever unit their platform delivers; consumers typically multiply thru the same scaling factor regardless.
// ============================================================================ Modifier state =============================================================
/// Live modifier-key state. All four bits set simultaneously is legal (shift+ctrl+alt+super).
// ============================================================================ Keys =======================================================================
/// Logical key value, post-keymap. `Character(c)` carries the character a printable key would produce (one Unicode scalar — IME composed text arrives via [`Event::Ime`], not here). `Named` covers non-printable keys.
/// Non-printable keys we route on. Variant set covers what fluor's widgets and chrome handle today; extending the enum requires updating every host's translation table, so we grow it deliberately.
/// Key press / release. `state` distinguishes press vs release; `repeat = true` means an OS-generated repeat (held-key auto-fire). `text` carries the character-producing keystroke (e.g. `Some("a")` for an unshifted A) when the press would type something — widgets typically read `text` to insert characters and read `logical_key` (Named arms) for control keys.
// ============================================================================ IME ========================================================================
/// IME composition events. Today we only translate `Commit` (the cross-platform "user accepted this string, type it"); preedit + state changes can land here when we wire IME on desktop or build a fancier Android InputConnection.
// ============================================================================ Cursor icon ================================================================
/// Cursor shape the host should display. Variants are limited to what fluor's chrome + widgets request today; Android stubs all variants to no-ops (no pointer cursor on touchscreens).