Skip to content

Commit c09524f

Browse files
author
dcz
committed
im: Add keyboard bind/unbind/consume requests
1 parent f79907a commit c09524f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/seat/input_method_v3.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::ops::Deref;
1313
use std::sync::{Arc, Mutex, MutexGuard, Weak};
1414

1515
use wayland_client::globals::{BindError, GlobalList};
16+
use wayland_client::protocol::wl_keyboard::WlKeyboard;
1617
use wayland_client::protocol::wl_seat::WlSeat;
1718
use wayland_client::protocol::wl_surface;
1819
use wayland_client::WEnum;
@@ -59,7 +60,7 @@ impl InputMethodManager {
5960
where
6061
D: Dispatch<XxInputMethodManagerV2, GlobalData> + 'static,
6162
{
62-
let manager = globals.bind(qh, 2..=2, GlobalData)?;
63+
let manager = globals.bind(qh, 3..=3, GlobalData)?;
6364
Ok(Self { manager })
6465
}
6566

@@ -238,6 +239,25 @@ impl InputMethod {
238239
surface,
239240
}
240241
}
242+
243+
/// May cause a protocol error if there's a bound keyboard already.
244+
pub fn keyboard_bind(&self, keyboard: &WlKeyboard) {
245+
self.input_method.keyboard_bind(&keyboard);
246+
}
247+
248+
/// May cause a protocol error if there's no bound keyboard.
249+
pub fn keyboard_unbind(&self) {
250+
self.input_method.keyboard_unbind();
251+
}
252+
253+
/// May cause a protocol error on invalid serial.
254+
pub fn keyboard_consume(
255+
&self,
256+
serial: u32,
257+
action: xx_input_method_v1::KeyboardConsumeAction,
258+
) {
259+
self.input_method.keyboard_consume(serial, action);
260+
}
241261
}
242262

243263
#[derive(Debug)]

0 commit comments

Comments
 (0)