修复 Windows 下桌面歌词最小高度与宽度设置问题,允许更小的桌面歌词窗口宽度(#2244)
parent
1f8df84b87
commit
92c9808bfb
|
@ -1,5 +1,9 @@
|
||||||
### 修复
|
### 修复
|
||||||
|
|
||||||
- 修复 Windows 下桌面歌词最小高度设置问题(#2244)
|
- 修复 Windows 下桌面歌词最小高度与宽度设置问题(#2244)
|
||||||
- 修复 Windows 下界面缩放后移动桌面歌词会改变歌词窗口大小的问题(#2244)
|
- 修复 Windows 下界面缩放后移动桌面歌词会改变歌词窗口大小的问题(#2244)
|
||||||
- 修复 tx 歌单搜索名字、描述出现乱码的问题(#2250)
|
- 修复 tx 歌单搜索名字、描述出现乱码的问题(#2250)
|
||||||
|
|
||||||
|
### 优化
|
||||||
|
|
||||||
|
- 允许更小的桌面歌词窗口宽度
|
||||||
|
|
|
@ -162,6 +162,7 @@ const modules = {
|
||||||
on_config_change: 'on_config_change',
|
on_config_change: 'on_config_change',
|
||||||
main_window_inited: 'main_window_inited',
|
main_window_inited: 'main_window_inited',
|
||||||
set_win_bounds: 'set_win_bounds',
|
set_win_bounds: 'set_win_bounds',
|
||||||
|
set_win_resizeable: 'set_win_resizeable',
|
||||||
key_down: 'key_down',
|
key_down: 'key_down',
|
||||||
request_main_window_channel: 'request_main_window_channel',
|
request_main_window_channel: 'request_main_window_channel',
|
||||||
provide_main_window_channel: 'provide_main_window_channel',
|
provide_main_window_channel: 'provide_main_window_channel',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import { BrowserWindow } from 'electron'
|
import { BrowserWindow } from 'electron'
|
||||||
import { debounce, getPlatform, isLinux, isWin } from '@common/utils'
|
import { debounce, getPlatform, isLinux, isWin } from '@common/utils'
|
||||||
import { initWindowSize } from './utils'
|
import { initWindowSize, minHeight, minWidth } from './utils'
|
||||||
import { mainSend } from '@common/mainIpc'
|
import { mainSend } from '@common/mainIpc'
|
||||||
import { encodePath } from '@common/utils/electron'
|
import { encodePath } from '@common/utils/electron'
|
||||||
|
|
||||||
|
@ -115,8 +115,8 @@ export const createWindow = () => {
|
||||||
width: winSize.width,
|
width: winSize.width,
|
||||||
x: winSize.x,
|
x: winSize.x,
|
||||||
y: winSize.y,
|
y: winSize.y,
|
||||||
minWidth: 380,
|
minWidth,
|
||||||
minHeight: 38,
|
minHeight,
|
||||||
useContentSize: true,
|
useContentSize: true,
|
||||||
frame: false,
|
frame: false,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
|
@ -160,6 +160,11 @@ export const showWindow = () => {
|
||||||
browserWindow.show()
|
browserWindow.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const setResizeable = (isResizeable: boolean) => {
|
||||||
|
if (!browserWindow) return
|
||||||
|
browserWindow.setResizable(isResizeable)
|
||||||
|
}
|
||||||
|
|
||||||
export const sendEvent = <T = any>(name: string, params?: T) => {
|
export const sendEvent = <T = any>(name: string, params?: T) => {
|
||||||
if (!browserWindow) return
|
if (!browserWindow) return
|
||||||
mainSend(browserWindow, name, params)
|
mainSend(browserWindow, name, params)
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { mainOn, mainHandle } from '@common/mainIpc'
|
||||||
import { WIN_LYRIC_RENDERER_EVENT_NAME } from '@common/ipcNames'
|
import { WIN_LYRIC_RENDERER_EVENT_NAME } from '@common/ipcNames'
|
||||||
import { buildLyricConfig, getLyricWindowBounds } from './utils'
|
import { buildLyricConfig, getLyricWindowBounds } from './utils'
|
||||||
import { sendNewDesktopLyricClient } from '@main/modules/winMain'
|
import { sendNewDesktopLyricClient } from '@main/modules/winMain'
|
||||||
import { getBounds, getMainFrame, sendEvent, setBounds } from './main'
|
import { getBounds, getMainFrame, sendEvent, setBounds, setResizeable } from './main'
|
||||||
import { MessageChannelMain } from 'electron'
|
import { MessageChannelMain } from 'electron'
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,6 +29,10 @@ export default () => {
|
||||||
setBounds(getLyricWindowBounds(getBounds(), options))
|
setBounds(getLyricWindowBounds(getBounds(), options))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mainOn<boolean>(WIN_LYRIC_RENDERER_EVENT_NAME.set_win_resizeable, ({ params: resizable }) => {
|
||||||
|
setResizeable(resizable)
|
||||||
|
})
|
||||||
|
|
||||||
mainOn(WIN_LYRIC_RENDERER_EVENT_NAME.request_main_window_channel, ({ event }) => {
|
mainOn(WIN_LYRIC_RENDERER_EVENT_NAME.request_main_window_channel, ({ event }) => {
|
||||||
if (event.senderFrame !== getMainFrame()) return
|
if (event.senderFrame !== getMainFrame()) return
|
||||||
// Create a new channel ...
|
// Create a new channel ...
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// 设置窗口位置、大小
|
// 设置窗口位置、大小
|
||||||
export let minWidth = 80
|
export let minWidth = 38
|
||||||
export let minHeight = 38
|
export let minHeight = 38
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { ref, onMounted, onBeforeUnmount, watch, nextTick } from '@common/utils/
|
||||||
import { scrollTo } from '@common/utils/renderer'
|
import { scrollTo } from '@common/utils/renderer'
|
||||||
import { lyric } from '@lyric/store/lyric'
|
import { lyric } from '@lyric/store/lyric'
|
||||||
import { isPlay, setting } from '@lyric/store/state'
|
import { isPlay, setting } from '@lyric/store/state'
|
||||||
import { setWindowBounds } from '@lyric/utils/ipc'
|
import { setWindowBounds, setWindowResizeable } from '@lyric/utils/ipc'
|
||||||
import { isWin } from '@common/utils'
|
import { isWin } from '@common/utils'
|
||||||
|
|
||||||
const getOffsetTop = (contentHeight, lineHeight) => {
|
const getOffsetTop = (contentHeight, lineHeight) => {
|
||||||
|
@ -87,6 +87,8 @@ export default (isComputeHeight) => {
|
||||||
winEvent.msDownY = y
|
winEvent.msDownY = y
|
||||||
winEvent.windowW = window.innerWidth
|
winEvent.windowW = window.innerWidth
|
||||||
winEvent.windowH = window.innerHeight
|
winEvent.windowH = window.innerHeight
|
||||||
|
// https://github.com/lyswhut/lx-music-desktop/issues/2244
|
||||||
|
if (isWin) setWindowResizeable(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleLyricMouseDown = event => {
|
const handleLyricMouseDown = event => {
|
||||||
|
@ -101,6 +103,7 @@ export default (isComputeHeight) => {
|
||||||
const handleMouseMsUp = () => {
|
const handleMouseMsUp = () => {
|
||||||
isMsDown.value = false
|
isMsDown.value = false
|
||||||
winEvent.isMsDown = false
|
winEvent.isMsDown = false
|
||||||
|
if (isWin) setWindowResizeable(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleMove = (x, y) => {
|
const handleMove = (x, y) => {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { ref, onMounted, onBeforeUnmount, watch, nextTick } from '@common/utils/
|
||||||
import { scrollXRTo } from '@common/utils/renderer'
|
import { scrollXRTo } from '@common/utils/renderer'
|
||||||
import { lyric } from '@lyric/store/lyric'
|
import { lyric } from '@lyric/store/lyric'
|
||||||
import { isPlay, setting } from '@lyric/store/state'
|
import { isPlay, setting } from '@lyric/store/state'
|
||||||
import { setWindowBounds } from '@lyric/utils/ipc'
|
import { setWindowBounds, setWindowResizeable } from '@lyric/utils/ipc'
|
||||||
import { isWin } from '@common/utils'
|
import { isWin } from '@common/utils'
|
||||||
|
|
||||||
const getOffsetTop = (contentWidth, lineWidth) => {
|
const getOffsetTop = (contentWidth, lineWidth) => {
|
||||||
|
@ -87,6 +87,8 @@ export default (isComputeWidth) => {
|
||||||
winEvent.msDownY = y
|
winEvent.msDownY = y
|
||||||
winEvent.windowW = window.innerWidth
|
winEvent.windowW = window.innerWidth
|
||||||
winEvent.windowH = window.innerHeight
|
winEvent.windowH = window.innerHeight
|
||||||
|
// https://github.com/lyswhut/lx-music-desktop/issues/2244
|
||||||
|
if (isWin) setWindowResizeable(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleLyricMouseDown = event => {
|
const handleLyricMouseDown = event => {
|
||||||
|
@ -101,6 +103,7 @@ export default (isComputeWidth) => {
|
||||||
const handleMouseMsUp = () => {
|
const handleMouseMsUp = () => {
|
||||||
isMsDown.value = false
|
isMsDown.value = false
|
||||||
winEvent.isMsDown = false
|
winEvent.isMsDown = false
|
||||||
|
if (isWin) setWindowResizeable(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleMove = (x, y) => {
|
const handleMove = (x, y) => {
|
||||||
|
|
|
@ -18,6 +18,9 @@ export const onSettingChanged = (listener: LX.IpcRendererEventListenerParams<Par
|
||||||
export const setWindowBounds = (bounds: LX.DesktopLyric.NewBounds) => {
|
export const setWindowBounds = (bounds: LX.DesktopLyric.NewBounds) => {
|
||||||
rendererSend<LX.DesktopLyric.NewBounds>(WIN_LYRIC_RENDERER_EVENT_NAME.set_win_bounds, bounds)
|
rendererSend<LX.DesktopLyric.NewBounds>(WIN_LYRIC_RENDERER_EVENT_NAME.set_win_bounds, bounds)
|
||||||
}
|
}
|
||||||
|
export const setWindowResizeable = (resizable: boolean) => {
|
||||||
|
rendererSend<boolean>(WIN_LYRIC_RENDERER_EVENT_NAME.set_win_resizeable, resizable)
|
||||||
|
}
|
||||||
|
|
||||||
export const sendConnectMainWindowEvent = () => {
|
export const sendConnectMainWindowEvent = () => {
|
||||||
rendererSend(WIN_LYRIC_RENDERER_EVENT_NAME.request_main_window_channel)
|
rendererSend(WIN_LYRIC_RENDERER_EVENT_NAME.request_main_window_channel)
|
||||||
|
|
Loading…
Reference in New Issue