rust-windowing / winit

Window handling library in pure Rust
https://docs.rs/winit/
Apache License 2.0
4.88k stars 911 forks source link

macOS: add ability to make titlebar unified #3960

Closed valentinegb closed 1 month ago

valentinegb commented 1 month ago

Adds WindowExtMacOS::set_unified_titlebar and WindowAttributesExtMacOS::with_unified_titlebar, which allow you to use a larger titlebar style on macOS.

Without unified titlebar (default) With unified titlebar
Screenshot 2024-10-22 at 8 31 52 PM Screenshot 2024-10-22 at 8 32 23 PM

The titlebar can be made transparent and the title can be hidden and there will be extra space around the window controls.

My code is probably not perfect, I would gladly accept edits or suggestions!

valentinegb commented 1 month ago

Yeah I understand, but I thought this might be helpful since fully-native Mac apps quite frequently use this style of title bar (technically, this style of toolbar, which is why a toolbar is needed) but I don't think I've ever seen a non-fully-native app do it, which makes me think it's maybe not easy enough I mean, it's pretty easy, but maybe not totally obvious, since you have to add a native view (and then not use it) while cross-platform apps typically stay away from native views and defer to their custom graphics

madsmtm commented 1 month ago

Thanks for the comment and the thoughts