const mate::Dictionary& options)
: content::WebContentsObserver(web_contents),
has_frame_(true),
+ enable_larger_than_screen_(false),
is_closed_(false),
node_integration_("except-iframe"),
has_dialog_attached_(false),
inspectable_web_contents_(
brightray::InspectableWebContents::Create(web_contents)) {
options.Get(switches::kFrame, &has_frame_);
+ options.Get(switches::kEnableLargerThanScreen, &enable_larger_than_screen_);
// Read icon before window is created.
options.Get(switches::kIcon, &icon_);
// Whether window has standard frame.
bool has_frame_;
+ // Whether window can be resized larger than screen.
+ bool enable_larger_than_screen_;
+
// Window icon.
gfx::ImageSkia icon_;
@end
@interface AtomNSWindow : EventProcessingWindow {
- @protected
+ @private
atom::NativeWindowMac* shell_;
+ bool enable_larger_than_screen_;
}
- (void)setShell:(atom::NativeWindowMac*)shell;
+- (void)setEnableLargerThanScreen:(bool)enable;
@end
@implementation AtomNSWindow
shell_ = shell;
}
+- (void)setEnableLargerThanScreen:(bool)enable {
+ enable_larger_than_screen_ = enable;
+}
+
// Enable the window to be larger than screen.
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen*)screen {
- return frameRect;
+ if (enable_larger_than_screen_)
+ return frameRect;
+ else
+ return [super constrainFrameRect:frameRect toScreen:screen];
}
- (IBAction)reload:(id)sender {
defer:YES];
[atomWindow setShell:this];
+ [atomWindow setEnableLargerThanScreen:enable_larger_than_screen_];
window_.reset(atomWindow);
AtomNSWindowDelegate* delegate =
menu_bar_alt_pressed_(false),
keyboard_event_handler_(new views::UnhandledKeyboardEventHandler),
use_content_size_(false),
- resizable_(true),
- // We need to set a default maximum window size here otherwise Windows
- // will not allow us to resize the window larger than scree.
- // Setting directly to INT_MAX somehow doesn't work, so we just devide
- // by 10, which should still be large enough.
- maximum_size_(INT_MAX / 10, INT_MAX / 10) {
+ resizable_(true) {
options.Get(switches::kResizable, &resizable_);
options.Get(switches::kTitle, &title_);
options.Get(switches::kAutoHideMenuBar, &menu_bar_autohide_);
+ if (enable_larger_than_screen_)
+ // We need to set a default maximum window size here otherwise Windows
+ // will not allow us to resize the window larger than scree.
+ // Setting directly to INT_MAX somehow doesn't work, so we just devide
+ // by 10, which should still be large enough.
+ maximum_size_.set(INT_MAX / 10, INT_MAX / 10);
+
int width = 800, height = 600;
options.Get(switches::kWidth, &width);
options.Get(switches::kHeight, &height);
// The menu bar is hidden unless "Alt" is pressed.
const char kAutoHideMenuBar[] = "auto-hide-menu-bar";
+// Enable window to be resized larger than screen.
+const char kEnableLargerThanScreen[] = "enable-larger-than-screen";
+
} // namespace switches
} // namespace atom
extern const char kWebPreferences[];
extern const char kZoomFactor[];
extern const char kAutoHideMenuBar[];
+extern const char kEnableLargerThanScreen[];
} // namespace switches
mouse-down event that simultaneously activates the window
* `auto-hide-menu-bar` Boolean - Auto hide the menu bar unless the `Alt`
key is pressed.
+ * `enable-larger-than-screen` Boolean - Enable the window to be resized larger
+ than screen.
* `web-preferences` Object - Settings of web page's features
* `javascript` Boolean
* `web-security` Boolean
assert.equal after[0], size[0]
assert.equal after[1], size[1]
- it 'can set the window larger than screen', ->
- 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', ->
size = [400, 400]
assert.equal size[0], 400
assert.equal size[1], 400
+ describe '"enable-larger-than-screen" option', ->
+ beforeEach ->
+ w.destroy()
+ w = new BrowserWindow(show: true, width: 400, height: 400, 'enable-larger-than-screen': true)
+
+ it 'can move the window out of screen', ->
+ w.setPosition -10, -10
+ after = w.getPosition()
+ assert.equal after[0], -10
+ assert.equal after[1], -10
+
+ it 'can set the window larger than screen', ->
+ 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 'beforeunload handler', ->
it 'returning true would not prevent close', (done) ->
w.on 'closed', ->