From 7c7b0333d464e34b19737bbb7a500f011e0ba296 Mon Sep 17 00:00:00 2001 From: Cjacker Date: Wed, 25 Oct 2017 15:03:21 +0800 Subject: [PATCH 1/3] 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) From 9379f19c19e4bc6142e004792330f77806c33361 Mon Sep 17 00:00:00 2001 From: Cjacker Date: Wed, 25 Oct 2017 15:09:09 +0800 Subject: [PATCH 2/3] Use tab instead of space to match original source format --- source/detail/platform_spec_posix.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/source/detail/platform_spec_posix.cpp b/source/detail/platform_spec_posix.cpp index 58e936ee..906aaf93 100644 --- a/source/detail/platform_spec_posix.cpp +++ b/source/detail/platform_spec_posix.cpp @@ -835,19 +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); - } + 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) From b7ad2d99e0744b0330cf0205cc717e5fca57078d Mon Sep 17 00:00:00 2001 From: Cjacker Date: Wed, 25 Oct 2017 15:29:29 +0800 Subject: [PATCH 3/3] Also need to check addr --- source/detail/platform_spec_posix.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/detail/platform_spec_posix.cpp b/source/detail/platform_spec_posix.cpp index 906aaf93..7f825395 100644 --- a/source/detail/platform_spec_posix.cpp +++ b/source/detail/platform_spec_posix.cpp @@ -836,9 +836,9 @@ namespace detail i->second->pos = pos; } auto addr = i->second; - XPoint spot; - XVaNestedList list; - if(addr->input_context) { + if(addr && addr->input_context) { + XPoint spot; + XVaNestedList list; spot.x = pos.x; spot.y = pos.y + addr->size.height; list = ::XVaCreateNestedList(0, XNSpotLocation, &spot,