src/video/x11/SDL_x11keyboard.c


Log

Author Commit Date CI Message
Frank Praznik c8551847 2022-11-04T12:41:46 wayland: Handle virtual keyboards that don't fit the X mapping SDL is built around the concept of keyboards having a fixed layout with scancodes that correspond to physical keys no matter what linguistic layout is used. Virtual keyboards don't have this concept and can present an arbitrary layout of keys with arbitrary scancodes and names, which don't fit the SDL model. When one of these keyboards is encountered, it requires special handling: use the keysym of the pressed keys to derive their ANSI keyboard scancode equivalents for control keys and ASCII characters. All other characters are passed through as text events only.
Frank Praznik 0e446c54 2022-11-04T12:27:36 events: Factor out the xkb keysym to scancode conversion from the X11 driver
Ethan Lee f3cc99fb 2022-11-15T13:56:44 x11: Minor style fixes for recent OSK changes
Ethan Lee c4b9f621 2022-11-13T12:45:13 x11: Add support for the Steam Deck on-screen keyboard
Sam Lantinga 13919214 2022-10-13T23:23:55 Fixed reported cases of "Keyboard layout unknown" messages In all cases they were using SDL_SCANCODE_TABLE_XFREE86_2 with some keycodes remapped or fewer than expected keycodes. This adds a sanity check that catches all of them and gives them the right scancode table.
Sam Lantinga 2c192385 2022-10-13T22:50:57 Don't remove entries from an existing scancode keymap If we can't find the X11 keysym, it's likely that either the keysym is NoSymbol, in which case we won't hit it anyway, or it's been mapped to a character, in which case the existing mapping is correct for the scancode and the character will be reflected in the keycode mapping.
Sam Lantinga 99f2a503 2022-10-13T22:40:24 X11 scancode mapping cleanup * Consolidated scancode mapping tables into a single location for all backends * Verified that the xfree86_scancode_table2 is largely identical to the Linux scancode table * Updated the Linux scancode table with the latest kernel keycodes (still unmapped) * Route X11 keysym -> scancode mapping through the linux scancode table (which a few hand-written exceptions), which will allow mappings to automatically get picked up as they are added in the Linux scancode table * Disabled verbose reporting of missing keysym mappings, we have enough data for now
Cameron Gutman 8b438f7b 2022-07-31T15:34:03 keyboard: Only send SDL_KEYMAPCHANGED when the keymap actually changes
rohlem b085c182 2022-07-04T16:38:05 make SDL_SetTextInputRect take a pointer to const The documentation doesn't state that the argument is ever modified, and no implementation does so currently. This is a non-breaking change to guarantee as much to callers.
Pierre Wendling 501a4991 2022-05-05T18:44:32 Add clang-format on/off comments where necessary. Comments were added in places where INDENT-ON/OFF comments are. Places like stdlib's asm don't need it as clang-format doesn't try to indent it.
Sam Lantinga 01ef98a5 2022-04-26T10:19:03 Don't force keyboard auto-repeat on, if the user has disabled it for some reason Fixes https://github.com/libsdl-org/SDL/issues/2400
Sylvain 6c56193a 2022-03-24T18:09:45 Fixed bug #1650: X11 doesn't set KMOD_NUM and KMOD_CAPS to system state
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Sylvain 6101499c 2021-12-16T09:07:31 BigEndian: fix code that generates illegal instruction with gcc-4.9.2 on powerpc Program received signal SIGILL, Illegal instruction. X11_InitKeyboard (_this=0x1001f8f0) at /home/sdl/SDL_git/src/video/x11/SDL_x11keyboard.c:273 273 XKeyboardState values = { .global_auto_repeat = AutoRepeatModeOff };
Sam Lantinga eda4c407 2021-11-10T12:46:54 Make sure the X event is an Xkb event before checking the Xkb event type
Ethan Lee 7ed415d2 2021-09-23T14:07:38 wayland: Reuse KeySymToUcs4 to replicate X11 keymap behavior
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Dmitry V. Levin 2b1edf41 2020-01-04T11:05:06 X11_InitKeyboard: do not call XAutoRepeatOn unnecessarily Use XGetKeyboardControl to initialize the current XKeyboardState, and skip XAutoRepeatOn invocation if global_auto_repeat is AutoRepeatModeOn. This fixes SDL2 when the X11 client is untrusted.
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Ryan C. Gordon 1ec56f73 2018-10-20T21:35:48 x11: Fixed incorrect function signature for XkbSetDetectableAutoRepeat. It needs to use Bool (which is an int) and not BOOL (which is CARD8), which causes problems on platforms with different byte order and alignment, etc. Fixes Bugzilla #4326.
Marc Di Luzio c3178e67 2018-07-12T16:52:45 Ensure we still clear the X locale modifiers even if not compiled with ibus or fcitx support
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Philipp Wiesemann 90ed3daa 2017-05-26T22:45:52 Changed messages about not recognized keys to include discourse link.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga d0c8bf7f 2016-11-01T10:48:59 Patch from Tapani P?lli to fix a memory leak in X11_InitKeyboard Patch uses XkbFreeKeyboard to free the memory returned by XkbGetMap. Earlier implementation called XkbFreeClientMap which frees all the maps but not data->xkb structure itself, XkbFreeKeyboard will free maps and the structure.
Alex Baines 5fe98497 2016-10-28T01:28:58 Fix double events / no repeat flag on key events when built withoutibus/fcitx Uses XkbSetDetectableKeyRepeat, and falls back to forcing @im=none if it's not supported.
Sam Lantinga 5af67f49 2016-10-17T21:37:26 Fixed bug 3458 - x11: reset deadkeys in StartTextInput/StopTextInput Eric Wasylishen The patch makes StartTextInput/StopTextInput call Xutf8ResetIC ( https://www.x.org/releases/X11R7.5/doc/man/man3/XmbResetIC.3.html ) on the XIC of all SDL windows. This fixes my use case in Quakespasm (Ubuntu 16.04, system keyboard layout set to German. Type the '^' dead key, which opens Quakespasm's developer console and calls SDL_StartTextInput, then press 'e'. I expect the dead key to be ignored.) Also, here is a patch for sdl2's "checkkeys" for testing this: https://bugzilla-attachments.libsdl.org/attachment.cgi?id=2451
Sam Lantinga 808c75d1 2016-10-07T18:57:40 Fixed bug 2824 - Add Fcitx Input Method Support Weitian Leung Just moved ibus direct call to SDL_IME_* related functions, and adds fcitx IME support (uses DBus, too), enable with env: SDL_IM_MODULE=fcitx (ibus still the default one)
Alex Baines 752931d8 2016-10-03T11:35:34 Improve X11 key handling when XKB isn't available + add xvnc scancodes. Based on a patch by Bill Lash (see bug 3094).
Sam Lantinga d2c8c509 2016-10-01T14:54:05 Fixed build for X11
Sam Lantinga 359f59ae 2016-10-01T14:22:10 Fixed bug 3130 - Spacebar not responding Alex Baines Make sure group is valid before passing it to XkbKeysymToKeycode.
Alex Szpakowski 32592178 2016-01-31T09:39:42 x11: Fix AltGr generating an invalid keycode (bug #3244). Thanks Thomas!
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Bill Lash cceca2ac 2015-08-15T00:25:52 Additional patch to correct the number key assignments, and add assignments for keys that were missed
Ryan C. Gordon 0d8c3a0b 2015-08-14T23:38:40 Patched to compile.
Ryan C. Gordon 0cf81fbd 2015-08-14T23:30:46 Minor coding convention fix.
Jason Wyatt fb37956d 2015-08-14T16:23:31 Supply current group when translating X11 Keycodes to Keysyms.
Sam Lantinga f1b7a843 2015-06-25T07:17:08 Fixed compiling if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM is not defined
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Sam Lantinga c8881837 2015-05-28T19:06:07 Improved fix for bug 2096 - Mapping from scancode to keycode doesn't work for remapped modifier keys Zack Middleton The change to the keymap to use SDL_SCANCODE_TO_KEYCODE in SDL_x11keyboard.c causes all SDL scancodes without a Usc4 character to be XOR'd with SDLK_SCANCODE_MASK, but not all key code are suppose to be (as seen in include/SDL_keycodes.h). SDLK_BACKSPACE is not 0x4000002A. I think the full list of keys affected are return, escape, backspace, tab, and delete.
Sam Lantinga 32d6dcdb 2015-05-28T12:48:20 Fixed bug 2096 - Mapping from scancode to keycode doesn't work for remapped modifier keys Jacob Lee If a user has a non-standard keyboard mapping -- say, their caps lock key has been mapped to Ctrl -- then SDL_GetModState() is no longer accurate: it only considers the unmapped keys. This is a regression from SDL 1.2. I think there are two parts to this bug: first, GetModState should use keycodes, rather than scancodes, which is easy enough. Unfortunately, on my system, SDL considers Caps Lock, even when mapped as Control, to be both SDL_SCANCODE_CAPSLOCK and SDLK_CAPSLOCK. The output from checkkeys for it is: INFO: Key pressed : scancode 57 = CapsLock, keycode 0x40000039 = CapsLock modifiers: CAPS Whereas the output for xev is: KeyPress event, serial 41, synthetic NO, window 0x4a00001, root 0x9a, subw 0x0, time 40218333, (144,177), root:(1458,222), state 0x10, keycode 66 (keysym 0xffe3, Control_L), same_screen YES, XKeysymToKeycode returns keycode: 37 XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False I think the problem is that X11_UpdateKeymap in SDL_x11keyboard.c only builds a mapping for keycodes associated with a Unicode character (anything where X11_KeyCodeToUcs returns a value). In the case of caps lock, SDL scancode 57 becomes x11 keycode 66, which becomes x11 keysym 65507(Control_L), which does not have a unicode value. To fix this, I suspect that SDL needs a mapping of the rest of the x11 keysyms to their corresponding SDL key codes.
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Alex Baines f4ddacf4 2014-08-19T23:17:28 Improvements to the IBus related code: + Handle HidePreeditText IBus signal. + Use SDL_GetKeyboardFocus instead of SDL_GetFocusWindow. + Move the X11 IBus SetFocus calls to the X11_DispatchFocus functions. + Simplify the IBus ifdefs when handling X11 KeyEvents. + Remove inotify watch when SDL_IBus_Quit is called.
Alex Baines 41a39837 2014-06-18T20:11:39 Add IBus IME Support, move DBus code to its own file. (v3.3 squashed)
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Sam Lantinga c3d10376 2014-03-23T09:44:04 Better keyboard detection when some of the keys are remapped, thanks to Lewis Wall
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
Ryan C. Gordon 7e1289af 2013-11-24T23:56:17 Make internal SDL sources include SDL_internal.h instead of SDL_config.h The new header will include SDL_config.h, but allows for other global stuff.
Sam Lantinga 298d3d62 2013-10-22T21:54:52 Fixed duplicate const warning
Ryan C. Gordon a2bd8970 2013-10-18T01:36:41 Don't supply duplicate X11 symbols inside SDL. Fixes static linking when something else also uses X11.
Sam Lantinga 7db31223 2013-10-17T17:37:23 Fixed using the wrong variable when reporting a missing SDL scancode mapping.
Ryan C. Gordon 24006be2 2013-08-20T20:31:57 Fixed compiler warning.
Gabriel Jacobo dad42067 2013-08-12T11:13:50 Fixes #2022, do not resume on Android when surfaceChanged If the app is in landscape mode and the user presses the power button, a pause is followed immediately by a surfaceChanged event because the lock screen is shown in portrait mode. This triggers a "false" resume. So, we just pause and resume following the onWindowFocusChanged events. Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before blocking the event pump.
Sam Lantinga 1ad936eb 2013-08-11T19:56:43 Fixed bug 2027 - Full-screen appears to be broken - hang in SDL_DestroyWindow() Rainer Deyke I'm running Linux Mint 15 with the Cinnamon window manager. SDL_DestroyWindow consistently locks up for me when the window if fullscreen.