mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user