diff options
author | Ted Yin <tederminant@gmail.com> | 2017-07-24 20:54:06 -0400 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-07-24 17:54:06 -0700 |
commit | 4c4c2f5f5c81e6efb580e50ea993606160809469 (patch) | |
tree | c7a1abe4b5e926e9dcf25f2c64965343ef738b05 /src/display.rs | |
parent | 49c73f6d55e5a681a0e0f836cd3e9fe6af30788f (diff) | |
download | alacritty-4c4c2f5f5c81e6efb580e50ea993606160809469.tar.gz alacritty-4c4c2f5f5c81e6efb580e50ea993606160809469.zip |
add support for X input method (#691)
Diffstat (limited to 'src/display.rs')
-rw-r--r-- | src/display.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/display.rs b/src/display.rs index 0f2c526f..d1af5411 100644 --- a/src/display.rs +++ b/src/display.rs @@ -331,4 +331,18 @@ impl Display { pub fn get_window_id(&self) -> Option<usize> { self.window.get_window_id() } + + /// Adjust the XIM editor position according to the new location of the cursor + pub fn update_ime_position(&mut self, terminal: &Term) { + use index::{Point, Line, Column}; + use term::SizeInfo; + let Point{line: Line(row), col: Column(col)} = terminal.cursor().point; + let SizeInfo{cell_width: cw, + cell_height: ch, + padding_x: px, + padding_y: py, ..} = *terminal.size_info(); + let nspot_y = (py + (row + 1) as f32 * ch) as i16; + let nspot_x = (px + col as f32 * cw) as i16; + self.window().send_xim_spot(nspot_x, nspot_y); + } } |