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_root_window_host_win.h" | 5 #include "ui/aura/remote_root_window_host_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 517 |
518 void RemoteWindowTreeHostWin::OnMouseButton( | 518 void RemoteWindowTreeHostWin::OnMouseButton( |
519 const MetroViewerHostMsg_MouseButtonParams& params) { | 519 const MetroViewerHostMsg_MouseButtonParams& params) { |
520 gfx::Point location = PointFromNativeEvent(params.x, params.y); | 520 gfx::Point location = PointFromNativeEvent(params.x, params.y); |
521 ui::MouseEvent mouse_event(params.event_type, location, location, | 521 ui::MouseEvent mouse_event(params.event_type, location, location, |
522 static_cast<int>(params.flags), | 522 static_cast<int>(params.flags), |
523 static_cast<int>(params.changed_button)); | 523 static_cast<int>(params.changed_button)); |
524 | 524 |
525 SetEventFlags(params.flags | key_event_flags()); | 525 SetEventFlags(params.flags | key_event_flags()); |
526 if (params.event_type == ui::ET_MOUSEWHEEL) { | 526 if (params.event_type == ui::ET_MOUSEWHEEL) { |
527 ui::MouseWheelEvent wheel_event(mouse_event, 0, params.extra); | 527 int x_offset = params.is_horizontal_wheel ? params.extra : 0; |
| 528 int y_offset = !params.is_horizontal_wheel ? params.extra : 0; |
| 529 ui::MouseWheelEvent wheel_event(mouse_event, x_offset, y_offset); |
528 delegate_->OnHostMouseEvent(&wheel_event); | 530 delegate_->OnHostMouseEvent(&wheel_event); |
529 } else if (params.event_type == ui::ET_MOUSE_PRESSED) { | 531 } else if (params.event_type == ui::ET_MOUSE_PRESSED) { |
530 // TODO(shrikant): Ideally modify code in event.cc by adding automatic | 532 // TODO(shrikant): Ideally modify code in event.cc by adding automatic |
531 // tracking of double clicks in synthetic MouseEvent constructor code. | 533 // tracking of double clicks in synthetic MouseEvent constructor code. |
532 // Non-synthetic MouseEvent constructor code does automatically track | 534 // Non-synthetic MouseEvent constructor code does automatically track |
533 // this. Need to use some caution while modifying synthetic constructor | 535 // this. Need to use some caution while modifying synthetic constructor |
534 // as many tests and other code paths depend on it and apparently | 536 // as many tests and other code paths depend on it and apparently |
535 // specifically depend on non implicit tracking of previous mouse event. | 537 // specifically depend on non implicit tracking of previous mouse event. |
536 if (last_mouse_click_event_ && | 538 if (last_mouse_click_event_ && |
537 ui::MouseEvent::IsRepeatedClickEvent(mouse_event, | 539 ui::MouseEvent::IsRepeatedClickEvent(mouse_event, |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 } | 739 } |
738 | 740 |
739 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { | 741 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { |
740 if (flags == event_flags_) | 742 if (flags == event_flags_) |
741 return; | 743 return; |
742 event_flags_ = flags; | 744 event_flags_ = flags; |
743 SetVirtualKeyStates(event_flags_); | 745 SetVirtualKeyStates(event_flags_); |
744 } | 746 } |
745 | 747 |
746 } // namespace aura | 748 } // namespace aura |
OLD | NEW |