This repository was archived by the owner on Jun 19, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,12 +36,7 @@ open class EVTWindow: NSWindow {
3636 return NSAppearance ( named: NSAppearanceNameVibrantDark) !
3737 }
3838
39- fileprivate var titlebarWidgets : [ NSButton ] ? {
40- return titlebarView? . subviews. flatMap { subview in
41- guard subview. isKind ( of: NSClassFromString ( " _NSThemeWidget " ) !) else { return nil }
42- return subview as? NSButton
43- }
44- }
39+ fileprivate var titlebarWidgets = Set < NSButton > ( )
4540
4641 fileprivate func appearanceForWidgets( ) -> NSAppearance ? {
4742 if allowsPiPMode {
@@ -53,7 +48,7 @@ open class EVTWindow: NSWindow {
5348
5449 fileprivate func applyAppearanceToWidgets( ) {
5550 let appearance = appearanceForWidgets ( )
56- titlebarWidgets? . forEach { $0. appearance = appearance }
51+ titlebarWidgets. forEach { $0. appearance = appearance }
5752 }
5853
5954 fileprivate var _storedTitlebarView : NSVisualEffectView ?
@@ -192,6 +187,14 @@ open class EVTWindow: NSWindow {
192187 } , completionHandler: nil )
193188 }
194189
190+ open override func standardWindowButton( _ b: NSWindowButton ) -> NSButton ? {
191+ guard let button = super. standardWindowButton ( b) else { return nil }
192+
193+ titlebarWidgets. insert ( button)
194+
195+ return button
196+ }
197+
195198 // MARK: - Content management
196199
197200 open override var title : String {
You can’t perform that action at this time.
0 commit comments