From d4fb1c1f8c574a53120cd79ce435271a9d869424 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 11 Aug 2014 10:22:56 +0800 Subject: [PATCH 1/2] Add spec for resizing window larger than screen. --- spec/api-browser-window-spec.coffee | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/api-browser-window-spec.coffee b/spec/api-browser-window-spec.coffee index 957ea271d092..d13a9fa78223 100644 --- a/spec/api-browser-window-spec.coffee +++ b/spec/api-browser-window-spec.coffee @@ -79,6 +79,18 @@ describe 'browser-window module', -> assert.equal after[0], size[0] assert.equal after[1], size[1] + it 'can set the window larger than screen', -> + # No way to reliably set size when window has not been shown on Linux. + return if process.platform is 'linux' + + size = require('screen').getPrimaryDisplay().size + size.width += 100 + size.height += 100 + w.setSize size.width, size.height + after = w.getSize() + assert.equal after[0], size.width + assert.equal after[1], size.height + describe 'BrowserWindow.setContentSize(width, height)', -> it 'sets the content size', -> # No way to reliably set size when window has not been shown on Linux. From 4b90c024207151efca50a861435ba533995e75be Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 11 Aug 2014 10:24:36 +0800 Subject: [PATCH 2/2] mac: Override system's default on resizing window no larger than screen. --- atom/browser/native_window_mac.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index cac5d63e0202..885eb3b0f7d4 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -120,6 +120,11 @@ static const CGFloat kAtomWindowCornerRadius = 4.0; shell_ = shell; } +// Enable the window to be larger than screen. +- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen*)screen { + return frameRect; +} + - (IBAction)reload:(id)sender { shell_->GetWebContents()->GetController().ReloadIgnoringCache(false); }