Implement IME-related methods of SctkWinitWindow for apps using single-instance feature

- At least, following apps are using `single-instance` feature:
  - cosmic-launcher
  - cosmic-app-library
- Once libcosmic text widgets supported the IME, these apps start hitting following methods of SctkWinitWindow which is `todo!()` and will crash at startup:
  - `set_ime_cursor_area()`
  - `set_ime_allowed()`
  - `set_ime_purpose()`
- So, this PR implements these method utilizing following wayland protocols.
  - zwp_text_input_v3
  - zwp_text_input_manager_v3
This commit is contained in:
KENZ 2026-01-24 07:26:34 +09:00 • committed by Ashley Wulber
parent e4da5002ae
commit d0ef1f9e85
7 changed files with 217 additions and 7 deletions

View file

@ -266,15 +266,24 @@ impl winit::window::Window for SctkWinitWindow {
position: winit::dpi::Position,
size: winit::dpi::Size,
) {
todo!()
let guard = self.common.lock().unwrap();
let scale_factor = guard.fractional_scale.unwrap_or(1.);
let position = position.to_logical(scale_factor);
let size = size.to_logical(scale_factor);
_ = self.tx.send(Action::SetImeCursorArea(
position.x,
position.y,
size.width,
size.height,
));
}
fn set_ime_allowed(&self, allowed: bool) {
todo!()
_ = self.tx.send(Action::SetImeAllowed(allowed));
}
fn set_ime_purpose(&self, purpose: winit::window::ImePurpose) {
todo!()
_ = self.tx.send(Action::SetImePurpose(purpose));
}
fn set_blur(&self, blur: bool) {