mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: stylistic changes
This commit is contained in:
@ -16,22 +16,10 @@ class FocusedSurfaceWrapper {
|
||||
class PrimaryWindow: NSWindow {
|
||||
var focusedSurfaceWrapper: FocusedSurfaceWrapper = FocusedSurfaceWrapper()
|
||||
|
||||
static func getStyleMask(renderDecoration: Bool) -> NSWindow.StyleMask {
|
||||
var mask: NSWindow.StyleMask = [.resizable, .closable, .miniaturizable]
|
||||
if renderDecoration {
|
||||
mask.insert(.titled)
|
||||
}
|
||||
return mask
|
||||
}
|
||||
|
||||
static func create(ghostty: Ghostty.AppState, appDelegate: AppDelegate, baseConfig: ghostty_surface_config_s? = nil) -> PrimaryWindow {
|
||||
var renderDecoration = false;
|
||||
let configString = "window-decoration"
|
||||
_ = ghostty_config_get(ghostty.config, &renderDecoration, configString, UInt(configString.count))
|
||||
|
||||
let window = PrimaryWindow(
|
||||
contentRect: NSRect(x: 0, y: 0, width: 800, height: 600),
|
||||
styleMask: getStyleMask(renderDecoration: renderDecoration),
|
||||
styleMask: getStyleMask(renderDecoration: ghostty.windowDecorations),
|
||||
backing: .buffered,
|
||||
defer: false)
|
||||
window.center()
|
||||
@ -57,6 +45,15 @@ class PrimaryWindow: NSWindow {
|
||||
return window
|
||||
}
|
||||
|
||||
static func getStyleMask(renderDecoration: Bool) -> NSWindow.StyleMask {
|
||||
var mask: NSWindow.StyleMask = [.resizable, .closable, .miniaturizable]
|
||||
if renderDecoration {
|
||||
mask.insert(.titled)
|
||||
}
|
||||
|
||||
return mask
|
||||
}
|
||||
|
||||
override var canBecomeKey: Bool {
|
||||
return true
|
||||
}
|
||||
|
@ -63,6 +63,15 @@ extension Ghostty {
|
||||
return Info(mode: raw.build_mode, version: String(version))
|
||||
}
|
||||
|
||||
/// True if we want to render window decorations
|
||||
var windowDecorations: Bool {
|
||||
guard let config = self.config else { return true }
|
||||
var v = false;
|
||||
let key = "window-decoration"
|
||||
_ = ghostty_config_get(config, &v, key, UInt(key.count))
|
||||
return v;
|
||||
}
|
||||
|
||||
/// Cached clipboard string for `read_clipboard` callback.
|
||||
private var cached_clipboard_string: String? = nil
|
||||
|
||||
|
@ -1,17 +1,16 @@
|
||||
import SwiftUI
|
||||
import GhosttyKit
|
||||
|
||||
class FullScreenHandler {
|
||||
var previousTabGroup: NSWindowTabGroup?
|
||||
class FullScreenHandler { var previousTabGroup: NSWindowTabGroup?
|
||||
var previousTabGroupIndex: Int?
|
||||
var previousContentFrame: NSRect?
|
||||
var isInFullscreen: Bool = false
|
||||
var previousStyleMask: NSWindow.StyleMask? = nil
|
||||
|
||||
// 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
|
||||
// and then wants to toggle it off
|
||||
var isInNonNativeFullscreen: Bool = false
|
||||
var isInFullscreen: Bool = false
|
||||
|
||||
func toggleFullscreen(window: NSWindow, nonNativeFullscreen: ghostty_non_native_fullscreen_e) {
|
||||
let useNonNativeFullscreen = nonNativeFullscreen != GHOSTTY_NON_NATIVE_FULLSCREEN_FALSE
|
||||
|
Reference in New Issue
Block a user