Revision: 14212
          http://sourceforge.net/p/skim-app/code/14212
Author:   hofman
Date:     2024-04-14 21:36:05 +0000 (Sun, 14 Apr 2024)
Log Message:
-----------
Avoid use of CGWindowListCreateImage on 14.0+, as it is deprecated and can show 
a dialog to the user

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

Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m   2024-04-14 14:40:31 UTC (rev 
14211)
+++ trunk/SKMainWindowController_FullScreen.m   2024-04-14 21:36:05 UTC (rev 
14212)
@@ -702,7 +702,7 @@
     NSArray *windows = openWindows(self);
     if ([windows count] == 1)
         return nil;
-    if ([[NSWorkspace sharedWorkspace] 
accessibilityDisplayShouldReduceMotion]) {
+    if (@available(macOS 14.0, *)) {} else if ([[NSWorkspace sharedWorkspace] 
accessibilityDisplayShouldReduceMotion]) {
         animationWindow = [[SKAnimatedBorderlessWindow alloc] 
initWithContentRect:[window frame]];
         windows = [windows arrayByAddingObject:animationWindow];
     }
@@ -795,7 +795,7 @@
     NSArray *windows = openWindows(self);
     if ([windows count] == 1)
         return nil;
-    if ([[NSWorkspace sharedWorkspace] 
accessibilityDisplayShouldReduceMotion]) {
+    if (@available(macOS 14.0, *)) {} else if ([[NSWorkspace sharedWorkspace] 
accessibilityDisplayShouldReduceMotion]) {
         animationWindow = [[SKAnimatedBorderlessWindow alloc] 
initWithContentRect:[window frame]];
         windows = [windows arrayByAddingObject:animationWindow];
     }

Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m  2024-04-14 14:40:31 UTC (rev 14211)
+++ trunk/SKSnapshotWindowController.m  2024-04-14 21:36:05 UTC (rev 14212)
@@ -641,8 +641,12 @@
         NSRect windowRect = [window frame];
         NSRect dockRect = [[self delegate] snapshotController:self 
miniaturizedRect:miniaturize];
         dockRect = [self miniaturizedRectForDockingRect:dockRect];
+        BOOL canUseCGWindowAPI = miniaturize;
         
-        if (miniaturize) {
+        if (@available(macOS 14.0, *))
+            canUseCGWindowAPI = NO;
+        
+        if (canUseCGWindowAPI) {
             CGImageRef cgImage = CGWindowListCreateImage(CGRectNull, 
kCGWindowListOptionIncludingWindow, (CGWindowID)[window windowNumber], 
kCGWindowImageBoundsIgnoreFraming);
             windowImage = [[NSImage alloc] initWithCGImage:cgImage 
size:windowRect.size];
             CGImageRelease(cgImage);

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