-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
feat(macos): Fix with_titlebar_transparent
, add WindowExtMacOS::set_titlebar_transparent
#372
Changes from all commits
eec4c0a
05f3684
1cad120
afa40fa
8293685
633cae2
48c832c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"tao": patch | ||
--- | ||
|
||
Add macOS `WindowExtMacOS::set_titlebar_transparent` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"tao": patch | ||
--- | ||
|
||
Fix macOS `WindowBuilderExtMacOS::with_titlebar_transparent` | ||
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -205,6 +205,13 @@ fn create_window( | |||||||||||||
ns_window.setAcceptsMouseMovedEvents_(YES); | ||||||||||||||
|
||||||||||||||
if pl_attrs.titlebar_transparent { | ||||||||||||||
let mut style_mask = ns_window.styleMask(); | ||||||||||||||
style_mask.set( | ||||||||||||||
NSWindowStyleMask::NSFullSizeContentViewWindowMask, | ||||||||||||||
true, | ||||||||||||||
); | ||||||||||||||
ns_window.setStyleMask_(style_mask); | ||||||||||||||
|
||||||||||||||
Comment on lines
+208
to
+214
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is
Suggested change
|
||||||||||||||
ns_window.setTitlebarAppearsTransparent_(YES); | ||||||||||||||
} | ||||||||||||||
if pl_attrs.title_hidden { | ||||||||||||||
|
@@ -1233,6 +1240,21 @@ impl WindowExtMacOS for UnownedWindow { | |||||||||||||
.setHasShadow_(if has_shadow { YES } else { NO }) | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
#[inline] | ||||||||||||||
fn set_titlebar_transparent(&self, transparent: bool) { | ||||||||||||||
unsafe { | ||||||||||||||
let id = self.ns_window() as cocoa::base::id; | ||||||||||||||
let mut style_mask = id.styleMask(); | ||||||||||||||
style_mask.set( | ||||||||||||||
NSWindowStyleMask::NSFullSizeContentViewWindowMask, | ||||||||||||||
transparent, | ||||||||||||||
); | ||||||||||||||
self.ns_window.setStyleMask_(style_mask); | ||||||||||||||
Comment on lines
+1247
to
+1253
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't be the responsibility of this method, it should probably be split into another method |
||||||||||||||
|
||||||||||||||
id.setTitlebarAppearsTransparent_(if transparent { YES } else { NO }); | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
impl Drop for UnownedWindow { | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it was broken in the first place, because it seems like users needed to just pair it with
WindowBuilderExtMacOS::with_fullsize_content_view
in wry/tauri apps.