Merge branch 'will-fullscreen' of https://github.com/MaxWhere/electron
This commit is contained in:
commit
f5d79677fa
4 changed files with 36 additions and 23 deletions
|
@ -133,12 +133,18 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) {
|
||||||
if (options.Get(options::kAlwaysOnTop, &top) && top) {
|
if (options.Get(options::kAlwaysOnTop, &top) && top) {
|
||||||
SetAlwaysOnTop(true);
|
SetAlwaysOnTop(true);
|
||||||
}
|
}
|
||||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
|
||||||
bool fullscreen;
|
// Disable fullscreen button when 'fullscreenable' is false or 'fullscreen'
|
||||||
if (options.Get(options::kFullscreen, &fullscreen) && fullscreen) {
|
// is specified to false.
|
||||||
|
bool fullscreenable = true;
|
||||||
|
options.Get(options::kFullScreenable, &fullscreenable);
|
||||||
|
bool fullscreen = false;
|
||||||
|
if (options.Get(options::kFullscreen, &fullscreen) && !fullscreen)
|
||||||
|
fullscreenable = false;
|
||||||
|
SetFullScreenable(fullscreenable);
|
||||||
|
if (fullscreen)
|
||||||
SetFullScreen(true);
|
SetFullScreen(true);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
bool skip;
|
bool skip;
|
||||||
if (options.Get(options::kSkipTaskbar, &skip) && skip) {
|
if (options.Get(options::kSkipTaskbar, &skip) && skip) {
|
||||||
SetSkipTaskbar(skip);
|
SetSkipTaskbar(skip);
|
||||||
|
|
|
@ -117,7 +117,8 @@ NativeWindowViews::NativeWindowViews(
|
||||||
movable_(true),
|
movable_(true),
|
||||||
resizable_(true),
|
resizable_(true),
|
||||||
maximizable_(true),
|
maximizable_(true),
|
||||||
minimizable_(true) {
|
minimizable_(true),
|
||||||
|
fullscreenable_(true) {
|
||||||
options.Get(options::kTitle, &title_);
|
options.Get(options::kTitle, &title_);
|
||||||
options.Get(options::kAutoHideMenuBar, &menu_bar_autohide_);
|
options.Get(options::kAutoHideMenuBar, &menu_bar_autohide_);
|
||||||
|
|
||||||
|
@ -365,21 +366,26 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
// There is no native fullscreen state on Windows.
|
// There is no native fullscreen state on Windows.
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
|
if (IsFullScreenable()) {
|
||||||
NotifyWindowEnterFullScreen();
|
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
|
||||||
|
NotifyWindowEnterFullScreen();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
||||||
NotifyWindowLeaveFullScreen();
|
NotifyWindowLeaveFullScreen();
|
||||||
}
|
}
|
||||||
// We set the new value after notifying, so we can handle the size event
|
// We set the new value after notifying, so we can handle the size event
|
||||||
// correctly.
|
// correctly.
|
||||||
window_->SetFullscreen(fullscreen);
|
if (IsFullScreenable())
|
||||||
#else
|
|
||||||
if (IsVisible())
|
|
||||||
window_->SetFullscreen(fullscreen);
|
window_->SetFullscreen(fullscreen);
|
||||||
else
|
#else
|
||||||
window_->native_widget_private()->ShowWithWindowState(
|
if (!fullscreen || (fullscreen && IsFullScreenable())) {
|
||||||
ui::SHOW_STATE_FULLSCREEN);
|
if (IsVisible())
|
||||||
|
window_->SetFullscreen(fullscreen);
|
||||||
|
else
|
||||||
|
window_->native_widget_private()->ShowWithWindowState(
|
||||||
|
ui::SHOW_STATE_FULLSCREEN);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,11 +511,12 @@ bool NativeWindowViews::IsMaximizable() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowViews::SetFullScreenable(bool maximizable) {
|
void NativeWindowViews::SetFullScreenable(bool fullscreenable) {
|
||||||
|
fullscreenable_ = fullscreenable;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NativeWindowViews::IsFullScreenable() {
|
bool NativeWindowViews::IsFullScreenable() {
|
||||||
return true;
|
return fullscreenable_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowViews::SetClosable(bool closable) {
|
void NativeWindowViews::SetClosable(bool closable) {
|
||||||
|
|
|
@ -212,6 +212,7 @@ class NativeWindowViews : public NativeWindow,
|
||||||
bool resizable_;
|
bool resizable_;
|
||||||
bool maximizable_;
|
bool maximizable_;
|
||||||
bool minimizable_;
|
bool minimizable_;
|
||||||
|
bool fullscreenable_;
|
||||||
std::string title_;
|
std::string title_;
|
||||||
gfx::Size widget_size_;
|
gfx::Size widget_size_;
|
||||||
|
|
||||||
|
|
|
@ -58,9 +58,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||||
* `alwaysOnTop` Boolean - Whether the window should always stay on top of
|
* `alwaysOnTop` Boolean - Whether the window should always stay on top of
|
||||||
other windows. Default is `false`.
|
other windows. Default is `false`.
|
||||||
* `fullscreen` Boolean - Whether the window should show in fullscreen. When
|
* `fullscreen` Boolean - Whether the window should show in fullscreen. When
|
||||||
explicitly set to `false` the fullscreen button will be hidden or disabled
|
explicity set to `false` the fullscreen button will be hidden or disabled
|
||||||
on OS X, or the maximize button will be disabled on Windows. Default is
|
on OS X. Default is `false`.
|
||||||
`false`.
|
|
||||||
* `fullscreenable` Boolean - Whether the maximize/zoom button on OS X should
|
* `fullscreenable` Boolean - Whether the maximize/zoom button on OS X should
|
||||||
toggle full screen mode or maximize window. Default is `true`.
|
toggle full screen mode or maximize window. Default is `true`.
|
||||||
* `skipTaskbar` Boolean - Whether to show the window in taskbar. Default is
|
* `skipTaskbar` Boolean - Whether to show the window in taskbar. Default is
|
||||||
|
@ -582,17 +581,17 @@ nothing.
|
||||||
Returns whether the window can be manually maximized by user. On Linux always
|
Returns whether the window can be manually maximized by user. On Linux always
|
||||||
returns `true`.
|
returns `true`.
|
||||||
|
|
||||||
### `win.setFullScreenable(fullscreenable)` _OS X_
|
### `win.setFullScreenable(fullscreenable)`
|
||||||
|
|
||||||
* `fullscreenable` Boolean
|
* `fullscreenable` Boolean
|
||||||
|
|
||||||
Sets whether the maximize/zoom window button toggles fullscreen mode or
|
Sets whether the maximize/zoom window button toggles fullscreen mode or
|
||||||
maximizes the window. On Windows and Linux does nothing.
|
maximizes the window.
|
||||||
|
|
||||||
### `win.isFullScreenable()` _OS X_
|
### `win.isFullScreenable()`
|
||||||
|
|
||||||
Returns whether the maximize/zoom window button toggles fullscreen mode or
|
Returns whether the maximize/zoom window button toggles fullscreen mode or
|
||||||
maximizes the window. On Windows and Linux always returns `true`.
|
maximizes the window.
|
||||||
|
|
||||||
### `win.setClosable(closable)` _OS X_ _Windows_
|
### `win.setClosable(closable)` _OS X_ _Windows_
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue