fix: correctly set gui error
This commit is contained in:
+12
-11
@@ -80,22 +80,23 @@ impl InputHandler {
|
||||
/// Toggle the mouse capture (via input of the 'm' key)
|
||||
fn m_key(&mut self) {
|
||||
if self.mouse_capture {
|
||||
match execute!(std::io::stdout(), DisableMouseCapture) {
|
||||
Ok(_) => self
|
||||
.gui_state
|
||||
if execute!(std::io::stdout(), DisableMouseCapture).is_ok() {
|
||||
self.gui_state
|
||||
.lock()
|
||||
.set_info_box("✖ mouse capture disabled".to_owned()),
|
||||
Err(_) => {
|
||||
self.app_data
|
||||
.lock()
|
||||
.set_error(AppError::MouseCapture(false));
|
||||
}
|
||||
.set_info_box("✖ mouse capture disabled".to_owned());
|
||||
} else {
|
||||
self.app_data
|
||||
.lock()
|
||||
.set_error(AppError::MouseCapture(false));
|
||||
self.gui_state.lock().status_push(Status::Error);
|
||||
}
|
||||
} else {
|
||||
Ui::enable_mouse_capture();
|
||||
} else if Ui::enable_mouse_capture().is_ok() {
|
||||
self.gui_state
|
||||
.lock()
|
||||
.set_info_box("✓ mouse capture enabled".to_owned());
|
||||
} else {
|
||||
self.app_data.lock().set_error(AppError::MouseCapture(true));
|
||||
self.gui_state.lock().status_push(Status::Error);
|
||||
};
|
||||
|
||||
// If the info box sleep handle is currently being executed, as in 'm' is pressed twice within a 4000ms window
|
||||
|
||||
Reference in New Issue
Block a user