Move window resize listener to render coordinator

This commit is contained in:
Daniel Imms
2019-05-18 19:22:51 -07:00
parent b64cc0a9de
commit 5f70b3f3be
2 changed files with 5 additions and 3 deletions
-3
View File
@@ -778,9 +778,6 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
this.register(this.onResize(() => this.renderer.onResize(this.cols, this.rows)));
this.register(this.addDisposableListener('blur', () => this.renderer.onBlur()));
this.register(this.addDisposableListener('focus', () => this.renderer.onFocus()));
// dprchange should handle this case, we need this as well for browsers that don't support the
// matchMedia query.
this.register(addDisposableDomListener(window, 'resize', () => this.renderer.onWindowResize(window.devicePixelRatio)));
this.register(this.charMeasure.onCharSizeChanged(() => this.renderer.onCharSizeChanged()));
this.register(this._renderCoordinator.onCanvasResize(() => this.viewport.syncScrollArea()));
+5
View File
@@ -8,6 +8,7 @@ import { RenderDebouncer } from '../ui/RenderDebouncer';
import { EventEmitter2, IEvent } from '../common/EventEmitter2';
import { Disposable } from '../common/Lifecycle';
import { ScreenDprMonitor } from '../../lib/ui/ScreenDprMonitor';
import { addDisposableDomListener } from '../ui/Lifecycle';
export class RenderCoordinator extends Disposable {
private _renderDebouncer: RenderDebouncer;
@@ -32,6 +33,10 @@ export class RenderCoordinator extends Disposable {
this._screenDprMonitor = new ScreenDprMonitor();
this._screenDprMonitor.setListener(() => this._renderer.onWindowResize(window.devicePixelRatio));
this.register(this._screenDprMonitor);
// dprchange should handle this case, we need this as well for browsers that don't support the
// matchMedia query.
this.register(addDisposableDomListener(window, 'resize', () => this._renderer.onWindowResize(window.devicePixelRatio)));
}
public refreshRows(start: number, end: number): void {