From 54dd097e4218d6f851b7452dbdf4362c17c6d7e3 Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Tue, 28 Mar 2023 13:23:28 +0700 Subject: [PATCH] added macos checker for traffic lights function --- src-tauri/src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 855ee3d4..3bc36051 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -17,7 +17,8 @@ fn main() { tauri::Builder::default() .setup(|app| { let main_window = app.get_window("main").unwrap(); - // set inset for traffic lights + // set inset for traffic lights (macos) + #[cfg(target_os = "macos")] main_window.position_traffic_lights(8.0, 20.0); Ok(()) @@ -36,11 +37,12 @@ fn main() { .build(), ) .on_window_event(|e| { + #[cfg(target_os = "macos")] let apply_offset = || { let win = e.window(); win.position_traffic_lights(8.0, 20.0); }; - + #[cfg(target_os = "macos")] match e.event() { WindowEvent::Resized(..) => apply_offset(), WindowEvent::ThemeChanged(..) => apply_offset(),