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

@ -3,6 +3,7 @@ use crate::{
handlers::{
activation::IcedRequestData,
overlap::{OverlapNotificationV1, OverlapNotifyV1},
text_input::{Preedit, TextInputManager},
},
platform_specific::{
Event,
@ -113,6 +114,7 @@ use wayland_protocols::{
zwp_keyboard_shortcuts_inhibit_manager_v1,
zwp_keyboard_shortcuts_inhibitor_v1,
},
text_input::zv3::client::zwp_text_input_v3::ZwpTextInputV3,
viewporter::client::wp_viewport::WpViewport,
},
xdg::shell::client::{xdg_surface::XdgSurface, xdg_toplevel::XdgToplevel},
@ -492,7 +494,12 @@ pub struct SctkState {
pub(crate) inhibitor_manager: Option<zwp_keyboard_shortcuts_inhibit_manager_v1::ZwpKeyboardShortcutsInhibitManagerV1>,
pub(crate) corner_radius_manager: Option<CosmicCornerRadiusManagerV1>,
pub(crate) pending_corner_radius: HashMap<core::window::Id, CornerRadius>
pub(crate) pending_corner_radius: HashMap<core::window::Id, CornerRadius>,
pub(crate) text_input_manager: Option<TextInputManager>,
pub(crate) text_input: Option<Arc<ZwpTextInputV3>>,
pub(crate) preedit: Option<Preedit>,
pub(crate) pending_commit: Option<String>,
}
/// An error that occurred while running an application.