mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
X11: Fix CJK IME input when locale CTYPE is "C"
Fixes #1587.
Fixes #1636.
(cherry picked from commit 4381b86b6b
)
This commit is contained in:
parent
d99249337e
commit
0ac013381b
@ -118,7 +118,7 @@ information on what to include when reporting a bug.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
There is nothing here yet.
|
- [X11] Bugfix: IME input of CJK was broken for "C" locale (#1587,#1636)
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
@ -1753,6 +1753,10 @@ typedef struct GLFWgamepadstate
|
|||||||
* bundle, if present. This can be disabled with the @ref
|
* bundle, if present. This can be disabled with the @ref
|
||||||
* GLFW_COCOA_CHDIR_RESOURCES init hint.
|
* GLFW_COCOA_CHDIR_RESOURCES init hint.
|
||||||
*
|
*
|
||||||
|
* @remark @x11 This function will set the `LC_CTYPE` category of the
|
||||||
|
* application locale according to the current environment if that category is
|
||||||
|
* still "C". This is because the "C" locale breaks Unicode text input.
|
||||||
|
*
|
||||||
* @thread_safety This function must only be called from the main thread.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
* @sa @ref intro_init
|
* @sa @ref intro_init
|
||||||
|
@ -931,15 +931,12 @@ Cursor _glfwCreateCursorX11(const GLFWimage* image, int xhot, int yhot)
|
|||||||
|
|
||||||
int _glfwPlatformInit(void)
|
int _glfwPlatformInit(void)
|
||||||
{
|
{
|
||||||
#if !defined(X_HAVE_UTF8_STRING)
|
// HACK: If the application has left the locale as "C" then both wide
|
||||||
// HACK: If the current locale is "C" and the Xlib UTF-8 functions are
|
// character text input and explicit UTF-8 input via XIM will break
|
||||||
// unavailable, apply the environment's locale in the hope that it's
|
// This sets the CTYPE part of the current locale from the environment
|
||||||
// both available and not "C"
|
// in the hope that it is set to something more sane than "C"
|
||||||
// This is done because the "C" locale breaks wide character input,
|
|
||||||
// which is what we fall back on when UTF-8 support is missing
|
|
||||||
if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0)
|
if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0)
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
#endif
|
|
||||||
|
|
||||||
XInitThreads();
|
XInitThreads();
|
||||||
XrmInitialize();
|
XrmInitialize();
|
||||||
|
Loading…
Reference in New Issue
Block a user