From 4c4c2f5f5c81e6efb580e50ea993606160809469 Mon Sep 17 00:00:00 2001 From: Ted Yin Date: Mon, 24 Jul 2017 20:54:06 -0400 Subject: add support for X input method (#691) --- src/display.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/display.rs') 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 { 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); + } } -- cgit v1.2.3-54-g00ecf