Skip to content

[OSX] Frameless, not-resizable window has wrong size #2552

Closed

Description

@atomicptr

When you try to create a frameless and not-resizable window with a specific size, Electron won't open it with the specified size (It's a bit bigger).

Example:

app.js

var app = require('app');
var BrowserWindow = require('browser-window')

var win = null;

app.on('window-all-closed', function() {
    app.quit();
});

app.on('ready', function() {
    win = new BrowserWindow({
        frame: false,
        resizable: false,
        width: 1024,
        height: 600
    });

    // and load the index.html of the app.
    win.loadUrl('file://' + __dirname + '/index.html');

    win.on('closed', function() {
        win = null;
    });
});

index.html

<!doctype html>
<style>
    body {
        background-color: yellow;
    }

    .test {
        position: absolute;
        top: 0px;
        left: 0px;
        width: 1024px;
        height: 600px;

        background-color: pink;
    }
</style>

<div class="test">

</div>

The window should be completely pink but as you can see in this screenshot the background also appears: wrong size

According to document.documentElement.clientHeight the current height is 622px.

I'm running this on OS X 10.10.4 and Electron v0.30.4

Activity

  1. photonstorm commented on Aug 21, 2015

    @photonstorm

    Just to say that I see this happen on Windows too (Electron v0.30.4) only in this case I get vertical and horizontal scroll bars appearing. It happens regardless if I have set resizeable or auto-hide-menu-bar - it seems to be getting some extra padding from somewhere not in the html file.

  2. sircharleswatson commented on Aug 22, 2015

    @sircharleswatson

    I'm noticing this as well. if I make a 100x100 window, it definitely comes up as a rectangle rather than a square.

  3. hokein commented on Aug 24, 2015

    @hokein
    Contributor

    If we remove resizable field in creating BrowserWindow, it works as expected.

  4. leshow commented on Aug 28, 2015

    @leshow

    also getting this bug on mac, I have a hack workaround while this is getting fixed:

    • set resizable: true in BrowserWindow opts (makes window correct height)
    • to stop resizing. in main.js/index.js:
    mainWindow.on('resize', function(e) {
    e.preventDefault();
    mainWindow.setContentSize(origW, origH);
    });

    it's a dirty hack I'd prefer not to do, hopefully this bug is fixed soon.

  5. smebberson commented on Sep 15, 2015

    @smebberson

    I'm also getting this bug...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions