Repo // Compatibility with Xcode 15.
This commit is contained in:
parent
0bb6a26b3a
commit
3f0f308c81
|
@ -8,7 +8,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import IMKUtils
|
import IMKUtils
|
||||||
import InputMethodKit
|
import InputMethodKit
|
||||||
import SwiftExtension
|
import SwiftExtension
|
||||||
|
@ -111,7 +111,7 @@ class AppDelegate: NSWindowController, NSApplicationDelegate {
|
||||||
|
|
||||||
window.center()
|
window.center()
|
||||||
window.orderFront(self)
|
window.orderFront(self)
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func agreeAndInstallAction(_: AnyObject) {
|
@IBAction func agreeAndInstallAction(_: AnyObject) {
|
||||||
|
@ -179,3 +179,21 @@ class AppDelegate: NSWindowController, NSApplicationDelegate {
|
||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - NSApp Activation Helper
|
||||||
|
|
||||||
|
// This is to deal with changes brought by macOS 14.
|
||||||
|
|
||||||
|
private extension NSApplication {
|
||||||
|
func popup() {
|
||||||
|
#if compiler(>=5.9) && canImport(AppKit, _version: "14.0")
|
||||||
|
if #available(macOS 14.0, *) {
|
||||||
|
NSApp.activate()
|
||||||
|
} else {
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import InputMethodKit
|
import InputMethodKit
|
||||||
|
|
||||||
extension AppDelegate {
|
extension AppDelegate {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// Ref: https://qiita.com/fuziki/items/b31055a69330a3ce55a5
|
// Ref: https://qiita.com/fuziki/items/b31055a69330a3ce55a5
|
||||||
// Modified by The vChewing Project in order to use it with AppKit.
|
// Modified by The vChewing Project in order to use it with AppKit.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import CocoaExtension
|
import CocoaExtension
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Ref: https://stackoverflow.com/a/61695824
|
// Ref: https://stackoverflow.com/a/61695824
|
||||||
// License: https://creativecommons.org/licenses/by-sa/4.0/
|
// License: https://creativecommons.org/licenses/by-sa/4.0/
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
public class BookmarkManager {
|
public class BookmarkManager {
|
||||||
public static let shared = BookmarkManager()
|
public static let shared = BookmarkManager()
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// ====================
|
// ====================
|
||||||
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
||||||
|
|
||||||
|
import AppKit
|
||||||
import Carbon
|
import Carbon
|
||||||
import Cocoa
|
|
||||||
|
|
||||||
private extension Date {
|
private extension Date {
|
||||||
static func - (lhs: Date, rhs: Date) -> TimeInterval {
|
static func - (lhs: Date, rhs: Date) -> TimeInterval {
|
||||||
|
|
|
@ -99,8 +99,8 @@ private extension EnvironmentValues {
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 10.15, *)
|
||||||
@propertyWrapper
|
@propertyWrapper
|
||||||
internal struct StringlyTypedEnvironment<Value> {
|
internal struct StringlyTypedEnvironment<Value> {
|
||||||
final class Store<Value>: ObservableObject {
|
final class Store<StoredValue>: ObservableObject {
|
||||||
var value: Value?
|
var value: StoredValue?
|
||||||
}
|
}
|
||||||
|
|
||||||
@Environment(\.self) private var env
|
@Environment(\.self) private var env
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// ====================
|
// ====================
|
||||||
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
extension NSToolbarItem.Identifier {
|
extension NSToolbarItem.Identifier {
|
||||||
static let toolbarSegmentedControlItem = Self("toolbarSegmentedControlItem")
|
static let toolbarSegmentedControlItem = Self("toolbarSegmentedControlItem")
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// ====================
|
// ====================
|
||||||
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
public extension Settings {
|
public extension Settings {
|
||||||
struct PaneIdentifier: Hashable, RawRepresentable, Codable {
|
struct PaneIdentifier: Hashable, RawRepresentable, Codable {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// ====================
|
// ====================
|
||||||
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
protocol SettingsStyleController: AnyObject {
|
protocol SettingsStyleController: AnyObject {
|
||||||
var delegate: SettingsStyleControllerDelegate? { get set }
|
var delegate: SettingsStyleControllerDelegate? { get set }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// ====================
|
// ====================
|
||||||
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
final class SettingsTabViewController: NSViewController, SettingsStyleControllerDelegate {
|
final class SettingsTabViewController: NSViewController, SettingsStyleControllerDelegate {
|
||||||
private var activeTab: Int?
|
private var activeTab: Int?
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// ====================
|
// ====================
|
||||||
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
extension NSWindow.FrameAutosaveName {
|
extension NSWindow.FrameAutosaveName {
|
||||||
static let settings: NSWindow.FrameAutosaveName = "com.sindresorhus.Preferences.FrameAutosaveName"
|
static let settings: NSWindow.FrameAutosaveName = "com.sindresorhus.Preferences.FrameAutosaveName"
|
||||||
|
@ -100,7 +100,15 @@ public final class SettingsWindowController: NSWindowController {
|
||||||
|
|
||||||
showWindow(self)
|
showWindow(self)
|
||||||
restoreWindowPosition()
|
restoreWindowPosition()
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
#if compiler(>=5.9) && canImport(AppKit, _version: "14.0")
|
||||||
|
if #available(macOS 14.0, *) {
|
||||||
|
NSApp.activate()
|
||||||
|
} else {
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private func restoreWindowPosition() {
|
private func restoreWindowPosition() {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// ====================
|
// ====================
|
||||||
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
public extension Settings {
|
public extension Settings {
|
||||||
enum Style {
|
enum Style {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// ====================
|
// ====================
|
||||||
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
final class ToolbarItemStyleViewController: NSObject, SettingsStyleController {
|
final class ToolbarItemStyleViewController: NSObject, SettingsStyleController {
|
||||||
let toolbar: NSToolbar
|
let toolbar: NSToolbar
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import Shared
|
import Shared
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import SwiftUIBackports
|
import SwiftUIBackports
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
// MARK: - Using One Single NSAttributedString.
|
// MARK: - Using One Single NSAttributedString.
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import Shared
|
import Shared
|
||||||
|
|
||||||
open class CtlCandidate: NSWindowController, CtlCandidateProtocol {
|
open class CtlCandidate: NSWindowController, CtlCandidateProtocol {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import CocoaExtension
|
import CocoaExtension
|
||||||
import Shared
|
import Shared
|
||||||
import SwiftExtension
|
import SwiftExtension
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import Shared
|
import Shared
|
||||||
|
|
||||||
/// 田所選字窗的 Cocoa 版本,繪製效率不受 SwiftUI 的限制。
|
/// 田所選字窗的 Cocoa 版本,繪製效率不受 SwiftUI 的限制。
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import Shared
|
import Shared
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import SwiftUIBackports
|
import SwiftUIBackports
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
@testable import CandidateWindow
|
@testable import CandidateWindow
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import SwiftExtension
|
import SwiftExtension
|
||||||
|
|
||||||
// MARK: - NSSize extension
|
// MARK: - NSSize extension
|
||||||
|
@ -238,3 +238,21 @@ public extension NSApplication {
|
||||||
return machine == "arm64"
|
return machine == "arm64"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - NSApp Activation Helper
|
||||||
|
|
||||||
|
// This is to deal with changes brought by macOS 14.
|
||||||
|
|
||||||
|
public extension NSApplication {
|
||||||
|
func popup() {
|
||||||
|
#if compiler(>=5.9) && canImport(AppKit, _version: "14.0")
|
||||||
|
if #available(macOS 14.0, *) {
|
||||||
|
NSApp.activate()
|
||||||
|
} else {
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import IMKUtils
|
import IMKUtils
|
||||||
|
|
||||||
// MARK: - NSEvent Extension - Reconstructors
|
// MARK: - NSEvent Extension - Reconstructors
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
|
import AppKit
|
||||||
import AVFoundation
|
import AVFoundation
|
||||||
import Cocoa
|
|
||||||
|
|
||||||
public extension NSSound {
|
public extension NSSound {
|
||||||
static func buzz(fart: Bool = false) {
|
static func buzz(fart: Bool = false) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import InputMethodKit
|
import InputMethodKit
|
||||||
|
|
||||||
public extension NSWindowController {
|
public extension NSWindowController {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Written by Alexis Bridoux - https://github.com/ABridoux
|
// Written by Alexis Bridoux - https://github.com/ABridoux
|
||||||
// Ref: https://gist.github.com/ABridoux/b935c21c7ead92033d39b357fae6366b
|
// Ref: https://gist.github.com/ABridoux/b935c21c7ead92033d39b357fae6366b
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
// MARK: Model
|
// MARK: Model
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// ====================
|
// ====================
|
||||||
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
@testable import Megrez
|
@testable import Megrez
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import CocoaExtension
|
import CocoaExtension
|
||||||
|
|
||||||
public class Notifier: NSWindowController {
|
public class Notifier: NSWindowController {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import Combine
|
import Combine
|
||||||
import Foundation
|
import Foundation
|
||||||
import LangModelAssembly
|
import LangModelAssembly
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
public extension String {
|
public extension String {
|
||||||
mutating func convertToPhonabets(newToneOne: String = "") {
|
mutating func convertToPhonabets(newToneOne: String = "") {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import Shared
|
import Shared
|
||||||
|
|
||||||
public class PopupCompositionBuffer: NSWindowController {
|
public class PopupCompositionBuffer: NSWindowController {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
public protocol CtlCandidateDelegate {
|
public protocol CtlCandidateDelegate {
|
||||||
func candidatePairs(conv: Bool) -> [(keyArray: [String], value: String)]
|
func candidatePairs(conv: Bool) -> [(keyArray: [String], value: String)]
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import InputMethodKit
|
import InputMethodKit
|
||||||
|
|
||||||
// 所有 IMEState 均遵守該協定:
|
// 所有 IMEState 均遵守該協定:
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import CocoaExtension
|
import CocoaExtension
|
||||||
|
|
||||||
extension NSEvent: InputSignalProtocol {}
|
extension NSEvent: InputSignalProtocol {}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import CocoaExtension
|
import CocoaExtension
|
||||||
import NSAttributedTextView
|
import NSAttributedTextView
|
||||||
import Shared
|
import Shared
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import CocoaExtension
|
import CocoaExtension
|
||||||
|
|
||||||
public enum Uninstaller {
|
public enum Uninstaller {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
public class UpdateSputnik {
|
public class UpdateSputnik {
|
||||||
public static let shared: UpdateSputnik = .init()
|
public static let shared: UpdateSputnik = .init()
|
||||||
|
@ -113,7 +113,7 @@ public class UpdateSputnik {
|
||||||
alert.informativeText = NSLocalizedString("You are already using the latest version.", comment: "")
|
alert.informativeText = NSLocalizedString("You are already using the latest version.", comment: "")
|
||||||
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
||||||
alert.runModal()
|
alert.runModal()
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ public class UpdateSputnik {
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = alert.runModal()
|
let result = alert.runModal()
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
switch result {
|
switch result {
|
||||||
case .alertFirstButtonReturn:
|
case .alertFirstButtonReturn:
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
@ -172,6 +172,24 @@ public class UpdateSputnik {
|
||||||
alert.informativeText = content
|
alert.informativeText = content
|
||||||
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
||||||
alert.runModal()
|
alert.runModal()
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - NSApp Activation Helper
|
||||||
|
|
||||||
|
// This is to deal with changes brought by macOS 14.
|
||||||
|
|
||||||
|
private extension NSApplication {
|
||||||
|
func popup() {
|
||||||
|
#if compiler(>=5.9) && canImport(AppKit, _version: "14.0")
|
||||||
|
if #available(macOS 14.0, *) {
|
||||||
|
NSApp.activate()
|
||||||
|
} else {
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ public extension AppDelegate {
|
||||||
}
|
}
|
||||||
alert.addButton(withTitle: NSLocalizedString("Not Now", comment: ""))
|
alert.addButton(withTitle: NSLocalizedString("Not Now", comment: ""))
|
||||||
let result = alert.runModal()
|
let result = alert.runModal()
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
if result == NSApplication.ModalResponse.alertFirstButtonReturn {
|
if result == NSApplication.ModalResponse.alertFirstButtonReturn {
|
||||||
NSWorkspace.shared.openFile(
|
NSWorkspace.shared.openFile(
|
||||||
LMMgr.dataFolderPath(isDefaultFolder: true), withApplication: "Finder"
|
LMMgr.dataFolderPath(isDefaultFolder: true), withApplication: "Finder"
|
||||||
|
@ -167,6 +167,6 @@ public extension AppDelegate {
|
||||||
// New About Window
|
// New About Window
|
||||||
@IBAction func about(_: Any) {
|
@IBAction func about(_: Any) {
|
||||||
CtlAboutWindow.show()
|
CtlAboutWindow.show()
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,7 +302,7 @@ public extension LMMgr {
|
||||||
alert.informativeText = content
|
alert.informativeText = content
|
||||||
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
||||||
alert.runModal()
|
alert.runModal()
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,7 +358,7 @@ public extension SessionCtl {
|
||||||
break modeCheck
|
break modeCheck
|
||||||
}
|
}
|
||||||
let result = sharedAlertForInputModeToggling.runModal()
|
let result = sharedAlertForInputModeToggling.runModal()
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
if result == NSApplication.ModalResponse.alertFirstButtonReturn {
|
if result == NSApplication.ModalResponse.alertFirstButtonReturn {
|
||||||
neta.activate()
|
neta.activate()
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,11 +225,11 @@ public extension SessionCtl {
|
||||||
// CtlPrefUIShared.shared.controller.window?.setPosition(vertical: .top, horizontal: .right, padding: 20)
|
// CtlPrefUIShared.shared.controller.window?.setPosition(vertical: .top, horizontal: .right, padding: 20)
|
||||||
default: CtlPrefUI.show()
|
default: CtlPrefUI.show()
|
||||||
}
|
}
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
CtlPrefWindow.show()
|
CtlPrefWindow.show()
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func showCheatSheet(_: Any? = nil) {
|
@objc func showCheatSheet(_: Any? = nil) {
|
||||||
|
@ -241,7 +241,7 @@ public extension SessionCtl {
|
||||||
|
|
||||||
@objc func showClientListMgr(_: Any? = nil) {
|
@objc func showClientListMgr(_: Any? = nil) {
|
||||||
CtlClientListMgr.show()
|
CtlClientListMgr.show()
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func toggleCassetteMode(_: Any? = nil) {
|
@objc func toggleCassetteMode(_: Any? = nil) {
|
||||||
|
@ -253,7 +253,7 @@ public extension SessionCtl {
|
||||||
let informativeText = "Please reconfigure the cassette path to a valid one before enabling this mode."
|
let informativeText = "Please reconfigure the cassette path to a valid one before enabling this mode."
|
||||||
alert.informativeText = informativeText.localized
|
alert.informativeText = informativeText.localized
|
||||||
let result = alert.runModal()
|
let result = alert.runModal()
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
if result == NSApplication.ModalResponse.alertFirstButtonReturn {
|
if result == NSApplication.ModalResponse.alertFirstButtonReturn {
|
||||||
LMMgr.resetCassettePath()
|
LMMgr.resetCassettePath()
|
||||||
PrefMgr.shared.cassetteEnabled = false
|
PrefMgr.shared.cassetteEnabled = false
|
||||||
|
@ -367,7 +367,7 @@ public extension SessionCtl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func selfTerminate(_: Any? = nil) {
|
@objc func selfTerminate(_: Any? = nil) {
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
NSApp.terminate(nil)
|
NSApp.terminate(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,6 +428,6 @@ public extension SessionCtl {
|
||||||
|
|
||||||
@objc func showAbout(_: Any? = nil) {
|
@objc func showAbout(_: Any? = nil) {
|
||||||
CtlAboutWindow.show()
|
CtlAboutWindow.show()
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ class CtlPrefUI: NSWindowController, NSWindowDelegate {
|
||||||
sharedWindow.orderFrontRegardless() // 逼著視窗往最前方顯示
|
sharedWindow.orderFrontRegardless() // 逼著視窗往最前方顯示
|
||||||
sharedWindow.level = .statusBar
|
sharedWindow.level = .statusBar
|
||||||
shared.showWindow(shared)
|
shared.showWindow(shared)
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
}
|
}
|
||||||
|
|
||||||
private var currentLanguageSelectItem: NSMenuItem?
|
private var currentLanguageSelectItem: NSMenuItem?
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import Shared
|
import Shared
|
||||||
|
|
||||||
enum PrefUITabs: String, CaseIterable {
|
enum PrefUITabs: String, CaseIterable {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
class CtlAboutWindow: NSWindowController {
|
class CtlAboutWindow: NSWindowController {
|
||||||
@IBOutlet var appVersionLabel: NSTextField!
|
@IBOutlet var appVersionLabel: NSTextField!
|
||||||
|
@ -23,7 +23,7 @@ class CtlAboutWindow: NSWindowController {
|
||||||
sharedWindow.level = .statusBar
|
sharedWindow.level = .statusBar
|
||||||
sharedWindow.titlebarAppearsTransparent = true
|
sharedWindow.titlebarAppearsTransparent = true
|
||||||
shared.showWindow(shared)
|
shared.showWindow(shared)
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func windowDidLoad() {
|
override func windowDidLoad() {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
|
|
||||||
class CtlClientListMgr: NSWindowController, NSTableViewDelegate, NSTableViewDataSource {
|
class CtlClientListMgr: NSWindowController, NSTableViewDelegate, NSTableViewDataSource {
|
||||||
@IBOutlet var tblClients: NSTableView!
|
@IBOutlet var tblClients: NSTableView!
|
||||||
|
@ -24,7 +24,7 @@ class CtlClientListMgr: NSWindowController, NSTableViewDelegate, NSTableViewData
|
||||||
sharedWindow.level = .statusBar
|
sharedWindow.level = .statusBar
|
||||||
sharedWindow.titlebarAppearsTransparent = true
|
sharedWindow.titlebarAppearsTransparent = true
|
||||||
shared.showWindow(shared)
|
shared.showWindow(shared)
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func windowDidLoad() {
|
override func windowDidLoad() {
|
||||||
|
|
|
@ -73,7 +73,7 @@ class CtlPrefWindow: NSWindowController, NSWindowDelegate {
|
||||||
sharedWindow.level = .statusBar
|
sharedWindow.level = .statusBar
|
||||||
shared.showWindow(shared)
|
shared.showWindow(shared)
|
||||||
if resetPhraseEditor { shared.initPhraseEditor() }
|
if resetPhraseEditor { shared.initPhraseEditor() }
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
}
|
}
|
||||||
|
|
||||||
private var currentLanguageSelectItem: NSMenuItem?
|
private var currentLanguageSelectItem: NSMenuItem?
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import LangModelAssembly
|
import LangModelAssembly
|
||||||
|
|
||||||
class CtlRevLookupWindow: NSWindowController, NSWindowDelegate {
|
class CtlRevLookupWindow: NSWindowController, NSWindowDelegate {
|
||||||
|
@ -22,7 +22,7 @@ class CtlRevLookupWindow: NSWindowController, NSWindowDelegate {
|
||||||
window.level = .statusBar
|
window.level = .statusBar
|
||||||
window.titlebarAppearsTransparent = true
|
window.titlebarAppearsTransparent = true
|
||||||
shared.showWindow(shared)
|
shared.showWindow(shared)
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.popup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// marks, or product names of Contributor, except as required to fulfill notice
|
// marks, or product names of Contributor, except as required to fulfill notice
|
||||||
// requirements defined in MIT License.
|
// requirements defined in MIT License.
|
||||||
|
|
||||||
import Cocoa
|
import AppKit
|
||||||
import CocoaExtension
|
import CocoaExtension
|
||||||
import IMKUtils
|
import IMKUtils
|
||||||
import InputMethodKit
|
import InputMethodKit
|
||||||
|
|
Loading…
Reference in New Issue