From 455365a71d8f9376eed16b9b6df7bf35128df37b Mon Sep 17 00:00:00 2001 From: Logan McNaughton <848146+loganmc10@users.noreply.github.com> Date: Sat, 9 May 2026 08:35:00 +0200 Subject: [PATCH] move sdl hint (#856) --- src/main.rs | 3 +++ src/ui.rs | 10 ++++++++++ src/ui/video.rs | 5 ----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 03294af..4cd1194 100644 --- a/src/main.rs +++ b/src/main.rs @@ -121,6 +121,9 @@ async fn main() -> std::io::Result<()> { std::fs::create_dir_all(dirs.cache_dir)?; std::fs::create_dir_all(dirs.data_dir.join("saves"))?; std::fs::create_dir_all(dirs.data_dir.join("states"))?; + + ui::sdl_hints(); + let args = Args::parse(); if let Some(game) = args.game { let file_path = std::path::Path::new(&game); diff --git a/src/ui.rs b/src/ui.rs index 6df498e..4d8992a 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -83,6 +83,16 @@ pub struct Ui { pub usb: Usb, } +pub fn sdl_hints() { + unsafe { + let hint = std::ffi::CString::new("1").unwrap(); + sdl3_sys::everything::SDL_SetHint( + sdl3_sys::everything::SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, + hint.as_ptr(), + ); + } +} + pub fn sdl_init(flag: sdl3_sys::init::SDL_InitFlags) { unsafe { if sdl3_sys::init::SDL_WasInit(flag) == 0 && !sdl3_sys::init::SDL_InitSubSystem(flag) { diff --git a/src/ui/video.rs b/src/ui/video.rs index 0769ded..e5838ab 100644 --- a/src/ui/video.rs +++ b/src/ui/video.rs @@ -97,11 +97,6 @@ pub fn init(device: &mut device::Device) { } unsafe { sdl3_sys::everything::SDL_HideCursor(); - let hint = std::ffi::CString::new("1").unwrap(); - sdl3_sys::everything::SDL_SetHint( - sdl3_sys::everything::SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, - hint.as_ptr(), - ); } let gfx_info = build_gfx_info(device);