1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-11 07:07:32 +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='hterm') hterm
option(value='xterm') xterm option(value='xterm') xterm
option(value='xterm-webgl') xterm (WebGL)
.form-line .form-line
.header .header

View File

@ -11,6 +11,7 @@ export class XTermFrontend extends Frontend {
enableResizing = true enableResizing = true
xterm: Terminal xterm: Terminal
xtermCore: any xtermCore: any
enableWebGL = false
private configuredFontSize = 0 private configuredFontSize = 0
private zoom = 0 private zoom = 0
private resizeHandler: () => void private resizeHandler: () => void
@ -89,7 +90,11 @@ export class XTermFrontend extends Frontend {
attach (host: HTMLElement): void { attach (host: HTMLElement): void {
this.xterm.open(host) this.xterm.open(host)
this.opened = true this.opened = true
;(this.xterm as any).loadWebgl(false)
if (this.enableWebGL) {
(this.xterm as any).loadWebgl(false)
}
if (this.configService.store.terminal.ligatures) { if (this.configService.store.terminal.ligatures) {
enableLigatures(this.xterm) enableLigatures(this.xterm)
} }
@ -220,3 +225,8 @@ export class XTermFrontend extends Frontend {
this.xterm.setOption('fontSize', this.configuredFontSize * Math.pow(1.1, this.zoom)) 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 { hterm } from './frontends/hterm'
import { Frontend } from './frontends/frontend' import { Frontend } from './frontends/frontend'
import { HTermFrontend } from './frontends/htermFrontend' import { HTermFrontend } from './frontends/htermFrontend'
import { XTermFrontend } from './frontends/xtermFrontend' import { XTermFrontend, XTermWebGLFrontend } from './frontends/xtermFrontend'
/** @hidden */ /** @hidden */
@NgModule({ @NgModule({
@ -217,5 +217,5 @@ export default class TerminalModule {
} }
export { TerminalService, BaseSession, TerminalTabComponent, TerminalFrontendService, BaseTerminalTabComponent } export { TerminalService, BaseSession, TerminalTabComponent, TerminalFrontendService, BaseTerminalTabComponent }
export { Frontend, XTermFrontend, HTermFrontend } export { Frontend, XTermFrontend, XTermWebGLFrontend, HTermFrontend }
export * from './api' export * from './api'

View File

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

View File

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