-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #266 from Ahmadre/hotfix/macos_ventura
hotfix: frame errors on MacOS Ventura
- Loading branch information
Showing
2 changed files
with
13 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,23 @@ | ||
import Cocoa | ||
import FlutterMacOS | ||
import flutter_acrylic | ||
import bitsdojo_window_macos | ||
|
||
class MainFlutterWindow: BitsdojoWindow { | ||
override func bitsdojo_window_configure() -> UInt { | ||
return BDW_CUSTOM_FRAME | BDW_HIDE_ON_STARTUP | ||
} | ||
|
||
override func awakeFromNib() { | ||
let flutterViewController = FlutterViewController.init() | ||
let windowFrame = self.frame | ||
self.contentViewController = flutterViewController | ||
let blurryContainerViewController = BlurryContainerViewController() // new | ||
self.contentViewController = blurryContainerViewController // new | ||
self.setFrame(windowFrame, display: true) | ||
RegisterGeneratedPlugins(registry: flutterViewController) | ||
|
||
// Adding a NSVisualEffectView to act as a translucent background | ||
let contentView = contentViewController!.view; | ||
let superView = contentView.superview!; | ||
|
||
let blurView = NSVisualEffectView(frame: superView.bounds) | ||
blurView.autoresizingMask = [.width, .height] | ||
blurView.blendingMode = NSVisualEffectView.BlendingMode.behindWindow | ||
|
||
// Pick the correct material for the task | ||
blurView.material = NSVisualEffectView.Material.underWindowBackground | ||
|
||
// Replace the contentView and the background view | ||
superView.replaceSubview(contentView, with: blurView) | ||
blurView.addSubview(contentView) | ||
|
||
/* Initialize the flutter_acrylic plugin */ | ||
MainFlutterWindowManipulator.start(mainFlutterWindow: self) // new | ||
|
||
RegisterGeneratedPlugins(registry: blurryContainerViewController.flutterViewController) // new | ||
super.awakeFromNib() | ||
} | ||
} | ||
} |