From b2cd229d1734a75cff773c6d456d17c751fd907b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=A4der?= Date: Thu, 4 Jul 2024 18:01:45 +0200 Subject: [PATCH] Make sure UI loads when minimized. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #13798 Contributed on behalf of STMicroelectronics Signed-off-by: Thomas Mäder --- packages/core/src/browser/shell/split-panels.ts | 7 ++++--- .../src/electron-main/electron-main-application.ts | 10 ++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/core/src/browser/shell/split-panels.ts b/packages/core/src/browser/shell/split-panels.ts index cb3de57c26dd7..d9f59bdf4a97a 100644 --- a/packages/core/src/browser/shell/split-panels.ts +++ b/packages/core/src/browser/shell/split-panels.ts @@ -91,13 +91,14 @@ export class SplitPositionHandler { move.resolve = resolve; move.reject = reject; if (this.splitMoves.length === 0) { - window.requestAnimationFrame(this.animationFrame.bind(this)); + setTimeout(this.animationFrame.bind(this), 10); } this.splitMoves.push(move); }); } - protected animationFrame(time: number): void { + protected animationFrame(): void { + const time = Date.now(); const move = this.splitMoves[this.currentMoveIndex]; let rejectedOrResolved = false; if (move.ended || move.referenceWidget && move.referenceWidget.isHidden) { @@ -133,7 +134,7 @@ export class SplitPositionHandler { this.currentMoveIndex = 0; } if (this.splitMoves.length > 0) { - window.requestAnimationFrame(this.animationFrame.bind(this)); + setTimeout(this.animationFrame.bind(this)); } } diff --git a/packages/core/src/electron-main/electron-main-application.ts b/packages/core/src/electron-main/electron-main-application.ts index b004fd444d07a..5a895f7ca2221 100644 --- a/packages/core/src/electron-main/electron-main-application.ts +++ b/packages/core/src/electron-main/electron-main-application.ts @@ -15,8 +15,10 @@ // ***************************************************************************** import { inject, injectable, named } from 'inversify'; -import { screen, app, BrowserWindow, WebContents, Event as ElectronEvent, BrowserWindowConstructorOptions, nativeImage, - nativeTheme, shell, dialog } from '../../electron-shared/electron'; +import { + screen, app, BrowserWindow, WebContents, Event as ElectronEvent, BrowserWindowConstructorOptions, nativeImage, + nativeTheme, shell, dialog +} from '../../electron-shared/electron'; import * as path from 'path'; import { Argv } from 'yargs'; import { AddressInfo } from 'net'; @@ -350,6 +352,9 @@ export class ElectronMainApplication { alwaysOnTop: true, show: false, transparent: true, + webPreferences: { + backgroundThrottling: false + } }); if (this.isShowWindowEarly()) { @@ -458,6 +463,7 @@ export class ElectronMainApplication { // Setting the following option to `true` causes some features to break, somehow. // Issue: https://github.com/eclipse-theia/theia/issues/8577 nodeIntegrationInWorker: false, + backgroundThrottling: false, preload: path.resolve(this.globals.THEIA_APP_PROJECT_PATH, 'lib', 'frontend', 'preload.js').toString() }, ...this.config.electron?.windowOptions || {},