Revision: 13372
          http://sourceforge.net/p/skim-app/code/13372
Author:   hofman
Date:     2023-03-15 22:36:50 +0000 (Wed, 15 Mar 2023)
Log Message:
-----------
make sure window image is restricted to window frame, coordinates used by CG is 
flipped and shifted to top-left of main screen

Modified Paths:
--------------
    trunk/SKMainWindowController_FullScreen.m

Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m   2023-03-15 22:26:12 UTC (rev 
13371)
+++ trunk/SKMainWindowController_FullScreen.m   2023-03-15 22:36:50 UTC (rev 
13372)
@@ -555,10 +555,13 @@
 
 static inline 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(CGRectNull, options, 
(CGWindowID)[window windowNumber], kCGWindowImageBoundsIgnoreFraming);
+    CGImageRef cgImage = CGWindowListCreateImage(NSRectToCGRect(frame), 
options, (CGWindowID)[window windowNumber], kCGWindowImageBoundsIgnoreFraming);
     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

Reply via email to