mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-09 06:20:22 +08:00
fixed context menu and xterm mouse events (fixes #442)
This commit is contained in:
parent
a931d47c23
commit
87933edb96
@ -188,10 +188,6 @@ export class Window {
|
||||
ipcMain.on('window-set-title', (_event, title) => {
|
||||
this.window.setTitle(title)
|
||||
})
|
||||
|
||||
ipcMain.on('window-popup-context-menu', (_event, menuDefinition) => {
|
||||
Menu.buildFromTemplate(menuDefinition).popup({ window: this.window })
|
||||
})
|
||||
}
|
||||
|
||||
private destroy () {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { TouchBar, BrowserWindow } from 'electron'
|
||||
import { TouchBar, BrowserWindow, Menu } from 'electron'
|
||||
|
||||
@Injectable()
|
||||
export class ElectronService {
|
||||
@ -14,6 +14,7 @@ export class ElectronService {
|
||||
remote: any
|
||||
TouchBar: typeof TouchBar
|
||||
BrowserWindow: typeof BrowserWindow
|
||||
Menu: typeof Menu
|
||||
private electron: any
|
||||
|
||||
constructor () {
|
||||
@ -29,6 +30,7 @@ export class ElectronService {
|
||||
this.nativeImage = this.remote.nativeImage
|
||||
this.TouchBar = this.remote.TouchBar
|
||||
this.BrowserWindow = this.remote.BrowserWindow
|
||||
this.Menu = this.remote.Menu
|
||||
}
|
||||
|
||||
remoteRequire (name: string): any {
|
||||
|
@ -169,7 +169,7 @@ export class HostAppService {
|
||||
}
|
||||
|
||||
popupContextMenu (menuDefinition: Electron.MenuItemConstructorOptions[]) {
|
||||
this.electron.ipcRenderer.send('window-popup-context-menu', menuDefinition)
|
||||
this.electron.Menu.buildFromTemplate(menuDefinition).popup({})
|
||||
}
|
||||
|
||||
broadcastConfigChange () {
|
||||
|
@ -43,6 +43,10 @@ export class XTermFrontend extends Frontend {
|
||||
|
||||
host.addEventListener('dragOver', (event: any) => this.dragOver.next(event))
|
||||
host.addEventListener('drop', event => this.drop.next(event))
|
||||
|
||||
host.addEventListener('mousedown', event => this.mouseEvent.next(event))
|
||||
host.addEventListener('mouseup', event => this.mouseEvent.next(event))
|
||||
host.addEventListener('mousewheel', event => this.mouseEvent.next(event))
|
||||
}
|
||||
|
||||
detach (host: HTMLElement): void {
|
||||
|
Loading…
Reference in New Issue
Block a user