Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: ui/views/cocoa/bridged_native_widget.mm

Issue 1109493002: [MacViews] Fix behavior of non-resizable windows in fullscreen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/cocoa/bridged_native_widget.mm
diff --git a/ui/views/cocoa/bridged_native_widget.mm b/ui/views/cocoa/bridged_native_widget.mm
index 24275787c04e43ac1ab87b032e13ff5f4665461c..fd51109f66063ef33c934b3eb37120675f8895ae 100644
--- a/ui/views/cocoa/bridged_native_widget.mm
+++ b/ui/views/cocoa/bridged_native_widget.mm
@@ -430,13 +430,11 @@ void BridgedNativeWidget::ToggleDesiredFullscreenState() {
return; // TODO(tapted): Implement this for Snow Leopard.
}
- // Since fullscreen requests are ignored if the collection behavior does not
- // allow it, save the collection behavior and restore it after.
- NSWindowCollectionBehavior behavior = [window_ collectionBehavior];
- [window_ setCollectionBehavior:behavior |
- NSWindowCollectionBehaviorFullScreenPrimary];
+ // Enable fullscreen collection behavior because:
+ // 1: -[NSWindow toggleFullscreen:] would otherwise be ignored,
+ // 2: the fullscreen button must be enabled so the user can leave fullscreen.
+ gfx::SetNSWindowCanFullscreen(window_, true);
tapted 2015/05/06 06:20:41 Why always `true`? (this function is a toggle). i
jackhou1 2015/05/13 04:27:53 Changed to only set the collection behavior if not
[window_ toggleFullScreen:nil];
- [window_ setCollectionBehavior:behavior];
}
void BridgedNativeWidget::OnSizeChanged() {
@@ -528,8 +526,10 @@ void BridgedNativeWidget::OnSizeConstraintsChanged() {
bool is_resizable = widget->widget_delegate()->CanResize();
bool shows_resize_controls =
is_resizable && (min_size.IsEmpty() || min_size != max_size);
- bool shows_fullscreen_controls =
- is_resizable && widget->widget_delegate()->CanMaximize();
+ // Fullscreen controls should be enabled when in fullscreen so the user can
+ // leave.
+ bool shows_fullscreen_controls = target_fullscreen_state_ ||
tapted 2015/05/06 06:20:41 What will call OnSizeConstraintsChanged() when tar
jackhou1 2015/05/13 04:27:53 There's a RootView::Layout after leaving fullscree
+ (is_resizable && widget->widget_delegate()->CanMaximize());
gfx::ApplyNSWindowSizeConstraints(window, min_size, max_size,
shows_resize_controls,

Powered by Google App Engine
This is Rietveld 408576698