Input monitoring permissions are requested on MacOS Big Sur #289
-
If Tetra uses
We may have to wait for the upstream library to fix this problem, but could it be handled on tetra? Links that may be relevant to this issue: https://discourse.libsdl.org/t/macos-catalina-keyboard-monitoring-permission/27529 // Official sample code for rust-sdl2
extern crate sdl2;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::pixels::Color;
use std::time::Duration;
fn main() -> Result<(), String> {
let sdl_context = sdl2::init()?;
let video_subsystem = sdl_context.video()?;
// Request input monitoring privileges !!
{
let joystick_sys = sdl_context.joystick()?;
let controller_sys = sdl_context.game_controller()?;
}
let haptic_sys = sdl_context.haptic()?;
let window = video_subsystem
.window("rust-sdl2 demo: Events", 800, 600)
.position_centered()
.resizable()
.build()
.map_err(|e| e.to_string())?;
let mut canvas = window.into_canvas().build().map_err(|e| e.to_string())?;
canvas.set_draw_color(Color::RGB(255, 0, 0));
canvas.clear();
canvas.present();
let mut event_pump = sdl_context.event_pump()?;
println!("This example simply prints all events SDL knows about.");
'running: loop {
for event in event_pump.poll_iter() {
match event {
Event::Quit { .. }
| Event::KeyDown {
keycode: Some(Keycode::Escape),
..
} => break 'running,
Event::MouseMotion { .. } => {}
e => {
println!("{:?}", e);
}
}
}
canvas.clear();
canvas.present();
::std::thread::sleep(Duration::new(0, 1_000_000_000u32 / 30));
}
Ok(())
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 11 replies
-
I found a more recent thread on the forums mentioning joysticks, so it's not just you: https://discourse.libsdl.org/t/my-sdl-app-is-asking-for-permission-to-read-all-keystrokes-from-any-application-on-macos/32893 Do you happen to know if this is something that worked fine in older SDL versions? Or has an OS update made this start happening? |
Beta Was this translation helpful? Give feedback.
I found a more recent thread on the forums mentioning joysticks, so it's not just you: https://discourse.libsdl.org/t/my-sdl-app-is-asking-for-permission-to-read-all-keystrokes-from-any-application-on-macos/32893
Do you happen to know if this is something that worked fine in older SDL versions? Or has an OS update made this start happening?