mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Merge pull request #805 from johankwarnmarksymphony/master
feat: SDA-1553 Add screen-sharing-frame, for sharing screen
This commit is contained in:
commit
c326d8a9df
@ -84,6 +84,7 @@ export class WindowHandler {
|
|||||||
private aboutAppWindow: Electron.BrowserWindow | null = null;
|
private aboutAppWindow: Electron.BrowserWindow | null = null;
|
||||||
private screenPickerWindow: Electron.BrowserWindow | null = null;
|
private screenPickerWindow: Electron.BrowserWindow | null = null;
|
||||||
private screenSharingIndicatorWindow: Electron.BrowserWindow | null = null;
|
private screenSharingIndicatorWindow: Electron.BrowserWindow | null = null;
|
||||||
|
private screenSharingFrameWindow: Electron.BrowserWindow | null = null;
|
||||||
private basicAuthWindow: Electron.BrowserWindow | null = null;
|
private basicAuthWindow: Electron.BrowserWindow | null = null;
|
||||||
private notificationSettingsWindow: Electron.BrowserWindow | null = null;
|
private notificationSettingsWindow: Electron.BrowserWindow | null = null;
|
||||||
|
|
||||||
@ -362,6 +363,10 @@ export class WindowHandler {
|
|||||||
|
|
||||||
if (browserWindow && windowExists(browserWindow)) {
|
if (browserWindow && windowExists(browserWindow)) {
|
||||||
browserWindow.destroy();
|
browserWindow.destroy();
|
||||||
|
|
||||||
|
if (this.screenSharingFrameWindow && windowExists(this.screenSharingFrameWindow)) {
|
||||||
|
this.screenSharingFrameWindow.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -699,6 +704,20 @@ export class WindowHandler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (displayId !== '') {
|
||||||
|
const displays = electron.screen.getAllDisplays();
|
||||||
|
|
||||||
|
displays.forEach((element) => {
|
||||||
|
if (displayId === element.id.toString()) {
|
||||||
|
this.createScrenSharingFrameWindow('screen-sharing-frame',
|
||||||
|
element.workArea.width,
|
||||||
|
element.workArea.height,
|
||||||
|
element.workArea.x,
|
||||||
|
element.workArea.y);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.screenSharingIndicatorWindow = createComponentWindow('screen-sharing-indicator', opts);
|
this.screenSharingIndicatorWindow = createComponentWindow('screen-sharing-indicator', opts);
|
||||||
this.screenSharingIndicatorWindow.setVisibleOnAllWorkspaces(true);
|
this.screenSharingIndicatorWindow.setVisibleOnAllWorkspaces(true);
|
||||||
this.screenSharingIndicatorWindow.webContents.once('did-finish-load', () => {
|
this.screenSharingIndicatorWindow.webContents.once('did-finish-load', () => {
|
||||||
@ -723,6 +742,55 @@ export class WindowHandler {
|
|||||||
ipcMain.once('stop-screen-sharing', stopScreenSharing);
|
ipcMain.once('stop-screen-sharing', stopScreenSharing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a screen-sharing frame around the shared area
|
||||||
|
*/
|
||||||
|
public createScrenSharingFrameWindow(windowName: string, frameWidth: number, frameHeight: number, framePositionX: number, framePositionY: number): void {
|
||||||
|
|
||||||
|
// This prevents creating multiple instances of the
|
||||||
|
// about window
|
||||||
|
if (this.screenSharingFrameWindow && windowExists(this.screenSharingFrameWindow)) {
|
||||||
|
if (this.screenSharingFrameWindow.isMinimized()) {
|
||||||
|
this.screenSharingFrameWindow.restore();
|
||||||
|
}
|
||||||
|
this.screenSharingFrameWindow.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const allWindows = BrowserWindow.getAllWindows();
|
||||||
|
const selectedParentWindow = allWindows.find((window) => {
|
||||||
|
return (window as ICustomBrowserWindow).winName === windowName;
|
||||||
|
});
|
||||||
|
|
||||||
|
const opts: BrowserWindowConstructorOptions = this.getWindowOpts({
|
||||||
|
width: frameWidth,
|
||||||
|
height: frameHeight,
|
||||||
|
frame: false,
|
||||||
|
transparent: true,
|
||||||
|
alwaysOnTop: true,
|
||||||
|
}, {
|
||||||
|
devTools: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.mainWindow && windowExists(this.mainWindow) && this.mainWindow.isAlwaysOnTop()) {
|
||||||
|
opts.alwaysOnTop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isWindowsOS && selectedParentWindow) {
|
||||||
|
opts.parent = selectedParentWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.screenSharingFrameWindow = createComponentWindow('screen-sharing-frame', opts);
|
||||||
|
|
||||||
|
const area = this.screenSharingFrameWindow.getBounds();
|
||||||
|
area.x = framePositionX;
|
||||||
|
area.y = framePositionY;
|
||||||
|
this.screenSharingFrameWindow.setBounds(area);
|
||||||
|
|
||||||
|
this.screenSharingFrameWindow.setIgnoreMouseEvents(true);
|
||||||
|
this.screenSharingFrameWindow.setVisibleOnAllWorkspaces(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update version info on the about app window and more info window
|
* Update version info on the about app window and more info window
|
||||||
*/
|
*/
|
||||||
|
19
src/renderer/components/screen-sharing-frame.tsx
Normal file
19
src/renderer/components/screen-sharing-frame.tsx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import classNames from 'classnames';
|
||||||
|
import * as React from 'react';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Window that display app version and copyright info
|
||||||
|
*/
|
||||||
|
export default class ScreenSharingFrame extends React.Component<{}> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* main render function
|
||||||
|
*/
|
||||||
|
public render(): JSX.Element {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={classNames('ScreenSharingFrame')}>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -8,12 +8,14 @@ import BasicAuth from './components/basic-auth';
|
|||||||
import NotificationComp from './components/notification-comp';
|
import NotificationComp from './components/notification-comp';
|
||||||
import NotificationSettings from './components/notification-settings';
|
import NotificationSettings from './components/notification-settings';
|
||||||
import ScreenPicker from './components/screen-picker';
|
import ScreenPicker from './components/screen-picker';
|
||||||
|
import ScreenSharingFrame from './components/screen-sharing-frame';
|
||||||
import ScreenSharingIndicator from './components/screen-sharing-indicator';
|
import ScreenSharingIndicator from './components/screen-sharing-indicator';
|
||||||
|
|
||||||
const enum components {
|
const enum components {
|
||||||
aboutApp = 'about-app',
|
aboutApp = 'about-app',
|
||||||
screenPicker = 'screen-picker',
|
screenPicker = 'screen-picker',
|
||||||
screenSharingIndicator = 'screen-sharing-indicator',
|
screenSharingIndicator = 'screen-sharing-indicator',
|
||||||
|
screenSharingFrame = 'screen-sharing-frame',
|
||||||
basicAuth = 'basic-auth',
|
basicAuth = 'basic-auth',
|
||||||
notification = 'notification-comp',
|
notification = 'notification-comp',
|
||||||
notificationSettings = 'notification-settings',
|
notificationSettings = 'notification-settings',
|
||||||
@ -51,6 +53,10 @@ const load = () => {
|
|||||||
document.title = 'Screen Sharing Indicator - Symphony';
|
document.title = 'Screen Sharing Indicator - Symphony';
|
||||||
component = ScreenSharingIndicator;
|
component = ScreenSharingIndicator;
|
||||||
break;
|
break;
|
||||||
|
case components.screenSharingFrame:
|
||||||
|
loadStyle(components.screenSharingFrame);
|
||||||
|
component = ScreenSharingFrame;
|
||||||
|
break;
|
||||||
case components.basicAuth:
|
case components.basicAuth:
|
||||||
loadStyle(components.basicAuth);
|
loadStyle(components.basicAuth);
|
||||||
document.title = 'Basic Authentication - Symphony';
|
document.title = 'Basic Authentication - Symphony';
|
||||||
|
14
src/renderer/styles/screen-sharing-frame.less
Normal file
14
src/renderer/styles/screen-sharing-frame.less
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
html, body {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ScreenSharingFrame {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
box-shadow: 0 0 0 4px #EE3D3D inset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user