KMApplication.swift 935 B

1234567891011121314151617181920212223242526272829
  1. //
  2. // KMApplication.swift
  3. // PDF Master
  4. //
  5. // Created by liujiajie on 2024/1/16.
  6. //
  7. import Cocoa
  8. let SKApplicationStartsTerminatingNotification = "SKApplicationStartsTerminatingNotification"
  9. @objc protocol KMApplicationDelegate: NSApplicationDelegate {
  10. @objc optional func applicationStartsTerminating(_ aNotification: NSNotification)
  11. }
  12. class KMApplication: NSApplication{
  13. var userAttentionDisabled = false
  14. var adelegate: KMApplicationDelegate?
  15. func updatePresentationOptions(for aWindow: NSWindow) {
  16. let options: [NSApplication.PresentationOptions] = [[], .autoHideDock, .autoHideMenuBar, .fullScreen, .hideDock, .hideMenuBar, .disableProcessSwitching]
  17. let mode = aWindow.windowController?.document?.systemInteractionMode()
  18. if self.presentationOptions != options[mode?.rawValue ?? 0] {
  19. self.presentationOptions = options[mode?.rawValue ?? 0]
  20. }
  21. }
  22. }