Skip to content

Commit

Permalink
Add CHANGELOG entry and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
francesca64 committed Mar 29, 2018
1 parent 30d04c7 commit 0e894fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

- On X11, input method creation first tries to use the value from the user's `XMODIFIERS` environment variable, so application developers should no longer need to manually call `XSetLocaleModifiers`. If that fails, fallbacks are tried, which should prevent input method initialization from ever outright failing.

# Version 0.11.3 (2018-03-28)

- Added `set_min_dimensions` and `set_max_dimensions` methods to `Window`, and implemented on Windows, X11, Wayland, and OSX.
Expand Down
8 changes: 8 additions & 0 deletions src/platform/linux/x11/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,10 @@ impl Window {

let mut im: ffi::XIM = ptr::null_mut();

// Setting an empty locale results in the user's XMODIFIERS environment variable being
// read, which should result in the user's configured input method (ibus, fcitx, etc.)
// being used. If that fails, we fall back to internal input methods which should
// always be available.
for modifiers in &[b"\0" as &[u8], b"@im=local\0", b"@im=\0"] {
if !im.is_null() {
break;
Expand All @@ -1027,6 +1031,10 @@ impl Window {
}

if im.is_null() {
// While it's possible to make IME optional and handle this more gracefully, it's
// not clear in what situations the fallbacks wouldn't work. Therefore, this panic
// is left here so that if it ever fails, someone will hopefully tell us about it,
// and we'd have a better grasp of what's necessary.
panic!("XOpenIM failed");
}

Expand Down

0 comments on commit 0e894fb

Please sign in to comment.