always keep default values when creating window

This commit is contained in:
theolivenbaum
2021-09-06 12:39:32 +02:00
parent 172f6ded3f
commit a3fb411d8a
2 changed files with 8 additions and 2 deletions

View File

@@ -126,10 +126,10 @@ namespace ElectronNET.API
if (options.X == -1 && options.Y == -1)
{
options.X = 0;
options.X = 0; //This is manually removed by the browserWindows.js code before creating the window
options.Y = 0;
BridgeConnector.Emit("createBrowserWindow", guid, JObject.FromObject(options, _jsonSerializer), loadUrl);
BridgeConnector.Emit("createBrowserWindow", guid, JObject.FromObject(options, _keepDefaultValuesSerializer), loadUrl);
}
else
{

View File

@@ -182,6 +182,12 @@ module.exports = (socket, app) => {
else if (!options.webPreferences) {
options = { ...options, webPreferences: { nodeIntegration: true, contextIsolation: false } };
}
if (options.x && options.y && options.x == 0 && options.y == 0) {
delete options.x;
delete options.y;
}
// we dont want to recreate the window when watch is ready.
if (app.commandLine.hasSwitch('watch') && app['mainWindowURL'] === loadUrl) {
window = app['mainWindow'];