Enable necessary protocols for supporting IMEs
This commit is contained in:
parent
18067def18
commit
5fcdd81fc3
5 changed files with 61 additions and 0 deletions
40
src/wayland/handlers/input_method.rs
Normal file
40
src/wayland/handlers/input_method.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::state::State;
|
||||
use smithay::{
|
||||
delegate_input_method_manager,
|
||||
desktop::{space::SpaceElement, PopupKind, PopupManager},
|
||||
reexports::wayland_server::protocol::wl_surface::WlSurface,
|
||||
utils::Rectangle,
|
||||
wayland::input_method::{InputMethodHandler, PopupSurface},
|
||||
};
|
||||
use tracing::warn;
|
||||
|
||||
impl InputMethodHandler for State {
|
||||
fn new_popup(&mut self, surface: PopupSurface) {
|
||||
if let Err(err) = self
|
||||
.common
|
||||
.shell
|
||||
.popups
|
||||
.track_popup(PopupKind::from(surface))
|
||||
{
|
||||
warn!("Failed to track popup: {}", err);
|
||||
}
|
||||
}
|
||||
|
||||
fn dismiss_popup(&mut self, surface: PopupSurface) {
|
||||
if let Some(parent) = surface.get_parent().map(|parent| parent.surface.clone()) {
|
||||
let _ = PopupManager::dismiss_popup(&parent, &PopupKind::from(surface));
|
||||
}
|
||||
}
|
||||
|
||||
fn parent_geometry(&self, parent: &WlSurface) -> Rectangle<i32, smithay::utils::Logical> {
|
||||
self.common
|
||||
.shell
|
||||
.element_for_wl_surface(parent)
|
||||
.map(|e| e.geometry())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
}
|
||||
|
||||
delegate_input_method_manager!(State);
|
||||
|
|
@ -7,6 +7,7 @@ pub mod decoration;
|
|||
pub mod dmabuf;
|
||||
pub mod drm_lease;
|
||||
pub mod fractional_scale;
|
||||
pub mod input_method;
|
||||
pub mod keyboard_shortcuts_inhibit;
|
||||
pub mod layer_shell;
|
||||
pub mod output;
|
||||
|
|
@ -22,9 +23,11 @@ pub mod security_context;
|
|||
pub mod selection;
|
||||
pub mod session_lock;
|
||||
pub mod shm;
|
||||
pub mod text_input;
|
||||
pub mod toplevel_info;
|
||||
pub mod toplevel_management;
|
||||
pub mod viewporter;
|
||||
pub mod virtual_keyboard;
|
||||
pub mod wl_drm;
|
||||
pub mod workspace;
|
||||
pub mod xdg_shell;
|
||||
|
|
|
|||
6
src/wayland/handlers/text_input.rs
Normal file
6
src/wayland/handlers/text_input.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::state::State;
|
||||
use smithay::delegate_text_input_manager;
|
||||
|
||||
delegate_text_input_manager!(State);
|
||||
6
src/wayland/handlers/virtual_keyboard.rs
Normal file
6
src/wayland/handlers/virtual_keyboard.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use crate::state::State;
|
||||
use smithay::delegate_virtual_keyboard_manager;
|
||||
|
||||
delegate_virtual_keyboard_manager!(State);
|
||||
Loading…
Add table
Add a link
Reference in a new issue