From cf40cded1708bb303be4a404b7aceddd196e1d46 Mon Sep 17 00:00:00 2001
From: Moli <13026959681@163.com>
Date: 星期三, 29 七月 2026 20:58:14 +0800
Subject: [PATCH] v1.0

---
 src/Moli.Desktop/Interop/Win32InteropService.cs |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/Moli.Desktop/Interop/Win32InteropService.cs b/src/Moli.Desktop/Interop/Win32InteropService.cs
index bf066f9..6bed968 100644
--- a/src/Moli.Desktop/Interop/Win32InteropService.cs
+++ b/src/Moli.Desktop/Interop/Win32InteropService.cs
@@ -79,6 +79,7 @@
 
     public void RestoreTopLevelWindow(IntPtr hwnd)
     {
+        RestoreTopLevelStyle(hwnd);
         NativeMethods.SetParent(hwnd, IntPtr.Zero);
         var error = NativeMethods.GetLastError();
         if (error != 0)
@@ -88,6 +89,18 @@
                 DiagnosticCodes.Win32InteropFailed,
                 "RestoreTopLevelWindow failed.",
                 new Dictionary<string, string> { ["hwnd"] = hwnd.ToString("X"), ["error"] = error.ToString() });
+        }
+
+        if (!NativeMethods.SetWindowPos(
+            hwnd,
+            IntPtr.Zero,
+            0,
+            0,
+            0,
+            0,
+            NativeMethods.SwpNoMove | NativeMethods.SwpNoSize | NativeMethods.SwpNoZOrder | NativeMethods.SwpNoActivate | NativeMethods.SwpFrameChanged))
+        {
+            RecordWin32Failure("RestoreTopLevelWindow.SetWindowPos", hwnd);
         }
     }
 
@@ -186,4 +199,11 @@
     {
         return new RectD(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top);
     }
+
+    private static void RestoreTopLevelStyle(IntPtr hwnd)
+    {
+        var current = unchecked((uint)NativeMethods.GetWindowLongPtr(hwnd, NativeMethods.GwlStyle).ToInt64());
+        var updated = (current | NativeMethods.WsPopup | NativeMethods.WsVisible) & ~NativeMethods.WsChild;
+        NativeMethods.SetWindowLongPtr(hwnd, NativeMethods.GwlStyle, new IntPtr(unchecked((int)updated)));
+    }
 }

--
Gitblit v1.9.1