summaryrefslogtreecommitdiffstats
path: root/ui/views/widget/native_widget_win.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ui/views/widget/native_widget_win.cc')
-rw-r--r--ui/views/widget/native_widget_win.cc47
1 files changed, 45 insertions, 2 deletions
diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc
index 190e10c..fbb62fa 100644
--- a/ui/views/widget/native_widget_win.cc
+++ b/ui/views/widget/native_widget_win.cc
@@ -249,7 +249,12 @@ bool NativeWidgetWin::HasCapture() const {
}
InputMethod* NativeWidgetWin::CreateInputMethod() {
- return message_handler_->CreateInputMethod();
+#if !defined(USE_AURA)
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (!command_line->HasSwitch(switches::kEnableViewsTextfield))
+ return NULL;
+#endif
+ return new InputMethodWin(GetMessageHandler());
}
internal::InputMethodDelegate* NativeWidgetWin::GetInputMethodDelegate() {
@@ -470,7 +475,7 @@ void NativeWidgetWin::FocusNativeView(gfx::NativeView native_view) {
}
gfx::Rect NativeWidgetWin::GetWorkAreaBoundsInScreen() const {
- return message_handler_->GetWorkAreaBoundsInScreen();
+ return gfx::Screen::GetDisplayNearestWindow(GetNativeView()).work_area();
}
void NativeWidgetWin::SetInactiveRenderingDisabled(bool value) {
@@ -746,10 +751,16 @@ void NativeWidgetWin::HandleFrameChanged() {
void NativeWidgetWin::HandleNativeFocus(HWND last_focused_window) {
delegate_->OnNativeFocus(last_focused_window);
+ InputMethod* input_method = GetInputMethod();
+ if (input_method)
+ input_method->OnFocus();
}
void NativeWidgetWin::HandleNativeBlur(HWND focused_window) {
delegate_->OnNativeBlur(focused_window);
+ InputMethod* input_method = GetInputMethod();
+ if (input_method)
+ input_method->OnBlur();
}
bool NativeWidgetWin::HandleMouseEvent(const ui::MouseEvent& event) {
@@ -760,6 +771,38 @@ bool NativeWidgetWin::HandleKeyEvent(const ui::KeyEvent& event) {
return delegate_->OnKeyEvent(event);
}
+bool NativeWidgetWin::HandleUntranslatedKeyEvent(const ui::KeyEvent& event) {
+ InputMethod* input_method = GetInputMethod();
+ if (input_method)
+ input_method->DispatchKeyEvent(event);
+ return !!input_method;
+}
+
+bool NativeWidgetWin::HandleIMEMessage(UINT message,
+ WPARAM w_param,
+ LPARAM l_param,
+ LRESULT* result) {
+ 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 NativeWidgetWin::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 NativeWidgetWin::HandlePaintAccelerated(const gfx::Rect& invalid_rect) {
return delegate_->OnNativeWidgetPaintAccelerated(gfx::Rect(invalid_rect));
}