在歌词滚动结束后清理窗口阴影,缓解Mac下桌面歌词出现残留阴影的问题

This commit is contained in:
lyswhut
2024-04-24 18:51:53 +08:00
parent 10028cf500
commit 1f6a6bbb39
7 changed files with 33 additions and 7 deletions
+5
View File
@@ -194,6 +194,11 @@ export const getMainFrame = (): Electron.WebFrameMain | null => {
return browserWindow.webContents.mainFrame
}
export const invalidateShadow = () => {
if (!browserWindow) return
browserWindow.invalidateShadow()
}
interface AlwaysOnTopTools {
timeout: NodeJS.Timeout | null
setAlwaysOnTop: (isLoop: boolean) => void
+5 -1
View File
@@ -3,7 +3,7 @@ import { mainOn, mainHandle } from '@common/mainIpc'
import { WIN_LYRIC_RENDERER_EVENT_NAME } from '@common/ipcNames'
import { buildLyricConfig, getLyricWindowBounds } from './utils'
import { sendNewDesktopLyricClient } from '@main/modules/winMain'
import { getBounds, getMainFrame, sendEvent, setBounds } from './main'
import { getBounds, getMainFrame, invalidateShadow, sendEvent, setBounds } from './main'
import { MessageChannelMain } from 'electron'
@@ -29,6 +29,10 @@ export default () => {
setBounds(getLyricWindowBounds(getBounds(), options))
})
mainOn(WIN_LYRIC_RENDERER_EVENT_NAME.invalidate_shadow, () => {
invalidateShadow()
})
mainOn(WIN_LYRIC_RENDERER_EVENT_NAME.request_main_window_channel, ({ event }) => {
if (event.senderFrame !== getMainFrame()) return
// Create a new channel ...