Browse Source

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

This helps if the user has configured an invalid input method in their XMODIFIERS variable.
rdb 5 years ago
parent
commit
4383fceba2
1 changed files with 7 additions and 2 deletions
  1. 7 2
      panda/src/x11display/x11GraphicsPipe.cxx

+ 7 - 2
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?