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) {
|
||||
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
|
||||
NotifyWindowEnterFullScreen();
|
||||
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.
|
||||
window_->SetFullscreen(fullscreen);
|
||||
#else
|
||||
if (IsVisible())
|
||||
if (IsFullScreenable())
|
||||
window_->SetFullscreen(fullscreen);
|
||||
else
|
||||
window_->native_widget_private()->ShowWithWindowState(
|
||||
ui::SHOW_STATE_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_;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue