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 "content/browser/renderer_host/render_widget_host_view_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <peninputpanel_i.c> | 9 #include <peninputpanel_i.c> |
10 #include <stack> | 10 #include <stack> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 #include "ui/base/win/mouse_wheel_util.h" | 59 #include "ui/base/win/mouse_wheel_util.h" |
60 #include "ui/gfx/canvas.h" | 60 #include "ui/gfx/canvas.h" |
61 #include "ui/gfx/gdi_util.h" | 61 #include "ui/gfx/gdi_util.h" |
62 #include "ui/gfx/rect.h" | 62 #include "ui/gfx/rect.h" |
63 #include "ui/gfx/screen.h" | 63 #include "ui/gfx/screen.h" |
64 #include "webkit/glue/webcursor.h" | 64 #include "webkit/glue/webcursor.h" |
65 #include "webkit/plugins/npapi/plugin_constants_win.h" | 65 #include "webkit/plugins/npapi/plugin_constants_win.h" |
66 #include "webkit/plugins/npapi/webplugin.h" | 66 #include "webkit/plugins/npapi/webplugin.h" |
67 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 67 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
68 | 68 |
69 // From MSDN. | |
70 #define MOUSEEVENTF_FROMTOUCH 0xFF515700 | |
71 | |
72 using base::TimeDelta; | 69 using base::TimeDelta; |
73 using base::TimeTicks; | 70 using base::TimeTicks; |
74 using ui::ViewProp; | 71 using ui::ViewProp; |
75 using WebKit::WebInputEvent; | 72 using WebKit::WebInputEvent; |
76 using WebKit::WebInputEventFactory; | 73 using WebKit::WebInputEventFactory; |
77 using WebKit::WebMouseEvent; | 74 using WebKit::WebMouseEvent; |
78 using WebKit::WebTextDirection; | 75 using WebKit::WebTextDirection; |
79 using webkit::npapi::WebPluginGeometry; | 76 using webkit::npapi::WebPluginGeometry; |
80 | 77 |
81 namespace content { | 78 namespace content { |
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1850 handled = FALSE; | 1847 handled = FALSE; |
1851 return 0; | 1848 return 0; |
1852 } | 1849 } |
1853 } | 1850 } |
1854 | 1851 |
1855 LRESULT RenderWidgetHostViewWin::OnMouseEvent(UINT message, WPARAM wparam, | 1852 LRESULT RenderWidgetHostViewWin::OnMouseEvent(UINT message, WPARAM wparam, |
1856 LPARAM lparam, BOOL& handled) { | 1853 LPARAM lparam, BOOL& handled) { |
1857 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnMouseEvent"); | 1854 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnMouseEvent"); |
1858 handled = TRUE; | 1855 handled = TRUE; |
1859 | 1856 |
1860 // Windows sends (fake) mouse messages for touch events. Ignore these since | |
1861 // we're processing WM_TOUCH elsewhere. | |
1862 if (touch_events_enabled_ && (message == WM_MOUSEMOVE || | |
1863 message == WM_LBUTTONDOWN || message == WM_LBUTTONUP || | |
1864 message == WM_RBUTTONDOWN || message == WM_RBUTTONUP) && | |
1865 (GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == | |
1866 MOUSEEVENTF_FROMTOUCH) | |
1867 return 0; | |
1868 | |
1869 if (message == WM_MOUSELEAVE) | 1857 if (message == WM_MOUSELEAVE) |
1870 ignore_mouse_movement_ = true; | 1858 ignore_mouse_movement_ = true; |
1871 | 1859 |
1872 if (mouse_locked_) { | 1860 if (mouse_locked_) { |
1873 HandleLockedMouseEvent(message, wparam, lparam); | 1861 HandleLockedMouseEvent(message, wparam, lparam); |
1874 MoveCursorToCenterIfNecessary(); | 1862 MoveCursorToCenterIfNecessary(); |
1875 return 0; | 1863 return 0; |
1876 } | 1864 } |
1877 | 1865 |
1878 if (::IsWindow(tooltip_hwnd_)) { | 1866 if (::IsWindow(tooltip_hwnd_)) { |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2912 event.movementX = | 2900 event.movementX = |
2913 event.globalX - last_mouse_position_.unlocked_global.x(); | 2901 event.globalX - last_mouse_position_.unlocked_global.x(); |
2914 event.movementY = | 2902 event.movementY = |
2915 event.globalY - last_mouse_position_.unlocked_global.y(); | 2903 event.globalY - last_mouse_position_.unlocked_global.y(); |
2916 } | 2904 } |
2917 | 2905 |
2918 last_mouse_position_.unlocked.SetPoint(event.windowX, event.windowY); | 2906 last_mouse_position_.unlocked.SetPoint(event.windowX, event.windowY); |
2919 last_mouse_position_.unlocked_global.SetPoint(event.globalX, event.globalY); | 2907 last_mouse_position_.unlocked_global.SetPoint(event.globalX, event.globalY); |
2920 } | 2908 } |
2921 | 2909 |
2922 // Send the event to the renderer before changing mouse capture, so that the | 2910 // Windows sends (fake) mouse messages for touch events. Don't send these to |
2923 // capturelost event arrives after mouseup. | 2911 // the render widget. |
2924 render_widget_host_->ForwardMouseEvent(event); | 2912 if (!(touch_events_enabled_ && base::win::IsMouseEventFromTouch(message))) { |
sky
2012/07/24 21:36:25
nit: !touch_events_enabled || !IsMouseEventFromTou
girard
2012/07/24 23:54:54
Done.
| |
2913 // Send the event to the renderer before changing mouse capture, so that | |
2914 // the capturelost event arrives after mouseup. | |
2915 render_widget_host_->ForwardMouseEvent(event); | |
2916 } | |
2925 | 2917 |
2926 switch (event.type) { | 2918 switch (event.type) { |
2927 case WebInputEvent::MouseMove: | 2919 case WebInputEvent::MouseMove: |
2928 TrackMouseLeave(true); | 2920 TrackMouseLeave(true); |
2929 break; | 2921 break; |
2930 case WebInputEvent::MouseLeave: | 2922 case WebInputEvent::MouseLeave: |
2931 TrackMouseLeave(false); | 2923 TrackMouseLeave(false); |
2932 break; | 2924 break; |
2933 case WebInputEvent::MouseDown: | 2925 case WebInputEvent::MouseDown: |
2934 SetCapture(); | 2926 SetCapture(); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3155 // receive a focus change in the context of a pointer down message, it means | 3147 // receive a focus change in the context of a pointer down message, it means |
3156 // that the pointer down message occurred on the edit field and we should | 3148 // that the pointer down message occurred on the edit field and we should |
3157 // display the on screen keyboard | 3149 // display the on screen keyboard |
3158 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 3150 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
3159 DisplayOnScreenKeyboardIfNeeded(); | 3151 DisplayOnScreenKeyboardIfNeeded(); |
3160 received_focus_change_after_pointer_down_ = false; | 3152 received_focus_change_after_pointer_down_ = false; |
3161 pointer_down_context_ = false; | 3153 pointer_down_context_ = false; |
3162 } | 3154 } |
3163 | 3155 |
3164 } // namespace content | 3156 } // namespace content |
OLD | NEW |