From 5b234f6062ea57901b5037fc2b16b8be9eecb167 Mon Sep 17 00:00:00 2001 From: sandydoo Date: Sun, 26 Jun 2022 20:17:36 +0400 Subject: [PATCH] desktop: Make the title bar transparent on macOS --- flux-desktop/src/main.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/flux-desktop/src/main.rs b/flux-desktop/src/main.rs index 9b1467e..0e00fbc 100644 --- a/flux-desktop/src/main.rs +++ b/flux-desktop/src/main.rs @@ -6,6 +6,9 @@ use glutin::window::Window; use glutin::PossiblyCurrent; use std::rc::Rc; +#[cfg(target_os = "macos")] +use glutin::platform::macos::WindowBuilderExtMacOS; + fn main() { env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("debug")).init(); @@ -106,11 +109,23 @@ pub fn get_rendering_context( EventLoop<()>, ) { let event_loop = glutin::event_loop::EventLoop::new(); + + #[cfg(not(target_os = "macos"))] let window_builder = glutin::window::WindowBuilder::new() .with_title("Flux") .with_decorations(true) .with_resizable(true) .with_inner_size(logical_size); + + #[cfg(target_os = "macos")] + let window_builder = glutin::window::WindowBuilder::new() + .with_title("Flux") + .with_inner_size(logical_size) + .with_resizable(true) + .with_title_hidden(true) + .with_titlebar_transparent(true) + .with_fullsize_content_view(true); + let window = glutin::ContextBuilder::new() .with_vsync(true) .with_multisampling(0)