diff options
53 files changed, 257 insertions, 180 deletions
diff --git a/ash/autoclick/autoclick_controller.cc b/ash/autoclick/autoclick_controller.cc index 9b49ca2..ec8977b 100644 --- a/ash/autoclick/autoclick_controller.cc +++ b/ash/autoclick/autoclick_controller.cc @@ -191,11 +191,13 @@ void AutoclickControllerImpl::DoAutoclick() { ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, click_location, click_location, - mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON); + mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON, + ui::EF_LEFT_MOUSE_BUTTON); ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, click_location, click_location, - mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON); + mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON, + ui::EF_LEFT_MOUSE_BUTTON); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&press_event); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&release_event); diff --git a/ash/autoclick/autoclick_unittest.cc b/ash/autoclick/autoclick_unittest.cc index 96f17cf..5151a9a7 100644 --- a/ash/autoclick/autoclick_unittest.cc +++ b/ash/autoclick/autoclick_unittest.cc @@ -36,7 +36,8 @@ class MouseEventCapturer : public ui::EventHandler { event->type(), event->location(), event->root_location(), - event->flags())); + event->flags(), + event->changed_button_flags())); // Stop event propagation so we don't click on random stuff that // might break test assumptions. event->StopPropagation(); diff --git a/ash/display/mouse_cursor_event_filter_unittest.cc b/ash/display/mouse_cursor_event_filter_unittest.cc index 7fa79fd..be7dac5 100644 --- a/ash/display/mouse_cursor_event_filter_unittest.cc +++ b/ash/display/mouse_cursor_event_filter_unittest.cc @@ -41,7 +41,7 @@ class MouseCursorEventFilterTest : public test::AshTestBase { gfx::Point point_in_screen) { gfx::Point location = drag_source_root->bounds().CenterPoint(); ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, location, - location, 0); + location, 0, 0); ui::Event::DispatcherApi(&pressed).set_target(drag_source_root); event_filter()->OnMouseEvent(&pressed); bool is_warped = event_filter()->WarpMouseCursorIfNecessary( @@ -49,7 +49,7 @@ class MouseCursorEventFilterTest : public test::AshTestBase { event_filter()->reset_was_mouse_warped_for_test(); ui::MouseEvent released(ui::ET_MOUSE_RELEASED, location, - location, 0); + location, 0, 0); ui::Event::DispatcherApi(&released).set_target(drag_source_root); event_filter()->OnMouseEvent(&released); return is_warped; diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc index baf5acb..f7481c6 100644 --- a/ash/drag_drop/drag_drop_controller_unittest.cc +++ b/ash/drag_drop/drag_drop_controller_unittest.cc @@ -736,7 +736,7 @@ TEST_F(DragDropControllerTest, SyntheticEventsDuringDragDrop) { // The DragDropController should simply ignore these events. gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location, - mouse_move_location, 0); + mouse_move_location, 0, 0); Shell::GetPrimaryRootWindow()->GetDispatcher()->AsRootWindowHostDelegate()-> OnHostMouseEvent(&mouse_move); } @@ -1022,6 +1022,7 @@ TEST_F(DragDropControllerTest, DragCancelAcrossDisplays) { ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, gfx::Point(200, 0), gfx::Point(200, 0), + ui::EF_NONE, ui::EF_NONE); drag_drop_controller_->DragUpdate(window, e); } @@ -1029,6 +1030,7 @@ TEST_F(DragDropControllerTest, DragCancelAcrossDisplays) { ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, gfx::Point(600, 0), gfx::Point(600, 0), + ui::EF_NONE, ui::EF_NONE); drag_drop_controller_->DragUpdate(window, e); } @@ -1057,6 +1059,7 @@ TEST_F(DragDropControllerTest, DragCancelAcrossDisplays) { ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, gfx::Point(600, 0), gfx::Point(600, 0), + ui::EF_NONE, ui::EF_NONE); drag_drop_controller_->DragUpdate(window, e); } @@ -1064,6 +1067,7 @@ TEST_F(DragDropControllerTest, DragCancelAcrossDisplays) { ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, gfx::Point(200, 0), gfx::Point(200, 0), + ui::EF_NONE, ui::EF_NONE); drag_drop_controller_->DragUpdate(window, e); } diff --git a/ash/drag_drop/drag_drop_tracker.cc b/ash/drag_drop/drag_drop_tracker.cc index 03ecf79..32fb417 100644 --- a/ash/drag_drop/drag_drop_tracker.cc +++ b/ash/drag_drop/drag_drop_tracker.cc @@ -74,7 +74,9 @@ ui::LocatedEvent* DragDropTracker::ConvertEvent( return new ui::MouseEvent(event.type(), target_location, target_root_location, - event.flags()); + event.flags(), + static_cast<const ui::MouseEvent&>(event). + changed_button_flags()); } } // namespace internal diff --git a/ash/drag_drop/drag_drop_tracker_unittest.cc b/ash/drag_drop/drag_drop_tracker_unittest.cc index ec2bc15..41eb089 100644 --- a/ash/drag_drop/drag_drop_tracker_unittest.cc +++ b/ash/drag_drop/drag_drop_tracker_unittest.cc @@ -37,6 +37,7 @@ class DragDropTrackerTest : public test::AshTestBase { ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, location, location, + ui::EF_NONE, ui::EF_NONE); aura::Window* target = tracker->GetTarget(e); return target; @@ -147,6 +148,7 @@ TEST_F(DragDropTrackerTest, MAYBE_ConvertEvent) { ui::MouseEvent original00(ui::ET_MOUSE_DRAGGED, gfx::Point(50, 50), gfx::Point(50, 50), + ui::EF_NONE, ui::EF_NONE); scoped_ptr<ui::LocatedEvent> converted00(ConvertEvent(window0.get(), original00)); @@ -160,6 +162,7 @@ TEST_F(DragDropTrackerTest, MAYBE_ConvertEvent) { ui::MouseEvent original01(ui::ET_MOUSE_DRAGGED, gfx::Point(350, 150), gfx::Point(350, 150), + ui::EF_NONE, ui::EF_NONE); scoped_ptr<ui::LocatedEvent> converted01(ConvertEvent(window1.get(), original01)); @@ -176,6 +179,7 @@ TEST_F(DragDropTrackerTest, MAYBE_ConvertEvent) { ui::MouseEvent original10(ui::ET_MOUSE_DRAGGED, gfx::Point(-150, 50), gfx::Point(-150, 50), + ui::EF_NONE, ui::EF_NONE); scoped_ptr<ui::LocatedEvent> converted10(ConvertEvent(window0.get(), original10)); @@ -189,6 +193,7 @@ TEST_F(DragDropTrackerTest, MAYBE_ConvertEvent) { ui::MouseEvent original11(ui::ET_MOUSE_DRAGGED, gfx::Point(150, 150), gfx::Point(150, 150), + ui::EF_NONE, ui::EF_NONE); scoped_ptr<ui::LocatedEvent> converted11(ConvertEvent(window1.get(), original11)); diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc index 8fed2ba..225deca 100644 --- a/ash/extended_desktop_unittest.cc +++ b/ash/extended_desktop_unittest.cc @@ -441,8 +441,7 @@ TEST_F(ExtendedDesktopTest, Capture) { generator2.ClickLeftButton(); EXPECT_EQ("0 0 0", r2_d1.GetMouseMotionCountsAndReset()); EXPECT_EQ("0 0", r2_d1.GetMouseButtonCountsAndReset()); - // mouse is already entered. - EXPECT_EQ("0 1 0", r1_d2.GetMouseMotionCountsAndReset()); + EXPECT_EQ("1 1 0", r1_d2.GetMouseMotionCountsAndReset()); EXPECT_EQ("1 1", r1_d2.GetMouseButtonCountsAndReset()); r1_w2->ReleaseCapture(); EXPECT_EQ(NULL, aura::client::GetCaptureWindow(r2_w1->GetRootWindow())); diff --git a/ash/shelf/shelf_tooltip_manager_unittest.cc b/ash/shelf/shelf_tooltip_manager_unittest.cc index 33792ec..6114202 100644 --- a/ash/shelf/shelf_tooltip_manager_unittest.cc +++ b/ash/shelf/shelf_tooltip_manager_unittest.cc @@ -231,7 +231,8 @@ TEST_F(ShelfTooltipManagerTest, HideForMouseMoveEvent) { // Shouldn't hide if the mouse is in the tooltip. ui::MouseEvent mouse_event(ui::ET_MOUSE_MOVED, tooltip_rect.CenterPoint(), - tooltip_rect.CenterPoint(), ui::EF_NONE); + tooltip_rect.CenterPoint(), ui::EF_NONE, + ui::EF_NONE); ui::LocatedEventTestApi test_api(&mouse_event); SetEventTarget(root_window, &mouse_event); @@ -260,7 +261,8 @@ TEST_F(ShelfTooltipManagerTest, HideForMouseClickEvent) { // Should hide if the mouse is pressed in the tooltip. ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, tooltip_rect.CenterPoint(), - tooltip_rect.CenterPoint(), ui::EF_NONE); + tooltip_rect.CenterPoint(), ui::EF_NONE, + ui::EF_NONE); SetEventTarget(root_window, &mouse_event); event_handler->OnMouseEvent(&mouse_event); diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc index 3b7e204..101c0cd 100644 --- a/ash/shelf/shelf_view.cc +++ b/ash/shelf/shelf_view.cc @@ -616,7 +616,7 @@ bool ShelfView::StartDrag(const std::string& app_id, ash::wm::ConvertPointFromScreen( ash::wm::GetRootWindowAt(location_in_screen_coordinates), &point_in_root); - ui::MouseEvent event(ui::ET_MOUSE_PRESSED, pt, point_in_root, 0); + ui::MouseEvent event(ui::ET_MOUSE_PRESSED, pt, point_in_root, 0, 0); PointerPressedOnButton(drag_and_drop_view, ShelfButtonHost::DRAG_AND_DROP, event); @@ -639,7 +639,7 @@ bool ShelfView::Drag(const gfx::Point& location_in_screen_coordinates) { ash::wm::ConvertPointFromScreen( ash::wm::GetRootWindowAt(location_in_screen_coordinates), &point_in_root); - ui::MouseEvent event(ui::ET_MOUSE_DRAGGED, pt, point_in_root, 0); + ui::MouseEvent event(ui::ET_MOUSE_DRAGGED, pt, point_in_root, 0, 0); PointerDraggedOnButton(drag_and_drop_view, ShelfButtonHost::DRAG_AND_DROP, event); diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc index ec1468a..ffd20a4 100644 --- a/ash/shelf/shelf_view_unittest.cc +++ b/ash/shelf/shelf_view_unittest.cc @@ -402,7 +402,7 @@ class ShelfViewTest : public AshTestBase { views::View* button = test_api_->GetButton(button_index); ui::MouseEvent click_event(ui::ET_MOUSE_PRESSED, button->bounds().origin(), - button->GetBoundsInScreen().origin(), 0); + button->GetBoundsInScreen().origin(), 0, 0); button_host->PointerPressedOnButton(button, pointer, click_event); return button; } @@ -427,7 +427,7 @@ class ShelfViewTest : public AshTestBase { views::View* destination = test_api_->GetButton(destination_index); ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, destination->bounds().origin(), - destination->GetBoundsInScreen().origin(), 0); + destination->GetBoundsInScreen().origin(), 0, 0); button_host->PointerDraggedOnButton(button, pointer, drag_event); return button; } diff --git a/ash/system/chromeos/screen_security/screen_tray_item_unittest.cc b/ash/system/chromeos/screen_security/screen_tray_item_unittest.cc index 928dad7..c8e673c 100644 --- a/ash/system/chromeos/screen_security/screen_tray_item_unittest.cc +++ b/ash/system/chromeos/screen_security/screen_tray_item_unittest.cc @@ -39,6 +39,7 @@ void ClickViewCenter(views::View* view) { view->OnMousePressed(ui::MouseEvent(ui::ET_MOUSE_PRESSED, click_location_in_local, click_location_in_local, + ui::EF_NONE, ui::EF_NONE)); } diff --git a/ash/wm/immersive_fullscreen_controller_unittest.cc b/ash/wm/immersive_fullscreen_controller_unittest.cc index 7e50916..c51217c 100644 --- a/ash/wm/immersive_fullscreen_controller_unittest.cc +++ b/ash/wm/immersive_fullscreen_controller_unittest.cc @@ -330,7 +330,7 @@ TEST_F(ImmersiveFullscreenControllerTest, OnMouseEvent) { // Mouse wheel event does nothing. ui::MouseEvent wheel( - ui::ET_MOUSEWHEEL, top_edge_pos, top_edge_pos, ui::EF_NONE); + ui::ET_MOUSEWHEEL, top_edge_pos, top_edge_pos, ui::EF_NONE, ui::EF_NONE); event_generator.Dispatch(&wheel); EXPECT_FALSE(top_edge_hover_timer_running()); diff --git a/ash/wm/sticky_keys_unittest.cc b/ash/wm/sticky_keys_unittest.cc index d6fc660..41c2238 100644 --- a/ash/wm/sticky_keys_unittest.cc +++ b/ash/wm/sticky_keys_unittest.cc @@ -235,6 +235,7 @@ class StickyKeysTest : public test::AshTestBase, is_button_press ? ui::ET_MOUSE_PRESSED : ui::ET_MOUSE_RELEASED, gfx::Point(0, 0), gfx::Point(0, 0), + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); ui::Event::DispatcherApi dispatcher(event); dispatcher.set_target(target_); diff --git a/ash/wm/user_activity_detector_unittest.cc b/ash/wm/user_activity_detector_unittest.cc index 89f6aee..338bb95 100644 --- a/ash/wm/user_activity_detector_unittest.cc +++ b/ash/wm/user_activity_detector_unittest.cc @@ -105,7 +105,7 @@ TEST_F(UserActivityDetectorTest, Basic) { UserActivityDetector::kNotifyIntervalMs); AdvanceTime(advance_delta); ui::MouseEvent mouse_event( - ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_NONE); + ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_NONE, ui::EF_NONE); SetEventTarget(window.get(), &mouse_event); detector_->OnMouseEvent(&mouse_event); EXPECT_FALSE(mouse_event.handled()); @@ -212,7 +212,8 @@ TEST_F(UserActivityDetectorTest, RateLimitNotifications) { TEST_F(UserActivityDetectorTest, IgnoreSyntheticMouseEvents) { scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(12345)); ui::MouseEvent mouse_event( - ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_IS_SYNTHESIZED); + ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EF_IS_SYNTHESIZED, + ui::EF_NONE); SetEventTarget(window.get(), &mouse_event); detector_->OnMouseEvent(&mouse_event); EXPECT_FALSE(mouse_event.handled()); diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc index af21613..ea1b97e 100644 --- a/ash/wm/window_manager_unittest.cc +++ b/ash/wm/window_manager_unittest.cc @@ -509,14 +509,14 @@ TEST_F(WindowManagerTest, MouseEventCursors) { { // Resize edges and corners show proper cursors. window_delegate.set_hittest_code(HTBOTTOM); - ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0x0); + ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0, 0); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); EXPECT_EQ(ui::kCursorSouthResize, dispatcher->last_cursor().native_type()); } { window_delegate.set_hittest_code(HTBOTTOMLEFT); - ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0x0); + ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0, 0); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move2); EXPECT_EQ(ui::kCursorSouthWestResize, dispatcher->last_cursor().native_type()); @@ -524,7 +524,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) { { window_delegate.set_hittest_code(HTBOTTOMRIGHT); - ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0x0); + ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0, 0); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); EXPECT_EQ(ui::kCursorSouthEastResize, dispatcher->last_cursor().native_type()); @@ -532,28 +532,28 @@ TEST_F(WindowManagerTest, MouseEventCursors) { { window_delegate.set_hittest_code(HTLEFT); - ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0x0); + ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0, 0); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move2); EXPECT_EQ(ui::kCursorWestResize, dispatcher->last_cursor().native_type()); } { window_delegate.set_hittest_code(HTRIGHT); - ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0x0); + ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0, 0); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); EXPECT_EQ(ui::kCursorEastResize, dispatcher->last_cursor().native_type()); } { window_delegate.set_hittest_code(HTTOP); - ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0x0); + ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0, 0); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move2); EXPECT_EQ(ui::kCursorNorthResize, dispatcher->last_cursor().native_type()); } { window_delegate.set_hittest_code(HTTOPLEFT); - ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0x0); + ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0, 0); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); EXPECT_EQ(ui::kCursorNorthWestResize, dispatcher->last_cursor().native_type()); @@ -561,7 +561,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) { { window_delegate.set_hittest_code(HTTOPRIGHT); - ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0x0); + ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0, 0); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move2); EXPECT_EQ(ui::kCursorNorthEastResize, dispatcher->last_cursor().native_type()); @@ -570,7 +570,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) { { // Client area uses null cursor. window_delegate.set_hittest_code(HTCLIENT); - ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0x0); + ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0, 0); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); EXPECT_EQ(ui::kCursorNull, dispatcher->last_cursor().native_type()); } @@ -606,6 +606,7 @@ TEST_F(WindowManagerTest, MAYBE_TransformActivate) { ui::MouseEvent mouseev1(ui::ET_MOUSE_PRESSED, miss_point, miss_point, + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseev1); @@ -613,6 +614,7 @@ TEST_F(WindowManagerTest, MAYBE_TransformActivate) { ui::MouseEvent mouseup(ui::ET_MOUSE_RELEASED, miss_point, miss_point, + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseup); @@ -621,6 +623,7 @@ TEST_F(WindowManagerTest, MAYBE_TransformActivate) { ui::MouseEvent mouseev2(ui::ET_MOUSE_PRESSED, hit_point, hit_point, + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseev2); EXPECT_TRUE(wm::IsActiveWindow(w1.get())); @@ -657,7 +660,7 @@ TEST_F(WindowManagerTest, AdditionalFilters) { aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&key_event); ui::MouseEvent mouse_pressed( - ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), 0x0); + ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), 0, 0); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_pressed); // Both filters should get the events. @@ -676,7 +679,7 @@ TEST_F(WindowManagerTest, AdditionalFilters) { // Dispatches events. dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&key_event); ui::MouseEvent mouse_released( - ui::ET_MOUSE_RELEASED, gfx::Point(0, 0), gfx::Point(0, 0), 0x0); + ui::ET_MOUSE_RELEASED, gfx::Point(0, 0), gfx::Point(0, 0), 0, 0); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_released); // f1 should still get the events but f2 no longer gets them. diff --git a/ash/wm/workspace/workspace_event_handler_unittest.cc b/ash/wm/workspace/workspace_event_handler_unittest.cc index feec4bd..b42c851 100644 --- a/ash/wm/workspace/workspace_event_handler_unittest.cc +++ b/ash/wm/workspace/workspace_event_handler_unittest.cc @@ -271,12 +271,14 @@ TEST_F(WorkspaceEventHandlerTest, DoubleClickCaptionTogglesMaximize) { WindowPropertyObserver observer(window.get()); ui::MouseEvent press(ui::ET_MOUSE_PRESSED, generator.current_location(), generator.current_location(), - ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK); + ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK, + ui::EF_MIDDLE_MOUSE_BUTTON); aura::WindowEventDispatcher* dispatcher = root->GetDispatcher(); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&press); ui::MouseEvent release(ui::ET_MOUSE_RELEASED, generator.current_location(), generator.current_location(), - ui::EF_IS_DOUBLE_CLICK); + ui::EF_IS_DOUBLE_CLICK, + ui::EF_MIDDLE_MOUSE_BUTTON); dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&release); EXPECT_FALSE(window_state->IsMaximized()); diff --git a/chrome/browser/ui/views/location_bar/star_view_browsertest.cc b/chrome/browser/ui/views/location_bar/star_view_browsertest.cc index d09a32f..d85c5a3 100644 --- a/chrome/browser/ui/views/location_bar/star_view_browsertest.cc +++ b/chrome/browser/ui/views/location_bar/star_view_browsertest.cc @@ -43,9 +43,11 @@ IN_PROC_BROWSER_TEST_F(StarViewTest, MAYBE_HideOnSecondClick) { browser_view->GetToolbarView()->location_bar()->star_view(); ui::MouseEvent pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, + ui::EF_LEFT_MOUSE_BUTTON); ui::MouseEvent released_event(ui::ET_MOUSE_RELEASED, gfx::Point(), - gfx::Point(), ui::EF_LEFT_MOUSE_BUTTON); + gfx::Point(), ui::EF_LEFT_MOUSE_BUTTON, + ui::EF_LEFT_MOUSE_BUTTON); // Verify that clicking once shows the bookmark bubble. EXPECT_FALSE(BookmarkBubbleView::IsShowing()); diff --git a/chrome/browser/ui/views/new_avatar_menu_button_browsertest.cc b/chrome/browser/ui/views/new_avatar_menu_button_browsertest.cc index ed2e855..f675d9b 100644 --- a/chrome/browser/ui/views/new_avatar_menu_button_browsertest.cc +++ b/chrome/browser/ui/views/new_avatar_menu_button_browsertest.cc @@ -83,7 +83,8 @@ void NewAvatarMenuButtonTest::StartAvatarMenu() { ASSERT_FALSE(browser_view->frame()->GetAvatarMenuButton()); ProfileChooserView::clear_close_on_deactivate_for_testing(); - ui::MouseEvent mouse_ev(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), 0); + ui::MouseEvent mouse_ev(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), 0, + 0); button->NotifyClick(mouse_ev); base::MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(ProfileChooserView::IsShowing()); diff --git a/chrome/browser/ui/views/sync/one_click_signin_bubble_view_unittest.cc b/chrome/browser/ui/views/sync/one_click_signin_bubble_view_unittest.cc index d548d02..44f8546 100644 --- a/chrome/browser/ui/views/sync/one_click_signin_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/sync/one_click_signin_bubble_view_unittest.cc @@ -152,7 +152,7 @@ TEST_F(OneClickSigninBubbleViewTest, BubbleOkButton) { views::ButtonListener* listener = view; const ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), - 0); + 0, 0); listener->ButtonPressed(view->ok_button_, event); // View should no longer be showing. The message loop will exit once the @@ -170,7 +170,7 @@ TEST_F(OneClickSigninBubbleViewTest, DialogOkButton) { views::ButtonListener* listener = view; const ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), - 0); + 0, 0); listener->ButtonPressed(view->ok_button_, event); // View should no longer be showing and sync should start @@ -190,7 +190,7 @@ TEST_F(OneClickSigninBubbleViewTest, DialogUndoButton) { views::ButtonListener* listener = view; const ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), - 0); + 0, 0); listener->ButtonPressed(view->undo_button_, event); // View should no longer be showing. The message loop will exit once the diff --git a/chrome/browser/ui/views/toolbar/reload_button_unittest.cc b/chrome/browser/ui/views/toolbar/reload_button_unittest.cc index 5adaf1d..6d8e257 100644 --- a/chrome/browser/ui/views/toolbar/reload_button_unittest.cc +++ b/chrome/browser/ui/views/toolbar/reload_button_unittest.cc @@ -57,7 +57,7 @@ TEST_F(ReloadButtonTest, Basic) { false); // Press the button. This should start the double-click timer. - ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 0); + ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 0, 0); reload_.ButtonPressed(&reload_, e); CheckState(true, ReloadButton::MODE_RELOAD, ReloadButton::MODE_RELOAD, true, false); @@ -76,7 +76,7 @@ TEST_F(ReloadButtonTest, Basic) { TEST_F(ReloadButtonTest, DoubleClickTimer) { // Start by pressing the button. - ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 0); + ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 0, 0); reload_.ButtonPressed(&reload_, e); // Try to press the button again. This should do nothing because the timer is @@ -102,7 +102,7 @@ TEST_F(ReloadButtonTest, DoubleClickTimer) { TEST_F(ReloadButtonTest, DisableOnHover) { // Change to stop and hover. - ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 0); + ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 0, 0); reload_.ButtonPressed(&reload_, e); reload_.ChangeMode(ReloadButton::MODE_STOP, false); set_mouse_hovered(true); @@ -115,7 +115,7 @@ TEST_F(ReloadButtonTest, DisableOnHover) { // Un-hover the button, which should allow it to reset. set_mouse_hovered(false); - ui::MouseEvent e2(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), 0); + ui::MouseEvent e2(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), 0, 0); reload_.OnMouseExited(e2); CheckState(true, ReloadButton::MODE_RELOAD, ReloadButton::MODE_RELOAD, false, false); @@ -123,7 +123,7 @@ TEST_F(ReloadButtonTest, DisableOnHover) { TEST_F(ReloadButtonTest, ResetOnClick) { // Change to stop and hover. - ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 0); + ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 0, 0); reload_.ButtonPressed(&reload_, e); reload_.ChangeMode(ReloadButton::MODE_STOP, false); set_mouse_hovered(true); @@ -137,7 +137,7 @@ TEST_F(ReloadButtonTest, ResetOnClick) { TEST_F(ReloadButtonTest, ResetOnTimer) { // Change to stop, hover, and change back to reload. - ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 0); + ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 0, 0); reload_.ButtonPressed(&reload_, e); reload_.ChangeMode(ReloadButton::MODE_STOP, false); set_mouse_hovered(true); diff --git a/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc b/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc index f9ab858..facbede 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc +++ b/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc @@ -63,7 +63,7 @@ void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform( const ui::LatencyInfo&) { gfx::Point location(web_wheel.x, web_wheel.y); ui::MouseEvent mouse_event( - ui::ET_MOUSEWHEEL, location, location, ui::EF_NONE); + ui::ET_MOUSEWHEEL, location, location, ui::EF_NONE, ui::EF_NONE); ui::MouseWheelEvent wheel_event( mouse_event, web_wheel.deltaX, web_wheel.deltaY); @@ -127,7 +127,8 @@ void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( gfx::Point location(web_mouse.x, web_mouse.y); ui::EventType event_type = WebMouseEventTypeToEventType(web_mouse.type); int flags = WebMouseEventButtonToFlags(web_mouse.button); - ui::MouseEvent mouse_event(event_type, location, location, flags); + // TODO: last argument (changed_button_flags) likely isn't right. + ui::MouseEvent mouse_event(event_type, location, location, flags, 0); GetRootWindowHostDelegate()->OnHostMouseEvent(&mouse_event); } diff --git a/content/browser/web_contents/aura/window_slider_unittest.cc b/content/browser/web_contents/aura/window_slider_unittest.cc index d56d1e7..a389c53 100644 --- a/content/browser/web_contents/aura/window_slider_unittest.cc +++ b/content/browser/web_contents/aura/window_slider_unittest.cc @@ -251,7 +251,7 @@ TEST_F(WindowSliderTest, WindowSlideIsCancelledOnEvent) { new ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(55, 10), gfx::Point(55, 10), - 0), + 0, 0), new ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, diff --git a/ui/app_list/views/apps_grid_view_unittest.cc b/ui/app_list/views/apps_grid_view_unittest.cc index 34c0c77..b47731d 100644 --- a/ui/app_list/views/apps_grid_view_unittest.cc +++ b/ui/app_list/views/apps_grid_view_unittest.cc @@ -155,11 +155,11 @@ class AppsGridViewTest : public views::ViewsTestBase { to - view->bounds().origin()); ui::MouseEvent pressed_event(ui::ET_MOUSE_PRESSED, - translated_from, from, 0); + translated_from, from, 0, 0); apps_grid_view_->InitiateDrag(view, pointer, pressed_event); ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, - translated_to, to, 0); + translated_to, to, 0, 0); apps_grid_view_->UpdateDragFromItem(pointer, drag_event); } diff --git a/ui/aura/remote_root_window_host_win.cc b/ui/aura/remote_root_window_host_win.cc index 760d955..db66beb 100644 --- a/ui/aura/remote_root_window_host_win.cc +++ b/ui/aura/remote_root_window_host_win.cc @@ -487,7 +487,7 @@ void RemoteRootWindowHostWin::OnMouseMoved(int32 x, int32 y, int32 flags) { return; gfx::Point location(x, y); - ui::MouseEvent event(ui::ET_MOUSE_MOVED, location, location, flags); + ui::MouseEvent event(ui::ET_MOUSE_MOVED, location, location, flags, 0); delegate_->OnHostMouseEvent(&event); } @@ -498,7 +498,8 @@ void RemoteRootWindowHostWin::OnMouseButton( ui::EventType type, ui::EventFlags flags) { gfx::Point location(x, y); - ui::MouseEvent mouse_event(type, location, location, flags); + // TODO: this needs to pass in changed flags. + ui::MouseEvent mouse_event(type, location, location, flags, 0); SetEventFlags(flags | key_event_flags()); if (type == ui::ET_MOUSEWHEEL) { diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index 493f60f..a819ef0 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -380,7 +380,8 @@ void RootWindow::DispatchMouseExitToHidingWindow(Window* window) { } void RootWindow::DispatchMouseExitAtPoint(const gfx::Point& point) { - ui::MouseEvent event(ui::ET_MOUSE_EXITED, point, point, ui::EF_NONE); + ui::MouseEvent event(ui::ET_MOUSE_EXITED, point, point, ui::EF_NONE, + ui::EF_NONE); DispatchDetails details = DispatchMouseEnterOrExit(event, ui::ET_MOUSE_EXITED); if (details.dispatcher_destroyed) @@ -632,7 +633,7 @@ void RootWindow::UpdateCapture(Window* old_capture, old_capture->delegate()) { // Send a capture changed event with bogus location data. ui::MouseEvent event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(), - gfx::Point(), 0); + gfx::Point(), 0, 0); DispatchDetails details = DispatchEvent(old_capture, &event); if (details.dispatcher_destroyed) @@ -1136,7 +1137,8 @@ ui::EventDispatchDetails RootWindow::SynthesizeMouseMoveEvent() { ui::MouseEvent event(ui::ET_MOUSE_MOVED, host_mouse_location, host_mouse_location, - ui::EF_IS_SYNTHESIZED); + ui::EF_IS_SYNTHESIZED, + 0); return OnHostMouseEventImpl(&event); } diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc index 2d13524..013e372 100644 --- a/ui/aura/root_window_unittest.cc +++ b/ui/aura/root_window_unittest.cc @@ -114,7 +114,8 @@ TEST_F(RootWindowTest, OnHostMouseEvent) { // Send a mouse event to window1. gfx::Point point(101, 201); ui::MouseEvent event1( - ui::ET_MOUSE_PRESSED, point, point, ui::EF_LEFT_MOUSE_BUTTON); + ui::ET_MOUSE_PRESSED, point, point, ui::EF_LEFT_MOUSE_BUTTON, + ui::EF_LEFT_MOUSE_BUTTON); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&event1); // Event was tested for non-client area for the target window. @@ -136,7 +137,8 @@ TEST_F(RootWindowTest, RepostEvent) { EXPECT_FALSE(Env::GetInstance()->IsMouseButtonDown()); gfx::Point point(10, 10); ui::MouseEvent event( - ui::ET_MOUSE_PRESSED, point, point, ui::EF_LEFT_MOUSE_BUTTON); + ui::ET_MOUSE_PRESSED, point, point, ui::EF_LEFT_MOUSE_BUTTON, + ui::EF_LEFT_MOUSE_BUTTON); dispatcher()->RepostEvent(event); RunAllPendingInMessageLoop(); EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown()); @@ -155,6 +157,7 @@ TEST_F(RootWindowTest, MouseButtonState) { ui::ET_MOUSE_PRESSED, location, location, + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get()); EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown()); @@ -164,7 +167,8 @@ TEST_F(RootWindowTest, MouseButtonState) { ui::ET_MOUSE_PRESSED, location, location, - ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON)); + ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON, + ui::EF_RIGHT_MOUSE_BUTTON)); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get()); EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown()); @@ -173,7 +177,8 @@ TEST_F(RootWindowTest, MouseButtonState) { ui::ET_MOUSE_RELEASED, location, location, - ui::EF_RIGHT_MOUSE_BUTTON)); + ui::EF_RIGHT_MOUSE_BUTTON, + ui::EF_LEFT_MOUSE_BUTTON)); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get()); EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown()); @@ -182,7 +187,8 @@ TEST_F(RootWindowTest, MouseButtonState) { ui::ET_MOUSE_RELEASED, location, location, - ui::EF_SHIFT_DOWN)); + ui::EF_SHIFT_DOWN, + ui::EF_RIGHT_MOUSE_BUTTON)); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get()); EXPECT_FALSE(Env::GetInstance()->IsMouseButtonDown()); @@ -191,6 +197,7 @@ TEST_F(RootWindowTest, MouseButtonState) { ui::ET_MOUSE_PRESSED, location, location, + ui::EF_MIDDLE_MOUSE_BUTTON, ui::EF_MIDDLE_MOUSE_BUTTON)); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get()); EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown()); @@ -201,7 +208,7 @@ TEST_F(RootWindowTest, TranslatedEvent) { gfx::Rect(50, 50, 100, 100), root_window())); gfx::Point origin(100, 100); - ui::MouseEvent root(ui::ET_MOUSE_PRESSED, origin, origin, 0); + ui::MouseEvent root(ui::ET_MOUSE_PRESSED, origin, origin, 0, 0); EXPECT_EQ("100,100", root.location().ToString()); EXPECT_EQ("100,100", root.root_location().ToString()); @@ -567,7 +574,7 @@ TEST_F(RootWindowTest, RepostTargetsCaptureWindow) { window->SetCapture(); const ui::MouseEvent press_event( ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); dispatcher()->RepostEvent(press_event); RunAllPendingInMessageLoop(); // Necessitated by RepostEvent(). // Mouse moves/enters may be generated. We only care about a pressed. @@ -584,7 +591,7 @@ TEST_F(RootWindowTest, MouseMovesHeld) { &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); ui::MouseEvent mouse_move_event(ui::ET_MOUSE_MOVED, gfx::Point(0, 0), - gfx::Point(0, 0), 0); + gfx::Point(0, 0), 0, 0); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent( &mouse_move_event); // Discard MOUSE_ENTER. @@ -594,7 +601,7 @@ TEST_F(RootWindowTest, MouseMovesHeld) { // Check that we don't immediately dispatch the MOUSE_DRAGGED event. ui::MouseEvent mouse_dragged_event(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), - gfx::Point(0, 0), 0); + gfx::Point(0, 0), 0, 0); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent( &mouse_dragged_event); EXPECT_TRUE(filter->events().empty()); @@ -602,7 +609,7 @@ TEST_F(RootWindowTest, MouseMovesHeld) { // Check that we do dispatch the held MOUSE_DRAGGED event before another type // of event. ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), - gfx::Point(0, 0), 0); + gfx::Point(0, 0), 0, 0); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent( &mouse_pressed_event); EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED", @@ -611,7 +618,7 @@ TEST_F(RootWindowTest, MouseMovesHeld) { // Check that we coalesce held MOUSE_DRAGGED events. ui::MouseEvent mouse_dragged_event2(ui::ET_MOUSE_DRAGGED, gfx::Point(1, 1), - gfx::Point(1, 1), 0); + gfx::Point(1, 1), 0, 0); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent( &mouse_dragged_event); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent( @@ -732,14 +739,14 @@ TEST_F(RootWindowTest, DispatchSyntheticMouseEvents) { // Dispatch a non-synthetic mouse event when mouse events are enabled. ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), - gfx::Point(10, 10), 0); + gfx::Point(10, 10), 0, 0); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse1); EXPECT_FALSE(filter->events().empty()); filter->events().clear(); // Dispatch a synthetic mouse event when mouse events are enabled. ui::MouseEvent mouse2(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), - gfx::Point(10, 10), ui::EF_IS_SYNTHESIZED); + gfx::Point(10, 10), ui::EF_IS_SYNTHESIZED, 0); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse2); EXPECT_FALSE(filter->events().empty()); filter->events().clear(); @@ -766,7 +773,7 @@ TEST_F(RootWindowTest, DispatchMouseExitWhenCursorHidden) { // Dispatch a mouse move event into the window. gfx::Point mouse_location(gfx::Point(15, 25)); ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, mouse_location, - mouse_location, 0); + mouse_location, 0, 0); EXPECT_TRUE(filter->events().empty()); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse1); EXPECT_FALSE(filter->events().empty()); @@ -1261,7 +1268,7 @@ class DontResetHeldEventWindowDelegate : public test::TestWindowDelegate { mouse_event_count_++ == 0) { ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(10, 10), - ui::EF_SHIFT_DOWN); + ui::EF_SHIFT_DOWN, 0); root_->GetDispatcher()->RepostEvent(mouse_event); } } @@ -1288,10 +1295,10 @@ TEST_F(RootWindowTest, DontResetHeldEvent) { w1->SetBounds(gfx::Rect(0, 0, 40, 40)); ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(10, 10), - ui::EF_SHIFT_DOWN); + ui::EF_SHIFT_DOWN, 0); root_window()->GetDispatcher()->RepostEvent(pressed); ui::MouseEvent pressed2(ui::ET_MOUSE_PRESSED, - gfx::Point(10, 10), gfx::Point(10, 10), 0); + gfx::Point(10, 10), gfx::Point(10, 10), 0, 0); // Invoke OnHostMouseEvent() to flush event scheduled by way of RepostEvent(). root_window_delegate->OnHostMouseEvent(&pressed2); // Delegate should have seen reposted event (identified by way of @@ -1358,7 +1365,7 @@ TEST_F(RootWindowTest, MAYBE_DeleteRootFromHeldMouseEvent) { w1->SetBounds(gfx::Rect(0, 0, 40, 40)); ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(10, 10), - ui::EF_SHIFT_DOWN); + ui::EF_SHIFT_DOWN, 0); r2->RepostEvent(pressed); // RunAllPendingInMessageLoop() to make sure the |pressed| is run. RunAllPendingInMessageLoop(); @@ -1477,7 +1484,7 @@ class RootWindowTestWithMessageLoop : public RootWindowTest { // terminate the message-loop. When the message-loop unwinds and gets back, // the reposted event should not have fired. ui::MouseEvent mouse(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), - gfx::Point(10, 10), ui::EF_NONE); + gfx::Point(10, 10), ui::EF_NONE, ui::EF_NONE); message_loop()->PostTask(FROM_HERE, base::Bind(&RootWindow::RepostEvent, base::Unretained(dispatcher()), diff --git a/ui/aura/test/event_generator.cc b/ui/aura/test/event_generator.cc index f11ab21..7625a11 100644 --- a/ui/aura/test/event_generator.cc +++ b/ui/aura/test/event_generator.cc @@ -150,14 +150,14 @@ void EventGenerator::SendMouseExit() { gfx::Point exit_location(current_location_); ConvertPointToTarget(current_root_window_->window(), &exit_location); ui::MouseEvent mouseev(ui::ET_MOUSE_EXITED, exit_location, exit_location, - flags_); + flags_, 0); Dispatch(&mouseev); } void EventGenerator::MoveMouseToInHost(const gfx::Point& point_in_host) { const ui::EventType event_type = (flags_ & ui::EF_LEFT_MOUSE_BUTTON) ? ui::ET_MOUSE_DRAGGED : ui::ET_MOUSE_MOVED; - ui::MouseEvent mouseev(event_type, point_in_host, point_in_host, flags_); + ui::MouseEvent mouseev(event_type, point_in_host, point_in_host, flags_, 0); Dispatch(&mouseev); current_location_ = point_in_host; @@ -178,7 +178,7 @@ void EventGenerator::MoveMouseTo(const gfx::Point& point_in_screen, if (!grab_) UpdateCurrentRootWindow(move_point); ConvertPointToTarget(current_root_window_->window(), &move_point); - ui::MouseEvent mouseev(event_type, move_point, move_point, flags_); + ui::MouseEvent mouseev(event_type, move_point, move_point, flags_, 0); Dispatch(&mouseev); } current_location_ = point_in_screen; @@ -511,7 +511,8 @@ void EventGenerator::PressButton(int flag) { flags_ |= flag; grab_ = flags_ & kAllButtonMask; gfx::Point location = GetLocationInCurrentRoot(); - ui::MouseEvent mouseev(ui::ET_MOUSE_PRESSED, location, location, flags_); + ui::MouseEvent mouseev(ui::ET_MOUSE_PRESSED, location, location, flags_, + flag); Dispatch(&mouseev); } } @@ -520,7 +521,7 @@ void EventGenerator::ReleaseButton(int flag) { if (flags_ & flag) { gfx::Point location = GetLocationInCurrentRoot(); ui::MouseEvent mouseev(ui::ET_MOUSE_RELEASED, location, - location, flags_); + location, flags_, flag); Dispatch(&mouseev); flags_ ^= flag; } diff --git a/ui/aura/window_targeter_unittest.cc b/ui/aura/window_targeter_unittest.cc index 396c805..08efdaa 100644 --- a/ui/aura/window_targeter_unittest.cc +++ b/ui/aura/window_targeter_unittest.cc @@ -37,6 +37,7 @@ TEST_F(WindowTargeterTest, Basic) { ui::MouseEvent press(ui::ET_MOUSE_PRESSED, gfx::Point(20, 20), gfx::Point(20, 20), + ui::EF_NONE, ui::EF_NONE); root_window()->GetDispatcher()->AsRootWindowHostDelegate()-> OnHostMouseEvent(&press); diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc index b791431..0c6adf4 100644 --- a/ui/aura/window_unittest.cc +++ b/ui/aura/window_unittest.cc @@ -1221,7 +1221,7 @@ TEST_F(WindowTest, RootWindowHostExit) { d1.ResetExpectations(); ui::MouseEvent exit_event( - ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(), 0); + ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(), 0, 0); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&exit_event); EXPECT_FALSE(d1.entered()); EXPECT_TRUE(d1.exited()); diff --git a/ui/events/event.cc b/ui/events/event.cc index 246e397..22e1625 100644 --- a/ui/events/event.cc +++ b/ui/events/event.cc @@ -281,9 +281,10 @@ MouseEvent::MouseEvent(const base::NativeEvent& native_event) MouseEvent::MouseEvent(EventType type, const gfx::Point& location, const gfx::Point& root_location, - int flags) + int flags, + int changed_button_flags) : LocatedEvent(type, location, root_location, EventTimeForNow(), flags), - changed_button_flags_(0) { + changed_button_flags_(changed_button_flags) { if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) SetType(ET_MOUSE_DRAGGED); } @@ -664,7 +665,7 @@ ScrollEvent::ScrollEvent(EventType type, float x_offset_ordinal, float y_offset_ordinal, int finger_count) - : MouseEvent(type, location, location, flags), + : MouseEvent(type, location, location, flags, 0), x_offset_(x_offset), y_offset_(y_offset), x_offset_ordinal_(x_offset_ordinal), diff --git a/ui/events/event.h b/ui/events/event.h index b8a341a..596f31e 100644 --- a/ui/events/event.h +++ b/ui/events/event.h @@ -321,7 +321,8 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent { MouseEvent(EventType type, const gfx::Point& location, const gfx::Point& root_location, - int flags); + int flags, + int changed_button_flags); // Conveniences to quickly test what button is down bool IsOnlyLeftMouseButton() const { diff --git a/ui/events/event_dispatcher_unittest.cc b/ui/events/event_dispatcher_unittest.cc index 30bbd0d..3b9f1db 100644 --- a/ui/events/event_dispatcher_unittest.cc +++ b/ui/events/event_dispatcher_unittest.cc @@ -258,7 +258,7 @@ TEST(EventDispatcherTest, EventDispatchOrder) { h8.set_expect_post_target(true); MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), - gfx::Point(3, 4), 0); + gfx::Point(3, 4), 0, 0); Event::DispatcherApi event_mod(&mouse); dispatcher.ProcessEvent(&child, &mouse); EXPECT_FALSE(mouse.stopped_propagation()); @@ -332,7 +332,7 @@ TEST(EventDispatcherTest, EventDispatchPhase) { handler.set_expect_post_target(true); MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), - gfx::Point(3, 4), 0); + gfx::Point(3, 4), 0, 0); Event::DispatcherApi event_mod(&mouse); dispatcher.ProcessEvent(&target, &mouse); EXPECT_EQ(ER_UNHANDLED, mouse.result()); @@ -364,7 +364,7 @@ TEST(EventDispatcherTest, EventDispatcherDestroyedDuringDispatch) { h2.set_expect_pre_target(false); MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), - gfx::Point(3, 4), 0); + gfx::Point(3, 4), 0, 0); Event::DispatcherApi event_mod(&mouse); dispatcher->ProcessEvent(&target, &mouse); EXPECT_EQ(ER_CONSUMED, mouse.result()); @@ -416,7 +416,7 @@ TEST(EventDispatcherTest, EventDispatcherDestroyedDuringDispatch) { h2.set_expect_post_target(false); MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), - gfx::Point(3, 4), 0); + gfx::Point(3, 4), 0, 0); Event::DispatcherApi event_mod(&mouse); dispatcher->ProcessEvent(&target, &mouse); EXPECT_EQ(ER_CONSUMED, mouse.result()); @@ -469,7 +469,8 @@ TEST(EventDispatcherTest, EventDispatcherInvalidateTarget) { // |h3| should not receive events as the target will be invalidated. h3.set_expect_pre_target(false); - MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4), 0); + MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4), 0, + 0); dispatcher.ProcessEvent(&target, &mouse); EXPECT_FALSE(target.valid()); EXPECT_TRUE(mouse.stopped_propagation()); @@ -508,7 +509,8 @@ TEST(EventDispatcherTest, EventHandlerDestroyedDuringDispatch) { // destroyed it. h3->set_expect_pre_target(false); - MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4), 0); + MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4), 0, + 0); dispatcher.ProcessEvent(&target, &mouse); EXPECT_FALSE(mouse.stopped_propagation()); EXPECT_EQ(2U, target.handler_list().size()); @@ -561,7 +563,8 @@ TEST(EventDispatcherTest, EventHandlerAndDispatcherDestroyedDuringDispatch) { // it. h3->set_expect_pre_target(false); - MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4), 0); + MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(3, 4), gfx::Point(3, 4), 0, + 0); dispatcher->ProcessEvent(&target, &mouse); EXPECT_TRUE(mouse.stopped_propagation()); EXPECT_EQ(2U, target.handler_list().size()); diff --git a/ui/events/event_processor_unittest.cc b/ui/events/event_processor_unittest.cc index 841cdb7..6d8edf5a 100644 --- a/ui/events/event_processor_unittest.cc +++ b/ui/events/event_processor_unittest.cc @@ -41,7 +41,7 @@ TEST_F(EventProcessorTest, Basic) { root()->AddChild(child.Pass()); MouseEvent mouse(ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10), - EF_NONE); + EF_NONE, EF_NONE); DispatchEvent(&mouse); EXPECT_TRUE(root()->child_at(0)->DidReceiveEvent(ET_MOUSE_MOVED)); EXPECT_FALSE(root()->DidReceiveEvent(ET_MOUSE_MOVED)); @@ -130,7 +130,8 @@ TEST_F(EventProcessorTest, Bounds) { // Dispatch a mouse event that falls on the parent, but not on the child. When // the default event-targeter used, the event will still reach |grandchild|, // because the default targeter does not look at the bounds. - MouseEvent mouse(ET_MOUSE_MOVED, gfx::Point(1, 1), gfx::Point(1, 1), EF_NONE); + MouseEvent mouse(ET_MOUSE_MOVED, gfx::Point(1, 1), gfx::Point(1, 1), EF_NONE, + EF_NONE); DispatchEvent(&mouse); EXPECT_FALSE(root()->DidReceiveEvent(ET_MOUSE_MOVED)); EXPECT_FALSE(parent_r->DidReceiveEvent(ET_MOUSE_MOVED)); @@ -151,7 +152,7 @@ TEST_F(EventProcessorTest, Bounds) { parent_r->ResetReceivedEvents(); MouseEvent second(ET_MOUSE_MOVED, gfx::Point(12, 12), gfx::Point(12, 12), - EF_NONE); + EF_NONE, EF_NONE); DispatchEvent(&second); EXPECT_FALSE(root()->DidReceiveEvent(ET_MOUSE_MOVED)); EXPECT_FALSE(parent_r->DidReceiveEvent(ET_MOUSE_MOVED)); diff --git a/ui/events/event_unittest.cc b/ui/events/event_unittest.cc index 012fc60..0d36423 100644 --- a/ui/events/event_unittest.cc +++ b/ui/events/event_unittest.cc @@ -58,7 +58,7 @@ TEST(EventTest, GetCharacter) { TEST(EventTest, ClickCount) { const gfx::Point origin(0, 0); - MouseEvent mouseev(ET_MOUSE_PRESSED, origin, origin, 0); + MouseEvent mouseev(ET_MOUSE_PRESSED, origin, origin, 0, 0); for (int i = 1; i <=3 ; ++i) { mouseev.SetClickCount(i); EXPECT_EQ(i, mouseev.GetClickCount()); @@ -67,8 +67,8 @@ TEST(EventTest, ClickCount) { TEST(EventTest, Repeated) { const gfx::Point origin(0, 0); - MouseEvent mouse_ev1(ET_MOUSE_PRESSED, origin, origin, 0); - MouseEvent mouse_ev2(ET_MOUSE_PRESSED, origin, origin, 0); + MouseEvent mouse_ev1(ET_MOUSE_PRESSED, origin, origin, 0, 0); + MouseEvent mouse_ev2(ET_MOUSE_PRESSED, origin, origin, 0, 0); LocatedEventTestApi test_ev1(&mouse_ev1); LocatedEventTestApi test_ev2(&mouse_ev2); diff --git a/ui/message_center/views/message_popup_collection_unittest.cc b/ui/message_center/views/message_popup_collection_unittest.cc index f763b516..4840f20 100644 --- a/ui/message_center/views/message_popup_collection_unittest.cc +++ b/ui/message_center/views/message_popup_collection_unittest.cc @@ -358,7 +358,7 @@ TEST_F(MessagePopupCollectionTest, DetectMouseHover) { views::WidgetDelegateView* toast1 = GetToast(id1); EXPECT_TRUE(toast1 != NULL); - ui::MouseEvent event(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), 0); + ui::MouseEvent event(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), 0, 0); // Test that mouse detection logic works in presence of out-of-order events. toast0->OnMouseEntered(event); @@ -393,7 +393,7 @@ TEST_F(MessagePopupCollectionTest, DetectMouseHoverWithUserClose) { views::WidgetDelegateView* toast1 = GetToast(id1); ASSERT_TRUE(toast1 != NULL); - ui::MouseEvent event(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), 0); + ui::MouseEvent event(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), 0, 0); toast1->OnMouseEntered(event); static_cast<MessageCenterObserver*>(collection())->OnNotificationRemoved( id1, true); diff --git a/ui/message_center/views/notifier_settings_view.cc b/ui/message_center/views/notifier_settings_view.cc index e345d93..daff2d4 100644 --- a/ui/message_center/views/notifier_settings_view.cc +++ b/ui/message_center/views/notifier_settings_view.cc @@ -384,7 +384,8 @@ void NotifierSettingsView::NotifierButton::SendLearnMorePressedForTest() { return; gfx::Point point(110, 120); ui::MouseEvent pressed( - ui::ET_MOUSE_PRESSED, point, point, ui::EF_LEFT_MOUSE_BUTTON); + ui::ET_MOUSE_PRESSED, point, point, ui::EF_LEFT_MOUSE_BUTTON, + ui::EF_LEFT_MOUSE_BUTTON); ButtonPressed(learn_more_, pressed); } diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc index 2be2a23..cafa5a3 100644 --- a/ui/views/controls/button/custom_button.cc +++ b/ui/views/controls/button/custom_button.cc @@ -199,6 +199,7 @@ bool CustomButton::OnKeyPressed(const ui::KeyEvent& event) { ui::MouseEvent synthetic_event(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); NotifyClick(synthetic_event); } else { @@ -216,6 +217,7 @@ bool CustomButton::OnKeyReleased(const ui::KeyEvent& event) { ui::MouseEvent synthetic_event(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); NotifyClick(synthetic_event); return true; @@ -260,6 +262,7 @@ bool CustomButton::AcceleratorPressed(const ui::Accelerator& accelerator) { ui::MouseEvent synthetic_event(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); NotifyClick(synthetic_event); return true; diff --git a/ui/views/controls/button/custom_button_unittest.cc b/ui/views/controls/button/custom_button_unittest.cc index f7b11e6..cb27628 100644 --- a/ui/views/controls/button/custom_button_unittest.cc +++ b/ui/views/controls/button/custom_button_unittest.cc @@ -80,10 +80,12 @@ TEST_F(CustomButtonTest, HoverStateOnVisibilityChange) { gfx::Point center(10, 10); button->OnMousePressed(ui::MouseEvent(ui::ET_MOUSE_PRESSED, center, center, + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); EXPECT_EQ(CustomButton::STATE_PRESSED, button->state()); button->OnMouseReleased(ui::MouseEvent(ui::ET_MOUSE_RELEASED, center, center, + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); EXPECT_EQ(CustomButton::STATE_HOVERED, button->state()); diff --git a/ui/views/controls/button/radio_button.cc b/ui/views/controls/button/radio_button.cc index 224e989..0b85469 100644 --- a/ui/views/controls/button/radio_button.cc +++ b/ui/views/controls/button/radio_button.cc @@ -123,7 +123,7 @@ bool RadioButton::IsGroupFocusTraversable() const { void RadioButton::OnFocus() { Checkbox::OnFocus(); SetChecked(true); - ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 0); + ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 0, 0); LabelButton::NotifyClick(event); } diff --git a/ui/views/controls/combobox/combobox_unittest.cc b/ui/views/controls/combobox/combobox_unittest.cc index 172ead3..573fcb3 100644 --- a/ui/views/controls/combobox/combobox_unittest.cc +++ b/ui/views/controls/combobox/combobox_unittest.cc @@ -220,10 +220,12 @@ class ComboboxTest : public ViewsTestBase { void PerformClick(const gfx::Point& point) { ui::MouseEvent pressed_event = ui::MouseEvent(ui::ET_MOUSE_PRESSED, point, point, + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); widget_->OnMouseEvent(&pressed_event); ui::MouseEvent released_event = ui::MouseEvent(ui::ET_MOUSE_RELEASED, point, point, + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); widget_->OnMouseEvent(&released_event); } diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc index 3b0e5d5..4629052 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc @@ -2230,12 +2230,13 @@ void MenuController::UpdateActiveMouseView(SubmenuView* event_source, target_menu, active_mouse_view, &target_point); ui::MouseEvent mouse_entered_event(ui::ET_MOUSE_ENTERED, target_point, target_point, - 0); + 0, 0); active_mouse_view->OnMouseEntered(mouse_entered_event); ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, target_point, target_point, - event.flags()); + event.flags(), + event.changed_button_flags()); active_mouse_view->OnMousePressed(mouse_pressed_event); } } @@ -2245,7 +2246,8 @@ void MenuController::UpdateActiveMouseView(SubmenuView* event_source, View::ConvertPointToTarget(target_menu, active_mouse_view, &target_point); ui::MouseEvent mouse_dragged_event(ui::ET_MOUSE_DRAGGED, target_point, target_point, - event.flags()); + event.flags(), + event.changed_button_flags()); active_mouse_view->OnMouseDragged(mouse_dragged_event); } } @@ -2261,7 +2263,7 @@ void MenuController::SendMouseReleaseToActiveView(SubmenuView* event_source, &target_loc); View::ConvertPointFromScreen(active_mouse_view, &target_loc); ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, target_loc, target_loc, - event.flags()); + event.flags(), event.changed_button_flags()); // Reset active mouse view before sending mouse released. That way if it calls // back to us, we aren't in a weird state. SetActiveMouseView(NULL); diff --git a/ui/views/controls/scrollbar/base_scroll_bar_button.cc b/ui/views/controls/scrollbar/base_scroll_bar_button.cc index 6eba692..c0a9e51 100644 --- a/ui/views/controls/scrollbar/base_scroll_bar_button.cc +++ b/ui/views/controls/scrollbar/base_scroll_bar_button.cc @@ -44,6 +44,7 @@ void BaseScrollBarButton::RepeaterNotifyClick() { #endif ui::MouseEvent event(ui::ET_MOUSE_RELEASED, cursor_point, cursor_point, + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); Button::NotifyClick(event); } diff --git a/ui/views/controls/single_split_view_unittest.cc b/ui/views/controls/single_split_view_unittest.cc index f82c1b5..9b621dea 100644 --- a/ui/views/controls/single_split_view_unittest.cc +++ b/ui/views/controls/single_split_view_unittest.cc @@ -166,7 +166,7 @@ TEST(SingleSplitViewTest, MouseDrag) { gfx::Point press_point(7, kInitialDividerOffset + kMouseOffset); ui::MouseEvent mouse_pressed( - ui::ET_MOUSE_PRESSED, press_point, press_point, 0); + ui::ET_MOUSE_PRESSED, press_point, press_point, 0, 0); ASSERT_TRUE(split.OnMousePressed(mouse_pressed)); EXPECT_EQ(kInitialDividerOffset, split.divider_offset()); @@ -174,7 +174,7 @@ TEST(SingleSplitViewTest, MouseDrag) { gfx::Point drag_1_point( 5, kInitialDividerOffset + kMouseOffset + kMouseMoveDelta); ui::MouseEvent mouse_dragged_1( - ui::ET_MOUSE_DRAGGED, drag_1_point, drag_1_point, 0); + ui::ET_MOUSE_DRAGGED, drag_1_point, drag_1_point, 0, 0); ASSERT_TRUE(split.OnMouseDragged(mouse_dragged_1)); EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta, split.divider_offset()); @@ -182,7 +182,7 @@ TEST(SingleSplitViewTest, MouseDrag) { gfx::Point drag_2_point( 7, kMinimumChildSize - 5); ui::MouseEvent mouse_dragged_2( - ui::ET_MOUSE_DRAGGED, drag_2_point, drag_2_point, 0); + ui::ET_MOUSE_DRAGGED, drag_2_point, drag_2_point, 0,0 ); ASSERT_TRUE(split.OnMouseDragged(mouse_dragged_2)); EXPECT_EQ(kMinimumChildSize, split.divider_offset()); @@ -191,7 +191,7 @@ TEST(SingleSplitViewTest, MouseDrag) { gfx::Point drag_3_point( 7, kTotalSplitSize - kMinimumChildSize + 5); ui::MouseEvent mouse_dragged_3( - ui::ET_MOUSE_DRAGGED, drag_3_point, drag_3_point, 0); + ui::ET_MOUSE_DRAGGED, drag_3_point, drag_3_point, 0, 0); ASSERT_TRUE(split.OnMouseDragged(mouse_dragged_3)); EXPECT_EQ(kTotalSplitSize - kMinimumChildSize - split.GetDividerSize(), split.divider_offset()); @@ -200,7 +200,7 @@ TEST(SingleSplitViewTest, MouseDrag) { gfx::Point drag_4_point( 6, kInitialDividerOffset + kMouseOffset + kMouseMoveDelta * 2); ui::MouseEvent mouse_dragged_4( - ui::ET_MOUSE_DRAGGED, drag_4_point, drag_4_point, 0); + ui::ET_MOUSE_DRAGGED, drag_4_point, drag_4_point, 0, 0); ASSERT_TRUE(split.OnMouseDragged(mouse_dragged_4)); EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta * 2, split.divider_offset()); @@ -208,7 +208,7 @@ TEST(SingleSplitViewTest, MouseDrag) { gfx::Point release_point( 7, kInitialDividerOffset + kMouseOffset + kMouseMoveDelta * 2); ui::MouseEvent mouse_released( - ui::ET_MOUSE_RELEASED, release_point, release_point, 0); + ui::ET_MOUSE_RELEASED, release_point, release_point, 0, 0); split.OnMouseReleased(mouse_released); EXPECT_EQ(kInitialDividerOffset + kMouseMoveDelta * 2, split.divider_offset()); diff --git a/ui/views/controls/slider_unittest.cc b/ui/views/controls/slider_unittest.cc index 7add734..caa93f3 100644 --- a/ui/views/controls/slider_unittest.cc +++ b/ui/views/controls/slider_unittest.cc @@ -17,10 +17,10 @@ namespace { void ClickAt(views::View* view, int x, int y) { gfx::Point point(x, y); ui::MouseEvent press(ui::ET_MOUSE_PRESSED, point, point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); view->OnMousePressed(press); ui::MouseEvent release(ui::ET_MOUSE_RELEASED, point, point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); view->OnMouseReleased(release); } diff --git a/ui/views/controls/table/table_view_unittest.cc b/ui/views/controls/table/table_view_unittest.cc index 4d89f32..70547ce 100644 --- a/ui/views/controls/table/table_view_unittest.cc +++ b/ui/views/controls/table/table_view_unittest.cc @@ -191,7 +191,8 @@ class TableViewTest : public testing::Test { const int y = row * table_->row_height(); const ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(0, y), gfx::Point(0, y), - ui::EF_LEFT_MOUSE_BUTTON | flags); + ui::EF_LEFT_MOUSE_BUTTON | flags, + ui::EF_LEFT_MOUSE_BUTTON); table_->OnMousePressed(pressed); } @@ -289,10 +290,12 @@ TEST_F(TableViewTest, Resize) { EXPECT_NE(0, x); // Drag the mouse 1 pixel to the left. const ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(x, 0), - gfx::Point(x, 0), ui::EF_LEFT_MOUSE_BUTTON); + gfx::Point(x, 0), ui::EF_LEFT_MOUSE_BUTTON, + ui::EF_LEFT_MOUSE_BUTTON); helper_->header()->OnMousePressed(pressed); const ui::MouseEvent dragged(ui::ET_MOUSE_DRAGGED, gfx::Point(x - 1, 0), - gfx::Point(x - 1, 0), ui::EF_LEFT_MOUSE_BUTTON); + gfx::Point(x - 1, 0), ui::EF_LEFT_MOUSE_BUTTON, + 0); helper_->header()->OnMouseDragged(dragged); // This should shrink the first column and pull the second column in. @@ -378,11 +381,13 @@ TEST_F(TableViewTest, SortOnMouse) { EXPECT_NE(0, x); // Press and release the mouse. const ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(x, 0), - gfx::Point(x, 0), ui::EF_LEFT_MOUSE_BUTTON); + gfx::Point(x, 0), ui::EF_LEFT_MOUSE_BUTTON, + ui::EF_LEFT_MOUSE_BUTTON); // The header must return true, else it won't normally get the release. EXPECT_TRUE(helper_->header()->OnMousePressed(pressed)); const ui::MouseEvent release(ui::ET_MOUSE_RELEASED, gfx::Point(x, 0), - gfx::Point(x, 0), ui::EF_LEFT_MOUSE_BUTTON); + gfx::Point(x, 0), ui::EF_LEFT_MOUSE_BUTTON, + ui::EF_LEFT_MOUSE_BUTTON); helper_->header()->OnMouseReleased(release); ASSERT_EQ(1u, table_->sort_descriptors().size()); diff --git a/ui/views/controls/textfield/native_textfield_views_unittest.cc b/ui/views/controls/textfield/native_textfield_views_unittest.cc index 33196ec..f351da0 100644 --- a/ui/views/controls/textfield/native_textfield_views_unittest.cc +++ b/ui/views/controls/textfield/native_textfield_views_unittest.cc @@ -293,20 +293,22 @@ class NativeTextfieldViewsTest : public ViewsTestBase, void MouseClick(const gfx::Rect bound, int x_offset) { gfx::Point point(bound.x() + x_offset, bound.y() + bound.height() / 2); ui::MouseEvent click(ui::ET_MOUSE_PRESSED, point, point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); textfield_view_->OnMousePressed(click); ui::MouseEvent release(ui::ET_MOUSE_RELEASED, point, point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); textfield_view_->OnMouseReleased(release); } // This is to avoid double/triple click. void NonClientMouseClick() { ui::MouseEvent click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), - ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_NON_CLIENT); + ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_NON_CLIENT, + ui::EF_LEFT_MOUSE_BUTTON); textfield_view_->OnMousePressed(click); ui::MouseEvent release(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), - ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_NON_CLIENT); + ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_NON_CLIENT, + ui::EF_LEFT_MOUSE_BUTTON); textfield_view_->OnMouseReleased(release); } @@ -781,7 +783,7 @@ TEST_F(NativeTextfieldViewsTest, FocusTraversalTest) { widget_->GetFocusManager()->AdvanceFocus(true); EXPECT_EQ(3, GetFocusedView()->id()); ui::MouseEvent click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); textfield_view_->OnMousePressed(click); EXPECT_EQ(1, GetFocusedView()->id()); } @@ -813,12 +815,13 @@ TEST_F(NativeTextfieldViewsTest, DoubleAndTripleClickTest) { InitTextfield(Textfield::STYLE_DEFAULT); textfield_->SetText(ASCIIToUTF16("hello world")); ui::MouseEvent click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); ui::MouseEvent release(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); ui::MouseEvent double_click( ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), - ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK); + ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK, + ui::EF_LEFT_MOUSE_BUTTON); // Test for double click. textfield_view_->OnMousePressed(click); @@ -847,15 +850,15 @@ TEST_F(NativeTextfieldViewsTest, DragToSelect) { gfx::Point start_point(kStart, 0); gfx::Point end_point(kEnd, 0); ui::MouseEvent click_a(ui::ET_MOUSE_PRESSED, start_point, start_point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); ui::MouseEvent click_b(ui::ET_MOUSE_PRESSED, end_point, end_point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); ui::MouseEvent drag_left(ui::ET_MOUSE_DRAGGED, gfx::Point(), gfx::Point(), - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, 0); ui::MouseEvent drag_right(ui::ET_MOUSE_DRAGGED, end_point, end_point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, 0); ui::MouseEvent release(ui::ET_MOUSE_RELEASED, end_point, end_point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); textfield_view_->OnMousePressed(click_a); EXPECT_TRUE(textfield_->GetSelectedText().empty()); // Check that dragging left selects the beginning of the string. @@ -962,6 +965,7 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_InitiateDrag) { textfield_->SetObscured(false); // Ensure that textfields only initiate drag operations inside the selection. ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, kStringPoint, kStringPoint, + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); textfield_view_->OnMousePressed(press_event); EXPECT_EQ(ui::DragDropTypes::DRAG_NONE, @@ -991,7 +995,7 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_ToTheRight) { textfield_->SelectRange(gfx::Range(1, 5)); gfx::Point point(GetCursorPositionX(3), 0); ui::MouseEvent click_a(ui::ET_MOUSE_PRESSED, point, point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); textfield_view_->OnMousePressed(click_a); EXPECT_TRUE(textfield_view_->CanStartDragForView(textfield_view_, click_a.location(), gfx::Point())); @@ -1046,7 +1050,7 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_ToTheLeft) { textfield_->SelectRange(gfx::Range(5, 10)); gfx::Point point(GetCursorPositionX(7), 0); ui::MouseEvent click_a(ui::ET_MOUSE_PRESSED, point, point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); textfield_view_->OnMousePressed(click_a); EXPECT_TRUE(textfield_view_->CanStartDragForView(textfield_view_, click_a.location(), gfx::Point())); @@ -1095,7 +1099,7 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_Canceled) { textfield_->SelectRange(gfx::Range(6, 10)); gfx::Point point(GetCursorPositionX(8), 0); ui::MouseEvent click(ui::ET_MOUSE_PRESSED, point, point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); textfield_view_->OnMousePressed(click); ui::OSExchangeData data; textfield_view_->WriteDragDataForView(NULL, click.location(), &data); @@ -1108,9 +1112,9 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_Canceled) { // "Cancel" the drag, via move and release over the selection, and OnDragDone. gfx::Point drag_point(GetCursorPositionX(9), 0); ui::MouseEvent drag(ui::ET_MOUSE_DRAGGED, drag_point, drag_point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, 0); ui::MouseEvent release(ui::ET_MOUSE_RELEASED, drag_point, drag_point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); textfield_view_->OnMouseDragged(drag); textfield_view_->OnMouseReleased(release); textfield_view_->OnDragDone(); @@ -1850,13 +1854,14 @@ TEST_F(NativeTextfieldViewsTest, KeepInitiallySelectedWord) { const gfx::Point middle(middle_cursor.x(), middle_cursor.y() + middle_cursor.height() / 2); ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, middle, middle, + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); textfield_view_->OnMousePressed(press_event); EXPECT_EQ(gfx::Range(4, 7), textfield_->GetSelectedRange()); // Drag the mouse to the beginning of the textfield. ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, beginning, beginning, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, 0); textfield_view_->OnMouseDragged(drag_event); EXPECT_EQ(gfx::Range(7, 0), textfield_->GetSelectedRange()); } diff --git a/ui/views/corewm/capture_controller_unittest.cc b/ui/views/corewm/capture_controller_unittest.cc index 558a403..c779547 100644 --- a/ui/views/corewm/capture_controller_unittest.cc +++ b/ui/views/corewm/capture_controller_unittest.cc @@ -102,7 +102,7 @@ TEST_F(CaptureControllerTest, ResetMouseEventHandlerOnCapture) { // Make a synthesized mouse down event. Ensure that the RootWindow will // dispatch further mouse events to |w1|. ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), - gfx::Point(5, 5), 0); + gfx::Point(5, 5), 0, 0); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent( &mouse_pressed_event); EXPECT_EQ(w1.get(), dispatcher()->mouse_pressed_handler()); diff --git a/ui/views/corewm/compound_event_filter_unittest.cc b/ui/views/corewm/compound_event_filter_unittest.cc index 293e2d3..fbeb2d3 100644 --- a/ui/views/corewm/compound_event_filter_unittest.cc +++ b/ui/views/corewm/compound_event_filter_unittest.cc @@ -70,19 +70,19 @@ TEST_F(CompoundEventFilterTest, CursorVisibilityChange) { // Synthesized mouse event should not show the cursor. ui::MouseEvent enter(ui::ET_MOUSE_ENTERED, gfx::Point(10, 10), - gfx::Point(10, 10), 0); + gfx::Point(10, 10), 0, 0); enter.set_flags(enter.flags() | ui::EF_IS_SYNTHESIZED); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&enter); EXPECT_FALSE(cursor_client.IsCursorVisible()); ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), - gfx::Point(10, 10), 0); + gfx::Point(10, 10), 0, 0); move.set_flags(enter.flags() | ui::EF_IS_SYNTHESIZED); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&move); EXPECT_FALSE(cursor_client.IsCursorVisible()); ui::MouseEvent real_move(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), - gfx::Point(10, 10), 0); + gfx::Point(10, 10), 0, 0); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&real_move); EXPECT_TRUE(cursor_client.IsCursorVisible()); @@ -92,7 +92,7 @@ TEST_F(CompoundEventFilterTest, CursorVisibilityChange) { // Mouse synthesized exit event should not show the cursor. ui::MouseEvent exit(ui::ET_MOUSE_EXITED, gfx::Point(10, 10), - gfx::Point(10, 10), 0); + gfx::Point(10, 10), 0, 0); exit.set_flags(enter.flags() | ui::EF_IS_SYNTHESIZED); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&exit); EXPECT_FALSE(cursor_client.IsCursorVisible()); @@ -113,7 +113,7 @@ TEST_F(CompoundEventFilterTest, TouchHidesCursor) { aura::test::TestCursorClient cursor_client(root_window()); ui::MouseEvent mouse0(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), - gfx::Point(10, 10), 0); + gfx::Point(10, 10), 0, 0); dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse0); EXPECT_TRUE(cursor_client.IsMouseEventsEnabled()); @@ -134,7 +134,7 @@ TEST_F(CompoundEventFilterTest, TouchHidesCursor) { EXPECT_FALSE(cursor_client.IsMouseEventsEnabled()); ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, gfx::Point(10, 10), - gfx::Point(10, 10), 0); + gfx::Point(10, 10), 0, 0); // Move the cursor again. The cursor should be visible. dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse1); EXPECT_TRUE(cursor_client.IsMouseEventsEnabled()); diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc index 1597f5d..ffe9db3 100644 --- a/ui/views/view_unittest.cc +++ b/ui/views/view_unittest.cc @@ -412,7 +412,7 @@ TEST_F(ViewTest, MouseEvent) { gfx::Point p1(110, 120); ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, p1, p1, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); root->OnMousePressed(pressed); EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_PRESSED); EXPECT_EQ(v2->location_.x(), 10); @@ -425,7 +425,7 @@ TEST_F(ViewTest, MouseEvent) { v2->Reset(); gfx::Point p2(50, 40); ui::MouseEvent dragged(ui::ET_MOUSE_DRAGGED, p2, p2, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, 0); root->OnMouseDragged(dragged); EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_DRAGGED); EXPECT_EQ(v2->location_.x(), -50); @@ -436,7 +436,8 @@ TEST_F(ViewTest, MouseEvent) { // Releasted event out of bounds. Should still go to v2 v1->Reset(); v2->Reset(); - ui::MouseEvent released(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), 0); + ui::MouseEvent released(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), 0, + 0); root->OnMouseDragged(released); EXPECT_EQ(v2->last_mouse_event_type_, ui::ET_MOUSE_RELEASED); EXPECT_EQ(v2->location_.x(), -100); @@ -471,7 +472,7 @@ TEST_F(ViewTest, DeleteOnPressed) { v2->delete_on_pressed_ = true; gfx::Point point(110, 120); ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, point, point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); root->OnMousePressed(pressed); EXPECT_EQ(0, v1->child_count()); @@ -1359,7 +1360,7 @@ TEST_F(ViewTest, NotifyEnterExitOnChild) { // Move the mouse in v111. gfx::Point p1(6, 6); - ui::MouseEvent move1(ui::ET_MOUSE_MOVED, p1, p1, 0); + ui::MouseEvent move1(ui::ET_MOUSE_MOVED, p1, p1, 0, 0); root_view->OnMouseMoved(move1); EXPECT_TRUE(v111->received_mouse_enter_); EXPECT_FALSE(v11->last_mouse_event_type_); @@ -1370,7 +1371,7 @@ TEST_F(ViewTest, NotifyEnterExitOnChild) { // Now, move into v121. gfx::Point p2(65, 21); - ui::MouseEvent move2(ui::ET_MOUSE_MOVED, p2, p2, 0); + ui::MouseEvent move2(ui::ET_MOUSE_MOVED, p2, p2, 0, 0); root_view->OnMouseMoved(move2); EXPECT_TRUE(v111->received_mouse_exit_); EXPECT_TRUE(v121->received_mouse_enter_); @@ -1381,7 +1382,7 @@ TEST_F(ViewTest, NotifyEnterExitOnChild) { // Now, move into v11. gfx::Point p3(1, 1); - ui::MouseEvent move3(ui::ET_MOUSE_MOVED, p3, p3, 0); + ui::MouseEvent move3(ui::ET_MOUSE_MOVED, p3, p3, 0, 0); root_view->OnMouseMoved(move3); EXPECT_TRUE(v121->received_mouse_exit_); EXPECT_TRUE(v11->received_mouse_enter_); @@ -1392,7 +1393,7 @@ TEST_F(ViewTest, NotifyEnterExitOnChild) { // Move to v21. gfx::Point p4(121, 15); - ui::MouseEvent move4(ui::ET_MOUSE_MOVED, p4, p4, 0); + ui::MouseEvent move4(ui::ET_MOUSE_MOVED, p4, p4, 0, 0); root_view->OnMouseMoved(move4); EXPECT_TRUE(v21->received_mouse_enter_); EXPECT_FALSE(v2->last_mouse_event_type_); @@ -1405,7 +1406,7 @@ TEST_F(ViewTest, NotifyEnterExitOnChild) { // Move to v1. gfx::Point p5(21, 0); - ui::MouseEvent move5(ui::ET_MOUSE_MOVED, p5, p5, 0); + ui::MouseEvent move5(ui::ET_MOUSE_MOVED, p5, p5, 0, 0); root_view->OnMouseMoved(move5); EXPECT_TRUE(v21->received_mouse_exit_); EXPECT_TRUE(v1->received_mouse_enter_); @@ -1415,7 +1416,7 @@ TEST_F(ViewTest, NotifyEnterExitOnChild) { // Now, move into v11. gfx::Point p6(15, 15); - ui::MouseEvent mouse6(ui::ET_MOUSE_MOVED, p6, p6, 0); + ui::MouseEvent mouse6(ui::ET_MOUSE_MOVED, p6, p6, 0, 0); root_view->OnMouseMoved(mouse6); EXPECT_TRUE(v11->received_mouse_enter_); EXPECT_FALSE(v1->last_mouse_event_type_); @@ -1427,7 +1428,7 @@ TEST_F(ViewTest, NotifyEnterExitOnChild) { // and the mouse remains inside |v1| the whole time, it receives another ENTER // when the mouse leaves v11. gfx::Point p7(21, 0); - ui::MouseEvent mouse7(ui::ET_MOUSE_MOVED, p7, p7, 0); + ui::MouseEvent mouse7(ui::ET_MOUSE_MOVED, p7, p7, 0, 0); root_view->OnMouseMoved(mouse7); EXPECT_TRUE(v11->received_mouse_exit_); EXPECT_FALSE(v1->received_mouse_enter_); @@ -1964,14 +1965,15 @@ TEST_F(ViewTest, TransformEvent) { gfx::Point p1(110, 210); ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, p1, p1, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); root->OnMousePressed(pressed); EXPECT_EQ(0, v1->last_mouse_event_type_); EXPECT_EQ(ui::ET_MOUSE_PRESSED, v2->last_mouse_event_type_); EXPECT_EQ(190, v2->location_.x()); EXPECT_EQ(10, v2->location_.y()); - ui::MouseEvent released(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), 0); + ui::MouseEvent released(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), 0, + 0); root->OnMouseReleased(released); // Now rotate |v2| inside |v1| clockwise. @@ -1988,7 +1990,7 @@ TEST_F(ViewTest, TransformEvent) { gfx::Point point2(110, 320); ui::MouseEvent p2(ui::ET_MOUSE_PRESSED, point2, point2, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); root->OnMousePressed(p2); EXPECT_EQ(0, v1->last_mouse_event_type_); EXPECT_EQ(ui::ET_MOUSE_PRESSED, v2->last_mouse_event_type_); @@ -2024,7 +2026,7 @@ TEST_F(ViewTest, TransformEvent) { gfx::Point point(112, 110); ui::MouseEvent p3(ui::ET_MOUSE_PRESSED, point, point, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); root->OnMousePressed(p3); EXPECT_EQ(ui::ET_MOUSE_PRESSED, v3->last_mouse_event_type_); @@ -2063,7 +2065,7 @@ TEST_F(ViewTest, TransformEvent) { gfx::Point point3(124, 125); ui::MouseEvent p4(ui::ET_MOUSE_PRESSED, point3, point3, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); root->OnMousePressed(p4); EXPECT_EQ(ui::ET_MOUSE_PRESSED, v3->last_mouse_event_type_); diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc index c825998..f3ad2a0 100644 --- a/ui/views/widget/root_view.cc +++ b/ui/views/widget/root_view.cc @@ -524,7 +524,8 @@ void RootView::OnMouseCaptureLost() { gfx::Point last_point(last_mouse_event_x_, last_mouse_event_y_); ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, last_point, last_point, - last_mouse_event_flags_); + last_mouse_event_flags_, + 0); UpdateCursor(release_event); } // We allow the view to delete us from OnMouseCaptureLost. As such, diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index dc1ace9..e8e5aa6 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -966,7 +966,7 @@ void Widget::SynthesizeMouseMoveEvent() { ui::MouseEvent mouse_event(ui::ET_MOUSE_MOVED, last_mouse_event_position_, last_mouse_event_position_, - ui::EF_IS_SYNTHESIZED); + ui::EF_IS_SYNTHESIZED, 0); root_view_->OnMouseMoved(mouse_event); } diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc index 30d44a3..202d453 100644 --- a/ui/views/widget/widget_interactive_uitest.cc +++ b/ui/views/widget/widget_interactive_uitest.cc @@ -227,7 +227,7 @@ TEST_F(WidgetTest, CaptureAutoReset) { // By default, mouse release removes capture. gfx::Point click_location(45, 15); ui::MouseEvent release(ui::ET_MOUSE_RELEASED, click_location, click_location, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); toplevel->OnMouseEvent(&release); EXPECT_FALSE(toplevel->HasCapture()); @@ -274,9 +274,9 @@ TEST_F(WidgetTest, ResetCaptureOnGestureEnd) { gfx::Point click_location(45, 15); ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); ui::MouseEvent release(ui::ET_MOUSE_RELEASED, click_location, click_location, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); EXPECT_TRUE(toplevel->HasCapture()); @@ -327,9 +327,10 @@ TEST_F(WidgetTest, DisableCaptureWidgetFromMousePress) { base::Owned(new ui::MouseEvent(ui::ET_MOUSE_RELEASED, location, location, + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)))); ui::MouseEvent press(ui::ET_MOUSE_PRESSED, location, location, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); first->OnMouseEvent(&press); EXPECT_FALSE(first->HasCapture()); first->Close(); @@ -361,7 +362,7 @@ TEST_F(WidgetTest, DISABLED_GrabUngrab) { // Click on child1 gfx::Point p1(45, 45); ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, p1, p1, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); toplevel->OnMouseEvent(&pressed); EXPECT_TRUE(toplevel->HasCapture()); @@ -369,7 +370,7 @@ TEST_F(WidgetTest, DISABLED_GrabUngrab) { EXPECT_FALSE(child2->HasCapture()); ui::MouseEvent released(ui::ET_MOUSE_RELEASED, p1, p1, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); toplevel->OnMouseEvent(&released); EXPECT_FALSE(toplevel->HasCapture()); @@ -381,7 +382,7 @@ TEST_F(WidgetTest, DISABLED_GrabUngrab) { // Click on child2 gfx::Point p2(315, 45); ui::MouseEvent pressed2(ui::ET_MOUSE_PRESSED, p2, p2, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); toplevel->OnMouseEvent(&pressed2); EXPECT_TRUE(pressed2.handled()); EXPECT_TRUE(toplevel->HasCapture()); @@ -389,7 +390,7 @@ TEST_F(WidgetTest, DISABLED_GrabUngrab) { EXPECT_FALSE(child1->HasCapture()); ui::MouseEvent released2(ui::ET_MOUSE_RELEASED, p2, p2, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); toplevel->OnMouseEvent(&released2); EXPECT_FALSE(toplevel->HasCapture()); EXPECT_FALSE(child1->HasCapture()); @@ -414,21 +415,24 @@ TEST_F(WidgetTest, CheckResizeControllerEvents) { // Move to an outside position. gfx::Point p1(200, 200); - ui::MouseEvent moved_out(ui::ET_MOUSE_MOVED, p1, p1, ui::EF_NONE); + ui::MouseEvent moved_out(ui::ET_MOUSE_MOVED, p1, p1, ui::EF_NONE, + ui::EF_NONE); toplevel->OnMouseEvent(&moved_out); EXPECT_EQ(0, view->EnteredCalls()); EXPECT_EQ(0, view->ExitedCalls()); // Move onto the active view. gfx::Point p2(95, 95); - ui::MouseEvent moved_over(ui::ET_MOUSE_MOVED, p2, p2, ui::EF_NONE); + ui::MouseEvent moved_over(ui::ET_MOUSE_MOVED, p2, p2, ui::EF_NONE, + ui::EF_NONE); toplevel->OnMouseEvent(&moved_over); EXPECT_EQ(1, view->EnteredCalls()); EXPECT_EQ(0, view->ExitedCalls()); // Move onto the outer resizing border. gfx::Point p3(102, 95); - ui::MouseEvent moved_resizer(ui::ET_MOUSE_MOVED, p3, p3, ui::EF_NONE); + ui::MouseEvent moved_resizer(ui::ET_MOUSE_MOVED, p3, p3, ui::EF_NONE, + ui::EF_NONE); toplevel->OnMouseEvent(&moved_resizer); EXPECT_EQ(0, view->EnteredCalls()); EXPECT_EQ(1, view->ExitedCalls()); @@ -775,7 +779,7 @@ TEST_F(WidgetCaptureTest, MAYBE_MouseEventDispatchedToRightWindow) { // Send a mouse event to the RootWindow associated with |widget1|. Even though // |widget2| has capture, |widget1| should still get the event. ui::MouseEvent mouse_event(ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(), - ui::EF_NONE); + ui::EF_NONE, ui::EF_NONE); widget1.GetNativeWindow()->GetDispatcher()->AsRootWindowHostDelegate()-> OnHostMouseEvent(&mouse_event); EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc index 51b444f..52d6a5f 100644 --- a/ui/views/widget/widget_unittest.cc +++ b/ui/views/widget/widget_unittest.cc @@ -1305,7 +1305,7 @@ class CloseWidgetView : public View { void GenerateMouseEvents(Widget* widget, ui::EventType last_event_type) { const gfx::Rect screen_bounds(widget->GetWindowBoundsInScreen()); ui::MouseEvent move_event(ui::ET_MOUSE_MOVED, screen_bounds.CenterPoint(), - screen_bounds.CenterPoint(), 0); + screen_bounds.CenterPoint(), 0, 0); aura::RootWindowHostDelegate* rwhd = widget->GetNativeWindow()->GetDispatcher()->AsRootWindowHostDelegate(); rwhd->OnHostMouseEvent(&move_event); @@ -1316,19 +1316,20 @@ void GenerateMouseEvents(Widget* widget, ui::EventType last_event_type) { return; ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, screen_bounds.CenterPoint(), - screen_bounds.CenterPoint(), 0); + screen_bounds.CenterPoint(), 0, 0); rwhd->OnHostMouseEvent(&press_event); if (last_event_type == ui::ET_MOUSE_PRESSED) return; gfx::Point end_point(screen_bounds.CenterPoint()); end_point.Offset(1, 1); - ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, end_point, end_point, 0); + ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, end_point, end_point, 0, 0); rwhd->OnHostMouseEvent(&drag_event); if (last_event_type == ui::ET_MOUSE_DRAGGED) return; - ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, end_point, end_point, 0); + ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, end_point, end_point, 0, + 0); rwhd->OnHostMouseEvent(&release_event); } @@ -1542,7 +1543,7 @@ TEST_F(WidgetTest, SynthesizeMouseMoveEvent) { gfx::Point cursor_location(5, 5); ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, - ui::EF_NONE); + ui::EF_NONE, ui::EF_NONE); widget->OnMouseEvent(&move); EXPECT_EQ(1, v1->GetEventCount(ui::ET_MOUSE_ENTERED)); @@ -1724,7 +1725,7 @@ TEST_F(WidgetTest, TestWidgetDeletedInOnMousePressed) { gfx::Point click_location(45, 15); ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); widget->OnMouseEvent(&press); // Yay we did not crash! @@ -1867,7 +1868,7 @@ TEST_F(WidgetTest, MAYBE_DisableTestRootViewHandlersWhenHidden) { EXPECT_EQ(NULL, GetMousePressedHandler(root_view)); gfx::Point click_location(45, 15); ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location, - ui::EF_LEFT_MOUSE_BUTTON); + ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); widget->OnMouseEvent(&press); EXPECT_EQ(view, GetMousePressedHandler(root_view)); widget->Hide(); @@ -1877,7 +1878,7 @@ TEST_F(WidgetTest, MAYBE_DisableTestRootViewHandlersWhenHidden) { widget->Show(); EXPECT_EQ(NULL, GetMouseMoveHandler(root_view)); gfx::Point move_location(45, 15); - ui::MouseEvent move(ui::ET_MOUSE_MOVED, move_location, move_location, 0); + ui::MouseEvent move(ui::ET_MOUSE_MOVED, move_location, move_location, 0, 0); widget->OnMouseEvent(&move); EXPECT_EQ(view, GetMouseMoveHandler(root_view)); widget->Hide(); @@ -2066,6 +2067,7 @@ TEST_F(WidgetTest, WindowMouseModalityTest) { ui::MouseEvent move_main(ui::ET_MOUSE_MOVED, cursor_location_main, cursor_location_main, + ui::EF_NONE, ui::EF_NONE); top_level_widget.GetNativeView()->GetDispatcher()-> AsRootWindowHostDelegate()->OnHostMouseEvent(&move_main); @@ -2092,6 +2094,7 @@ TEST_F(WidgetTest, WindowMouseModalityTest) { ui::MouseEvent mouse_down_dialog(ui::ET_MOUSE_PRESSED, cursor_location_dialog, cursor_location_dialog, + ui::EF_NONE, ui::EF_NONE); top_level_widget.GetNativeView()->GetDispatcher()-> AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_down_dialog); @@ -2103,6 +2106,7 @@ TEST_F(WidgetTest, WindowMouseModalityTest) { ui::MouseEvent mouse_down_main(ui::ET_MOUSE_MOVED, cursor_location_main2, cursor_location_main2, + ui::EF_NONE, ui::EF_NONE); top_level_widget.GetNativeView()->GetDispatcher()-> AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_down_main); |