From 4383fceba27bae6c496cf22c5ee65cd7ba4e1314 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 28 Feb 2020 15:53:21 +0100 Subject: [PATCH] x11: fall back to @im=none if XOpenIM failed This helps if the user has configured an invalid input method in their XMODIFIERS variable. --- panda/src/x11display/x11GraphicsPipe.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/panda/src/x11display/x11GraphicsPipe.cxx b/panda/src/x11display/x11GraphicsPipe.cxx index 8f87b57609..64393a1541 100644 --- a/panda/src/x11display/x11GraphicsPipe.cxx +++ b/panda/src/x11display/x11GraphicsPipe.cxx @@ -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?