linux: Fix IME panel position while enumerating input methods (#12495)
Release Notes: - N/A This updates the IME position every time the selection changes, this is probably only useful when you enumerate languages with your IME. TODO: - ~There is a rare chance that the ime panel is not updated because the window input handler is None.~ - ~Update IME panel in vim mode.~ - ~Update IME panel when leaving Buffer search input.~ --------- Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
co-authored by
Mikayla Maki
parent
e6d5f4406f
commit
8e8927db4b
@@ -579,8 +579,8 @@ fn handle_mouse_horizontal_wheel_msg(
|
||||
|
||||
fn retrieve_caret_position(state_ptr: &Rc<WindowsWindowStatePtr>) -> Option<POINT> {
|
||||
with_input_handler_and_scale_factor(state_ptr, |input_handler, scale_factor| {
|
||||
let caret_range = input_handler.selected_text_range()?;
|
||||
let caret_position = input_handler.bounds_for_range(caret_range)?;
|
||||
let caret_range = input_handler.selected_text_range(false)?;
|
||||
let caret_position = input_handler.bounds_for_range(caret_range.range)?;
|
||||
Some(POINT {
|
||||
// logical to physical
|
||||
x: (caret_position.origin.x.0 * scale_factor) as i32,
|
||||
@@ -593,6 +593,7 @@ fn retrieve_caret_position(state_ptr: &Rc<WindowsWindowStatePtr>) -> Option<POIN
|
||||
fn handle_ime_position(handle: HWND, state_ptr: Rc<WindowsWindowStatePtr>) -> Option<isize> {
|
||||
unsafe {
|
||||
let ctx = ImmGetContext(handle);
|
||||
|
||||
let Some(caret_position) = retrieve_caret_position(&state_ptr) else {
|
||||
return Some(0);
|
||||
};
|
||||
|
||||
@@ -676,6 +676,10 @@ impl PlatformWindow for WindowsWindow {
|
||||
Some(self.0.state.borrow().renderer.gpu_specs())
|
||||
}
|
||||
|
||||
fn update_ime_position(&self, _bounds: Bounds<Pixels>) {
|
||||
// todo(windows)
|
||||
}
|
||||
|
||||
fn fps(&self) -> Option<f32> {
|
||||
None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user