mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Store and restore style mask on fullscreen
This commit is contained in:

committed by
Mitchell Hashimoto

parent
4c1cf5efe3
commit
3cb21dd76e
@ -6,6 +6,7 @@ class FullScreenHandler {
|
|||||||
var previousTabGroupIndex: Int?
|
var previousTabGroupIndex: Int?
|
||||||
var previousContentFrame: NSRect?
|
var previousContentFrame: NSRect?
|
||||||
var isInFullscreen: Bool = false
|
var isInFullscreen: Bool = false
|
||||||
|
var previousStyleMask: NSWindow.StyleMask? = nil
|
||||||
|
|
||||||
// We keep track of whether we entered non-native fullscreen in case
|
// We keep track of whether we entered non-native fullscreen in case
|
||||||
// a user goes to fullscreen, changes the config to disable non-native fullscreen
|
// a user goes to fullscreen, changes the config to disable non-native fullscreen
|
||||||
@ -89,6 +90,7 @@ class FullScreenHandler {
|
|||||||
|
|
||||||
// This is important: it gives us the full screen, including the
|
// This is important: it gives us the full screen, including the
|
||||||
// notch area on MacBooks.
|
// notch area on MacBooks.
|
||||||
|
self.previousStyleMask = window.styleMask
|
||||||
window.styleMask.remove(.titled)
|
window.styleMask.remove(.titled)
|
||||||
|
|
||||||
// Set frame to screen size, accounting for the menu bar if needed
|
// Set frame to screen size, accounting for the menu bar if needed
|
||||||
@ -126,8 +128,8 @@ class FullScreenHandler {
|
|||||||
func leaveFullscreen(window: NSWindow) {
|
func leaveFullscreen(window: NSWindow) {
|
||||||
guard let previousFrame = previousContentFrame else { return }
|
guard let previousFrame = previousContentFrame else { return }
|
||||||
|
|
||||||
// Restore title bar
|
// Restore the style mask
|
||||||
window.styleMask.insert(.titled)
|
window.styleMask = self.previousStyleMask!
|
||||||
|
|
||||||
// Restore previous presentation options
|
// Restore previous presentation options
|
||||||
NSApp.presentationOptions = []
|
NSApp.presentationOptions = []
|
||||||
|
Reference in New Issue
Block a user