mirror of
https://github.com/glfw/glfw
synced 2026-09-26 16:18:21 +03:00
X11: Implement text input focus
Map explicit text input focus to XIM input context focus with XSetICFocus and XUnsetICFocus. On focus out, reset preedit through the existing X11 helper before unsetting IC focus, preserving its conservative behavior. Native FocusIn only restores XIC focus when text input focus has not been explicitly disabled.
This commit is contained in:
parent
571d06738d
commit
44ec6b2467
1 changed files with 16 additions and 1 deletions
|
|
@ -1961,8 +1961,11 @@ static void processEvent(XEvent *event)
|
|||
else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
captureCursor(window);
|
||||
|
||||
if (window->x11.ic)
|
||||
if (window->x11.ic &&
|
||||
(!window->textInputFocusInitialized || window->textInputFocus))
|
||||
{
|
||||
XSetICFocus(window->x11.ic);
|
||||
}
|
||||
|
||||
_glfwInputWindowFocus(window, GLFW_TRUE);
|
||||
return;
|
||||
|
|
@ -3431,6 +3434,18 @@ void _glfwSetIMEStatusX11(_GLFWwindow* window, int active)
|
|||
|
||||
void _glfwSetTextInputFocusX11(_GLFWwindow* window, GLFWbool focused)
|
||||
{
|
||||
XIC ic = window->x11.ic;
|
||||
|
||||
if (!ic)
|
||||
return;
|
||||
|
||||
if (focused)
|
||||
XSetICFocus(ic);
|
||||
else
|
||||
{
|
||||
_glfwResetPreeditTextX11(window);
|
||||
XUnsetICFocus(ic);
|
||||
}
|
||||
}
|
||||
|
||||
int _glfwGetIMEStatusX11(_GLFWwindow* window)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue