mirror of
https://github.com/finos/SymphonyElectron.git
synced 2026-10-25 14:20:04 -05:00
SDA-4867 - Apply workaround for focus issue (#2362)
This commit is contained in:
1 parent
e0daf40ad3
commit
db6442ba6a
1 file changed
+29
-2
@@ -6,13 +6,14 @@ import {
|
||||
session,
|
||||
} from 'electron';
|
||||
import { NOTIFICATION_WINDOW_TITLE } from '../common/api-interface';
|
||||
import { isDevEnv, isMac } from '../common/env';
|
||||
import { isDevEnv, isMac, isWindowsOS } from '../common/env';
|
||||
import { logger } from '../common/logger';
|
||||
import { windowHandler } from './window-handler';
|
||||
import { createComponentWindow } from './window-utils';
|
||||
import { createComponentWindow, windowExists } from './window-utils';
|
||||
|
||||
class DisplayMediaRequestHandler {
|
||||
private screenPickerWindow: BrowserWindow | null = null;
|
||||
private screenPickerPlaceholderWindow: BrowserWindow | null = null;
|
||||
|
||||
/**
|
||||
* Display media request handler initialization
|
||||
@@ -65,6 +66,16 @@ class DisplayMediaRequestHandler {
|
||||
this.screenPickerWindow.on('closed', () => {
|
||||
this.screenPickerWindow = null;
|
||||
ipcMain.removeAllListeners('screen-source-select');
|
||||
this.screenPickerWindow = null;
|
||||
if (isWindowsOS) {
|
||||
if (
|
||||
this.screenPickerPlaceholderWindow &&
|
||||
windowExists(this.screenPickerPlaceholderWindow)
|
||||
) {
|
||||
this.screenPickerPlaceholderWindow.close();
|
||||
this.screenPickerPlaceholderWindow = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.screenPickerWindow.webContents.once('did-finish-load', () => {
|
||||
@@ -100,6 +111,22 @@ class DisplayMediaRequestHandler {
|
||||
// @ts-ignore
|
||||
callback();
|
||||
} else {
|
||||
// SDA-3646 hack for macOS: whenever we try to close the penultimate window (here screensharing screen picker), Electron activates the last Electron window
|
||||
// This behaviour was observed while trying to upgrade from Electron 14 to Electron 17
|
||||
// Here the hack to solve that issue is to create a new invisible BrowserWindow.
|
||||
this.screenPickerPlaceholderWindow = new BrowserWindow({
|
||||
title: 'Screen sharing - Symphony',
|
||||
width: 0,
|
||||
height: 0,
|
||||
transparent: true,
|
||||
frame: false,
|
||||
x: 0,
|
||||
y: 0,
|
||||
resizable: false,
|
||||
movable: false,
|
||||
fullscreenable: false,
|
||||
});
|
||||
this.screenPickerPlaceholderWindow.show();
|
||||
callback({ video: source });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user