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

Unified Diff: ui/views/corewm/focus_controller.cc

Issue 11348314: FocusController needs to restack windows upon activation (but not focus). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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 | « ui/aura/window.cc ('k') | ui/views/corewm/focus_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/corewm/focus_controller.cc
===================================================================
--- ui/views/corewm/focus_controller.cc (revision 170463)
+++ ui/views/corewm/focus_controller.cc (working copy)
@@ -5,6 +5,7 @@
#include "ui/views/corewm/focus_controller.h"
#include "base/auto_reset.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
#include "ui/views/corewm/focus_change_event.h"
#include "ui/views/corewm/focus_rules.h"
@@ -13,12 +14,27 @@
namespace corewm {
namespace {
+// When a modal window is activated, we bring its entire transient parent chain
+// to the front. This function must be called before the modal transient is
+// stacked at the top to ensure correct stacking order.
+void StackTransientParentsBelowModalWindow(aura::Window* window) {
+ if (window->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_WINDOW)
+ return;
+
+ aura::Window* transient_parent = window->transient_parent();
+ while (transient_parent) {
+ transient_parent->parent()->StackChildAtTop(transient_parent);
+ transient_parent = transient_parent->transient_parent();
+ }
+}
+
// Updates focused window state and dispatches changing/changed events.
void DispatchEventsAndUpdateState(ui::EventDispatcher* dispatcher,
int changing_event_type,
int changed_event_type,
aura::Window** state,
aura::Window* new_state,
+ bool restack,
ui::EventTarget** event_dispatch_target) {
int result = ui::ER_UNHANDLED;
{
@@ -31,6 +47,11 @@
*state = new_state;
+ if (restack && new_state) {
+ StackTransientParentsBelowModalWindow(new_state);
+ new_state->parent()->StackChildAtTop(new_state);
+ }
+
{
base::AutoReset<ui::EventTarget*> reset(event_dispatch_target, *state);
FocusChangeEvent changed_event(changed_event_type);
@@ -183,6 +204,7 @@
FocusChangeEvent::focus_changed_event_type(),
&focused_window_,
window,
+ /* restack */ false,
&event_dispatch_target_);
}
@@ -198,6 +220,7 @@
FocusChangeEvent::activation_changed_event_type(),
&active_window_,
window,
+ /* restack */ true,
&event_dispatch_target_);
}
« no previous file with comments | « ui/aura/window.cc ('k') | ui/views/corewm/focus_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698