Fixed non-pre-edit character input via XIM.

Fixes #501.
Fixes #473.
This commit is contained in:
Camilla Berglund 2015-06-09 14:41:15 +02:00
parent 8e96402819
commit 08b3af4387
2 changed files with 15 additions and 4 deletions

View File

@ -74,6 +74,7 @@ GLFW bundles a number of dependencies in the `deps/` directory.
- [Cocoa] Bugfix: Creating or showing a window would make its context current
- [X11] Bugfix: `glfwInit` would segfault on systems without RandR
- [X11] Bugfix: The response to `_NET_WM_PING` was sent to the wrong window
- [X11] Bugfix: Character input via XIM did not work in many cases
- [WGL] Removed `GLFW_USE_DWM_SWAP_INTERVAL` compile-time option
- [WGL] Bugfix: Swap interval was ignored when DWM was enabled
- [GLX] Added dependency on `libdl` on systems where it provides `dlopen`

View File

@ -863,6 +863,10 @@ static void leaveFullscreenMode(_GLFWwindow* window)
static void processEvent(XEvent *event)
{
_GLFWwindow* window = NULL;
Bool filtered = False;
if (_glfw.x11.im)
filtered = XFilterEvent(event, None);
if (event->type != GenericEvent)
{
@ -893,11 +897,8 @@ static void processEvent(XEvent *event)
Status status;
wchar_t buffer[16];
if (XFilterEvent(event, None))
{
// Discard intermediary (dead key) events for character input
if (filtered)
break;
}
const int count = XwcLookupString(window->x11.ic,
&event->xkey,
@ -1112,6 +1113,9 @@ static void processEvent(XEvent *event)
{
// Custom client message, probably from the window manager
if (filtered)
break;
if (event->xclient.message_type == None)
break;
@ -1239,6 +1243,9 @@ static void processEvent(XEvent *event)
{
if (event->xfocus.mode == NotifyNormal)
{
if (window->x11.ic)
XSetICFocus(window->x11.ic);
_glfwInputWindowFocus(window, GL_TRUE);
if (window->cursorMode == GLFW_CURSOR_DISABLED)
@ -1252,6 +1259,9 @@ static void processEvent(XEvent *event)
{
if (event->xfocus.mode == NotifyNormal)
{
if (window->x11.ic)
XUnsetICFocus(window->x11.ic);
_glfwInputWindowFocus(window, GL_FALSE);
if (window->cursorMode == GLFW_CURSOR_DISABLED)