|
@@ -14,6 +14,8 @@ class KMScreenShotHandler: NSObject{
|
|
|
|
|
|
static let defaultManager = KMScreenShotHandler()
|
|
static let defaultManager = KMScreenShotHandler()
|
|
|
|
|
|
|
|
+ static var screenShotWindow: KMScreenShotMaskWindowController!
|
|
|
|
+
|
|
class func fullScreenShot() -> NSImage {
|
|
class func fullScreenShot() -> NSImage {
|
|
var screenShot = CGWindowListCreateImage(.infinite, .optionOnScreenOnly, kCGNullWindowID, [])
|
|
var screenShot = CGWindowListCreateImage(.infinite, .optionOnScreenOnly, kCGNullWindowID, [])
|
|
let img2 = NSImage(cgImage: screenShot!, size: NSZeroSize)
|
|
let img2 = NSImage(cgImage: screenShot!, size: NSZeroSize)
|
|
@@ -105,7 +107,7 @@ class KMScreenShotHandler: NSObject{
|
|
if KMScreenShotHandler.defaultManager.isCapturing == true {
|
|
if KMScreenShotHandler.defaultManager.isCapturing == true {
|
|
NotificationCenter.default.post(name: Notification.Name(KMCancelCurrentCapturingActionNotification), object: nil)
|
|
NotificationCenter.default.post(name: Notification.Name(KMCancelCurrentCapturingActionNotification), object: nil)
|
|
}
|
|
}
|
|
- let screenShotWindow = KMScreenShotMaskWindowController { (ima) in
|
|
|
|
|
|
+ screenShotWindow = KMScreenShotMaskWindowController { (ima) in
|
|
if let image = ima {
|
|
if let image = ima {
|
|
handler(image)
|
|
handler(image)
|
|
}
|
|
}
|
|
@@ -117,7 +119,7 @@ class KMScreenShotHandler: NSObject{
|
|
NotificationCenter.default.post(name: Notification.Name(KMCancelCurrentCapturingActionNotification), object: nil)
|
|
NotificationCenter.default.post(name: Notification.Name(KMCancelCurrentCapturingActionNotification), object: nil)
|
|
}
|
|
}
|
|
KMScreenShotHandler.defaultManager.isCapturing = true
|
|
KMScreenShotHandler.defaultManager.isCapturing = true
|
|
- let screenShotWindow = KMScreenShotMaskWindowController(fullScreenShot: delayTime, completeHandler: { (ima) in
|
|
|
|
|
|
+ screenShotWindow = KMScreenShotMaskWindowController(fullScreenShot: delayTime, completeHandler: { (ima) in
|
|
KMScreenShotHandler.defaultManager.isCapturing = false
|
|
KMScreenShotHandler.defaultManager.isCapturing = false
|
|
if let image = ima {
|
|
if let image = ima {
|
|
handler(image)
|
|
handler(image)
|
|
@@ -128,7 +130,7 @@ class KMScreenShotHandler: NSObject{
|
|
if KMScreenShotHandler.defaultManager.isCapturing {
|
|
if KMScreenShotHandler.defaultManager.isCapturing {
|
|
NotificationCenter.default.post(name: Notification.Name(KMCancelCurrentCapturingActionNotification), object: nil)
|
|
NotificationCenter.default.post(name: Notification.Name(KMCancelCurrentCapturingActionNotification), object: nil)
|
|
}
|
|
}
|
|
- let screenShotWindow = KMScreenShotMaskWindowController( handler: { (ima) in
|
|
|
|
|
|
+ screenShotWindow = KMScreenShotMaskWindowController( handler: { (ima) in
|
|
if let image = ima {
|
|
if let image = ima {
|
|
handler(image)
|
|
handler(image)
|
|
}
|
|
}
|