KMBrowserWindow.swift 1004 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // KMBrowserWindow.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by tangchao on 2024/4/1.
  6. //
  7. import Cocoa
  8. class KMBrowserWindow: CTBrowserWindow {
  9. override func sendEvent(_ event: NSEvent) {
  10. if event.type == .leftMouseDown || event.type == .rightMouseDown || event.type == .keyDown {
  11. KMImageToolTipWindow.shared.orderOut(nil)
  12. }
  13. super.sendEvent(event)
  14. }
  15. override func resignMain() {
  16. KMImageToolTipWindow.shared.orderOut(nil)
  17. super.resignMain()
  18. }
  19. override func resignKey() {
  20. KMImageToolTipWindow.shared.orderOut(nil)
  21. super.resignKey()
  22. }
  23. override func miniaturize(_ sender: Any?) {
  24. super.miniaturize(sender)
  25. if let browser = (self.windowController as? KMBrowserWindowController)?.browser {
  26. let document = browser.activeTabContents() as? KMMainDocument
  27. document?.mainViewController?.hideMeasureFloatingWindows()
  28. }
  29. }
  30. }