Use screen module to get screen's available size.

In Chrome31 the window.screen.availHeight and availWidth are sometimes
0, this is a workaround of this bug.
This commit is contained in:
Cheng Zhao
2014-01-14 14:03:10 +08:00
parent 46c5f09721
commit 2023aeef97

View File

@@ -4,6 +4,7 @@ keytar = require 'keytar'
os = require 'os'
path = require 'path'
remote = require 'remote'
screen = require 'screen'
shell = require 'shell'
dialog = remote.require 'dialog'
app = remote.require 'app'
@@ -207,10 +208,11 @@ class Atom extends Model
# Private:
restoreWindowDimensions: ->
workAreaSize = screen.getPrimaryDisplay().workAreaSize
windowDimensions = @state.windowDimensions ? {}
{initialSize} = @getLoadSettings()
windowDimensions.height ?= initialSize?.height ? global.screen.availHeight
windowDimensions.width ?= initialSize?.width ? Math.min(global.screen.availWidth, 1024)
windowDimensions.height ?= initialSize?.height ? workAreaSize.height
windowDimensions.width ?= initialSize?.width ? Math.min(workAreaSize.width, 1024)
@setWindowDimensions(windowDimensions)
# Private: