Ver Fonte

Exposed SDL_ResetKeyboard() as a public function

This will be used by Source 2 titles to reset keyboard state before showing assertion dialogs
Sam Lantinga há 2 anos atrás
pai
commit
2373da5d94

+ 12 - 0
include/SDL_keyboard.h

@@ -90,9 +90,21 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
  * \since This function is available since SDL 2.0.0.
  *
  * \sa SDL_PumpEvents
+ * \sa SDL_ResetKeyboard
  */
 extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
 
+/**
+ * Clear the state of the keyboard
+ *
+ * This function will generate key up events for all pressed keys.
+ *
+ * \since This function is available since SDL 2.24.0.
+ *
+ * \sa SDL_GetKeyboardState
+ */
+extern DECLSPEC void SDLCALL SDL_ResetKeyboard(void);
+
 /**
  * Get the current key modifier state for the keyboard.
  *

+ 1 - 0
src/dynapi/SDL2.exports

@@ -852,3 +852,4 @@
 # ++'_SDL_GDKGetTaskQueue'.'SDL2.dll'.'SDL_GDKGetTaskQueue'
 # ++'_SDL_GDKRunApp'.'SDL2.dll'.'SDL_GDKRunApp'
 ++'_SDL_GetOriginalMemoryFunctions'.'SDL2.dll'.'SDL_GetOriginalMemoryFunctions'
+++'_SDL_ResetKeyboard'.'SDL2.dll'.'SDL_ResetKeyboard'

+ 1 - 0
src/dynapi/SDL_dynapi_overrides.h

@@ -878,3 +878,4 @@
 #define SDL_GDKGetTaskQueue SDL_GDKGetTaskQueue_REAL
 #define SDL_GDKRunApp SDL_GDKRunApp_REAL
 #define SDL_GetOriginalMemoryFunctions SDL_GetOriginalMemoryFunctions_REAL
+#define SDL_ResetKeyboard SDL_ResetKeyboard_REAL

+ 1 - 0
src/dynapi/SDL_dynapi_procs.h

@@ -961,3 +961,4 @@ SDL_DYNAPI_PROC(int,SDL_GDKGetTaskQueue,(XTaskQueueHandle *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_GDKRunApp,(SDL_main_func a, void *b),(a,b),return)
 #endif
 SDL_DYNAPI_PROC(void,SDL_GetOriginalMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),)
+SDL_DYNAPI_PROC(void,SDL_ResetKeyboard,(void),(),)

+ 0 - 3
src/events/SDL_keyboard_c.h

@@ -29,9 +29,6 @@
 /* Initialize the keyboard subsystem */
 extern int SDL_KeyboardInit(void);
 
-/* Clear the state of the keyboard */
-extern void SDL_ResetKeyboard(void);
-
 /* Get the default keymap */
 extern void SDL_GetDefaultKeymap(SDL_Keycode * keymap);