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) {
|
||||
SetAlwaysOnTop(true);
|
||||
}
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
bool fullscreen;
|
||||
if (options.Get(options::kFullscreen, &fullscreen) && fullscreen) {
|
||||
|
||||
// Disable fullscreen button when 'fullscreenable' is false or '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);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool skip;
|
||||
if (options.Get(options::kSkipTaskbar, &skip) && skip) {
|
||||
SetSkipTaskbar(skip);
|
||||
|
|
|
@ -117,7 +117,8 @@ NativeWindowViews::NativeWindowViews(
|
|||
movable_(true),
|
||||
resizable_(true),
|
||||
maximizable_(true),
|
||||
minimizable_(true) {
|
||||
minimizable_(true),
|
||||
fullscreenable_(true) {
|
||||
options.Get(options::kTitle, &title_);
|
||||
options.Get(options::kAutoHideMenuBar, &menu_bar_autohide_);
|
||||
|
||||
|
@ -365,21 +366,26 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
|
|||
#if defined(OS_WIN)
|
||||
// There is no native fullscreen state on Windows.
|
||||
if (fullscreen) {
|
||||
if (IsFullScreenable()) {
|
||||
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
|
||||
NotifyWindowEnterFullScreen();
|
||||
}
|
||||
} else {
|
||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
||||
NotifyWindowLeaveFullScreen();
|
||||
}
|
||||
// We set the new value after notifying, so we can handle the size event
|
||||
// correctly.
|
||||
if (IsFullScreenable())
|
||||
window_->SetFullscreen(fullscreen);
|
||||
#else
|
||||
if (!fullscreen || (fullscreen && IsFullScreenable())) {
|
||||
if (IsVisible())
|
||||
window_->SetFullscreen(fullscreen);
|
||||
else
|
||||
window_->native_widget_private()->ShowWithWindowState(
|
||||
ui::SHOW_STATE_FULLSCREEN);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -505,11 +511,12 @@ bool NativeWindowViews::IsMaximizable() {
|
|||
#endif
|
||||
}
|
||||
|
||||
void NativeWindowViews::SetFullScreenable(bool maximizable) {
|
||||
void NativeWindowViews::SetFullScreenable(bool fullscreenable) {
|
||||
fullscreenable_ = fullscreenable;
|
||||
}
|
||||
|
||||
bool NativeWindowViews::IsFullScreenable() {
|
||||
return true;
|
||||
return fullscreenable_;
|
||||
}
|
||||
|
||||
void NativeWindowViews::SetClosable(bool closable) {
|
||||
|
|
|
@ -212,6 +212,7 @@ class NativeWindowViews : public NativeWindow,
|
|||
bool resizable_;
|
||||
bool maximizable_;
|
||||
bool minimizable_;
|
||||
bool fullscreenable_;
|
||||
std::string title_;
|
||||
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
|
||||
other windows. Default is `false`.
|
||||
* `fullscreen` Boolean - Whether the window should show in fullscreen. When
|
||||
explicitly 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
|
||||
`false`.
|
||||
explicity set to `false` the fullscreen button will be hidden or disabled
|
||||
on OS X. Default is `false`.
|
||||
* `fullscreenable` Boolean - Whether the maximize/zoom button on OS X should
|
||||
toggle full screen mode or maximize window. Default is `true`.
|
||||
* `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 `true`.
|
||||
|
||||
### `win.setFullScreenable(fullscreenable)` _OS X_
|
||||
### `win.setFullScreenable(fullscreenable)`
|
||||
|
||||
* `fullscreenable` Boolean
|
||||
|
||||
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
|
||||
maximizes the window. On Windows and Linux always returns `true`.
|
||||
maximizes the window.
|
||||
|
||||
### `win.setClosable(closable)` _OS X_ _Windows_
|
||||
|
||||
|
|
Loading…
Reference in a new issue