Child Window Migrates Every Open


#1

Not a huge issue, but I’m curious to know why a child window I ‘hide’ gets bumped up a few pixels every time I ‘show’. Here’s the creation code in my main.js file:

function createChild() {
  childWindow = new BrowserWindow({
    width: 400,
    height: 400,
    parent: mainWindow,
    modal: true,
    show: false, // Do not show initially
  });

  childWindow.on('close', function (event) {
    childWindow.hide();
    event.preventDefault();
  });

  childWindow.loadURL(url.format({
    pathname: path.join(__dirname, 'child.html'),
    protocol: 'file:',
    slashes: true,
  }));
}

Then I’m using IPC to “show” the hidden window. Each time it “shows” it’s a few pixels further up the screen.

Update:

Should be noted I’m on Ubuntu 16.04 with Unity, and the amount raised each time appears to be the height of the window’s top menu bar (with the buttons / menu items)