Fix misbehaving input after IME changes (Linux)

This commit is contained in:
yw05 2021-04-18 21:27:15 +02:00 committed by sfan5
parent 4719f3c114
commit 21cb990e75

View File

@ -829,7 +829,7 @@ bool CIrrDeviceLinux::run()
{ {
XEvent event; XEvent event;
XNextEvent(XDisplay, &event); XNextEvent(XDisplay, &event);
if (acceptsIME() && XFilterEvent(&event, None)) if (XFilterEvent(&event, None))
continue; continue;
switch (event.type) switch (event.type)
@ -1156,8 +1156,6 @@ bool CIrrDeviceLinux::run()
break; break;
} // end switch } // end switch
} // end while
// Update IME information // Update IME information
if (XInputContext && GUIEnvironment) if (XInputContext && GUIEnvironment)
{ {
@ -1168,11 +1166,17 @@ bool CIrrDeviceLinux::run()
XPoint p; XPoint p;
p.x = (short)r.UpperLeftCorner.X; p.x = (short)r.UpperLeftCorner.X;
p.y = (short)r.LowerRightCorner.Y; p.y = (short)r.LowerRightCorner.Y;
XSetICFocus(XInputContext);
XVaNestedList l = XVaCreateNestedList(0, XNSpotLocation, &p, NULL); XVaNestedList l = XVaCreateNestedList(0, XNSpotLocation, &p, NULL);
XSetICValues(XInputContext, XNPreeditAttributes, l, NULL); XSetICValues(XInputContext, XNPreeditAttributes, l, NULL);
XFree(l); XFree(l);
} else {
XUnsetICFocus(XInputContext);
} }
} }
} // end while
} }
#endif //_IRR_COMPILE_WITH_X11_ #endif //_IRR_COMPILE_WITH_X11_