feat: refactor project structure for platform-specific code - part 1

- add the `platform` module
- move the `macos` module from `window` to `platform`
- add a new `mod.rs` file in the `platform` directory
- update import paths for `macos` module in `renderer` and `vsync_macos_display_link` files
- update import paths in the `window` module
This commit is contained in:
Alexsander Falcucci 2025-10-24 20:50:02 +02:00
parent 0ea39b7737
commit ee8e77eb00
6 changed files with 11 additions and 8 deletions

View file

@ -22,6 +22,7 @@ mod dimensions;
mod editor;
mod error_handling;
mod frame;
mod platform;
mod profiling;
mod renderer;
mod running_tracker;

View file

@ -26,10 +26,10 @@ use crate::{
};
use crate::{cmd_line::CmdLineSettings, error_msg, frame::Frame};
use super::{WindowSettings, WindowSettingsChanged};
use crate::window::{WindowSettings, WindowSettingsChanged};
static NEOVIDE_ICON_PATH: &[u8] =
include_bytes!("../../extra/osx/Neovide.app/Contents/Resources/Neovide.icns");
include_bytes!("../../../extra/osx/Neovide.app/Contents/Resources/Neovide.icns");
define_class!(
// A view to simulate the double-click-to-zoom effect for `--frame transparency`.

2
src/platform/mod.rs Normal file
View file

@ -0,0 +1,2 @@
#[cfg(target_os = "macos")]
pub mod macos;

View file

@ -20,9 +20,10 @@ use skia_safe::{
use winit::{event_loop::EventLoopProxy, window::Window};
use crate::{
platform::macos::get_ns_window,
profiling::tracy_gpu_zone,
renderer::{RendererSettings, SkiaRenderer, VSync},
window::{macos::get_ns_window, UserEvent},
window::UserEvent,
};
use super::Settings;

View file

@ -10,7 +10,7 @@ use crate::window::UserEvent;
use std::{ffi::c_void, marker::PhantomPinned, pin::Pin, ptr::NonNull};
use crate::{profiling::tracy_zone, window::macos::get_ns_window};
use crate::{platform::macos::get_ns_window, profiling::tracy_zone};
use objc2_core_foundation::CFRetained;
use objc2_core_graphics::CGDirectDisplayID;

View file

@ -6,7 +6,9 @@ mod update_loop;
mod window_wrapper;
#[cfg(target_os = "macos")]
pub mod macos;
use crate::platform::macos;
#[cfg(target_os = "macos")]
use crate::platform::macos::register_file_handler;
#[cfg(target_os = "linux")]
use std::env;
@ -33,9 +35,6 @@ use winit::platform::windows::WindowAttributesExtWindows;
#[cfg(target_os = "macos")]
use winit::platform::macos::EventLoopBuilderExtMacOS;
#[cfg(target_os = "macos")]
use macos::register_file_handler;
use image::{load_from_memory, GenericImageView, Pixel};
use keyboard_manager::KeyboardManager;
use mouse_manager::MouseManager;