@@ -159,10 +159,10 @@ type cWindowEvent C.SDL_WindowEvent
159
159
160
160
//TODO: Key{Up,Down}Event only differ in 'Type' - a boolean field would be enough to distinguish up/down events
161
161
162
- // KeyDownEvent contains keyboard key down event information.
162
+ // KeyboardEvent contains keyboard key down event information.
163
163
// (https://wiki.libsdl.org/SDL_KeyboardEvent)
164
- type KeyDownEvent struct {
165
- Type uint32 // KEYDOWN
164
+ type KeyboardEvent struct {
165
+ Type uint32 // KEYUP / KEYDOWN
166
166
Timestamp uint32 // timestamp of the event
167
167
WindowID uint32 // the window with keyboard focus, if any
168
168
State uint8 // PRESSED, RELEASED
@@ -173,19 +173,6 @@ type KeyDownEvent struct {
173
173
}
174
174
type cKeyboardEvent C.SDL_KeyboardEvent
175
175
176
- // KeyUpEvent contains keyboard key up event information.
177
- // (https://wiki.libsdl.org/SDL_KeyboardEvent)
178
- type KeyUpEvent struct {
179
- Type uint32 // KEYUP
180
- Timestamp uint32 // timestamp of the event
181
- WindowID uint32 // the window with keyboard focus, if any
182
- State uint8 // PRESSED, RELEASED
183
- Repeat uint8 // non-zero if this is a key repeat
184
- _ uint8 // padding
185
- _ uint8 // padding
186
- Keysym Keysym // Keysym representing the key that was pressed or released
187
- }
188
-
189
176
// TextEditingEvent contains keyboard text editing event information.
190
177
// (https://wiki.libsdl.org/SDL_TextEditingEvent)
191
178
type TextEditingEvent struct {
@@ -560,9 +547,9 @@ func goEvent(cevent *CEvent) Event {
560
547
case SYSWMEVENT :
561
548
return (* SysWMEvent )(unsafe .Pointer (cevent ))
562
549
case KEYDOWN :
563
- return ( * KeyDownEvent )( unsafe . Pointer ( cevent ))
550
+ fallthrough
564
551
case KEYUP :
565
- return (* KeyUpEvent )(unsafe .Pointer (cevent ))
552
+ return (* KeyboardEvent )(unsafe .Pointer (cevent ))
566
553
case TEXTEDITING :
567
554
return (* TextEditingEvent )(unsafe .Pointer (cevent ))
568
555
case TEXTINPUT :
0 commit comments