| 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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 | 825 |
| 826 void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { | 826 void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { |
| 827 // TODO(beng): inform the native_widget_delegate_. | 827 // TODO(beng): inform the native_widget_delegate_. |
| 828 } | 828 } |
| 829 | 829 |
| 830 void DesktopWindowTreeHostWin::HandleNativeBlur(HWND focused_window) { | 830 void DesktopWindowTreeHostWin::HandleNativeBlur(HWND focused_window) { |
| 831 // TODO(beng): inform the native_widget_delegate_. | 831 // TODO(beng): inform the native_widget_delegate_. |
| 832 } | 832 } |
| 833 | 833 |
| 834 bool DesktopWindowTreeHostWin::HandleMouseEvent(const ui::MouseEvent& event) { | 834 bool DesktopWindowTreeHostWin::HandleMouseEvent(const ui::MouseEvent& event) { |
| 835 SendEventToProcessor(const_cast<ui::MouseEvent*>(&event)); | 835 SendEventToSink(const_cast<ui::MouseEvent*>(&event)); |
| 836 return event.handled(); | 836 return event.handled(); |
| 837 } | 837 } |
| 838 | 838 |
| 839 void DesktopWindowTreeHostWin::HandleKeyEvent(ui::KeyEvent* event) { | 839 void DesktopWindowTreeHostWin::HandleKeyEvent(ui::KeyEvent* event) { |
| 840 GetInputMethod()->DispatchKeyEvent(event); | 840 GetInputMethod()->DispatchKeyEvent(event); |
| 841 } | 841 } |
| 842 | 842 |
| 843 void DesktopWindowTreeHostWin::HandleTouchEvent( | 843 void DesktopWindowTreeHostWin::HandleTouchEvent( |
| 844 const ui::TouchEvent& event) { | 844 const ui::TouchEvent& event) { |
| 845 // HWNDMessageHandler asynchronously processes touch events. Because of this | 845 // HWNDMessageHandler asynchronously processes touch events. Because of this |
| 846 // it's possible for the aura::WindowEventDispatcher to have been destroyed | 846 // it's possible for the aura::WindowEventDispatcher to have been destroyed |
| 847 // by the time we attempt to process them. | 847 // by the time we attempt to process them. |
| 848 if (!GetWidget()->GetNativeView()) | 848 if (!GetWidget()->GetNativeView()) |
| 849 return; | 849 return; |
| 850 | 850 |
| 851 // Currently we assume the window that has capture gets touch events too. | 851 // Currently we assume the window that has capture gets touch events too. |
| 852 aura::WindowTreeHost* host = | 852 aura::WindowTreeHost* host = |
| 853 aura::WindowTreeHost::GetForAcceleratedWidget(GetCapture()); | 853 aura::WindowTreeHost::GetForAcceleratedWidget(GetCapture()); |
| 854 if (host) { | 854 if (host) { |
| 855 DesktopWindowTreeHostWin* target = | 855 DesktopWindowTreeHostWin* target = |
| 856 host->window()->GetProperty(kDesktopWindowTreeHostKey); | 856 host->window()->GetProperty(kDesktopWindowTreeHostKey); |
| 857 if (target && target->HasCapture() && target != this) { | 857 if (target && target->HasCapture() && target != this) { |
| 858 POINT target_location(event.location().ToPOINT()); | 858 POINT target_location(event.location().ToPOINT()); |
| 859 ClientToScreen(GetHWND(), &target_location); | 859 ClientToScreen(GetHWND(), &target_location); |
| 860 ScreenToClient(target->GetHWND(), &target_location); | 860 ScreenToClient(target->GetHWND(), &target_location); |
| 861 ui::TouchEvent target_event(event, static_cast<View*>(NULL), | 861 ui::TouchEvent target_event(event, static_cast<View*>(NULL), |
| 862 static_cast<View*>(NULL)); | 862 static_cast<View*>(NULL)); |
| 863 target_event.set_location(gfx::Point(target_location)); | 863 target_event.set_location(gfx::Point(target_location)); |
| 864 target_event.set_root_location(target_event.location()); | 864 target_event.set_root_location(target_event.location()); |
| 865 target->SendEventToProcessor(&target_event); | 865 target->SendEventToSink(&target_event); |
| 866 return; | 866 return; |
| 867 } | 867 } |
| 868 } | 868 } |
| 869 SendEventToProcessor(const_cast<ui::TouchEvent*>(&event)); | 869 SendEventToSink(const_cast<ui::TouchEvent*>(&event)); |
| 870 } | 870 } |
| 871 | 871 |
| 872 bool DesktopWindowTreeHostWin::HandleIMEMessage(UINT message, | 872 bool DesktopWindowTreeHostWin::HandleIMEMessage(UINT message, |
| 873 WPARAM w_param, | 873 WPARAM w_param, |
| 874 LPARAM l_param, | 874 LPARAM l_param, |
| 875 LRESULT* result) { | 875 LRESULT* result) { |
| 876 MSG msg = {}; | 876 MSG msg = {}; |
| 877 msg.hwnd = GetHWND(); | 877 msg.hwnd = GetHWND(); |
| 878 msg.message = message; | 878 msg.message = message; |
| 879 msg.wParam = w_param; | 879 msg.wParam = w_param; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 return false; | 915 return false; |
| 916 } | 916 } |
| 917 | 917 |
| 918 void DesktopWindowTreeHostWin::PostHandleMSG(UINT message, | 918 void DesktopWindowTreeHostWin::PostHandleMSG(UINT message, |
| 919 WPARAM w_param, | 919 WPARAM w_param, |
| 920 LPARAM l_param) { | 920 LPARAM l_param) { |
| 921 } | 921 } |
| 922 | 922 |
| 923 bool DesktopWindowTreeHostWin::HandleScrollEvent( | 923 bool DesktopWindowTreeHostWin::HandleScrollEvent( |
| 924 const ui::ScrollEvent& event) { | 924 const ui::ScrollEvent& event) { |
| 925 SendEventToProcessor(const_cast<ui::ScrollEvent*>(&event)); | 925 SendEventToSink(const_cast<ui::ScrollEvent*>(&event)); |
| 926 return event.handled(); | 926 return event.handled(); |
| 927 } | 927 } |
| 928 | 928 |
| 929 void DesktopWindowTreeHostWin::HandleWindowSizeChanging() { | 929 void DesktopWindowTreeHostWin::HandleWindowSizeChanging() { |
| 930 if (compositor()) | 930 if (compositor()) |
| 931 compositor()->DisableSwapUntilResize(); | 931 compositor()->DisableSwapUntilResize(); |
| 932 } | 932 } |
| 933 | 933 |
| 934 void DesktopWindowTreeHostWin::HandleWindowSizeUnchanged() { | 934 void DesktopWindowTreeHostWin::HandleWindowSizeUnchanged() { |
| 935 // A resize may not have occurred if the window size happened not to have | 935 // A resize may not have occurred if the window size happened not to have |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 | 996 |
| 997 // static | 997 // static |
| 998 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 998 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
| 999 internal::NativeWidgetDelegate* native_widget_delegate, | 999 internal::NativeWidgetDelegate* native_widget_delegate, |
| 1000 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 1000 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| 1001 return new DesktopWindowTreeHostWin(native_widget_delegate, | 1001 return new DesktopWindowTreeHostWin(native_widget_delegate, |
| 1002 desktop_native_widget_aura); | 1002 desktop_native_widget_aura); |
| 1003 } | 1003 } |
| 1004 | 1004 |
| 1005 } // namespace views | 1005 } // namespace views |
| OLD | NEW |