We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3817 - Keyboard layout change during SDL application is not recognized in Fedora 25 Linux used with LXDE/X11
Summary: Keyboard layout change during SDL application is not recognized in Fedora 25 ...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.5
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-11 09:59 UTC by Bencsik Roland
Modified: 2018-08-07 16:02 UTC (History)
1 user (show)

See Also:


Attachments
XKB keyboard layout switch tester (3.34 KB, text/x-csrc)
2017-09-11 09:59 UTC, Bencsik Roland
Details
SDL x11 keyboard layout change patch (7.09 KB, patch)
2017-09-11 10:02 UTC, Bencsik Roland
Details | Diff
Gzipped SDL x11 keyboard layout change patch (7.09 KB, application/gzip)
2017-09-11 10:13 UTC, Bencsik Roland
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bencsik Roland 2017-09-11 09:59:01 UTC
Created attachment 2923 [details]
XKB keyboard layout switch tester

Switching between US and Hungarian keyboard layouts during SDL application is not recognized, because MappingNotify is not sent by X11 to SDL.

Components:

OS: Fedora 25 Linux
X11: X.Org X Server 1.19.0 Release Date: 2016-11-15, X Protocol Version 11, Revision 0, Build ID: xorg-x11-server 1.19.0-1.fc25
LXDE: lxdm (version: 0.5.3, release: 5.D20161111gita548c73e.fc25)
LXDE Keyboard Layout Handler plugin: lxpanel (version: 0.9.1, release: 1.fc25)
setxkbmap: 1.3.1

However when subscribing for XkbNewKeyboardNotify, XkbMapNotify and XkbStateNotify events X11 sends XKB events which can be used to detect layout change.

Test program is attached.

Tested cases:
1. switch layout by its key combination (for example both shift keys),
2. switch layout by clicking on LXDE Keyboard Layout Handler plugin layout button,
3. using "setxkbmap -layout us" and "setxkbmap -layout hu".

Case 3. only works for me if LXDE Keyboard Layout Handler plugin is removed from lxpanel.

The US and Hungarian keyboard have difference at least in the '`', '0' keys.
Comment 1 Bencsik Roland 2017-09-11 10:02:15 UTC
Created attachment 2924 [details]
SDL x11 keyboard layout change patch
Comment 2 Bencsik Roland 2017-09-11 10:13:20 UTC
Created attachment 2925 [details]
Gzipped SDL x11 keyboard layout change patch

Patch is big due to "xevent.type" => "xevent->type" changes in X11_DispatchEvent(), because of 

XkbEvent xkbevent;
XEvent * xevent;
xevent = &(xkbevent.core);
X11_XNextEvent(display, xevent);

which was suggested in https://www.x.org/docs/XKB/XKBlib.pdf page 18.
Comment 3 Ryan C. Gordon 2018-08-07 16:02:25 UTC
We added support for system keymap changes at some point, so this is fixed now.

--ryan.