11/*
2- * Copyright 2023-2024 Steve Xiao (stevexmh@qq.com) and contributors.
2+ * Copyright 2023-2025 Steve Xiao (stevexmh@qq.com) and contributors.
33 *
44 * 本源代码文件是属于 AMLL TTML Tool 项目的一部分。
55 * This source code file is a part of AMLL TTML Tool project.
99 * https://github.com/Steve-xmh/amll-ttml-tool/blob/main/LICENSE
1010 */
1111
12- import { Box , Button , Flex , Text , Theme } from "@radix-ui/themes" ;
13- import "@radix-ui/themes/styles.css" ;
1412import SuspensePlaceHolder from "$/components/SuspensePlaceHolder" ;
1513import { TouchSyncPanel } from "$/components/TouchSyncPanel" ;
14+ import { Box , Flex , Theme } from "@radix-ui/themes" ;
15+ import "@radix-ui/themes/styles.css" ;
1616import { getCurrentWindow } from "@tauri-apps/api/window" ;
17+ import { platform , version } from "@tauri-apps/plugin-os" ;
1718import { AnimatePresence , motion } from "framer-motion" ;
1819import { useAtomValue , useStore } from "jotai" ;
19- import { Suspense , lazy , useEffect } from "react" ;
20+ import { Suspense , lazy , useEffect , useState } from "react" ;
2021import { ToastContainer , toast } from "react-toastify" ;
22+ import semverGt from "semver/functions/gt" ;
2123import styles from "./App.module.css" ;
2224import AudioControls from "./components/AudioControls" ;
2325import DarkThemeDetector from "./components/DarkThemeDetector" ;
@@ -43,13 +45,24 @@ function App() {
4345 const isDarkTheme = useAtomValue ( isDarkThemeAtom ) ;
4446 const toolMode = useAtomValue ( toolModeAtom ) ;
4547 const showTouchSyncPanel = useAtomValue ( showTouchSyncPanelAtom ) ;
48+ const [ hasBackground , setHasBackground ] = useState ( false ) ;
4649 const store = useStore ( ) ;
50+
4751 if ( import . meta. env . TAURI_ENV_PLATFORM ) {
4852 // eslint-disable-next-line react-hooks/rules-of-hooks
4953 useEffect ( ( ) => {
50- const win = getCurrentWindow ( ) ;
54+ ( async ( ) => {
55+ const win = getCurrentWindow ( ) ;
56+ if ( platform ( ) === "windows" ) {
57+ if ( semverGt ( "10.0.22000" , version ( ) ) ) {
58+ setHasBackground ( true ) ;
59+ await win . clearEffects ( ) ;
60+ }
61+ }
62+ await new Promise ( ( r ) => requestAnimationFrame ( r ) ) ;
5163
52- win . show ( ) ;
64+ await win . show ( ) ;
65+ } ) ( ) ;
5366 } , [ ] ) ;
5467 }
5568
@@ -79,7 +92,7 @@ function App() {
7992 < Theme
8093 appearance = { isDarkTheme ? "dark" : "light" }
8194 panelBackground = "solid"
82- hasBackground = { ! import . meta . env . TAURI_ENV_PLATFORM }
95+ hasBackground = { hasBackground }
8396 accentColor = { isDarkTheme ? "jade" : "green" }
8497 className = { styles . radixTheme }
8598 onClick = { ( evt ) => {
0 commit comments