x11: fall back to @im=none if XOpenIM failed

This helps if the user has configured an invalid input method in their XMODIFIERS variable.
This commit is contained in:
rdb 2020-02-28 15:53:21 +01:00
parent b225a3260b
commit 4383fceba2

View File

@ -278,8 +278,13 @@ x11GraphicsPipe(const std::string &display) :
// Connect to an input method for supporting international text entry.
_im = XOpenIM(_display, nullptr, nullptr, nullptr);
if (_im == (XIM)nullptr) {
x11display_cat.warning()
<< "Couldn't open input method.\n";
// Fall back to internal input method.
XSetLocaleModifiers("@im=none");
_im = XOpenIM(_display, nullptr, nullptr, nullptr);
if (_im == (XIM)nullptr) {
x11display_cat.warning()
<< "Couldn't open input method.\n";
}
}
// What styles does the current input method support?