Revision: 14129
          http://sourceforge.net/p/skim-app/code/14129
Author:   hofman
Date:     2024-03-23 18:50:42 +0000 (Sat, 23 Mar 2024)
Log Message:
-----------
Draw pdf content as window image when deminiaturizing snapshot window without 
being shown before, getting the window image does not work when the window was 
not on screen

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

Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m  2024-03-23 18:18:24 UTC (rev 14128)
+++ trunk/SKSnapshotWindowController.m  2024-03-23 18:50:42 UTC (rev 14129)
@@ -549,6 +549,14 @@
     return [self thumbnailAttachmentWithSize:32.0];
 }
 
+- (NSImage *)windowContentImage {
+    NSImage *image = [[NSImage alloc] initWithSize:[[self window] frame].size];
+    [image lockFocus];
+    [[self thumbnailWithSize:0.0] drawInRect:[pdfView visibleContentRect]];
+    [image unlockFocus];
+    return image;
+}
+
 #pragma mark Miniaturize / Deminiaturize
 
 - (NSRect)miniaturizedRectForDockingRect:(NSRect)dockRect {
@@ -578,8 +586,12 @@
 }
 
 - (void)miniaturizeWindowFromRect:(NSRect)startRect toRect:(NSRect)endRect {
-    if (windowImage == nil)
-        windowImage = [(SKSnapshotWindow *)[self window] windowImage];
+    if (windowImage == nil) {
+        if ([self hasWindow])
+            windowImage = [(SKSnapshotWindow *)[self window] windowImage];
+        else
+            windowImage = [self windowContentImage];
+    }
     
     SKAnimatedBorderlessWindow *miniaturizeWindow = 
[[SKAnimatedBorderlessWindow alloc] initWithContentRect:startRect];
     [miniaturizeWindow setLevel:NSFloatingWindowLevel];

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