OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/base/ime/input_method_win.h" | 5 #include "ui/base/ime/input_method_win.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "ui/base/ime/text_input_client.h" | 8 #include "ui/base/ime/text_input_client.h" |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 #include "ui/events/event_constants.h" | 10 #include "ui/events/event_constants.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 SetDelegate(delegate); | 30 SetDelegate(delegate); |
31 } | 31 } |
32 | 32 |
33 void InputMethodWin::Init(bool focused) { | 33 void InputMethodWin::Init(bool focused) { |
34 // Gets the initial input locale and text direction information. | 34 // Gets the initial input locale and text direction information. |
35 OnInputLocaleChanged(); | 35 OnInputLocaleChanged(); |
36 | 36 |
37 InputMethodBase::Init(focused); | 37 InputMethodBase::Init(focused); |
38 } | 38 } |
39 | 39 |
40 bool InputMethodWin::DispatchKeyEvent( | 40 bool InputMethodWin::DispatchKeyEvent(const ui::KeyEvent& event) { |
41 const base::NativeEvent& native_key_event) { | 41 if (!event.HasNativeEvent()) |
| 42 return DispatchFabricatedKeyEvent(event); |
| 43 |
| 44 const base::NativeEvent& native_key_event = event.native_event(); |
42 if (native_key_event.message == WM_CHAR) { | 45 if (native_key_event.message == WM_CHAR) { |
43 BOOL handled; | 46 BOOL handled; |
44 OnChar(native_key_event.hwnd, native_key_event.message, | 47 OnChar(native_key_event.hwnd, native_key_event.message, |
45 native_key_event.wParam, native_key_event.lParam, &handled); | 48 native_key_event.wParam, native_key_event.lParam, &handled); |
46 return !!handled; // Don't send WM_CHAR for post event processing. | 49 return !!handled; // Don't send WM_CHAR for post event processing. |
47 } | 50 } |
48 // Handles ctrl-shift key to change text direction and layout alignment. | 51 // Handles ctrl-shift key to change text direction and layout alignment. |
49 if (ui::IMM32Manager::IsRTLKeyboardLayoutInstalled() && | 52 if (ui::IMM32Manager::IsRTLKeyboardLayoutInstalled() && |
50 !IsTextInputTypeNone()) { | 53 !IsTextInputTypeNone()) { |
51 // TODO: shouldn't need to generate a KeyEvent here. | 54 // TODO: shouldn't need to generate a KeyEvent here. |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 // receiving keyboard input as long as it is an active window. This works well | 346 // receiving keyboard input as long as it is an active window. This works well |
344 // even when the |attached_window_handle| becomes active but has not received | 347 // even when the |attached_window_handle| becomes active but has not received |
345 // WM_FOCUS yet. | 348 // WM_FOCUS yet. |
346 return attached_window_handle && GetActiveWindow() == attached_window_handle; | 349 return attached_window_handle && GetActiveWindow() == attached_window_handle; |
347 #else | 350 #else |
348 return attached_window_handle && GetFocus() == attached_window_handle; | 351 return attached_window_handle && GetFocus() == attached_window_handle; |
349 #endif | 352 #endif |
350 } | 353 } |
351 | 354 |
352 } // namespace ui | 355 } // namespace ui |
OLD | NEW |