Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS: add ability to make titlebar unified #3960

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

valentinegb
Copy link
Contributor

  • Tested on all platforms changed
  • Added an entry to the changelog module if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

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!

Copy link
Member

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks fine (though I quite dislike adding features like this that should be fairly easy to do with objc2 directly).

@valentinegb
Copy link
Contributor Author

valentinegb commented Oct 25, 2024

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 madsmtm merged commit 3e9b80d into rust-windowing:master Oct 25, 2024
58 checks passed
@madsmtm
Copy link
Member

madsmtm commented Oct 25, 2024

Thanks for the comment and the thoughts

@valentinegb valentinegb deleted the unified-titlebar branch October 25, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants