fix electron titlebar context menu freeze
This commit is contained in:
@@ -3119,6 +3119,16 @@ function attachDevToolsShortcut(win: BrowserWindow): void {
|
||||
})
|
||||
}
|
||||
|
||||
function suppressSystemContextMenu(win: BrowserWindow): void {
|
||||
type SystemContextMenuWindow = BrowserWindow & {
|
||||
on(event: 'system-context-menu', listener: (event: { preventDefault: () => void }) => void): BrowserWindow
|
||||
}
|
||||
|
||||
;(win as SystemContextMenuWindow).on('system-context-menu', (event) => {
|
||||
event.preventDefault()
|
||||
})
|
||||
}
|
||||
|
||||
function toggleFocusedDevTools(): void {
|
||||
const target = BrowserWindow.getFocusedWindow()
|
||||
if (!target) return
|
||||
@@ -3178,6 +3188,7 @@ function createWindow(): void {
|
||||
})
|
||||
|
||||
attachDevToolsShortcut(mainWindow)
|
||||
suppressSystemContextMenu(mainWindow)
|
||||
mainWindow.once('ready-to-show', () => {
|
||||
setTimeout(() => {
|
||||
splashWindow?.close()
|
||||
|
||||
Reference in New Issue
Block a user