1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-03 00:32:17 +03:00

include xterm webgl renderer as a separate frontend

This commit is contained in:
Eugene Pankov 2019-06-05 22:16:24 +02:00
parent ac727885c4
commit 1c23db3b55
5 changed files with 21 additions and 8 deletions

View File

@ -12,6 +12,7 @@ h3.mb-3 Appearance
)
option(value='hterm') hterm
option(value='xterm') xterm
option(value='xterm-webgl') xterm (WebGL)
.form-line
.header

View File

@ -11,6 +11,7 @@ export class XTermFrontend extends Frontend {
enableResizing = true
xterm: Terminal
xtermCore: any
enableWebGL = false
private configuredFontSize = 0
private zoom = 0
private resizeHandler: () => void
@ -89,7 +90,11 @@ export class XTermFrontend extends Frontend {
attach (host: HTMLElement): void {
this.xterm.open(host)
this.opened = true
;(this.xterm as any).loadWebgl(false)
if (this.enableWebGL) {
(this.xterm as any).loadWebgl(false)
}
if (this.configService.store.terminal.ligatures) {
enableLigatures(this.xterm)
}
@ -220,3 +225,8 @@ export class XTermFrontend extends Frontend {
this.xterm.setOption('fontSize', this.configuredFontSize * Math.pow(1.1, this.zoom))
}
}
/** @hidden */
export class XTermWebGLFrontend extends XTermFrontend {
enableWebGL = true
}

View File

@ -52,7 +52,7 @@ import { WSLShellProvider } from './shells/wsl'
import { hterm } from './frontends/hterm'
import { Frontend } from './frontends/frontend'
import { HTermFrontend } from './frontends/htermFrontend'
import { XTermFrontend } from './frontends/xtermFrontend'
import { XTermFrontend, XTermWebGLFrontend } from './frontends/xtermFrontend'
/** @hidden */
@NgModule({
@ -217,5 +217,5 @@ export default class TerminalModule {
}
export { TerminalService, BaseSession, TerminalTabComponent, TerminalFrontendService, BaseTerminalTabComponent }
export { Frontend, XTermFrontend, HTermFrontend }
export { Frontend, XTermFrontend, XTermWebGLFrontend, HTermFrontend }
export * from './api'

View File

@ -321,7 +321,7 @@ export class SessionsService {
constructor (
log: LogService,
) {
//require('../bufferizedPTY')(nodePTY)
require('../bufferizedPTY')(nodePTY)
this.logger = log.create('sessions')
}

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'
import { ConfigService, ThemesService, HotkeysService } from 'terminus-core'
import { Frontend } from '../frontends/frontend'
import { HTermFrontend } from '../frontends/htermFrontend'
import { XTermFrontend } from '../frontends/xtermFrontend'
import { XTermFrontend, XTermWebGLFrontend } from '../frontends/xtermFrontend'
import { BaseSession } from '../services/sessions.service'
@Injectable({ providedIn: 'root' })
@ -18,9 +18,11 @@ export class TerminalFrontendService {
getFrontend (session?: BaseSession): Frontend {
if (!session) {
let frontend: Frontend = (this.config.store.terminal.frontend === 'xterm')
? new XTermFrontend()
: new HTermFrontend()
let frontend: Frontend = new ({
'xterm': XTermFrontend,
'xterm-webgl': XTermWebGLFrontend,
'hterm': HTermFrontend,
}[this.config.store.terminal.frontend])()
frontend.configService = this.config
frontend.themesService = this.themes
frontend.hotkeysService = this.hotkeys