Disable tabbing out by grabbing keyboard

We grab the keyboard and bind it to the roftl window. This works as long
as there is no other window grabbing the keyboard afterwards (and
effectively stealing the keyboard from roftl).

This is done so tabbing out of roftl (and hence loosing focus) is not
possible.
This commit is contained in:
Armin Friedl 2022-04-16 09:06:09 +02:00
parent 8cdfca3a62
commit 2b67891ca2

View file

@ -76,6 +76,22 @@ fn main() -> Result<(), Box<dyn Error>> {
xcb_util::ewmh::CLIENT_SOURCE_TYPE_NORMAL, xcb_util::ewmh::CLIENT_SOURCE_TYPE_NORMAL,
); );
debug! {"Grab keyboard, disable tabbing out"}
let xcb_conn = unsafe {
xcb::Connection::from_raw_conn(
window.xcb_connection().unwrap() as *mut xcb::ffi::xcb_connection_t
)
};
xcb::xproto::grab_keyboard(
&xcb_conn,
true,
xcb_window,
xcb::ffi::base::XCB_CURRENT_TIME,
xcb::xproto::GRAB_MODE_ASYNC as u8,
xcb::xproto::GRAB_MODE_ASYNC as u8,
);
debug! {"Window id: {:?}", window.id()} debug! {"Window id: {:?}", window.id()}
debug! {"Draw primary state to window"} debug! {"Draw primary state to window"}