x11: Add XIM support (#11657)
This pull request adds XIM (X Input Method) support to x11 platform. The implementation utilizes [xim-rs](https://crates.io/crates/xim), a XIM library written entirely in Rust, to provide asynchronous XIM communication. Preedit and candidate positioning are fully supported in the editor interface, yet notably absent in the terminal environment. This work is sponsored by [Rainlab Inc.](https://rainlab.co.jp/en/) Release Notes: - N/A --------- Signed-off-by: npmania <np@mkv.li>
This commit is contained in:
parent
97691c1def
commit
b60254feca
6 changed files with 423 additions and 5 deletions
|
@ -478,6 +478,40 @@ impl X11WindowStatePtr {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn handle_ime_commit(&self, text: String) {
|
||||
let mut state = self.state.borrow_mut();
|
||||
if let Some(mut input_handler) = state.input_handler.take() {
|
||||
drop(state);
|
||||
input_handler.replace_text_in_range(None, &text);
|
||||
let mut state = self.state.borrow_mut();
|
||||
state.input_handler = Some(input_handler);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_ime_preedit(&self, text: String) {
|
||||
let mut state = self.state.borrow_mut();
|
||||
if let Some(mut input_handler) = state.input_handler.take() {
|
||||
drop(state);
|
||||
input_handler.replace_and_mark_text_in_range(None, &text, None);
|
||||
let mut state = self.state.borrow_mut();
|
||||
state.input_handler = Some(input_handler);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_ime_area(&self) -> Option<Bounds<Pixels>> {
|
||||
let mut state = self.state.borrow_mut();
|
||||
let mut bounds: Option<Bounds<Pixels>> = None;
|
||||
if let Some(mut input_handler) = state.input_handler.take() {
|
||||
drop(state);
|
||||
if let Some(range) = input_handler.selected_text_range() {
|
||||
bounds = input_handler.bounds_for_range(range);
|
||||
}
|
||||
let mut state = self.state.borrow_mut();
|
||||
state.input_handler = Some(input_handler);
|
||||
};
|
||||
bounds
|
||||
}
|
||||
|
||||
pub fn configure(&self, bounds: Bounds<i32>) {
|
||||
let mut resize_args = None;
|
||||
let do_move;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue