| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
SDL3.Sys.Keyboard
Contents
Description
SDL keyboard management.
Please refer to the Best Keyboard Practices document for details on how best to accept keyboard input in various types of programs:
https://wiki.libsdl.org/SDL3/BestKeyboardPractices This is a unique ID for a keyboard for the time it is connected to the system, and is never reused for the lifetime of the application.
If the keyboard is disconnected and reconnected, it will get a new ID.
The value 0 is an invalid ID.
FFI conventions
Unsuffixed aliases are unsafe foreign imports; aliases suffixed Safe are safe. Functions whose callbacks fire during the call export only the Safe alias (the genuine unsafe import stays reachable under SDL3.Sys.Bindgen.Keyboard.Unsafe); functions curated unsafe-only export only the unsuffixed one. Each alias's documentation records its flavor and rationale.
Full conventions: SDL3.Sys.
Since: 3.2.0
Synopsis
- module SDL3.Sys.Bindgen.Keyboard
- hasKeyboard :: IO Bool
- hasKeyboardSafe :: IO Bool
- getKeyboards :: Ptr CInt -> IO (Ptr SDL_KeyboardID)
- getKeyboardsSafe :: Ptr CInt -> IO (Ptr SDL_KeyboardID)
- getKeyboardNameForID :: SDL_KeyboardID -> IO (PtrConst CChar)
- getKeyboardNameForIDSafe :: SDL_KeyboardID -> IO (PtrConst CChar)
- getKeyboardFocus :: IO (Ptr SDL_Window)
- getKeyboardFocusSafe :: IO (Ptr SDL_Window)
- getKeyboardState :: Ptr CInt -> IO (PtrConst CBool)
- getKeyboardStateSafe :: Ptr CInt -> IO (PtrConst CBool)
- resetKeyboard :: IO ()
- resetKeyboardSafe :: IO ()
- getModState :: IO SDL_Keymod
- getModStateSafe :: IO SDL_Keymod
- setModState :: SDL_Keymod -> IO ()
- setModStateSafe :: SDL_Keymod -> IO ()
- getKeyFromScancode :: SDL_Scancode -> SDL_Keymod -> Bool -> IO SDL_Keycode
- getKeyFromScancodeSafe :: SDL_Scancode -> SDL_Keymod -> Bool -> IO SDL_Keycode
- getScancodeFromKey :: SDL_Keycode -> Ptr SDL_Keymod -> IO SDL_Scancode
- getScancodeFromKeySafe :: SDL_Keycode -> Ptr SDL_Keymod -> IO SDL_Scancode
- setScancodeName :: SDL_Scancode -> PtrConst CChar -> IO Bool
- setScancodeNameSafe :: SDL_Scancode -> PtrConst CChar -> IO Bool
- getScancodeName :: SDL_Scancode -> IO (PtrConst CChar)
- getScancodeNameSafe :: SDL_Scancode -> IO (PtrConst CChar)
- getScancodeFromName :: PtrConst CChar -> IO SDL_Scancode
- getScancodeFromNameSafe :: PtrConst CChar -> IO SDL_Scancode
- getKeyName :: SDL_Keycode -> IO (PtrConst CChar)
- getKeyNameSafe :: SDL_Keycode -> IO (PtrConst CChar)
- getKeyFromName :: PtrConst CChar -> IO SDL_Keycode
- getKeyFromNameSafe :: PtrConst CChar -> IO SDL_Keycode
- startTextInput :: Ptr SDL_Window -> IO Bool
- startTextInputSafe :: Ptr SDL_Window -> IO Bool
- startTextInputWithProperties :: Ptr SDL_Window -> SDL_PropertiesID -> IO Bool
- startTextInputWithPropertiesSafe :: Ptr SDL_Window -> SDL_PropertiesID -> IO Bool
- textInputActive :: Ptr SDL_Window -> IO Bool
- textInputActiveSafe :: Ptr SDL_Window -> IO Bool
- stopTextInput :: Ptr SDL_Window -> IO Bool
- stopTextInputSafe :: Ptr SDL_Window -> IO Bool
- clearComposition :: Ptr SDL_Window -> IO Bool
- clearCompositionSafe :: Ptr SDL_Window -> IO Bool
- setTextInputArea :: Ptr SDL_Window -> PtrConst SDL_Rect -> Int32 -> IO Bool
- setTextInputAreaSafe :: Ptr SDL_Window -> PtrConst SDL_Rect -> Int32 -> IO Bool
- getTextInputArea :: Ptr SDL_Window -> Ptr SDL_Rect -> Ptr CInt -> IO Bool
- getTextInputAreaSafe :: Ptr SDL_Window -> Ptr SDL_Rect -> Ptr CInt -> IO Bool
- hasScreenKeyboardSupport :: IO Bool
- hasScreenKeyboardSupportSafe :: IO Bool
- screenKeyboardShown :: Ptr SDL_Window -> IO Bool
- screenKeyboardShownSafe :: Ptr SDL_Window -> IO Bool
Documentation
module SDL3.Sys.Bindgen.Keyboard
Function aliases
hasKeyboard :: IO Bool Source #
Return whether a keyboard is currently connected.
- Returns
- true if a keyboard is connected, false otherwise.
- Thread safety
- This function should only be called on the main thread.
- See also
getKeyboards
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_HasKeyboard. The safe flavor ishasKeyboardSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_HasKeyboard, defined atSDL3/SDL_keyboard.h 75:34
Since: 3.2.0
hasKeyboardSafe :: IO Bool Source #
Return whether a keyboard is currently connected.
- Returns
- true if a keyboard is connected, false otherwise.
- Thread safety
- This function should only be called on the main thread.
- See also
getKeyboards
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_HasKeyboard. The unsafe flavor ishasKeyboard. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_HasKeyboard, defined atSDL3/SDL_keyboard.h 75:34
Since: 3.2.0
Arguments
| :: Ptr CInt |
|
| -> IO (Ptr SDL_KeyboardID) |
Get a list of currently connected keyboards.
Note that this will include any device or virtual driver that includes keyboard functionality, including some mice, KVM switches, motherboard power buttons, etc. You should wait for input from a device before you consider it actively in use.
- Returns
- a 0 terminated array of keyboards instance IDs or NULL on failure; call
getErrorfor more information. This should be freed withfreewhen it is no longer needed. - Thread safety
- This function should only be called on the main thread.
- See also
getKeyboardNameForID,hasKeyboard
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetKeyboards. The safe flavor isgetKeyboardsSafe. - C declaration
SDL_GetKeyboards, defined atSDL3/SDL_keyboard.h 98:46
Since: 3.2.0
Arguments
| :: Ptr CInt |
|
| -> IO (Ptr SDL_KeyboardID) |
Get a list of currently connected keyboards.
Note that this will include any device or virtual driver that includes keyboard functionality, including some mice, KVM switches, motherboard power buttons, etc. You should wait for input from a device before you consider it actively in use.
- Returns
- a 0 terminated array of keyboards instance IDs or NULL on failure; call
getErrorfor more information. This should be freed withfreewhen it is no longer needed. - Thread safety
- This function should only be called on the main thread.
- See also
getKeyboardNameForID,hasKeyboard
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetKeyboards. The unsafe flavor isgetKeyboards. - C declaration
SDL_GetKeyboards, defined atSDL3/SDL_keyboard.h 98:46
Since: 3.2.0
Arguments
| :: SDL_KeyboardID |
|
| -> IO (PtrConst CChar) |
Get the name of a keyboard.
This function returns "" if the keyboard doesn't have a name.
- Returns
- the name of the selected keyboard or NULL on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
getKeyboards
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetKeyboardNameForID. The safe flavor isgetKeyboardNameForIDSafe. - C declaration
SDL_GetKeyboardNameForID, defined atSDL3/SDL_keyboard.h 115:42
Since: 3.2.0
getKeyboardNameForIDSafe Source #
Arguments
| :: SDL_KeyboardID |
|
| -> IO (PtrConst CChar) |
Get the name of a keyboard.
This function returns "" if the keyboard doesn't have a name.
- Returns
- the name of the selected keyboard or NULL on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
getKeyboards
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetKeyboardNameForID. The unsafe flavor isgetKeyboardNameForID. - C declaration
SDL_GetKeyboardNameForID, defined atSDL3/SDL_keyboard.h 115:42
Since: 3.2.0
getKeyboardFocus :: IO (Ptr SDL_Window) Source #
Query the window which currently has keyboard focus.
- Returns
- the window with keyboard focus.
- Thread safety
- This function should only be called on the main thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetKeyboardFocus. The safe flavor isgetKeyboardFocusSafe. - C declaration
SDL_GetKeyboardFocus, defined atSDL3/SDL_keyboard.h 126:42
Since: 3.2.0
getKeyboardFocusSafe :: IO (Ptr SDL_Window) Source #
Query the window which currently has keyboard focus.
- Returns
- the window with keyboard focus.
- Thread safety
- This function should only be called on the main thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetKeyboardFocus. The unsafe flavor isgetKeyboardFocus. - C declaration
SDL_GetKeyboardFocus, defined atSDL3/SDL_keyboard.h 126:42
Since: 3.2.0
Arguments
| :: Ptr CInt |
|
| -> IO (PtrConst CBool) |
Get a snapshot of the current state of the keyboard.
The pointer returned is a pointer to an internal SDL array. It will be valid for the whole lifetime of the application and should not be freed by the caller.
A array element with a value of true means that the key is pressed and a value of false means that it is not. Indexes into this array are obtained by using SDL_Scancode values.
Use pumpEvents to update the state array.
This function gives you the current state after all events have been processed, so if a key or button has been pressed and released before you process events, then the pressed state will never show up in the calls.getKeyboardState
Note: This function doesn't take into account whether shift has been pressed or not.
- Returns
- a pointer to an array of key states.
- Thread safety
- It is safe to call this function from any thread.
- See also
pumpEvents,resetKeyboard
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetKeyboardState. The safe flavor isgetKeyboardStateSafe. - C declaration
SDL_GetKeyboardState, defined atSDL3/SDL_keyboard.h 159:42
Since: 3.2.0
Arguments
| :: Ptr CInt |
|
| -> IO (PtrConst CBool) |
Get a snapshot of the current state of the keyboard.
The pointer returned is a pointer to an internal SDL array. It will be valid for the whole lifetime of the application and should not be freed by the caller.
A array element with a value of true means that the key is pressed and a value of false means that it is not. Indexes into this array are obtained by using SDL_Scancode values.
Use pumpEvents to update the state array.
This function gives you the current state after all events have been processed, so if a key or button has been pressed and released before you process events, then the pressed state will never show up in the calls.getKeyboardState
Note: This function doesn't take into account whether shift has been pressed or not.
- Returns
- a pointer to an array of key states.
- Thread safety
- It is safe to call this function from any thread.
- See also
pumpEvents,resetKeyboard
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetKeyboardState. The unsafe flavor isgetKeyboardState. - C declaration
SDL_GetKeyboardState, defined atSDL3/SDL_keyboard.h 159:42
Since: 3.2.0
resetKeyboard :: IO () Source #
Clear the state of the keyboard.
This function will generate key up events for all pressed keys.
- Thread safety
- This function should only be called on the main thread.
- See also
getKeyboardState
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_ResetKeyboard. The safe flavor isresetKeyboardSafe. - C declaration
SDL_ResetKeyboard, defined atSDL3/SDL_keyboard.h 172:34
Since: 3.2.0
resetKeyboardSafe :: IO () Source #
Clear the state of the keyboard.
This function will generate key up events for all pressed keys.
- Thread safety
- This function should only be called on the main thread.
- See also
getKeyboardState
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_ResetKeyboard. The unsafe flavor isresetKeyboard. - C declaration
SDL_ResetKeyboard, defined atSDL3/SDL_keyboard.h 172:34
Since: 3.2.0
getModState :: IO SDL_Keymod Source #
Get the current key modifier state for the keyboard.
- Returns
- an OR'd combination of the modifier keys for the keyboard.
- Thread safety
- It is safe to call this function from any thread.
- See also
getKeyboardState,setModState
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetModState. The safe flavor isgetModStateSafe. - C declaration
SDL_GetModState, defined atSDL3/SDL_keyboard.h 186:40
Since: 3.2.0
getModStateSafe :: IO SDL_Keymod Source #
Get the current key modifier state for the keyboard.
- Returns
- an OR'd combination of the modifier keys for the keyboard.
- Thread safety
- It is safe to call this function from any thread.
- See also
getKeyboardState,setModState
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetModState. The unsafe flavor isgetModState. - C declaration
SDL_GetModState, defined atSDL3/SDL_keyboard.h 186:40
Since: 3.2.0
Arguments
| :: SDL_Keymod |
|
| -> IO () |
Set the current key modifier state for the keyboard.
The inverse of , getModState allows you to impose modifier key states on your application. Simply pass your desired modifier states into setModStatemodstate. This value may be a bitwise, OR'd combination of SDL_Keymod values.
This does not change the keyboard state, only the key modifier flags that SDL reports.
- Thread safety
- It is safe to call this function from any thread.
- See also
getModState
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SetModState. The safe flavor issetModStateSafe. - C declaration
SDL_SetModState, defined atSDL3/SDL_keyboard.h 207:34
Since: 3.2.0
Arguments
| :: SDL_Keymod |
|
| -> IO () |
Set the current key modifier state for the keyboard.
The inverse of , getModState allows you to impose modifier key states on your application. Simply pass your desired modifier states into setModStatemodstate. This value may be a bitwise, OR'd combination of SDL_Keymod values.
This does not change the keyboard state, only the key modifier flags that SDL reports.
- Thread safety
- It is safe to call this function from any thread.
- See also
getModState
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SetModState. The unsafe flavor issetModState. - C declaration
SDL_SetModState, defined atSDL3/SDL_keyboard.h 207:34
Since: 3.2.0
Arguments
| :: SDL_Scancode |
|
| -> SDL_Keymod |
|
| -> Bool |
|
| -> IO SDL_Keycode |
Get the key code corresponding to the given scancode according to the current keyboard layout.
If you want to get the keycode as it would be delivered in key events, including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should pass key_event as true. Otherwise this function simply translates the scancode based on the given modifier state.
- Returns
- the SDL_Keycode that corresponds to the given SDL_Scancode.
- Thread safety
- This function is not thread safe.
- See also
getKeyName,getScancodeFromKey
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetKeyFromScancode. The safe flavor isgetKeyFromScancodeSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_GetKeyFromScancode, defined atSDL3/SDL_keyboard.h 231:41
Since: 3.2.0
getKeyFromScancodeSafe Source #
Arguments
| :: SDL_Scancode |
|
| -> SDL_Keymod |
|
| -> Bool |
|
| -> IO SDL_Keycode |
Get the key code corresponding to the given scancode according to the current keyboard layout.
If you want to get the keycode as it would be delivered in key events, including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should pass key_event as true. Otherwise this function simply translates the scancode based on the given modifier state.
- Returns
- the SDL_Keycode that corresponds to the given SDL_Scancode.
- Thread safety
- This function is not thread safe.
- See also
getKeyName,getScancodeFromKey
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetKeyFromScancode. The unsafe flavor isgetKeyFromScancode. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_GetKeyFromScancode, defined atSDL3/SDL_keyboard.h 231:41
Since: 3.2.0
Arguments
| :: SDL_Keycode |
|
| -> Ptr SDL_Keymod |
|
| -> IO SDL_Scancode |
Get the scancode corresponding to the given key code according to the current keyboard layout.
Note that there may be multiple scancode+modifier states that can generate this keycode, this will just return the first one found.
- Returns
- the SDL_Scancode that corresponds to the given SDL_Keycode.
- Thread safety
- This function is not thread safe.
- See also
getKeyFromScancode,getScancodeName
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetScancodeFromKey. The safe flavor isgetScancodeFromKeySafe. - C declaration
SDL_GetScancodeFromKey, defined atSDL3/SDL_keyboard.h 252:42
Since: 3.2.0
getScancodeFromKeySafe Source #
Arguments
| :: SDL_Keycode |
|
| -> Ptr SDL_Keymod |
|
| -> IO SDL_Scancode |
Get the scancode corresponding to the given key code according to the current keyboard layout.
Note that there may be multiple scancode+modifier states that can generate this keycode, this will just return the first one found.
- Returns
- the SDL_Scancode that corresponds to the given SDL_Keycode.
- Thread safety
- This function is not thread safe.
- See also
getKeyFromScancode,getScancodeName
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetScancodeFromKey. The unsafe flavor isgetScancodeFromKey. - C declaration
SDL_GetScancodeFromKey, defined atSDL3/SDL_keyboard.h 252:42
Since: 3.2.0
Arguments
| :: SDL_Scancode |
|
| -> PtrConst CChar |
|
| -> IO Bool |
Set a human-readable name for a scancode.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function is not thread safe.
- See also
getScancodeName
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SetScancodeName. The safe flavor issetScancodeNameSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_SetScancodeName, defined atSDL3/SDL_keyboard.h 270:34
Since: 3.2.0
Arguments
| :: SDL_Scancode |
|
| -> PtrConst CChar |
|
| -> IO Bool |
Set a human-readable name for a scancode.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function is not thread safe.
- See also
getScancodeName
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SetScancodeName. The unsafe flavor issetScancodeName. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_SetScancodeName, defined atSDL3/SDL_keyboard.h 270:34
Since: 3.2.0
Arguments
| :: SDL_Scancode |
|
| -> IO (PtrConst CChar) |
Get a human-readable name for a scancode.
Warning: The returned name is by design not stable across platforms, e.g. the name for SDL_SCANCODE_LGUI is "Left GUI" under Linux but "Left Windows" under Microsoft Windows, and some scancodes like SDL_SCANCODE_NONUSBACKSLASH don't have any name at all. There are even scancodes that share names, e.g. SDL_SCANCODE_RETURN and SDL_SCANCODE_RETURN2 (both called "Return"). This function is therefore unsuitable for creating a stable cross-platform two-way mapping between strings and scancodes.
- Returns
- a pointer to the name for the scancode. If the scancode doesn't have a name this function returns an empty string ("").
- Thread safety
- This function is not thread safe.
- See also
getScancodeFromKey,getScancodeFromName,setScancodeName
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetScancodeName. The safe flavor isgetScancodeNameSafe. - C declaration
SDL_GetScancodeName, defined atSDL3/SDL_keyboard.h 296:42
Since: 3.2.0
Arguments
| :: SDL_Scancode |
|
| -> IO (PtrConst CChar) |
Get a human-readable name for a scancode.
Warning: The returned name is by design not stable across platforms, e.g. the name for SDL_SCANCODE_LGUI is "Left GUI" under Linux but "Left Windows" under Microsoft Windows, and some scancodes like SDL_SCANCODE_NONUSBACKSLASH don't have any name at all. There are even scancodes that share names, e.g. SDL_SCANCODE_RETURN and SDL_SCANCODE_RETURN2 (both called "Return"). This function is therefore unsuitable for creating a stable cross-platform two-way mapping between strings and scancodes.
- Returns
- a pointer to the name for the scancode. If the scancode doesn't have a name this function returns an empty string ("").
- Thread safety
- This function is not thread safe.
- See also
getScancodeFromKey,getScancodeFromName,setScancodeName
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetScancodeName. The unsafe flavor isgetScancodeName. - C declaration
SDL_GetScancodeName, defined atSDL3/SDL_keyboard.h 296:42
Since: 3.2.0
Arguments
| :: PtrConst CChar |
|
| -> IO SDL_Scancode |
Get a scancode from a human-readable name.
- Returns
- the SDL_Scancode, or
SDL_SCANCODE_UNKNOWNif the name wasn't recognized; callgetErrorfor more information. - Thread safety
- This function is not thread safe.
- See also
getKeyFromName,getScancodeFromKey,getScancodeName
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetScancodeFromName. The safe flavor isgetScancodeFromNameSafe. - C declaration
SDL_GetScancodeFromName, defined atSDL3/SDL_keyboard.h 313:42
Since: 3.2.0
getScancodeFromNameSafe Source #
Arguments
| :: PtrConst CChar |
|
| -> IO SDL_Scancode |
Get a scancode from a human-readable name.
- Returns
- the SDL_Scancode, or
SDL_SCANCODE_UNKNOWNif the name wasn't recognized; callgetErrorfor more information. - Thread safety
- This function is not thread safe.
- See also
getKeyFromName,getScancodeFromKey,getScancodeName
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetScancodeFromName. The unsafe flavor isgetScancodeFromName. - C declaration
SDL_GetScancodeFromName, defined atSDL3/SDL_keyboard.h 313:42
Since: 3.2.0
Arguments
| :: SDL_Keycode |
|
| -> IO (PtrConst CChar) |
Get a human-readable name for a key.
If the key doesn't have a name, this function returns an empty string ("").
Letters will be presented in their uppercase form, if applicable.
- Returns
- a UTF-8 encoded string of the key name.
- Thread safety
- This function is not thread safe.
- See also
getKeyFromName,getKeyFromScancode,getScancodeFromKey
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetKeyName. The safe flavor isgetKeyNameSafe. - C declaration
SDL_GetKeyName, defined atSDL3/SDL_keyboard.h 333:42
Since: 3.2.0
Arguments
| :: SDL_Keycode |
|
| -> IO (PtrConst CChar) |
Get a human-readable name for a key.
If the key doesn't have a name, this function returns an empty string ("").
Letters will be presented in their uppercase form, if applicable.
- Returns
- a UTF-8 encoded string of the key name.
- Thread safety
- This function is not thread safe.
- See also
getKeyFromName,getKeyFromScancode,getScancodeFromKey
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetKeyName. The unsafe flavor isgetKeyName. - C declaration
SDL_GetKeyName, defined atSDL3/SDL_keyboard.h 333:42
Since: 3.2.0
Arguments
| :: PtrConst CChar |
|
| -> IO SDL_Keycode |
Get a key code from a human-readable name.
- Returns
- key code, or
SDLK_UNKNOWNif the name wasn't recognized; callgetErrorfor more information. - Thread safety
- This function is not thread safe.
- See also
getKeyFromScancode,getKeyName,getScancodeFromName
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetKeyFromName. The safe flavor isgetKeyFromNameSafe. - C declaration
SDL_GetKeyFromName, defined atSDL3/SDL_keyboard.h 350:41
Since: 3.2.0
Arguments
| :: PtrConst CChar |
|
| -> IO SDL_Keycode |
Get a key code from a human-readable name.
- Returns
- key code, or
SDLK_UNKNOWNif the name wasn't recognized; callgetErrorfor more information. - Thread safety
- This function is not thread safe.
- See also
getKeyFromScancode,getKeyName,getScancodeFromName
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetKeyFromName. The unsafe flavor isgetKeyFromName. - C declaration
SDL_GetKeyFromName, defined atSDL3/SDL_keyboard.h 350:41
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> IO Bool |
Start accepting Unicode text input events in a window.
This function will enable text input (SDL_EVENT_TEXT_INPUT and SDL_EVENT_TEXT_EDITING events) in the specified window. Please use this function paired with .stopTextInput
Text input events are not received by default.
On some platforms using this function shows the screen keyboard and/or activates an IME, which can prevent some key press events from being passed through.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
setTextInputArea,startTextInputWithProperties,stopTextInput,textInputActive
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_StartTextInput. The safe flavor isstartTextInputSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_StartTextInput, defined atSDL3/SDL_keyboard.h 378:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> IO Bool |
Start accepting Unicode text input events in a window.
This function will enable text input (SDL_EVENT_TEXT_INPUT and SDL_EVENT_TEXT_EDITING events) in the specified window. Please use this function paired with .stopTextInput
Text input events are not received by default.
On some platforms using this function shows the screen keyboard and/or activates an IME, which can prevent some key press events from being passed through.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
setTextInputArea,startTextInputWithProperties,stopTextInput,textInputActive
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_StartTextInput. The unsafe flavor isstartTextInput. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_StartTextInput, defined atSDL3/SDL_keyboard.h 378:34
Since: 3.2.0
startTextInputWithProperties Source #
Arguments
| :: Ptr SDL_Window |
|
| -> SDL_PropertiesID |
|
| -> IO Bool |
Start accepting Unicode text input events in a window, with properties describing the input.
This function will enable text input (SDL_EVENT_TEXT_INPUT and SDL_EVENT_TEXT_EDITING events) in the specified window. Please use this function paired with .stopTextInput
Text input events are not received by default.
On some platforms using this function shows the screen keyboard and/or activates an IME, which can prevent some key press events from being passed through.
These are the supported properties:
- ansDL_PROP_TEXTINPUT_TYPE_NUMBERSDL_TextInputTypevalue that describes text being input, defaults to SDL_TEXTINPUT_TYPE_TEXT.- ansDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBERSDL_Capitalizationvalue that describes how text should be capitalized, defaults to SDL_CAPITALIZE_SENTENCES for normal text entry, SDL_CAPITALIZE_WORDS for SDL_TEXTINPUT_TYPE_TEXT_NAME, and SDL_CAPITALIZE_NONE for e-mail addresses, usernames, and passwords.- true to enable auto completion and auto correction, defaults to true.sDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN- true if multiple lines of text are allowed. This defaults to true if SDL_HINT_RETURN_KEY_HIDES_IME is "0" or is not set, and defaults to false if SDL_HINT_RETURN_KEY_HIDES_IME is "1".sDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN
On Android you can directly specify the input type:
- the text input type to use, overriding other properties. This is documented at https://developer.android.com/reference/android/text/InputTypesDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
setTextInputArea,startTextInput,stopTextInput,textInputActive
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_StartTextInputWithProperties. The safe flavor isstartTextInputWithPropertiesSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_StartTextInputWithProperties, defined atSDL3/SDL_keyboard.h 473:34
Since: 3.2.0
startTextInputWithPropertiesSafe Source #
Arguments
| :: Ptr SDL_Window |
|
| -> SDL_PropertiesID |
|
| -> IO Bool |
Start accepting Unicode text input events in a window, with properties describing the input.
This function will enable text input (SDL_EVENT_TEXT_INPUT and SDL_EVENT_TEXT_EDITING events) in the specified window. Please use this function paired with .stopTextInput
Text input events are not received by default.
On some platforms using this function shows the screen keyboard and/or activates an IME, which can prevent some key press events from being passed through.
These are the supported properties:
- ansDL_PROP_TEXTINPUT_TYPE_NUMBERSDL_TextInputTypevalue that describes text being input, defaults to SDL_TEXTINPUT_TYPE_TEXT.- ansDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBERSDL_Capitalizationvalue that describes how text should be capitalized, defaults to SDL_CAPITALIZE_SENTENCES for normal text entry, SDL_CAPITALIZE_WORDS for SDL_TEXTINPUT_TYPE_TEXT_NAME, and SDL_CAPITALIZE_NONE for e-mail addresses, usernames, and passwords.- true to enable auto completion and auto correction, defaults to true.sDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN- true if multiple lines of text are allowed. This defaults to true if SDL_HINT_RETURN_KEY_HIDES_IME is "0" or is not set, and defaults to false if SDL_HINT_RETURN_KEY_HIDES_IME is "1".sDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN
On Android you can directly specify the input type:
- the text input type to use, overriding other properties. This is documented at https://developer.android.com/reference/android/text/InputTypesDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
setTextInputArea,startTextInput,stopTextInput,textInputActive
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_StartTextInputWithProperties. The unsafe flavor isstartTextInputWithProperties. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_StartTextInputWithProperties, defined atSDL3/SDL_keyboard.h 473:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> IO Bool |
Check whether or not Unicode text input events are enabled for a window.
- Returns
- true if text input events are enabled else false.
- Thread safety
- This function should only be called on the main thread.
- See also
startTextInput
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_TextInputActive. The safe flavor istextInputActiveSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_TextInputActive, defined atSDL3/SDL_keyboard.h 493:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> IO Bool |
Check whether or not Unicode text input events are enabled for a window.
- Returns
- true if text input events are enabled else false.
- Thread safety
- This function should only be called on the main thread.
- See also
startTextInput
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_TextInputActive. The unsafe flavor istextInputActive. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_TextInputActive, defined atSDL3/SDL_keyboard.h 493:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> IO Bool |
Stop receiving any text input events in a window.
If showed the screen keyboard, this function will hide it.startTextInput
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
startTextInput
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_StopTextInput. The safe flavor isstopTextInputSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_StopTextInput, defined atSDL3/SDL_keyboard.h 511:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> IO Bool |
Stop receiving any text input events in a window.
If showed the screen keyboard, this function will hide it.startTextInput
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
startTextInput
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_StopTextInput. The unsafe flavor isstopTextInput. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_StopTextInput, defined atSDL3/SDL_keyboard.h 511:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> IO Bool |
Dismiss the composition window/IME without disabling the subsystem.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
startTextInput,stopTextInput
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_ClearComposition. The safe flavor isclearCompositionSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_ClearComposition, defined atSDL3/SDL_keyboard.h 527:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> IO Bool |
Dismiss the composition window/IME without disabling the subsystem.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
startTextInput,stopTextInput
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_ClearComposition. The unsafe flavor isclearComposition. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_ClearComposition, defined atSDL3/SDL_keyboard.h 527:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> PtrConst SDL_Rect |
|
| -> Int32 |
|
| -> IO Bool |
Set the area used to type Unicode text input.
Native input methods may place a window with word suggestions near the cursor, without covering the text being entered.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
getTextInputArea,startTextInput
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SetTextInputArea. The safe flavor issetTextInputAreaSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_SetTextInputArea, defined atSDL3/SDL_keyboard.h 550:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> PtrConst SDL_Rect |
|
| -> Int32 |
|
| -> IO Bool |
Set the area used to type Unicode text input.
Native input methods may place a window with word suggestions near the cursor, without covering the text being entered.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
getTextInputArea,startTextInput
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SetTextInputArea. The unsafe flavor issetTextInputArea. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_SetTextInputArea, defined atSDL3/SDL_keyboard.h 550:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> Ptr SDL_Rect |
|
| -> Ptr CInt |
|
| -> IO Bool |
Get the area used to type Unicode text input.
This returns the values previously set by .setTextInputArea
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
setTextInputArea
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetTextInputArea. The safe flavor isgetTextInputAreaSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_GetTextInputArea, defined atSDL3/SDL_keyboard.h 571:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> Ptr SDL_Rect |
|
| -> Ptr CInt |
|
| -> IO Bool |
Get the area used to type Unicode text input.
This returns the values previously set by .setTextInputArea
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- This function should only be called on the main thread.
- See also
setTextInputArea
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetTextInputArea. The unsafe flavor isgetTextInputArea. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_GetTextInputArea, defined atSDL3/SDL_keyboard.h 571:34
Since: 3.2.0
hasScreenKeyboardSupport :: IO Bool Source #
Check whether the platform has screen keyboard support.
- Returns
- true if the platform has some screen keyboard support or false if not.
- Thread safety
- This function should only be called on the main thread.
- See also
startTextInput,screenKeyboardShown
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_HasScreenKeyboardSupport. The safe flavor ishasScreenKeyboardSupportSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_HasScreenKeyboardSupport, defined atSDL3/SDL_keyboard.h 586:34
Since: 3.2.0
hasScreenKeyboardSupportSafe :: IO Bool Source #
Check whether the platform has screen keyboard support.
- Returns
- true if the platform has some screen keyboard support or false if not.
- Thread safety
- This function should only be called on the main thread.
- See also
startTextInput,screenKeyboardShown
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_HasScreenKeyboardSupport. The unsafe flavor ishasScreenKeyboardSupport. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_HasScreenKeyboardSupport, defined atSDL3/SDL_keyboard.h 586:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Window |
|
| -> IO Bool |
Check whether the screen keyboard is shown for given window.
- Returns
- true if screen keyboard is shown or false if not.
- Thread safety
- This function should only be called on the main thread.
- See also
hasScreenKeyboardSupport
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_ScreenKeyboardShown. The safe flavor isscreenKeyboardShownSafe. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_ScreenKeyboardShown, defined atSDL3/SDL_keyboard.h 600:34
Since: 3.2.0
screenKeyboardShownSafe Source #
Arguments
| :: Ptr SDL_Window |
|
| -> IO Bool |
Check whether the screen keyboard is shown for given window.
- Returns
- true if screen keyboard is shown or false if not.
- Thread safety
- This function should only be called on the main thread.
- See also
hasScreenKeyboardSupport
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_ScreenKeyboardShown. The unsafe flavor isscreenKeyboardShown. - Scalars
- The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
- C declaration
SDL_ScreenKeyboardShown, defined atSDL3/SDL_keyboard.h 600:34
Since: 3.2.0