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

Unified Diff: ui/wm/core/focus_controller.cc

Issue 173803002: Redesigns the text input focus handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reset the text input client in FocusController. Created 6 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/wm/core/focus_controller.cc
diff --git a/ui/wm/core/focus_controller.cc b/ui/wm/core/focus_controller.cc
index f4d3f3fb8feaa1502400d40ca3c0266cce9bab95..b03322fbc69104f5bfd203fa10d59c0a747c1290 100644
--- a/ui/wm/core/focus_controller.cc
+++ b/ui/wm/core/focus_controller.cc
@@ -10,6 +10,7 @@
#include "ui/aura/client/focus_change_observer.h"
#include "ui/aura/env.h"
#include "ui/aura/window_tracker.h"
+#include "ui/base/ime/text_input_focus_manager.h"
#include "ui/events/event.h"
#include "ui/wm/core/focus_rules.h"
#include "ui/wm/core/window_util.h"
@@ -133,6 +134,14 @@ void FocusController::FocusWindow(aura::Window* window) {
return;
DCHECK((focusable && activatable) || !window);
+ // |window| is going to get the focus, so reset the text input client.
+ // SetActiveWindow() and/or SetFocusedWindow() may set a proper text input
+ // client if the implementation supports text input.
+ ui::TextInputFocusManager* text_input_focus_manager =
+ ui::TextInputFocusManager::GetInstance();
+ if (window)
+ text_input_focus_manager->FocusTextInputClient(NULL);
sky 2014/04/25 18:20:21 Shouldn't all this be in SetFocusedWindow?
Yuki 2014/04/28 12:59:29 You're right. Moved.
+
// Activation change observers may change the focused window. If this happens
// we must not adjust the focus below since this will clobber that change.
aura::Window* last_focused_window = focused_window_;
@@ -147,6 +156,10 @@ void FocusController::FocusWindow(aura::Window* window) {
DCHECK(active_window_->Contains(focusable));
SetFocusedWindow(focusable);
}
+
+ // Ensure that the text input client is reset when the window loses the focus.
+ if (!window)
+ text_input_focus_manager->FocusTextInputClient(NULL);
}
void FocusController::ResetFocusWithinActiveWindow(aura::Window* window) {
« ui/views/widget/desktop_aura/desktop_native_widget_aura.cc ('K') | « ui/views/widget/widget.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698