From e756a89135342b66dca5e53910a67d540c5c7d37 Mon Sep 17 00:00:00 2001 From: Henry Castro Date: Mon, 11 Nov 2024 09:06:25 -0400 Subject: [PATCH] browser: slideshow: open presenter in secondary screen Change-Id: Ifa0410075ceb25b01797f6219356adc184a74b31 Signed-off-by: Henry Castro --- browser/src/slideshow/SlideShowPresenter.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/browser/src/slideshow/SlideShowPresenter.ts b/browser/src/slideshow/SlideShowPresenter.ts index d7b51b14e2d8..0cb888123d09 100644 --- a/browser/src/slideshow/SlideShowPresenter.ts +++ b/browser/src/slideshow/SlideShowPresenter.ts @@ -422,7 +422,7 @@ class SlideShowPresenter { else return this._slideShowWindowProxy.document; } - _doInWindowPresentation() { + async _doInWindowPresentation() { const popupTitle = _('Windowed Presentation: ') + this._map['wopi'].BaseFileName; const htmlContent = this._generateSlideWindowHtml(popupTitle); @@ -437,7 +437,20 @@ class SlideShowPresenter { this._getProxyDocumentNode().write(''); this._getProxyDocumentNode().close(); } else { - this._slideShowWindowProxy = window.open('', '_blank', 'popup'); + let options = 'popup'; + // if the device has more than one screen. + if ((window.screen as any).isExtended) { + const details = await (window as any).getScreenDetails(); + const secondary = details.screens.find(function (s: any) { + return s !== s.primaryScreen; + }); + options += + 'left=${secondary.availLeft},' + + 'top=${secondary.availTop},' + + 'width=${secondary.availWidth},' + + 'height=${secondary.availHeight}'; + } + this._slideShowWindowProxy = window.open('', '_blank', options); } if (!this._slideShowWindowProxy) {