mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
SDA-4452 Focus on current window after taking a screenshot (#2077)
* SDA-4422 Bug - Workaroud for frameless transparent windows titlebar being displayed * SDA-4452 Focus on current window after taking a screenshot * SDA-4452 Focus on current window after cancelling screenshot
This commit is contained in:
parent
bafe62616d
commit
0bb3f1449e
@ -186,8 +186,8 @@ class ScreenSnippet {
|
||||
currentWindowName,
|
||||
hideOnCapture,
|
||||
);
|
||||
this.uploadSnippet(webContents, hideOnCapture);
|
||||
this.closeSnippet(webContents);
|
||||
this.uploadSnippet(currentWindowObj, webContents, hideOnCapture);
|
||||
this.closeSnippet(currentWindowObj?.webContents);
|
||||
this.copyToClipboard();
|
||||
this.saveAs();
|
||||
return;
|
||||
@ -335,7 +335,11 @@ class ScreenSnippet {
|
||||
* Uploads a screen snippet
|
||||
* @param webContents A browser window's web contents object
|
||||
*/
|
||||
private uploadSnippet(webContents: WebContents, hideOnCapture?: boolean) {
|
||||
private uploadSnippet(
|
||||
focusedWindow: BrowserWindow | null,
|
||||
webContents: WebContents,
|
||||
hideOnCapture?: boolean,
|
||||
) {
|
||||
ipcMain.once(
|
||||
'upload-snippet',
|
||||
async (
|
||||
@ -362,7 +366,7 @@ class ScreenSnippet {
|
||||
`screen-snippet-handler: upload of screen capture failed with error: ${error}!`,
|
||||
);
|
||||
}
|
||||
webContents.focus();
|
||||
focusedWindow?.webContents.focus();
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -370,7 +374,7 @@ class ScreenSnippet {
|
||||
/**
|
||||
* Close the current snippet
|
||||
*/
|
||||
private closeSnippet(webContents: WebContents) {
|
||||
private closeSnippet(webContents: WebContents | undefined) {
|
||||
ipcMain.once(ScreenShotAnnotation.CLOSE, async (_event) => {
|
||||
try {
|
||||
windowHandler.closeSnippingToolWindow();
|
||||
@ -381,7 +385,6 @@ class ScreenSnippet {
|
||||
`screen-snippet-handler: close window failed with error: ${error}!`,
|
||||
);
|
||||
}
|
||||
|
||||
webContents?.focus();
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user