Skip to content

Commit

Permalink
perf: fix frame bug
Browse files Browse the repository at this point in the history
  • Loading branch information
boxizen committed May 8, 2023
1 parent 2e03be1 commit 3109caf
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
setting_show,
} from './electron/constants/event'
import { PresetType, PanelVisible } from './@types'

interface Tips {
type: 'success' | 'error' | 'warning'
message: string
Expand Down
2 changes: 2 additions & 0 deletions src/electron/client/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
getPluginPrompt,
changeLanguage,
runScript,
setWinSize,
} from '../constants/event'

export const api = {
Expand All @@ -29,6 +30,7 @@ export const api = {
*/
ignoreWinMouse: (ignore: boolean) => ipcRenderer.send(winIgnoreMouse, ignore),
moveWindowPos: (pos: PosType) => ipcRenderer.send(winMouseMove, pos),
setWinSize: (w: number, h: number) => ipcRenderer.send(setWinSize, { w, h }),
setUsePreset: (preset: PresetType) => ipcRenderer.send(usePreset, preset),
jumpLink: (link: string) => ipcRenderer.send(jumpLink, link),
changeLanguage: (lng: Languages) => ipcRenderer.send(changeLanguage, lng),
Expand Down
7 changes: 6 additions & 1 deletion src/electron/client/window.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BrowserWindow, ipcMain } from 'electron'
import { winIgnoreMouse, winMouseMove } from '../constants/event'
import { winIgnoreMouse, winMouseMove, setWinSize } from '../constants/event'

export function setupWindowHandlers(win: BrowserWindow | null) {
ipcMain.on(winIgnoreMouse, (_, ignore) => {
Expand All @@ -9,4 +9,9 @@ export function setupWindowHandlers(win: BrowserWindow | null) {
ipcMain.on(winMouseMove, (_, pos) => {
win?.setPosition(pos.posX, pos.posY)
})

ipcMain.on(setWinSize, (_, size) => {
console.log('???win', size)
win?.setSize(size.w, size.h)
})
}
1 change: 1 addition & 0 deletions src/electron/constants/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const setPluginPrompt = 'setPluginPrompt'
export const getPluginPrompt = 'getPluginPrompt'
export const changeLanguage = 'changeLanguage'
export const runScript = 'runScript'
export const setWinSize = 'setWinSize'

// sender
export const clipboard_change = 'clipboard_change'
Expand Down
10 changes: 0 additions & 10 deletions src/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ function initWindow() {
win = new BrowserWindow({
resizable: false,
width: 800,
// TODO: autosize height
height: 600,
frame: false,
show: true,
Expand All @@ -50,15 +49,6 @@ function initWindow() {
},
})

// Plugin View
// const view = new BrowserView()
// win.setBrowserView(view)
// view.setBounds({ x: 0, y: 70, width: 800, height: 300 })
// view.webContents.loadURL('https://www.google.com')
// view.webContents.openDevTools({
// mode:'bottom'
// })

if (!app.isPackaged) {
win?.webContents.openDevTools({
mode: 'bottom',
Expand Down

0 comments on commit 3109caf

Please sign in to comment.