From 4355feecdb10269c78e90975aa527f54efa2b2ce Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sun, 28 Apr 2024 18:39:40 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E5=9C=A8=E6=AD=8C=E8=AF=8D=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E7=BB=93=E6=9D=9F=E5=90=8E=E6=B8=85=E7=90=86=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E9=98=B4=E5=BD=B1=EF=BC=8C=E7=BC=93=E8=A7=A3Mac?= =?UTF-8?q?=E4=B8=8B=E6=A1=8C=E9=9D=A2=E6=AD=8C=E8=AF=8D=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E6=AE=8B=E7=95=99=E9=98=B4=E5=BD=B1=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1f6a6bbb39a754cfec9fdd08316a066eb9e05457. --- publish/changeLog.md | 1 - src/common/ipcNames.ts | 1 - src/main/modules/winLyric/main.ts | 5 ----- src/main/modules/winLyric/rendererEvent.ts | 6 +----- .../components/layout/LyricHorizontal/useLyric.js | 11 +++-------- .../components/layout/LyricVertical/useLyric.js | 11 +++-------- src/renderer-lyric/utils/ipc.ts | 5 ----- 7 files changed, 7 insertions(+), 33 deletions(-) diff --git a/publish/changeLog.md b/publish/changeLog.md index 99497615..23b6b7a9 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -10,7 +10,6 @@ - 修复存在多级弹窗时的背景显示问题 - 增大在线导入自定义源文件的大小限制问题(#1857) -- 在歌词滚动结束后清理窗口阴影,缓解Mac下桌面歌词出现残留阴影的问题 ### 变更 diff --git a/src/common/ipcNames.ts b/src/common/ipcNames.ts index 8632f14a..d2d5d026 100644 --- a/src/common/ipcNames.ts +++ b/src/common/ipcNames.ts @@ -165,7 +165,6 @@ const modules = { key_down: 'key_down', request_main_window_channel: 'request_main_window_channel', provide_main_window_channel: 'provide_main_window_channel', - invalidate_shadow: 'invalidate_shadow', }, hotKey: { enable: 'enable', diff --git a/src/main/modules/winLyric/main.ts b/src/main/modules/winLyric/main.ts index 15e4ed2f..c8732c18 100644 --- a/src/main/modules/winLyric/main.ts +++ b/src/main/modules/winLyric/main.ts @@ -195,11 +195,6 @@ 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 diff --git a/src/main/modules/winLyric/rendererEvent.ts b/src/main/modules/winLyric/rendererEvent.ts index a2e97202..e08daddc 100644 --- a/src/main/modules/winLyric/rendererEvent.ts +++ b/src/main/modules/winLyric/rendererEvent.ts @@ -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, invalidateShadow, sendEvent, setBounds } from './main' +import { getBounds, getMainFrame, sendEvent, setBounds } from './main' import { MessageChannelMain } from 'electron' @@ -29,10 +29,6 @@ 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 ... diff --git a/src/renderer-lyric/components/layout/LyricHorizontal/useLyric.js b/src/renderer-lyric/components/layout/LyricHorizontal/useLyric.js index fdca7da7..10336722 100644 --- a/src/renderer-lyric/components/layout/LyricHorizontal/useLyric.js +++ b/src/renderer-lyric/components/layout/LyricHorizontal/useLyric.js @@ -2,7 +2,7 @@ import { ref, onMounted, onBeforeUnmount, watch, nextTick } from '@common/utils/ import { scrollTo } from '@common/utils/renderer' import { lyric } from '@lyric/store/lyric' import { isPlay, setting } from '@lyric/store/state' -import { invalidateShadow, setWindowBounds } from '@lyric/utils/ipc' +import { setWindowBounds } from '@lyric/utils/ipc' const getOffsetTop = (contentHeight, lineHeight) => { switch (setting['desktopLyric.scrollAlign']) { @@ -45,13 +45,9 @@ export default (isComputeHeight) => { offset = prevActiveLine < lyric.line ? ((dom_lines[prevActiveLine]?.clientHeight ?? 0) - prevLineHeight) : 0 // console.log(prevActiveLine, dom_lines[prevActiveLine]?.clientHeight ?? 0, prevLineHeight, offset) } - cancelScrollFn = scrollTo(dom_lyric.value, dom_p ? (dom_p.offsetTop - offset - getOffsetTop(dom_lyric.value.clientHeight, dom_p.clientHeight)) : 0, duration, () => { - invalidateShadow() - }) + cancelScrollFn = scrollTo(dom_lyric.value, dom_p ? (dom_p.offsetTop - offset - getOffsetTop(dom_lyric.value.clientHeight, dom_p.clientHeight)) : 0, duration) } else { - cancelScrollFn = scrollTo(dom_lyric.value, 0, duration, () => { - invalidateShadow() - }) + cancelScrollFn = scrollTo(dom_lyric.value, 0, duration) } } const clearLyricScrollTimeout = () => { @@ -162,7 +158,6 @@ export default (isComputeHeight) => { setLyric(lines) } else { cancelScrollFn = scrollTo(dom_lyric.value, 0, 300, () => { - invalidateShadow() if (lyric.lines !== lines) return setLyric(lines) }, 50) diff --git a/src/renderer-lyric/components/layout/LyricVertical/useLyric.js b/src/renderer-lyric/components/layout/LyricVertical/useLyric.js index 6c64b191..2648ee03 100644 --- a/src/renderer-lyric/components/layout/LyricVertical/useLyric.js +++ b/src/renderer-lyric/components/layout/LyricVertical/useLyric.js @@ -2,7 +2,7 @@ import { ref, onMounted, onBeforeUnmount, watch, nextTick } from '@common/utils/ import { scrollXRTo } from '@common/utils/renderer' import { lyric } from '@lyric/store/lyric' import { isPlay, setting } from '@lyric/store/state' -import { invalidateShadow, setWindowBounds } from '@lyric/utils/ipc' +import { setWindowBounds } from '@lyric/utils/ipc' const getOffsetTop = (contentWidth, lineWidth) => { switch (setting['desktopLyric.scrollAlign']) { @@ -45,13 +45,9 @@ export default (isComputeWidth) => { offset = prevActiveLine < lyric.line ? ((dom_lines[prevActiveLine]?.clientWidth ?? 0) - prevLineWidth) : 0 // console.log(prevActiveLine, dom_lines[prevActiveLine]?.clientHeight ?? 0, prevLineWidth, offset) } - cancelScrollFn = scrollXRTo(dom_lyric.value, dom_p ? (dom_p.offsetLeft + offset - getOffsetTop(dom_lyric.value.clientWidth, dom_p.clientWidth)) : 0, duration, () => { - invalidateShadow() - }) + cancelScrollFn = scrollXRTo(dom_lyric.value, dom_p ? (dom_p.offsetLeft + offset - getOffsetTop(dom_lyric.value.clientWidth, dom_p.clientWidth)) : 0, duration) } else { - cancelScrollFn = scrollXRTo(dom_lyric.value, 0, duration, () => { - invalidateShadow() - }) + cancelScrollFn = scrollXRTo(dom_lyric.value, 0, duration) } } const clearLyricScrollTimeout = () => { @@ -162,7 +158,6 @@ export default (isComputeWidth) => { setLyric(lines) } else { cancelScrollFn = scrollXRTo(dom_lyric.value, 0, 300, () => { - invalidateShadow() if (lyric.lines !== lines) return setLyric(lines) }, 50) diff --git a/src/renderer-lyric/utils/ipc.ts b/src/renderer-lyric/utils/ipc.ts index f476f687..346dfa1e 100644 --- a/src/renderer-lyric/utils/ipc.ts +++ b/src/renderer-lyric/utils/ipc.ts @@ -1,6 +1,5 @@ import { rendererSend, rendererInvoke, rendererOn, rendererOff } from '@common/rendererIpc' import { CMMON_EVENT_NAME, WIN_LYRIC_RENDERER_EVENT_NAME } from '@common/ipcNames' -import { isMac } from '@common/utils' type RemoveListener = () => void @@ -19,10 +18,6 @@ export const onSettingChanged = (listener: LX.IpcRendererEventListenerParams { rendererSend(WIN_LYRIC_RENDERER_EVENT_NAME.set_win_bounds, bounds) } -export const invalidateShadow = () => { - if (!isMac) return - rendererSend(WIN_LYRIC_RENDERER_EVENT_NAME.invalidate_shadow) -} export const sendConnectMainWindowEvent = () => { rendererSend(WIN_LYRIC_RENDERER_EVENT_NAME.request_main_window_channel)