X11: Revive inputContextDestroyCallback()

XCreateIC() has vararg so that both XNStatusAttributes and
XNDestroyCallback are acceptable.
This commit is contained in:
Takuro Ashie 2022-04-08 09:31:10 +09:00 committed by Daijiro Fukuda
parent 2130afeb02
commit 8a02ec2702

View File

@ -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);