From 7c7b0333d464e34b19737bbb7a500f011e0ba296 Mon Sep 17 00:00:00 2001 From: Cjacker Date: Wed, 25 Oct 2017 15:03:21 +0800 Subject: [PATCH] Fix input method cursor follow issue under X11 --- source/detail/platform_spec_posix.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/detail/platform_spec_posix.cpp b/source/detail/platform_spec_posix.cpp index e495cf7d..58e936ee 100644 --- a/source/detail/platform_spec_posix.cpp +++ b/source/detail/platform_spec_posix.cpp @@ -835,6 +835,19 @@ namespace detail i->second->reinstate(); i->second->pos = pos; } + auto addr = i->second; + XPoint spot; + XVaNestedList list; + if(addr->input_context) { + spot.x = pos.x; + spot.y = pos.y + addr->size.height; + list = ::XVaCreateNestedList(0, XNSpotLocation, &spot, + XNForeground, 0, + XNBackground, 0, + (void *)0); + ::XSetICValues(addr->input_context, XNPreeditAttributes, list, NULL); + ::XFree(list); + } } void platform_spec::caret_visible(native_window_type wd, bool vis)