Revision: 13373
http://sourceforge.net/p/skim-app/code/13373
Author: hofman
Date: 2023-03-15 23:20:37 +0000 (Wed, 15 Mar 2023)
Log Message:
-----------
draw just main window and toolbar window in combined image. For some reason
CGWindowListCreateImageFromArray does not work.
Modified Paths:
--------------
trunk/SKMainWindowController_FullScreen.m
Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m 2023-03-15 22:36:50 UTC (rev
13372)
+++ trunk/SKMainWindowController_FullScreen.m 2023-03-15 23:20:37 UTC (rev
13373)
@@ -553,15 +553,32 @@
return 0.0;
}
-static inline NSImage *imageForWindow(NSWindow *window) {
+static NSImage *imageForWindow(NSWindow *window) {
NSRect frame = [window frame];
NSRect screenFrame = [[NSScreen mainScreen] frame];
frame.origin.x -= NSMinX(screenFrame);
frame.origin.y = NSMaxY(screenFrame) - NSMaxY(frame);
- CGWindowListOption options = kCGWindowListOptionIncludingWindow;
- if (([window styleMask] & NSWindowStyleMaskFullScreen) != 0 &&
autoHideToolbarInFullScreen == NO && [[window toolbar] isVisible])
- options |= kCGWindowListOptionOnScreenAboveWindow;
- CGImageRef cgImage = CGWindowListCreateImage(NSRectToCGRect(frame),
options, (CGWindowID)[window windowNumber], kCGWindowImageBoundsIgnoreFraming);
+ CGImageRef cgImage = CGWindowListCreateImage(NSRectToCGRect(frame),
kCGWindowListOptionIncludingWindow, (CGWindowID)[window windowNumber],
kCGWindowImageBoundsIgnoreFraming);
+ NSWindow *tbWindow = nil;
+ if (([window styleMask] & NSWindowStyleMaskFullScreen) != 0 &&
autoHideToolbarInFullScreen == NO && [[window toolbar] isVisible]) {
+ for (tbWindow in [window childWindows])
+ if ([NSStringFromClass([tbWindow class])
containsString:@"Toolbar"])
+ break;
+ if (tbWindow) {
+ CGImageRef tbCgImage = CGWindowListCreateImage(CGRectNull,
kCGWindowListOptionIncludingWindow, (CGWindowID)[tbWindow windowNumber],
kCGWindowImageBoundsIgnoreFraming);
+ CGColorSpaceRef cs = CGImageGetColorSpace(cgImage);
+ size_t width = CGImageGetWidth(cgImage), height =
CGImageGetHeight(cgImage);
+ size_t tbWidth = CGImageGetWidth(tbCgImage), tbHeight =
CGImageGetHeight(tbCgImage);
+ CGContextRef ctx = CGBitmapContextCreate(NULL, width, height, 8, 4
* width, cs, kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst);
+ CGColorSpaceRelease(cs);
+ CGContextDrawImage(ctx, CGRectMake(0.0, 0.0, width, height),
cgImage);
+ CGContextDrawImage(ctx, CGRectMake(0.0, height - tbHeight,
tbWidth, tbHeight), tbCgImage);
+ CGImageRelease(tbCgImage);
+ CGImageRelease(cgImage);
+ cgImage = CGBitmapContextCreateImage(ctx);
+ CGContextRelease(ctx);
+ }
+ }
NSImage *image = [[NSImage alloc] initWithCGImage:cgImage size:frame.size];
CGImageRelease(cgImage);
return [image autorelease];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit