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

Unified Diff: ui/views/widget/desktop_root_window_host_win.cc

Issue 10911317: KeyEvent work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 | « ui/views/widget/desktop_root_window_host_win.h ('k') | ui/views/widget/native_widget_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_root_window_host_win.cc
===================================================================
--- ui/views/widget/desktop_root_window_host_win.cc (revision 156802)
+++ ui/views/widget/desktop_root_window_host_win.cc (working copy)
@@ -8,6 +8,8 @@
#include "ui/aura/desktop/desktop_dispatcher_client.h"
#include "ui/aura/focus_manager.h"
#include "ui/aura/root_window.h"
+#include "ui/aura/shared/compound_event_filter.h"
+#include "ui/views/ime/input_method_win.h"
#include "ui/views/widget/desktop_capture_client.h"
#include "ui/views/win/hwnd_message_handler.h"
@@ -61,6 +63,11 @@
dispatcher_client_.reset(new aura::DesktopDispatcherClient);
aura::client::SetDispatcherClient(root_window_.get(),
dispatcher_client_.get());
+
+ // CEF sets focus to the window the user clicks down on.
+ // TODO(beng): see if we can't do this some other way. CEF seems a heavy-
+ // handed way of accomplishing focus.
+ root_window_->SetEventFilter(new aura::shared::CompoundEventFilter);
}
void DesktopRootWindowHostWin::Close() {
@@ -88,6 +95,15 @@
return message_handler_->GetClientAreaBoundsInScreen();
}
+InputMethod* DesktopRootWindowHostWin::CreateInputMethod() {
+ return new InputMethodWin(message_handler_.get(), message_handler_->hwnd());
+}
+
+internal::InputMethodDelegate*
+ DesktopRootWindowHostWin::GetInputMethodDelegate() {
+ return message_handler_.get();
+}
+
////////////////////////////////////////////////////////////////////////////////
// DesktopRootWindowHostWin, RootWindowHost implementation:
@@ -262,7 +278,7 @@
}
InputMethod* DesktopRootWindowHostWin::GetInputMethod() {
- return NULL;
+ return native_widget_delegate_->AsWidget()->GetInputMethodDirect();
}
void DesktopRootWindowHostWin::HandleAppDeactivated() {
@@ -340,9 +356,15 @@
}
void DesktopRootWindowHostWin::HandleNativeFocus(HWND last_focused_window) {
+ InputMethod* input_method = GetInputMethod();
+ if (input_method)
+ input_method->OnFocus();
}
void DesktopRootWindowHostWin::HandleNativeBlur(HWND focused_window) {
+ InputMethod* input_method = GetInputMethod();
+ if (input_method)
+ input_method->OnBlur();
}
bool DesktopRootWindowHostWin::HandleMouseEvent(const ui::MouseEvent& event) {
@@ -351,24 +373,42 @@
}
bool DesktopRootWindowHostWin::HandleKeyEvent(const ui::KeyEvent& event) {
- return false;
+ return root_window_host_delegate_->OnHostKeyEvent(
+ const_cast<ui::KeyEvent*>(&event));
}
bool DesktopRootWindowHostWin::HandleUntranslatedKeyEvent(
const ui::KeyEvent& event) {
- return false;
+ InputMethod* input_method = GetInputMethod();
+ if (input_method)
+ input_method->DispatchKeyEvent(event);
+ return !!input_method;
}
bool DesktopRootWindowHostWin::HandleIMEMessage(UINT message,
WPARAM w_param,
LPARAM l_param,
LRESULT* result) {
- return false;
+ InputMethod* input_method = GetInputMethod();
+ if (!input_method || input_method->IsMock()) {
+ *result = 0;
+ return false;
+ }
+
+ InputMethodWin* ime_win = static_cast<InputMethodWin*>(input_method);
+ BOOL handled = FALSE;
+ *result = ime_win->OnImeMessages(message, w_param, l_param, &handled);
+ return !!handled;
}
void DesktopRootWindowHostWin::HandleInputLanguageChange(
DWORD character_set,
HKL input_language_id) {
+ InputMethod* input_method = GetInputMethod();
+ if (input_method && !input_method->IsMock()) {
+ static_cast<InputMethodWin*>(input_method)->OnInputLangChange(
+ character_set, input_language_id);
+ }
}
bool DesktopRootWindowHostWin::HandlePaintAccelerated(
« no previous file with comments | « ui/views/widget/desktop_root_window_host_win.h ('k') | ui/views/widget/native_widget_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698