-
-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: show minimized windows (closes #11)
- Loading branch information
louis.pontoise
committed
Dec 16, 2019
1 parent
87647b9
commit 0466e36
Showing
13 changed files
with
163 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Private APIs from Webkit repo | ||
// see https://github.com/WebKit/webkit/blob/master/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h | ||
|
||
#import <CoreFoundation/CoreFoundation.h> | ||
|
||
typedef uint32_t CGSConnectionID; | ||
typedef uint32_t CGSWindowID; | ||
typedef uint32_t CGSWindowCount; | ||
typedef uint32_t CGSWindowCaptureOptions; | ||
enum { | ||
kCGSWindowCaptureNominalResolution = 0x0200, | ||
kCGSCaptureIgnoreGlobalClipShape = 0x0800, | ||
}; | ||
|
||
extern CGSConnectionID CGSMainConnectionID(void); | ||
|
||
extern CFArrayRef CGSHWCaptureWindowList(CGSConnectionID cid, CGSWindowID *windowList, CGSWindowCount windowCount, CGSWindowCaptureOptions options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Cocoa | ||
import Foundation | ||
|
||
class PrivateApis { | ||
// CGSHWCaptureWindowList can capture screenshots of minimized windows, which CGWindowListCreateImage can't | ||
static func windowScreenshots(_ windowId: [CGSWindowID]) -> Array<CGImage> { | ||
return CGSHWCaptureWindowList( | ||
CGSMainConnectionID(), | ||
UnsafeMutablePointer(mutating: windowId), | ||
CGSWindowCount(windowId.count), | ||
CGSWindowCaptureOptions(kCGSCaptureIgnoreGlobalClipShape | kCGSWindowCaptureNominalResolution) | ||
)!.takeRetainedValue() as! Array<CGImage> | ||
// // Fall back to the non-hardware capture path if we didn't get a snapshot | ||
// // (which usually happens if the window is fully off-screen). | ||
// CGWindowImageOption imageOptions = kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque; | ||
// if (captureAtNominalResolution) | ||
// imageOptions |= kCGWindowImageNominalResolution; | ||
// return adoptCF(CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, windowID, imageOptions)); | ||
} | ||
} |
Oops, something went wrong.