mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-29 02:11:28 -06:00
Merge pull request #186 from KiranNiranjan/ELECTRON-118
Electron-118 (Screen snippet always on top)
This commit is contained in:
commit
5694c534b8
@ -10,10 +10,12 @@ const path = require('path');
|
|||||||
const { isMac, isDevEnv } = require('../utils/misc.js');
|
const { isMac, isDevEnv } = require('../utils/misc.js');
|
||||||
const log = require('../log.js');
|
const log = require('../log.js');
|
||||||
const logLevels = require('../enums/logLevels.js');
|
const logLevels = require('../enums/logLevels.js');
|
||||||
|
const eventEmitter = require('.././eventEmitter');
|
||||||
|
|
||||||
// static ref to child process, only allow one screen snippet at time, so
|
// static ref to child process, only allow one screen snippet at time, so
|
||||||
// hold ref to prev, so can kill before starting next snippet.
|
// hold ref to prev, so can kill before starting next snippet.
|
||||||
let child;
|
let child;
|
||||||
|
let isAlwaysOnTop;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Captures a user selected portion of the monitor and returns jpeg image
|
* Captures a user selected portion of the monitor and returns jpeg image
|
||||||
@ -61,6 +63,17 @@ class ScreenSnippet {
|
|||||||
captureUtil = path.join(execPath, 'ScreenSnippet.exe');
|
captureUtil = path.join(execPath, 'ScreenSnippet.exe');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Method to verify and disable always on top property
|
||||||
|
// as an issue with the ScreenSnippet.exe not being on top
|
||||||
|
// of the electron wrapper
|
||||||
|
const windows = electron.BrowserWindow.getAllWindows();
|
||||||
|
if (windows && windows.length > 0) {
|
||||||
|
isAlwaysOnTop = windows[ 0 ].isAlwaysOnTop();
|
||||||
|
if (isAlwaysOnTop) {
|
||||||
|
eventEmitter.emit('isAlwaysOnTop', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
captureUtilArgs = [outputFileName];
|
captureUtilArgs = [outputFileName];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,6 +85,10 @@ class ScreenSnippet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
child = childProcess.execFile(captureUtil, captureUtilArgs, (error) => {
|
child = childProcess.execFile(captureUtil, captureUtilArgs, (error) => {
|
||||||
|
// Method to reset always on top feature
|
||||||
|
if (isAlwaysOnTop) {
|
||||||
|
eventEmitter.emit('isAlwaysOnTop', true);
|
||||||
|
}
|
||||||
// will be called when child process exits.
|
// will be called when child process exits.
|
||||||
if (error && error.killed) {
|
if (error && error.killed) {
|
||||||
// processs was killed, just resolve with no data.
|
// processs was killed, just resolve with no data.
|
||||||
|
Loading…
Reference in New Issue
Block a user