-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cocoa based implementation, fullscreen mode
Move from SwiftUI to NSApplication Implement system-wide fullscreen overlay Ignore mouse events
- Loading branch information
Showing
9 changed files
with
262 additions
and
133 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
40 changes: 40 additions & 0 deletions
40
BrightXDR.xcodeproj/xcuserdata/starkdmi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Bucket | ||
uuid = "7B8C64E6-FB6D-40E6-BF89-2F09C5B82A54" | ||
type = "1" | ||
version = "2.0"> | ||
<Breakpoints> | ||
<BreakpointProxy | ||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
<BreakpointContent | ||
uuid = "2D99A84E-BC09-4FC0-90AF-0FD9F7B6F491" | ||
shouldBeEnabled = "No" | ||
ignoreCount = "0" | ||
continueAfterRunningActions = "No" | ||
filePath = "BrightXDR/AppDelegate.swift" | ||
startingColumnNumber = "9223372036854775807" | ||
endingColumnNumber = "9223372036854775807" | ||
startingLineNumber = "39" | ||
endingLineNumber = "39" | ||
landmarkName = "applicationDidFinishLaunching(_:)" | ||
landmarkType = "7"> | ||
</BreakpointContent> | ||
</BreakpointProxy> | ||
<BreakpointProxy | ||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
<BreakpointContent | ||
uuid = "04D399E1-E8C3-426C-9953-48172FA223C4" | ||
shouldBeEnabled = "No" | ||
ignoreCount = "0" | ||
continueAfterRunningActions = "No" | ||
filePath = "BrightXDR/AppDelegate.swift" | ||
startingColumnNumber = "9223372036854775807" | ||
endingColumnNumber = "9223372036854775807" | ||
startingLineNumber = "36" | ||
endingLineNumber = "36" | ||
landmarkName = "applicationDidFinishLaunching(_:)" | ||
landmarkType = "7"> | ||
</BreakpointContent> | ||
</BreakpointProxy> | ||
</Breakpoints> | ||
</Bucket> |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// AppDelegate.swift | ||
// BrightXDR | ||
// | ||
// Created by Dmitry Starkov on 31/03/2023. | ||
// | ||
|
||
import Cocoa | ||
|
||
class AppDelegate: NSObject, NSApplicationDelegate { | ||
// The overlay window | ||
private var window: NSWindow! | ||
|
||
// The MTKView instance | ||
private var metalView: MetalView! | ||
|
||
func applicationDidFinishLaunching(_ aNotification: Notification) { | ||
guard let mainScreen = NSScreen.main else { return } | ||
|
||
// let splitViewRect = NSRect(x: mainScreen.frame.width/2, y: 0, width: mainScreen.frame.width/2, height: mainScreen.frame.height) | ||
let fullScreenRect = NSRect(x: 0, y: 0, width: mainScreen.frame.width, height: mainScreen.frame.height) | ||
|
||
// Create a new transparent, borderless window | ||
window = NSWindow(contentRect: fullScreenRect, styleMask: [.borderless], backing: .buffered, defer: false) | ||
window.isOpaque = false | ||
window.backgroundColor = NSColor.clear | ||
// Ignore all mouse events | ||
window.ignoresMouseEvents = true | ||
|
||
// Set the window's level to mainMenu to make it float above all other windows | ||
// Requires "Application is agent (UIElement)" set to "YES" in info.plist for system-wide support | ||
// The maximum possible values is NSWindow.Level(rawValue: Int(CGShieldingWindowLevel() + 19)) | ||
window.level = NSWindow.Level.mainMenu | ||
|
||
// Allow window to overlay in Mission Control and Spaces | ||
window.collectionBehavior = [.stationary, .canJoinAllSpaces, .fullScreenAuxiliary, .ignoresCycle, .managed] | ||
|
||
// Keep visible all time (required for overlays) | ||
window.hidesOnDeactivate = false | ||
|
||
// Add metal view with HDR overlay | ||
guard let view = window.contentView else { return } | ||
metalView = MetalView(frame: view.bounds) | ||
metalView.autoresizingMask = [.width, .height] | ||
view.addSubview(metalView) | ||
|
||
// Present the window | ||
window.makeKeyAndOrderFront(nil) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict/> | ||
</plist> |
Oops, something went wrong.