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

Unified Diff: chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm

Issue 275693002: Fix the bug that minimized panel window might steal focus on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm b/chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm
index ef8f353c82710ae384193c676ff2080e562b52bb..9587aa0566bdb979191a9bd266d481c30549add3 100644
--- a/chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm
+++ b/chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm
@@ -588,6 +588,12 @@ const double kWidthOfMouseResizeArea = 15.0;
// whether it's refactoring more things into BrowserWindowUtils or making a
// common base controller for browser windows.
- (void)windowDidBecomeKey:(NSNotification*)notification {
+ // Prevent the minimized panel from invoking any activation logic. This is
Dmitry Titov 2014/05/16 16:37:38 I'm not sure I understand the change being made. I
jianli 2014/05/20 00:56:00 We do instruct canBecomeKeyWindow to return NO bu
+ // because Cocoa does not support deactivating a window and it could still
+ // try to activate the minimized panel window.
+ if (windowShim_->panel()->IsMinimized())
+ return;
+
// We need to activate the controls (in the "WebView"). To do this, get the
// selected WebContents's RenderWidgetHostView and tell it to activate.
if (WebContents* contents = windowShim_->panel()->GetWebContents()) {
@@ -612,13 +618,6 @@ const double kWidthOfMouseResizeArea = 15.0;
return;
[self onWindowDidResignKey];
-
- // Make the window not user-resizable when it loses the focus. This is to
- // solve the problem that the bottom edge of the active panel does not
- // trigger the user-resizing if this panel stacks with another inactive
- // panel at the bottom.
- [[self window] setStyleMask:
- [[self window] styleMask] & ~NSResizableWindowMask];
}
- (void)windowWillStartLiveResize:(NSNotification*)notification {
@@ -741,6 +740,13 @@ const double kWidthOfMouseResizeArea = 15.0;
}
windowShim_->panel()->OnActiveStateChanged(false);
+
+ // Make the window not user-resizable when it loses the focus. This is to
+ // solve the problem that the bottom edge of the active panel does not
+ // trigger the user-resizing if this panel stacks with another inactive
+ // panel at the bottom.
+ [[self window] setStyleMask:
+ [[self window] styleMask] & ~NSResizableWindowMask];
}
- (void)preventBecomingKeyWindow:(BOOL)prevent {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698