Skip to content

Commit

Permalink
X11: Don't replace IME if it doesn't make sense to
Browse files Browse the repository at this point in the history
  • Loading branch information
francesca64 committed Apr 23, 2018
1 parent 42f0671 commit e77a6c2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/platform/linux/x11/ime/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,16 @@ pub unsafe extern fn xim_instantiate_callback(
) {
let inner: *mut ImeInner = client_data as _;
if !inner.is_null() {
let xconn = &(*inner).xconn;
let result = replace_im(inner);
if result.is_ok() {
let _ = unset_instantiate_callback(xconn, client_data);
(*inner).is_fallback = false;
} else if result.is_err() && (*inner).is_destroyed {
// We have no usable input methods!
result.expect("Failed to reopen input method");
if (*inner).is_destroyed || (*inner).is_fallback {
let xconn = &(*inner).xconn;
let result = replace_im(inner);
if result.is_ok() {
let _ = unset_instantiate_callback(xconn, client_data);
(*inner).is_fallback = false;
} else if result.is_err() && (*inner).is_destroyed {
// We have no usable input methods!
result.expect("Failed to reopen input method");
}
}
}
}
Expand Down

0 comments on commit e77a6c2

Please sign in to comment.