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 3136

Summary: [PATCH] Call setlocale + XSetLocaleModifiers before XOpenIM (With ibus workaround)
Product: SDL Reporter: Alex Baines <alex>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sezeroz
Version: HG 2.1   
Hardware: x86_64   
OS: Linux   
Attachments: Patch to fix various X11 input things
Fix for my setlocale mistake

Description Alex Baines 2015-09-30 20:34:10 UTC
Created attachment 2281 [details]
Patch to fix various X11 input things

This patch calls setlocale(LC_ALL, "") and XSetLocaleModifiers before calling XOpenIM so that compose keys will work correctly. This fixes bug 3102 .

It also checks the XMODIFIERS for @im=ibus, and calls XSetLocaleModifiers with @im=none so that ibus is never used via XIM (The DBus implementation still works). This fixes bug 2526 .

It also re-enables the sending of KeyEvents that are filtered by XFilterEvents. This fixes bug 2071 .

It resets the locale back to whatever the user had it set to after XOpenIM was called.
Comment 1 Sam Lantinga 2016-10-01 21:09:39 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/2f18ea79bc03
Comment 2 Alex Baines 2016-10-03 14:41:57 UTC
Created attachment 2573 [details]
Fix for my setlocale mistake

Sorry, I tested the new hg with my patch applied in valgrind and I introduced an invalid read by invalidating the string returned by setlocale.

This new patch fixes that by storing it like it does for XSetLocaleModifiers.
Comment 3 Sam Lantinga 2016-10-11 20:15:34 UTC
Got it, thanks!
https://hg.libsdl.org/SDL/rev/01761b2d701e