|
SDL
2.0
|
#include "../SDL_internal.h"#include "SDL_timer.h"#include "SDL_events.h"#include "SDL_events_c.h"#include "../video/SDL_sysvideo.h"
Include dependency graph for SDL_keyboard.c:Go to the source code of this file.
Data Structures | |
| struct | SDL_Keyboard |
Macros | |
| #define | KEYBOARD_HARDWARE 0x01 |
| #define | KEYBOARD_AUTORELEASE 0x02 |
Variables | |
| static SDL_Keyboard | SDL_keyboard |
| static const SDL_Keycode | SDL_default_keymap [SDL_NUM_SCANCODES] |
| static const char * | SDL_scancode_names [SDL_NUM_SCANCODES] |
| #define KEYBOARD_AUTORELEASE 0x02 |
Definition at line 36 of file SDL_keyboard.c.
| #define KEYBOARD_HARDWARE 0x01 |
Definition at line 35 of file SDL_keyboard.c.
| void SDL_GetDefaultKeymap | ( | SDL_Keycode * | keymap | ) |
Definition at line 592 of file SDL_keyboard.c.
References SDL_default_keymap, and SDL_memcpy.
| SDL_Window* SDL_GetKeyboardFocus | ( | void | ) |
Get the window which currently has keyboard focus.
Definition at line 626 of file SDL_keyboard.c.
References SDL_Keyboard::focus, and SDL_keyboard.
Get a snapshot of the current state of the keyboard.
| numkeys | if non-NULL, receives the length of the returned array. |
Example:
Definition at line 896 of file SDL_keyboard.c.
References SDL_Keyboard::keystate, SDL_keyboard, and SDL_NUM_SCANCODES.
| SDL_Keycode SDL_GetKeyFromName | ( | const char * | name | ) |
Get a key code from a human-readable name.
Definition at line 1041 of file SDL_keyboard.c.
References i, NULL, SDL_default_keymap, SDL_GetScancodeFromName(), SDL_strlen, and SDLK_UNKNOWN.
| SDL_Keycode SDL_GetKeyFromScancode | ( | SDL_Scancode | scancode | ) |
Get the key code corresponding to the given scancode according to the current keyboard layout.
See SDL_Keycode for details.
Definition at line 936 of file SDL_keyboard.c.
References SDL_Keyboard::keymap, SDL_InvalidParamError, SDL_keyboard, SDL_NUM_SCANCODES, and SDL_SCANCODE_UNKNOWN.
| const char* SDL_GetKeyName | ( | SDL_Keycode | key | ) |
Get a human-readable name for a key.
Definition at line 1002 of file SDL_keyboard.c.
References SDL_GetScancodeName(), SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_DELETE, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_RETURN, SDL_SCANCODE_SPACE, SDL_SCANCODE_TAB, SDL_UCS4ToUTF8(), SDLK_BACKSPACE, SDLK_DELETE, SDLK_ESCAPE, SDLK_RETURN, SDLK_SCANCODE_MASK, SDLK_SPACE, and SDLK_TAB.
| SDL_Keymod SDL_GetModState | ( | void | ) |
Get the current key modifier state for the keyboard.
Definition at line 907 of file SDL_keyboard.c.
References SDL_Keyboard::modstate, and SDL_keyboard.
| SDL_Scancode SDL_GetScancodeFromKey | ( | SDL_Keycode | key | ) |
Get the scancode corresponding to the given key code according to the current keyboard layout.
See SDL_Scancode for details.
Definition at line 949 of file SDL_keyboard.c.
References SDL_Keyboard::keymap, SDL_keyboard, SDL_NUM_SCANCODES, and SDL_SCANCODE_UNKNOWN.
| SDL_Scancode SDL_GetScancodeFromName | ( | const char * | name | ) |
Get a scancode from a human-readable name.
Definition at line 979 of file SDL_keyboard.c.
References i, SDL_arraysize, SDL_InvalidParamError, SDL_scancode_names, SDL_SCANCODE_UNKNOWN, and SDL_strcasecmp.
Referenced by SDL_GetKeyFromName().
| const char* SDL_GetScancodeName | ( | SDL_Scancode | scancode | ) |
Get a human-readable name for a scancode.
Definition at line 964 of file SDL_keyboard.c.
References SDL_InvalidParamError, SDL_NUM_SCANCODES, SDL_scancode_names, and SDL_SCANCODE_UNKNOWN.
Referenced by SDL_GetKeyName(), and SDL_SendKeyboardKeyInternal().
Definition at line 834 of file SDL_keyboard.c.
References KEYBOARD_HARDWARE, SDL_Keyboard::keysource, SDL_FALSE, SDL_keyboard, SDL_NUM_SCANCODES, SDL_SCANCODE_UNKNOWN, and SDL_TRUE.
Definition at line 566 of file SDL_keyboard.c.
References SDL_Keyboard::keymap, SDL_default_keymap, SDL_keyboard, and SDL_memcpy.
Referenced by SDL_VideoInit().
Definition at line 818 of file SDL_keyboard.c.
References SDL_Keyboard::autorelease_pending, KEYBOARD_AUTORELEASE, SDL_Keyboard::keysource, SDL_FALSE, SDL_keyboard, SDL_NUM_SCANCODES, SDL_RELEASED, SDL_SCANCODE_UNKNOWN, and SDL_SendKeyboardKeyInternal().
Referenced by SDL_PumpEvents().
Definition at line 576 of file SDL_keyboard.c.
References SDL_Keyboard::keystate, SDL_keyboard, SDL_NUM_SCANCODES, SDL_PRESSED, SDL_RELEASED, and SDL_SendKeyboardKey().
Referenced by SDL_SetKeyboardFocus(), and SDL_ShowMessageBox().
Definition at line 871 of file SDL_keyboard.c.
References SDL_Keyboard::focus, SDL_Window::id, SDL_arraysize, SDL_ENABLE, SDL_GetEventState, SDL_keyboard, SDL_PushEvent, SDL_TEXTEDITING, SDL_utf8strlcpy, and text.
Referenced by DBus_MessageFilter().
| int SDL_SendKeyboardKey | ( | Uint8 | state, |
| SDL_Scancode | scancode | ||
| ) |
Definition at line 806 of file SDL_keyboard.c.
References KEYBOARD_HARDWARE, SDL_SendKeyboardKeyInternal(), and state.
Referenced by SDL_BApp::_HandleKey(), handleKeyboardEvent(), SDL_ResetKeyboard(), and WINRT_OnBackButtonPressed().
| int SDL_SendKeyboardKeyAutoRelease | ( | SDL_Scancode | scancode | ) |
Definition at line 812 of file SDL_keyboard.c.
References KEYBOARD_AUTORELEASE, SDL_PRESSED, and SDL_SendKeyboardKeyInternal().
|
static |
Definition at line 683 of file SDL_keyboard.c.
References SDL_Keyboard::autorelease_pending, SDL_Keyboard::focus, SDL_Window::id, KEYBOARD_AUTORELEASE, SDL_Keyboard::keymap, SDL_Keyboard::keysource, SDL_Keyboard::keystate, KMOD_CAPS, KMOD_LALT, KMOD_LCTRL, KMOD_LGUI, KMOD_LSHIFT, KMOD_MODE, KMOD_NONE, KMOD_NUM, KMOD_RALT, KMOD_RCTRL, KMOD_RGUI, KMOD_RSHIFT, SDL_Keyboard::modstate, SDL_ENABLE, SDL_FALSE, SDL_GetEventState, SDL_GetScancodeName(), SDL_keyboard, SDL_KEYDOWN, SDL_KEYUP, SDL_PRESSED, SDL_PushEvent, SDL_RELEASED, SDL_SCANCODE_UNKNOWN, SDL_TRUE, SDLK_CAPSLOCK, SDLK_LALT, SDLK_LCTRL, SDLK_LGUI, SDLK_LSHIFT, SDLK_MODE, SDLK_NUMLOCKCLEAR, SDLK_RALT, SDLK_RCTRL, SDLK_RGUI, SDLK_RSHIFT, and state.
Referenced by SDL_ReleaseAutoReleaseKeys(), SDL_SendKeyboardKey(), and SDL_SendKeyboardKeyAutoRelease().
| int SDL_SendKeyboardText | ( | const char * | text | ) |
Definition at line 848 of file SDL_keyboard.c.
References SDL_Keyboard::focus, SDL_Window::id, SDL_arraysize, SDL_ENABLE, SDL_GetEventState, SDL_keyboard, SDL_PushEvent, SDL_TEXTINPUT, SDL_utf8strlcpy, and text.
Referenced by SDL_BApp::_HandleKey(), and DBus_MessageFilter().
| void SDL_SetKeyboardFocus | ( | SDL_Window * | window | ) |
Definition at line 634 of file SDL_keyboard.c.
References SDL_Window::flags, SDL_Keyboard::focus, SDL_assert, SDL_CaptureMouse, SDL_EventState, SDL_FALSE, SDL_GetVideoDevice(), SDL_keyboard, SDL_QUERY, SDL_ResetKeyboard(), SDL_SendWindowEvent(), SDL_TEXTINPUT, SDL_WINDOW_MOUSE_CAPTURE, SDL_WINDOWEVENT_FOCUS_GAINED, SDL_WINDOWEVENT_FOCUS_LOST, SDL_VideoDevice::StartTextInput, and SDL_VideoDevice::StopTextInput.
Referenced by SDL_BApp::_HandleKeyboardFocus(), and SDL_DestroyWindow().
| void SDL_SetKeymap | ( | int | start, |
| SDL_Keycode * | keys, | ||
| int | length | ||
| ) |
Definition at line 598 of file SDL_keyboard.c.
References SDL_Keyboard::keymap, SDL_keyboard, SDL_memcpy, SDL_NUM_SCANCODES, SDL_SCANCODE_0, SDL_SCANCODE_1, SDL_SCANCODE_9, SDLK_0, and SDLK_1.
| void SDL_SetModState | ( | SDL_Keymod | modstate | ) |
Set the current key modifier state for the keyboard.
Definition at line 915 of file SDL_keyboard.c.
References SDL_Keyboard::modstate, and SDL_keyboard.
| void SDL_SetScancodeName | ( | SDL_Scancode | scancode, |
| const char * | name | ||
| ) |
Definition at line 620 of file SDL_keyboard.c.
References SDL_scancode_names.
| void SDL_ToggleModState | ( | const SDL_Keymod | modstate, |
| const SDL_bool | toggle | ||
| ) |
| char* SDL_UCS4ToUTF8 | ( | Uint32 | ch, |
| char * | dst | ||
| ) |
|
static |
Definition at line 53 of file SDL_keyboard.c.
Referenced by SDL_GetDefaultKeymap(), SDL_GetKeyFromName(), and SDL_KeyboardInit().
|
static |
Definition at line 51 of file SDL_keyboard.c.
Referenced by SDL_GetKeyboardFocus(), SDL_GetKeyboardState(), SDL_GetKeyFromScancode(), SDL_GetModState(), SDL_GetScancodeFromKey(), SDL_HardwareKeyboardKeyPressed(), SDL_KeyboardInit(), SDL_ReleaseAutoReleaseKeys(), SDL_ResetKeyboard(), SDL_SendEditingText(), SDL_SendKeyboardKeyInternal(), SDL_SendKeyboardText(), SDL_SetKeyboardFocus(), SDL_SetKeymap(), SDL_SetModState(), and SDL_ToggleModState().
|
static |
Definition at line 286 of file SDL_keyboard.c.
Referenced by SDL_GetScancodeFromName(), SDL_GetScancodeName(), and SDL_SetScancodeName().