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/aura/remote_window_tree_host_win.h" | 5 #include "ui/aura/remote_window_tree_host_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 static float scale_factor = gfx::GetDPIScale(); | 299 static float scale_factor = gfx::GetDPIScale(); |
300 gfx::Point result( x * scale_factor, y * scale_factor); | 300 gfx::Point result( x * scale_factor, y * scale_factor); |
301 return result; | 301 return result; |
302 } | 302 } |
303 | 303 |
304 void RemoteWindowTreeHostWin::OnMouseMoved(int32 x, int32 y, int32 flags) { | 304 void RemoteWindowTreeHostWin::OnMouseMoved(int32 x, int32 y, int32 flags) { |
305 if (ignore_mouse_moves_until_set_cursor_ack_) | 305 if (ignore_mouse_moves_until_set_cursor_ack_) |
306 return; | 306 return; |
307 | 307 |
308 gfx::Point location = PointFromNativeEvent(x, y); | 308 gfx::Point location = PointFromNativeEvent(x, y); |
309 ui::MouseEvent event(ui::ET_MOUSE_MOVED, location, location, | 309 ui::MouseEvent event( |
310 ui::EventTimeForNow(), flags, 0); | 310 ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(), flags, 0, |
| 311 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
311 SendEventToProcessor(&event); | 312 SendEventToProcessor(&event); |
312 } | 313 } |
313 | 314 |
314 void RemoteWindowTreeHostWin::OnMouseButton( | 315 void RemoteWindowTreeHostWin::OnMouseButton( |
315 const MetroViewerHostMsg_MouseButtonParams& params) { | 316 const MetroViewerHostMsg_MouseButtonParams& params) { |
316 gfx::Point location = PointFromNativeEvent(params.x, params.y); | 317 gfx::Point location = PointFromNativeEvent(params.x, params.y); |
317 ui::MouseEvent mouse_event( | 318 ui::MouseEvent mouse_event( |
318 params.event_type, location, location, ui::EventTimeForNow(), | 319 params.event_type, location, location, ui::EventTimeForNow(), |
319 static_cast<int>(params.flags), static_cast<int>(params.changed_button)); | 320 static_cast<int>(params.flags), static_cast<int>(params.changed_button), |
| 321 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
320 | 322 |
321 SetEventFlags(params.flags | key_event_flags()); | 323 SetEventFlags(params.flags | key_event_flags()); |
322 if (params.event_type == ui::ET_MOUSEWHEEL) { | 324 if (params.event_type == ui::ET_MOUSEWHEEL) { |
323 int x_offset = params.is_horizontal_wheel ? params.extra : 0; | 325 int x_offset = params.is_horizontal_wheel ? params.extra : 0; |
324 int y_offset = !params.is_horizontal_wheel ? params.extra : 0; | 326 int y_offset = !params.is_horizontal_wheel ? params.extra : 0; |
325 ui::MouseWheelEvent wheel_event(mouse_event, x_offset, y_offset); | 327 ui::MouseWheelEvent wheel_event(mouse_event, x_offset, y_offset); |
326 SendEventToProcessor(&wheel_event); | 328 SendEventToProcessor(&wheel_event); |
327 } else if (params.event_type == ui::ET_MOUSE_PRESSED) { | 329 } else if (params.event_type == ui::ET_MOUSE_PRESSED) { |
328 // TODO(shrikant): Ideally modify code in event.cc by adding automatic | 330 // TODO(shrikant): Ideally modify code in event.cc by adding automatic |
329 // tracking of double clicks in synthetic MouseEvent constructor code. | 331 // tracking of double clicks in synthetic MouseEvent constructor code. |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 } | 507 } |
506 | 508 |
507 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { | 509 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { |
508 if (flags == event_flags_) | 510 if (flags == event_flags_) |
509 return; | 511 return; |
510 event_flags_ = flags; | 512 event_flags_ = flags; |
511 SetVirtualKeyStates(event_flags_); | 513 SetVirtualKeyStates(event_flags_); |
512 } | 514 } |
513 | 515 |
514 } // namespace aura | 516 } // namespace aura |
OLD | NEW |