diff options
author | jcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 06:44:38 +0000 |
---|---|---|
committer | jcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 06:44:38 +0000 |
commit | 494f5c479d1c61ecfb72ec1e0af89dd8e363d395 (patch) | |
tree | 2fef3beadf58d7c91dd74e326840f5a1cee38649 /views | |
parent | 603e195332575bbe0fd60ba86041e96516372522 (diff) | |
download | chromium_src-494f5c479d1c61ecfb72ec1e0af89dd8e363d395.zip chromium_src-494f5c479d1c61ecfb72ec1e0af89dd8e363d395.tar.gz chromium_src-494f5c479d1c61ecfb72ec1e0af89dd8e363d395.tar.bz2 |
Making window.focus() work in Chrome.
A patch on the WebKit side https://bugs.webkit.org/show_bug.cgi?id=43542
ensures we get the correct notification when window.focus()/blur() is called.
This CL makes the browser active/unactive in response to the focus/blur message.
BUG=29643
TEST=Visit gmail. Open an IM conversation window and pop-it out.
Focus the browser (so the IM window is in the back). Click on the person name in the IM section of gmail.
The conversation window should be brought back to the front.
Repeat but this time minimize the conversation window.
Review URL: http://codereview.chromium.org/3060045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55678 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/window/window.h | 6 | ||||
-rw-r--r-- | views/window/window_gtk.cc | 4 | ||||
-rw-r--r-- | views/window/window_gtk.h | 1 | ||||
-rw-r--r-- | views/window/window_win.cc | 6 | ||||
-rw-r--r-- | views/window/window_win.h | 3 |
5 files changed, 18 insertions, 2 deletions
diff --git a/views/window/window.h b/views/window/window.h index af1dc70..1d5ffea 100644 --- a/views/window/window.h +++ b/views/window/window.h @@ -93,9 +93,13 @@ class Window { virtual void DisableInactiveRendering() = 0; #endif - // Activate the window, assuming it already exists and is visible. + // Activates the window, assuming it already exists and is visible. virtual void Activate() = 0; + // Deactivates the window, making the next window in the Z order the active + // window. + virtual void Deactivate() = 0; + // Closes the window, ultimately destroying it. This isn't immediate (it // occurs after a return to the message loop. Implementors must also make sure // that invoking Close multiple times doesn't cause bad things to happen, diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc index f4d00f7..b22aa9a 100644 --- a/views/window/window_gtk.cc +++ b/views/window/window_gtk.cc @@ -130,6 +130,10 @@ void WindowGtk::Activate() { gtk_window_present(GTK_WINDOW(GetNativeView())); } +void WindowGtk::Deactivate() { + // TODO(jcivelli): http://crbug.com/51364 Implement me. +} + void WindowGtk::Close() { if (window_closed_) { // Don't do anything if we've already been closed. diff --git a/views/window/window_gtk.h b/views/window/window_gtk.h index c62bc71..b184979 100644 --- a/views/window/window_gtk.h +++ b/views/window/window_gtk.h @@ -33,6 +33,7 @@ class WindowGtk : public WidgetGtk, public Window { virtual void Show(); virtual void HideWindow(); virtual void Activate(); + virtual void Deactivate(); virtual void Close(); virtual void Maximize(); virtual void Minimize(); diff --git a/views/window/window_win.cc b/views/window/window_win.cc index ac347f5..af03463 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -244,6 +244,12 @@ void WindowWin::Activate() { SetForegroundWindow(GetNativeView()); } +void WindowWin::Deactivate() { + HWND hwnd = ::GetNextWindow(GetNativeView(), GW_HWNDNEXT); + if (hwnd) + ::SetForegroundWindow(hwnd); +} + void WindowWin::Close() { if (window_closed_) { // It appears we can hit this code path if you close a modal dialog then diff --git a/views/window/window_win.h b/views/window/window_win.h index eb6ba63..60210f9 100644 --- a/views/window/window_win.h +++ b/views/window/window_win.h @@ -65,6 +65,7 @@ class WindowWin : public WidgetWin, virtual void PushForceHidden(); virtual void PopForceHidden(); virtual void Activate(); + virtual void Deactivate(); virtual void Close(); virtual void Maximize(); virtual void Minimize(); @@ -156,7 +157,7 @@ class WindowWin : public WidgetWin, RECT window_rect; }; - // Set the window as modal (by disabling all the other windows). + // Sets the window as modal (by disabling all the other windows). void BecomeModal(); // Sets-up the focus manager with the view that should have focus when the |