From 6fcd905d4f19e3f9f3f1cb8a82e60cd5ae2b89ec Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 8 Apr 2014 16:57:18 -0700 Subject: [PATCH] Use windowDimensions instead of initialSize --- src/browser/atom-application.coffee | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index c0f5636e8..402f00c15 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -172,7 +172,7 @@ class AtomApplication @on 'application:run-all-specs', -> @runSpecs(exitWhenDone: false, resourcePath: global.devResourcePath) @on 'application:run-benchmarks', -> @runBenchmarks() @on 'application:quit', -> app.quit() - @on 'application:new-window', -> @openPath(initialSize: @getFocusedWindowSize()) + @on 'application:new-window', -> @openPath(windowDimensions: @getFocusedWindowDimensions()) @on 'application:new-file', -> (@focusedWindow() ? this).openPath() @on 'application:open', -> @promptForPath() @on 'application:open-dev', -> @promptForPath(devMode: true) @@ -304,14 +304,15 @@ class AtomApplication focusedWindow: -> _.find @windows, (atomWindow) -> atomWindow.isFocused() - # Public: Get the height and width of the focused window. + # Public: Get the dimensions focused window. # - # Returns an object with height and width keys or null if there is no + # Returns an object with x, y height and width keys or null if there is no # focused window. - getFocusedWindowSize: -> + getFocusedWindowDimensions: -> if focusedWindow = @focusedWindow() [width, height] = focusedWindow.getSize() - {width, height} + [x, y] = focusedWindow.getPosition() + {x, y, width, height} else null @@ -340,9 +341,9 @@ class AtomApplication # Boolean of whether this should be opened in a new window. # + devMode: # Boolean to control the opened window's dev mode. - # + initialSize: + # + windowDimensions: # Object with height and width keys. - openPath: ({pathToOpen, pidToKillWhenClosed, newWindow, devMode, initialSize}={}) -> + openPath: ({pathToOpen, pidToKillWhenClosed, newWindow, devMode, windowDimensions}={}) -> if pathToOpen [basename, initialLine] = path.basename(pathToOpen).split(':') if initialLine @@ -362,7 +363,7 @@ class AtomApplication bootstrapScript ?= require.resolve('../window-bootstrap') resourcePath ?= @resourcePath - openedWindow = new AtomWindow({pathToOpen, initialLine, bootstrapScript, resourcePath, devMode, initialSize}) + openedWindow = new AtomWindow({pathToOpen, initialLine, bootstrapScript, resourcePath, devMode, windowDimensions}) if pidToKillWhenClosed? @pidsToOpenWindows[pidToKillWhenClosed] = openedWindow @@ -414,7 +415,7 @@ class AtomApplication if pack.urlMain packagePath = @packages.resolvePackagePath(packageName) bootstrapScript = path.resolve(packagePath, pack.urlMain) - new AtomWindow({bootstrapScript, @resourcePath, devMode, urlToOpen, initialSize: @getFocusedWindowSize()}) + new AtomWindow({bootstrapScript, @resourcePath, devMode, urlToOpen, windowDimensions: @getFocusedWindowDimensions()}) else console.log "Package '#{pack.name}' does not have a url main: #{urlToOpen}" else