Skip to content

Commit f034cd7

Browse files
committed
Merge pull request #198 from bvssvni/master
Added `#[repr(C)]`
2 parents 5450198 + 8707952 commit f034cd7

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/sdl2/event.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,13 @@ pub mod ll {
8686
pub const SDL_USEREVENT: SDL_EventType = 32768;
8787
pub const SDL_LASTEVENT: SDL_EventType = 65535;
8888

89+
#[repr(C)]
8990
pub struct SDL_CommonEvent {
9091
pub _type: uint32_t,
9192
pub timestamp: uint32_t,
9293
}
9394

95+
#[repr(C)]
9496
pub struct SDL_WindowEvent {
9597
pub _type: uint32_t,
9698
pub timestamp: uint32_t,
@@ -103,6 +105,7 @@ pub mod ll {
103105
pub data2: int32_t,
104106
}
105107

108+
#[repr(C)]
106109
pub struct SDL_KeyboardEvent {
107110
pub _type: uint32_t,
108111
pub timestamp: uint32_t,
@@ -114,6 +117,7 @@ pub mod ll {
114117
pub keysym: SDL_Keysym,
115118
}
116119

120+
#[repr(C)]
117121
pub struct SDL_TextEditingEvent {
118122
pub _type: uint32_t,
119123
pub timestamp: uint32_t,
@@ -123,13 +127,15 @@ pub mod ll {
123127
pub length: int32_t,
124128
}
125129

130+
#[repr(C)]
126131
pub struct SDL_TextInputEvent {
127132
pub _type: uint32_t,
128133
pub timestamp: uint32_t,
129134
pub windowID: uint32_t,
130135
pub text: [c_char, ..32u],
131136
}
132137

138+
#[repr(C)]
133139
pub struct SDL_MouseMotionEvent {
134140
pub _type: uint32_t,
135141
pub timestamp: uint32_t,
@@ -142,6 +148,7 @@ pub mod ll {
142148
pub yrel: int32_t,
143149
}
144150

151+
#[repr(C)]
145152
pub struct SDL_MouseButtonEvent {
146153
pub _type: uint32_t,
147154
pub timestamp: uint32_t,
@@ -155,6 +162,7 @@ pub mod ll {
155162
pub y: int32_t,
156163
}
157164

165+
#[repr(C)]
158166
pub struct SDL_MouseWheelEvent {
159167
pub _type: uint32_t,
160168
pub timestamp: uint32_t,
@@ -164,6 +172,7 @@ pub mod ll {
164172
pub y: int32_t,
165173
}
166174

175+
#[repr(C)]
167176
pub struct SDL_JoyAxisEvent {
168177
pub _type: uint32_t,
169178
pub timestamp: uint32_t,
@@ -176,6 +185,7 @@ pub mod ll {
176185
pub padding4: uint16_t,
177186
}
178187

188+
#[repr(C)]
179189
pub struct SDL_JoyBallEvent {
180190
pub _type: uint32_t,
181191
pub timestamp: uint32_t,
@@ -188,6 +198,7 @@ pub mod ll {
188198
pub yrel: int16_t,
189199
}
190200

201+
#[repr(C)]
191202
pub struct SDL_JoyHatEvent {
192203
pub _type: uint32_t,
193204
pub timestamp: uint32_t,
@@ -198,6 +209,7 @@ pub mod ll {
198209
pub padding2: uint8_t,
199210
}
200211

212+
#[repr(C)]
201213
pub struct SDL_JoyButtonEvent {
202214
pub _type: uint32_t,
203215
pub timestamp: uint32_t,
@@ -208,12 +220,14 @@ pub mod ll {
208220
pub padding2: uint8_t,
209221
}
210222

223+
#[repr(C)]
211224
pub struct SDL_JoyDeviceEvent {
212225
pub _type: uint32_t,
213226
pub timestamp: uint32_t,
214227
pub which: int32_t,
215228
}
216229

230+
#[repr(C)]
217231
pub struct SDL_ControllerAxisEvent {
218232
pub _type: uint32_t,
219233
pub timestamp: uint32_t,
@@ -226,6 +240,7 @@ pub mod ll {
226240
pub padding4: uint16_t,
227241
}
228242

243+
#[repr(C)]
229244
pub struct SDL_ControllerButtonEvent {
230245
pub _type: uint32_t,
231246
pub timestamp: uint32_t,
@@ -236,12 +251,14 @@ pub mod ll {
236251
pub padding2: uint8_t,
237252
}
238253

254+
#[repr(C)]
239255
pub struct SDL_ControllerDeviceEvent {
240256
pub _type: uint32_t,
241257
pub timestamp: uint32_t,
242258
pub which: int32_t,
243259
}
244260

261+
#[repr(C)]
245262
pub struct SDL_TouchFingerEvent {
246263
pub _type: uint32_t,
247264
pub timestamp: uint32_t,
@@ -254,6 +271,7 @@ pub mod ll {
254271
pub pressure: c_float,
255272
}
256273

274+
#[repr(C)]
257275
pub struct SDL_MultiGestureEvent {
258276
pub _type: uint32_t,
259277
pub timestamp: uint32_t,
@@ -266,6 +284,7 @@ pub mod ll {
266284
pub padding: uint16_t,
267285
}
268286

287+
#[repr(C)]
269288
pub struct SDL_DollarGestureEvent {
270289
pub _type: uint32_t,
271290
pub timestamp: uint32_t,
@@ -277,22 +296,26 @@ pub mod ll {
277296
pub y: c_float,
278297
}
279298

299+
#[repr(C)]
280300
pub struct SDL_DropEvent {
281301
pub _type: uint32_t,
282302
pub timestamp: uint32_t,
283303
pub file: *const c_char,
284304
}
285305

306+
#[repr(C)]
286307
pub struct SDL_QuitEvent {
287308
pub _type: uint32_t,
288309
pub timestamp: uint32_t,
289310
}
290311

312+
#[repr(C)]
291313
pub struct SDL_OSEvent {
292314
pub _type: uint32_t,
293315
pub timestamp: uint32_t,
294316
}
295317

318+
#[repr(C)]
296319
pub struct SDL_UserEvent {
297320
pub _type: uint32_t,
298321
pub timestamp: uint32_t,
@@ -302,6 +325,7 @@ pub mod ll {
302325
pub data2: *const c_void,
303326
}
304327

328+
#[repr(C)]
305329
pub struct SDL_SysWMEvent {
306330
pub _type: uint32_t,
307331
pub timestamp: uint32_t,
@@ -852,7 +876,7 @@ impl Event {
852876
event.x as int, event.y as int)
853877
}
854878
MouseWheelEventType => {
855-
let event = *raw.button();
879+
let event = *raw.wheel();
856880

857881
let window = video::Window::from_id(event.windowID);
858882
let window = match window {

0 commit comments

Comments
 (0)