fix(window): hover effect of the minimize and close button does not disappear

`5bb4539e3f2d04288bf52164fdbf47bcaf949aea` was accidentally reverted in `8316c75c7836af254257d6be338d99c5c4c5923c`, so we reapply it here.
This commit is contained in:
Slinetrac
2025-12-12 17:27:05 +08:00
parent 8316c75c78
commit f0c7aca3ff
3 changed files with 13 additions and 4 deletions
+10 -2
View File
@@ -12,8 +12,16 @@ export const WindowProvider: React.FC<{ children: React.ReactNode }> = ({
const [decorated, setDecorated] = useState<boolean | null>(null);
const [maximized, setMaximized] = useState<boolean | null>(null);
const close = useCallback(() => currentWindow.close(), [currentWindow]);
const minimize = useCallback(() => currentWindow.minimize(), [currentWindow]);
const close = useCallback(async () => {
// Delay one frame so the UI can clear :hover before the window hides.
await new Promise((resolve) => setTimeout(resolve, 20));
await currentWindow.close();
}, [currentWindow]);
const minimize = useCallback(async () => {
// Delay one frame so the UI can clear :hover before the window hides.
await new Promise((resolve) => setTimeout(resolve, 10));
await currentWindow.minimize();
}, [currentWindow]);
useEffect(() => {
let isUnmounted = false;