input: Allow Escape to cancel grabs
This commit is contained in:
parent
e347076145
commit
2e08bde657
2 changed files with 27 additions and 0 deletions
|
|
@ -143,6 +143,8 @@ pub enum Action {
|
||||||
Terminate,
|
Terminate,
|
||||||
Debug,
|
Debug,
|
||||||
Close,
|
Close,
|
||||||
|
#[serde(skip)]
|
||||||
|
Escape,
|
||||||
|
|
||||||
Workspace(u8),
|
Workspace(u8),
|
||||||
NextWorkspace,
|
NextWorkspace,
|
||||||
|
|
@ -317,4 +319,11 @@ pub fn add_default_bindings(
|
||||||
output_next.iter().copied(),
|
output_next.iter().copied(),
|
||||||
Action::MoveToOutput(output_next_dir),
|
Action::MoveToOutput(output_next_dir),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
insert_binding(
|
||||||
|
key_bindings,
|
||||||
|
KeyModifiers::default(),
|
||||||
|
std::iter::once(Keysym::Escape),
|
||||||
|
Action::Escape,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1197,6 +1197,24 @@ impl State {
|
||||||
window.send_close();
|
window.send_close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Action::Escape => {
|
||||||
|
self.common
|
||||||
|
.shell
|
||||||
|
.set_overview_mode(None, self.common.event_loop_handle.clone());
|
||||||
|
self.common.shell.set_resize_mode(
|
||||||
|
None,
|
||||||
|
&self.common.config,
|
||||||
|
self.common.event_loop_handle.clone(),
|
||||||
|
);
|
||||||
|
let pointer = seat.get_pointer().unwrap();
|
||||||
|
let keyboard = seat.get_keyboard().unwrap();
|
||||||
|
if pointer.is_grabbed() {
|
||||||
|
pointer.unset_grab(self, serial, time);
|
||||||
|
}
|
||||||
|
if keyboard.is_grabbed() {
|
||||||
|
keyboard.unset_grab();
|
||||||
|
}
|
||||||
|
}
|
||||||
Action::Workspace(key_num) => {
|
Action::Workspace(key_num) => {
|
||||||
let current_output = seat.active_output();
|
let current_output = seat.active_output();
|
||||||
let workspace = match key_num {
|
let workspace = match key_num {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue