message: Share screen hack
diff: @@ -157,6 +157,7 @@ export class WindowHandler {
  private aboutAppWindow: Electron.BrowserWindow | null = null;
  private welcomeScreenWindow: Electron.BrowserWindow | null = null;
  private screenPickerWindow: Electron.BrowserWindow | null = null;
  + private screenPickerPlaceholderWindow: Electron.BrowserWindow | null = null;
  private screenSharingIndicatorWindow: Electron.BrowserWindow | null = null;
  private screenSharingFrameWindow: Electron.BrowserWindow | null = null;
  private basicAuthWindow: Electron.BrowserWindow | null = null;
  @@ -902,6 +903,12 @@ export class WindowHandler {
  }
  break;
  case 'screen-sharing-indicator':
  + if (
  + this.screenPickerPlaceholderWindow &&
  + windowExists(this.screenPickerPlaceholderWindow)
  + ) {
  + this.screenPickerPlaceholderWindow.close();
  + }
  if (winKey) {
  const browserWindow = this.windows[winKey];
  @@ -1454,6 +1461,31 @@ export class WindowHandler {
  logger.info(`window-handler: screen-source-selected`, source, id);
  if (source == null) {
  this.execCmd(this.screenShareIndicatorFrameUtil, []);
  + if (
  + this.screenPickerPlaceholderWindow &&
  + windowExists(this.screenPickerPlaceholderWindow)
  + ) {
  + this.screenPickerPlaceholderWindow.close();
  + this.screenPickerPlaceholderWindow = null;
  + }
  + } 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.
  + if (isMac) {
  + this.screenPickerPlaceholderWindow = new BrowserWindow({
  + width: 0,
  + height: 0,
  + transparent: true,
  + frame: false,
  + x: 0,
  + y: 0,
  + resizable: false,
  + movable: false,
  + fullscreenable: false,
  + });
  + this.screenPickerPlaceholderWindow.show();
  + }
  }
  window.send('start-share' + id, source);
  