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:
parent
e4da5002ae
commit
d0ef1f9e85
7 changed files with 217 additions and 7 deletions
|
|
@ -8,6 +8,7 @@ use cctk::sctk::{
|
|||
seat::{pointer::ThemeSpec, SeatHandler},
|
||||
};
|
||||
use iced_runtime::keyboard::Modifiers;
|
||||
use std::sync::Arc;
|
||||
|
||||
impl SeatHandler for SctkState {
|
||||
fn seat_state(&mut self) -> &mut cctk::sctk::seat::SeatState {
|
||||
|
|
@ -141,6 +142,16 @@ impl SeatHandler for SctkState {
|
|||
}
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
|
||||
if let Some(text_input_manager) = self
|
||||
.text_input
|
||||
.is_none()
|
||||
.then_some(self.text_input_manager.as_ref())
|
||||
.flatten()
|
||||
{
|
||||
self.text_input =
|
||||
Some(Arc::new((text_input_manager).get_text_input(&seat, &qh)));
|
||||
}
|
||||
}
|
||||
|
||||
fn remove_capability(
|
||||
|
|
@ -193,6 +204,10 @@ impl SeatHandler for SctkState {
|
|||
}
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
|
||||
if let Some(text_input) = self.text_input.take() {
|
||||
text_input.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
fn remove_seat(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue