Revision: 15311 http://sourceforge.net/p/skim-app/code/15311 Author: hofman Date: 2025-05-27 22:10:40 +0000 (Tue, 27 May 2025) Log Message: ----------- draw toolbar screenshot in sublayer
Modified Paths: -------------- trunk/SKMainWindowController_FullScreen.m Modified: trunk/SKMainWindowController_FullScreen.m =================================================================== --- trunk/SKMainWindowController_FullScreen.m 2025-05-27 15:21:37 UTC (rev 15310) +++ trunk/SKMainWindowController_FullScreen.m 2025-05-27 22:10:40 UTC (rev 15311) @@ -477,28 +477,24 @@ NSWindow *displayWindow = savedNormalWindow; NSRect frame = [window frame]; CALayer *layer = [CALayer layer]; + CALayer *tbLayer = nil; CGImageRef cgImage = CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, (CGWindowID)[window windowNumber], kCGWindowImageBoundsIgnoreFraming | kCGWindowImageBestResolution); + [layer setMasksToBounds:YES]; + [layer setBounds:[[window contentView] bounds]]; + [layer setContents:CFBridgingRelease(cgImage)]; if (([window styleMask] & NSWindowStyleMaskFullScreen) != 0 && autoHideToolbarInFullScreen() == NO && [[window toolbar] isVisible]) { - NSWindow *tbWindow = nil; - for (tbWindow in [window childWindows]) - if ([NSStringFromClass([tbWindow class]) containsString:@"Toolbar"]) + for (NSWindow *tbWindow in [window childWindows]) { + if ([NSStringFromClass([tbWindow class]) containsString:@"Toolbar"]) { + CGImageRef tbCgImage = CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, (CGWindowID)[tbWindow windowNumber], kCGWindowImageBoundsIgnoreFraming | kCGWindowImageBestResolution); + tbLayer = [CALayer layer]; + [tbLayer setMasksToBounds:YES]; + [tbLayer setFrame:[window convertRectFromScreen:[tbWindow frame]]]; + [tbLayer setContents:CFBridgingRelease(tbCgImage)]; + [layer addSublayer:tbLayer]; break; - if (tbWindow) { - CGImageRef tbCgImage = CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, (CGWindowID)[tbWindow windowNumber], kCGWindowImageBoundsIgnoreFraming | kCGWindowImageBestResolution); - NSRect tbFrame = [tbWindow frame]; - size_t width = CGImageGetWidth(cgImage), height = CGImageGetHeight(cgImage); - CGFloat sx = width / NSWidth(frame), sy = height / NSHeight(frame); - CGContextRef ctx = CGBitmapContextCreate(NULL, width, height, CGImageGetBitsPerComponent(cgImage), CGImageGetBytesPerRow(cgImage), CGImageGetColorSpace(cgImage), CGImageGetBitmapInfo(cgImage)); - CGContextDrawImage(ctx, CGRectMake(0.0, 0.0, width, height), cgImage); - CGContextDrawImage(ctx, CGRectMake(sx * (NSMinX(tbFrame) - NSMinX(frame)), sy * (NSMinY(tbFrame) - NSMinY(frame)), sx * NSWidth(tbFrame), sy * NSHeight(tbFrame)), tbCgImage); - CGImageRelease(tbCgImage); - CGImageRelease(cgImage); - cgImage = CGBitmapContextCreateImage(ctx); - CGContextRelease(ctx); + } } } - [layer setMasksToBounds:YES]; - [layer setContents:CFBridgingRelease(cgImage)]; [displayWindow setFrame:frame display:NO]; [[displayWindow contentView] setLayer:layer]; [[displayWindow contentView] setWantsLayer:YES]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit