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_window_tree_host_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
6 | 6 |
7 #include "base/win/metro.h" | 7 #include "base/win/metro.h" |
8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" | 31 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" |
32 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" | 32 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" |
33 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 33 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
34 #include "ui/views/widget/root_view.h" | 34 #include "ui/views/widget/root_view.h" |
35 #include "ui/views/widget/widget_delegate.h" | 35 #include "ui/views/widget/widget_delegate.h" |
36 #include "ui/views/widget/widget_hwnd_utils.h" | 36 #include "ui/views/widget/widget_hwnd_utils.h" |
37 #include "ui/views/win/fullscreen_handler.h" | 37 #include "ui/views/win/fullscreen_handler.h" |
38 #include "ui/views/win/hwnd_message_handler.h" | 38 #include "ui/views/win/hwnd_message_handler.h" |
39 #include "ui/views/win/hwnd_util.h" | 39 #include "ui/views/win/hwnd_util.h" |
40 #include "ui/wm/core/compound_event_filter.h" | 40 #include "ui/wm/core/compound_event_filter.h" |
41 #include "ui/wm/core/input_method_event_filter.h" | |
42 #include "ui/wm/core/window_animations.h" | 41 #include "ui/wm/core/window_animations.h" |
43 #include "ui/wm/public/scoped_tooltip_disabler.h" | 42 #include "ui/wm/public/scoped_tooltip_disabler.h" |
44 | 43 |
45 DECLARE_WINDOW_PROPERTY_TYPE(views::DesktopWindowTreeHostWin*); | 44 DECLARE_WINDOW_PROPERTY_TYPE(views::DesktopWindowTreeHostWin*); |
46 | 45 |
47 namespace views { | 46 namespace views { |
48 | 47 |
49 namespace { | 48 namespace { |
50 | 49 |
51 gfx::Size GetExpandedWindowSize(DWORD window_style, gfx::Size size) { | 50 gfx::Size GetExpandedWindowSize(DWORD window_style, gfx::Size size) { |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 ::ShowCursor(!!show); | 559 ::ShowCursor(!!show); |
561 } | 560 } |
562 | 561 |
563 void DesktopWindowTreeHostWin::MoveCursorToNative(const gfx::Point& location) { | 562 void DesktopWindowTreeHostWin::MoveCursorToNative(const gfx::Point& location) { |
564 POINT cursor_location = location.ToPOINT(); | 563 POINT cursor_location = location.ToPOINT(); |
565 ::ClientToScreen(GetHWND(), &cursor_location); | 564 ::ClientToScreen(GetHWND(), &cursor_location); |
566 ::SetCursorPos(cursor_location.x, cursor_location.y); | 565 ::SetCursorPos(cursor_location.x, cursor_location.y); |
567 } | 566 } |
568 | 567 |
569 //////////////////////////////////////////////////////////////////////////////// | 568 //////////////////////////////////////////////////////////////////////////////// |
570 // DesktopWindowTreeHostWin, ui::EventSource implementation: | |
571 | |
572 ui::EventProcessor* DesktopWindowTreeHostWin::GetEventProcessor() { | |
573 return dispatcher(); | |
574 } | |
575 | |
576 //////////////////////////////////////////////////////////////////////////////// | |
577 // DesktopWindowTreeHostWin, aura::AnimationHost implementation: | 569 // DesktopWindowTreeHostWin, aura::AnimationHost implementation: |
578 | 570 |
579 void DesktopWindowTreeHostWin::SetHostTransitionOffsets( | 571 void DesktopWindowTreeHostWin::SetHostTransitionOffsets( |
580 const gfx::Vector2d& top_left_delta, | 572 const gfx::Vector2d& top_left_delta, |
581 const gfx::Vector2d& bottom_right_delta) { | 573 const gfx::Vector2d& bottom_right_delta) { |
582 gfx::Rect bounds_without_expansion = GetBounds(); | 574 gfx::Rect bounds_without_expansion = GetBounds(); |
583 window_expansion_top_left_delta_ = top_left_delta; | 575 window_expansion_top_left_delta_ = top_left_delta; |
584 window_expansion_bottom_right_delta_ = bottom_right_delta; | 576 window_expansion_bottom_right_delta_ = bottom_right_delta; |
585 SetBounds(bounds_without_expansion); | 577 SetBounds(bounds_without_expansion); |
586 } | 578 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 } | 674 } |
683 | 675 |
684 void DesktopWindowTreeHostWin::ResetWindowControls() { | 676 void DesktopWindowTreeHostWin::ResetWindowControls() { |
685 GetWidget()->non_client_view()->ResetWindowControls(); | 677 GetWidget()->non_client_view()->ResetWindowControls(); |
686 } | 678 } |
687 | 679 |
688 gfx::NativeViewAccessible DesktopWindowTreeHostWin::GetNativeViewAccessible() { | 680 gfx::NativeViewAccessible DesktopWindowTreeHostWin::GetNativeViewAccessible() { |
689 return GetWidget()->GetRootView()->GetNativeViewAccessible(); | 681 return GetWidget()->GetRootView()->GetNativeViewAccessible(); |
690 } | 682 } |
691 | 683 |
692 InputMethod* DesktopWindowTreeHostWin::GetInputMethod() { | |
693 return GetWidget()->GetInputMethodDirect(); | |
694 } | |
695 | |
696 bool DesktopWindowTreeHostWin::ShouldHandleSystemCommands() const { | 684 bool DesktopWindowTreeHostWin::ShouldHandleSystemCommands() const { |
697 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands(); | 685 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands(); |
698 } | 686 } |
699 | 687 |
700 void DesktopWindowTreeHostWin::HandleAppDeactivated() { | 688 void DesktopWindowTreeHostWin::HandleAppDeactivated() { |
701 native_widget_delegate_->EnableInactiveRendering(); | 689 native_widget_delegate_->EnableInactiveRendering(); |
702 } | 690 } |
703 | 691 |
704 void DesktopWindowTreeHostWin::HandleActivationChanged(bool active) { | 692 void DesktopWindowTreeHostWin::HandleActivationChanged(bool active) { |
705 // This can be invoked from HWNDMessageHandler::Init(), at which point we're | 693 // This can be invoked from HWNDMessageHandler::Init(), at which point we're |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 | 847 |
860 bool DesktopWindowTreeHostWin::HandleIMEMessage(UINT message, | 848 bool DesktopWindowTreeHostWin::HandleIMEMessage(UINT message, |
861 WPARAM w_param, | 849 WPARAM w_param, |
862 LPARAM l_param, | 850 LPARAM l_param, |
863 LRESULT* result) { | 851 LRESULT* result) { |
864 MSG msg = {}; | 852 MSG msg = {}; |
865 msg.hwnd = GetHWND(); | 853 msg.hwnd = GetHWND(); |
866 msg.message = message; | 854 msg.message = message; |
867 msg.wParam = w_param; | 855 msg.wParam = w_param; |
868 msg.lParam = l_param; | 856 msg.lParam = l_param; |
869 return desktop_native_widget_aura_->input_method_event_filter()-> | 857 return GetInputMethod()->OnUntranslatedIMEMessage(msg, result); |
870 input_method()->OnUntranslatedIMEMessage(msg, result); | |
871 } | 858 } |
872 | 859 |
873 void DesktopWindowTreeHostWin::HandleInputLanguageChange( | 860 void DesktopWindowTreeHostWin::HandleInputLanguageChange( |
874 DWORD character_set, | 861 DWORD character_set, |
875 HKL input_language_id) { | 862 HKL input_language_id) { |
876 desktop_native_widget_aura_->input_method_event_filter()-> | 863 GetInputMethod()->OnInputLocaleChanged(); |
877 input_method()->OnInputLocaleChanged(); | |
878 } | 864 } |
879 | 865 |
880 void DesktopWindowTreeHostWin::HandlePaintAccelerated( | 866 void DesktopWindowTreeHostWin::HandlePaintAccelerated( |
881 const gfx::Rect& invalid_rect) { | 867 const gfx::Rect& invalid_rect) { |
882 if (compositor()) | 868 if (compositor()) |
883 compositor()->ScheduleRedrawRect(invalid_rect); | 869 compositor()->ScheduleRedrawRect(invalid_rect); |
884 } | 870 } |
885 | 871 |
886 bool DesktopWindowTreeHostWin::HandleTooltipNotify(int w_param, | 872 bool DesktopWindowTreeHostWin::HandleTooltipNotify(int w_param, |
887 NMHDR* l_param, | 873 NMHDR* l_param, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 | 951 |
966 // static | 952 // static |
967 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 953 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
968 internal::NativeWidgetDelegate* native_widget_delegate, | 954 internal::NativeWidgetDelegate* native_widget_delegate, |
969 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 955 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
970 return new DesktopWindowTreeHostWin(native_widget_delegate, | 956 return new DesktopWindowTreeHostWin(native_widget_delegate, |
971 desktop_native_widget_aura); | 957 desktop_native_widget_aura); |
972 } | 958 } |
973 | 959 |
974 } // namespace views | 960 } // namespace views |
OLD | NEW |