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.

Map desktop-owned windows to the desktop for mouse gestures only

KnifeLemon00cc05fdfbd8
diff --git a/src/Filee.Platform.Windows/WindowsPlatformServices.cs b/src/Filee.Platform.Windows/WindowsPlatformServices.cs
index 32759b15..7d9e713c 100644
--- a/src/Filee.Platform.Windows/WindowsPlatformServices.cs
+++ b/src/Filee.Platform.Windows/WindowsPlatformServices.cs
@@ -53,7 +53,9 @@ public sealed class WindowsPlatformServices : IPlatformServices
public bool IsFileManagerAt(int x, int y)
{
- var root = RootWindowAt(x, y);
+ // Over a window the desktop owns (a desktop icon layer), a gesture is in the desktop's scope. Only here: the
+ // process name (ProcessNameAt, the excluded apps list) stays the layer's own, so the layer can be excluded.
+ var root = DesktopOrSelf(RootWindowAt(x, y));
if (root == 0)
return false;
return IsFileManager(NativeMethods.ClassNameOf(root), ProcessNameOf(root));
@@ -85,8 +87,9 @@ public sealed class WindowsPlatformServices : IPlatformServices
/// <summary>
/// True when the end of a window's owner chain (<paramref name="rootOwner"/>) is another window and the desktop.
/// Desktop icon layers (apps that hide Explorer's icon view and draw the icons themselves) cover the screen with a
- /// window owned by the shell's desktop window and keep Explorer's desktop view selected like their own icons, so
- /// over them, or with them in front, gestures and the selection shortcut act as on the desktop.
+ /// window owned by the shell's desktop window, so a mouse gesture over them acts as on the desktop: the files
+ /// arrive through the OLE drag the layer starts. The selection shortcut is left out on purpose: it would read
+ /// Explorer's hidden desktop view, and nothing shows that a given layer keeps that view's selection in step.
/// </summary>
internal static bool StandsForDesktop(nint window, nint rootOwner, string? rootOwnerClass) =>
rootOwner != 0 && rootOwner != window && IsDesktop(rootOwnerClass);
@@ -235,7 +238,7 @@ public sealed class WindowsPlatformServices : IPlatformServices
if (foreground == 0)
return 0;
var root = NativeMethods.GetAncestor(foreground, NativeMethods.GA_ROOT);
- return DesktopOrSelf(root == 0 ? foreground : root);
+ return root == 0 ? foreground : root;
}
public int SystemDragThreshold => Math.Max(2, NativeMethods.GetSystemMetrics(NativeMethods.SM_CXDRAG));
@@ -402,7 +405,7 @@ public sealed class WindowsPlatformServices : IPlatformServices
private static nint RootWindowAt(int x, int y)
{
var hwnd = NativeMethods.WindowFromPoint(new NativeMethods.POINT { X = x, Y = y });
- return hwnd == 0 ? 0 : DesktopOrSelf(NativeMethods.GetAncestor(hwnd, NativeMethods.GA_ROOT));
+ return hwnd == 0 ? 0 : NativeMethods.GetAncestor(hwnd, NativeMethods.GA_ROOT);
}
private static string? ProcessNameOf(nint hwnd)