Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

fix(macos): show the donut over full-screen windows (#251) (#629)

mendax-iitmf80ecb74a37d
diff --git a/src/Filee.Platform.MacOS/NativeMethods.cs b/src/Filee.Platform.MacOS/NativeMethods.cs
index 507ff0f2..b343bab7 100644
--- a/src/Filee.Platform.MacOS/NativeMethods.cs
+++ b/src/Filee.Platform.MacOS/NativeMethods.cs
@@ -126,13 +126,22 @@ internal static class NativeMethods
const nint fullScreenPrimary = 1 << 7, fullScreenAuxiliary = 1 << 8, fullScreenNone = 1 << 9;
var behavior = Send(window, sel_registerName("collectionBehavior"));
behavior = (behavior & ~(moveToActiveSpace | fullScreenPrimary | fullScreenNone)) | canJoinAllSpaces | fullScreenAuxiliary;
- if (OperatingSystem.IsMacOSVersionAtLeast(13))
- {
- const nint primary = 1 << 16, auxiliary = 1 << 17, canJoinAllApplications = 1 << 18;
- behavior = (behavior & ~(primary | auxiliary)) | canJoinAllApplications;
- }
+ // macOS 13's primary, auxiliary and canJoinAllApplications: with canJoinAllApplications set the donut still
+ // stays off a full-screen Finder Space, even as a panel (#251).
+ behavior &= ~((1 << 16) | (1 << 17) | (1 << 18));
// Finder can occupy a full-screen Space that would otherwise hide another app's toolbar.
SendInteger(window, sel_registerName("setCollectionBehavior:"), behavior);
+ // While Filee shows in the Dock, AppKit keeps its windows off another app's full-screen Space and lets only a
+ // non-activating panel join it (#251). AvnPanel is Avalonia's NSPanel build of AvnWindow, same ivars and methods
+ // but canBecomeMainWindow, so the donut becomes one in place.
+ var panel = objc_getClass("AvnPanel");
+ if (panel != 0 && object_getClass(window) == objc_getClass("AvnWindow"))
+ {
+ object_setClass(window, panel);
+ const nint nonactivatingPanel = 1 << 7;
+ SendInteger(window, sel_registerName("setStyleMask:"), Send(window, sel_registerName("styleMask")) | nonactivatingPanel);
+ SendInteger(window, sel_registerName("setHidesOnDeactivate:"), 0);
+ }
SendInteger(window, sel_registerName("setLevel:"), 3);
SendVoid(window, sel_registerName("orderFrontRegardless"));
}
@@ -417,6 +426,12 @@ internal static class NativeMethods
[DllImport(ObjC)]
private static extern nint objc_getClass([MarshalAs(UnmanagedType.LPUTF8Str)] string name);
+ [DllImport(ObjC)]
+ private static extern nint object_getClass(nint instance);
+
+ [DllImport(ObjC)]
+ private static extern nint object_setClass(nint instance, nint cls);
+
[DllImport(ObjC)]
private static extern nint sel_registerName([MarshalAs(UnmanagedType.LPUTF8Str)] string name);