-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segmentation fault on keypress (OSX) #74
Comments
i got the same issue, but only if the vscode, terminal & app are allowed to listen to keyboard events and so on, i have checked the entire osx settings list fn create_device_query_listener(handle: tauri::AppHandle) {
//! keyboard key press will freeze, if run in another thread
std::thread::spawn(move || {
let mut alt_pressed = false;
let mut tab_pressed = false;
let mut coords_on_open = Vector2::new(0.0, 0.0);
let mut coords_current = Vector2::new(0.0, 0.0);
let mut win_visible = false;
let callback = move |event: Event| {
// println!("My callback {:?}", event);
// return ;
match event.event_type {
KeyRelease(key) => {
if key == Alt {
alt_pressed = false;
} else if key == Tab {
tab_pressed = false;
}
}
KeyPress(key) => {
if key == Alt {
alt_pressed = true;
} else if key == Tab {
tab_pressed = true;
}
}
MouseMove { x, y } => {
coords_current = Vector2::new(x as f32, y as f32);
println!("mouse: x {} y {}", x , y);
}
_ => println!("event ignored")
}
// {
// println!("alt: {}, tab: {}", alt_pressed, tab_pressed);
// }
if alt_pressed && tab_pressed {
println!("alt tab pressed");
if win_visible == false {
win_visible = true;
coords_on_open = coords_current.clone();
show_window(&handle, &coords_on_open)
}
let angle = get_angle(&coords_on_open, &coords_current);
let distance = get_distance(&coords_on_open, &coords_current);
transfer_angle_distance_to_window(&handle, &angle, &distance);
} else {
win_visible = false;
}
};
if let Err(error) = listen(callback) {
println!("Error: {:?}", error)
}
});
} |
I got the same issue
this is the code
|
Please do pull the changes if possible, it would be very helpful |
OS: OSX (Terminal.app has been add to Accessibility->Privacy)
Mouse move & click are succesfully listened but whenever I press any key the program exist with
The text was updated successfully, but these errors were encountered: