Show the preview window, when corresponding preference is enabled, above the editor but not above all windows on the screen (#3203)

This commit is contained in:
Arthur Pacaud
2021-10-28 21:11:03 +02:00
committed by GitHub
parent 67612009d1
commit c09d29a959
2 changed files with 6 additions and 3 deletions

View File

@@ -72,10 +72,13 @@ export default class LocalPreviewLauncher extends React.Component<
)
return;
const win = new BrowserWindow(this.state.previewBrowserWindowConfig);
const browserWindowOptions = {
...this.state.previewBrowserWindowConfig,
parent: this.state.alwaysOnTop ? BrowserWindow.getFocusedWindow() : null,
};
const win = new BrowserWindow(browserWindowOptions);
win.loadURL(`file://${this.state.previewGamePath}/index.html`);
win.setMenuBarVisibility(this.state.hideMenuBar);
win.setAlwaysOnTop(this.state.alwaysOnTop);
win.webContents.on('devtools-opened', () => {
this.setState({ devToolsOpen: true });
});

View File

@@ -319,7 +319,7 @@ const PreferencesDialog = ({ i18n, onClose }: Props) => {
labelPosition="right"
label={
<Trans>
Always display the preview window on top of others
Always display the preview window on top of the editor
</Trans>
}
/>