diff --git a/src/x11_window.c b/src/x11_window.c index 99a0e6b5..bf9a540b 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -535,13 +535,12 @@ static void enableCursor(_GLFWwindow* window) updateCursorImage(window); } -// TODO This callback is replaced by _createXIMPreeditCallbacks. Is there a possibility that this clearing process is necessary? // Clear its handle when the input context has been destroyed -// static void inputContextDestroyCallback(XIC ic, XPointer clientData, XPointer callData) -// { -// _GLFWwindow* window = (_GLFWwindow*) clientData; -// window->x11.ic = NULL; -// } +static void inputContextDestroyCallback(XIC ic, XPointer clientData, XPointer callData) +{ + _GLFWwindow* window = (_GLFWwindow*) clientData; + window->x11.ic = NULL; +} // Update cursor position to decide candidate window static void _ximChangeCursorPosition(XIC xic, _GLFWwindow* window) @@ -2045,6 +2044,9 @@ void _glfwPushSelectionToManagerX11(void) void _glfwCreateInputContextX11(_GLFWwindow* window) { + XIMCallback callback; + callback.callback = (XIMProc) inputContextDestroyCallback; + callback.client_data = (XPointer) window; XVaNestedList preeditList = _createXIMPreeditCallbacks(window); XVaNestedList statusList = _createXIMStatusCallbacks(window); @@ -2059,6 +2061,8 @@ void _glfwCreateInputContextX11(_GLFWwindow* window) preeditList, XNStatusAttributes, statusList, + XNDestroyCallback, + &callback, NULL); XFree(preeditList);