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/views/widget/desktop_aura/desktop_root_window_host_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h" |
6 | 6 |
| 7 #include "base/win/metro.h" |
7 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
8 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
9 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/focus_manager.h" | 11 #include "ui/aura/focus_manager.h" |
11 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
12 #include "ui/aura/window_property.h" | 13 #include "ui/aura/window_property.h" |
13 #include "ui/base/cursor/cursor_loader_win.h" | 14 #include "ui/base/cursor/cursor_loader_win.h" |
14 #include "ui/base/ime/input_method_win.h" | 15 #include "ui/base/ime/input_method_win.h" |
| 16 #include "ui/base/ime/win/tsf_bridge.h" |
15 #include "ui/base/win/dpi.h" | 17 #include "ui/base/win/dpi.h" |
16 #include "ui/base/win/shell.h" | 18 #include "ui/base/win/shell.h" |
17 #include "ui/gfx/insets.h" | 19 #include "ui/gfx/insets.h" |
18 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
19 #include "ui/gfx/path_win.h" | 21 #include "ui/gfx/path_win.h" |
20 #include "ui/native_theme/native_theme_aura.h" | 22 #include "ui/native_theme/native_theme_aura.h" |
21 #include "ui/native_theme/native_theme_win.h" | 23 #include "ui/native_theme/native_theme_win.h" |
22 #include "ui/views/corewm/compound_event_filter.h" | 24 #include "ui/views/corewm/compound_event_filter.h" |
23 #include "ui/views/corewm/corewm_switches.h" | 25 #include "ui/views/corewm/corewm_switches.h" |
24 #include "ui/views/corewm/cursor_manager.h" | 26 #include "ui/views/corewm/cursor_manager.h" |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 } | 746 } |
745 | 747 |
746 void DesktopRootWindowHostWin::HandleNativeBlur(HWND focused_window) { | 748 void DesktopRootWindowHostWin::HandleNativeBlur(HWND focused_window) { |
747 // TODO(beng): inform the native_widget_delegate_. | 749 // TODO(beng): inform the native_widget_delegate_. |
748 InputMethod* input_method = GetInputMethod(); | 750 InputMethod* input_method = GetInputMethod(); |
749 if (input_method) | 751 if (input_method) |
750 input_method->OnBlur(); | 752 input_method->OnBlur(); |
751 } | 753 } |
752 | 754 |
753 bool DesktopRootWindowHostWin::HandleMouseEvent(const ui::MouseEvent& event) { | 755 bool DesktopRootWindowHostWin::HandleMouseEvent(const ui::MouseEvent& event) { |
| 756 if (base::win::IsTSFAwareRequired() && event.IsAnyButton()) |
| 757 ui::TSFBridge::GetInstance()->CancelComposition(); |
754 return root_window_host_delegate_->OnHostMouseEvent( | 758 return root_window_host_delegate_->OnHostMouseEvent( |
755 const_cast<ui::MouseEvent*>(&event)); | 759 const_cast<ui::MouseEvent*>(&event)); |
756 } | 760 } |
757 | 761 |
758 bool DesktopRootWindowHostWin::HandleKeyEvent(const ui::KeyEvent& event) { | 762 bool DesktopRootWindowHostWin::HandleKeyEvent(const ui::KeyEvent& event) { |
759 return false; | 763 return false; |
760 } | 764 } |
761 | 765 |
762 bool DesktopRootWindowHostWin::HandleUntranslatedKeyEvent( | 766 bool DesktopRootWindowHostWin::HandleUntranslatedKeyEvent( |
763 const ui::KeyEvent& event) { | 767 const ui::KeyEvent& event) { |
764 scoped_ptr<ui::KeyEvent> duplicate_event(event.Copy()); | 768 scoped_ptr<ui::KeyEvent> duplicate_event(event.Copy()); |
765 return static_cast<aura::RootWindowHostDelegate*>(root_window_)-> | 769 return static_cast<aura::RootWindowHostDelegate*>(root_window_)-> |
766 OnHostKeyEvent(duplicate_event.get()); | 770 OnHostKeyEvent(duplicate_event.get()); |
767 } | 771 } |
768 | 772 |
769 bool DesktopRootWindowHostWin::HandleTouchEvent( | 773 bool DesktopRootWindowHostWin::HandleTouchEvent( |
770 const ui::TouchEvent& event) { | 774 const ui::TouchEvent& event) { |
771 return root_window_host_delegate_->OnHostTouchEvent( | 775 return root_window_host_delegate_->OnHostTouchEvent( |
772 const_cast<ui::TouchEvent*>(&event)); | 776 const_cast<ui::TouchEvent*>(&event)); |
773 } | 777 } |
774 | 778 |
775 bool DesktopRootWindowHostWin::HandleIMEMessage(UINT message, | 779 bool DesktopRootWindowHostWin::HandleIMEMessage(UINT message, |
776 WPARAM w_param, | 780 WPARAM w_param, |
777 LPARAM l_param, | 781 LPARAM l_param, |
778 LRESULT* result) { | 782 LRESULT* result) { |
779 // TODO(ime): Having to cast here is wrong. Maybe we should have IME events | 783 // TODO(ime): Having to cast here is wrong. Maybe we should have IME events |
780 // and have these flow through the same path as HandleUntranslatedKeyEvent() | 784 // and have these flow through the same path as |
781 // does. | 785 // HandleUnHandletranslatedKeyEvent() does. |
782 ui::InputMethodWin* ime_win = | 786 ui::InputMethodWin* ime_win = |
783 static_cast<ui::InputMethodWin*>( | 787 static_cast<ui::InputMethodWin*>( |
784 desktop_native_widget_aura_->input_method_event_filter()-> | 788 desktop_native_widget_aura_->input_method_event_filter()-> |
785 input_method()); | 789 input_method()); |
786 BOOL handled = FALSE; | 790 BOOL handled = FALSE; |
787 *result = ime_win->OnImeMessages(message, w_param, l_param, &handled); | 791 *result = ime_win->OnImeMessages(message, w_param, l_param, &handled); |
788 return !!handled; | 792 return !!handled; |
789 } | 793 } |
790 | 794 |
791 void DesktopRootWindowHostWin::HandleInputLanguageChange( | 795 void DesktopRootWindowHostWin::HandleInputLanguageChange( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 857 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
854 internal::NativeWidgetDelegate* native_widget_delegate, | 858 internal::NativeWidgetDelegate* native_widget_delegate, |
855 DesktopNativeWidgetAura* desktop_native_widget_aura, | 859 DesktopNativeWidgetAura* desktop_native_widget_aura, |
856 const gfx::Rect& initial_bounds) { | 860 const gfx::Rect& initial_bounds) { |
857 return new DesktopRootWindowHostWin(native_widget_delegate, | 861 return new DesktopRootWindowHostWin(native_widget_delegate, |
858 desktop_native_widget_aura, | 862 desktop_native_widget_aura, |
859 initial_bounds); | 863 initial_bounds); |
860 } | 864 } |
861 | 865 |
862 } // namespace views | 866 } // namespace views |
OLD | NEW |