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:
parent
8cdfca3a62
commit
2b67891ca2
1 changed files with 16 additions and 0 deletions
16
src/main.rs
16
src/main.rs
|
@ -76,6 +76,22 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
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! {"Draw primary state to window"}
|
||||
|
|
Loading…
Reference in a new issue