diff options
author | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-19 02:12:59 +0000 |
---|---|---|
committer | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-19 02:12:59 +0000 |
commit | d46c48484879ed310a0cddc161ec6cd5f2811222 (patch) | |
tree | 04a5fdbbc14c4a9b0b8c25cadec7f7d8f88bb856 /views | |
parent | 1e4dc692612b67c9b79325861539df8d2de526c7 (diff) | |
download | chromium_src-d46c48484879ed310a0cddc161ec6cd5f2811222.zip chromium_src-d46c48484879ed310a0cddc161ec6cd5f2811222.tar.gz chromium_src-d46c48484879ed310a0cddc161ec6cd5f2811222.tar.bz2 |
Forward mouse wheel events to submenus
Mouse wheel wasn't working for submenus on chromeos.
This CL fixes this issue by forwarding events to submenu, like other mouse events.
BUG=chromium-os:11834
TEST=see bug for repro step.
Review URL: http://codereview.chromium.org/6673105
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78802 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/menu/menu_controller.cc | 9 | ||||
-rw-r--r-- | views/controls/menu/menu_controller.h | 6 | ||||
-rw-r--r-- | views/controls/menu/menu_host_root_view.cc | 9 |
3 files changed, 23 insertions, 1 deletions
diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc index baabf69..4e9ba38 100644 --- a/views/controls/menu/menu_controller.cc +++ b/views/controls/menu/menu_controller.cc @@ -579,6 +579,14 @@ void MenuController::OnMouseEntered(SubmenuView* source, // do anything here. } +#if defined(OS_LINUX) +bool MenuController::OnMouseWheel(SubmenuView* source, + const MouseWheelEvent& event) { + MenuPart part = GetMenuPartByScreenCoordinate(source, event.x(), event.y()); + return part.submenu && part.submenu->OnMouseWheel(event); +} +#endif + bool MenuController::GetDropFormats( SubmenuView* source, int* formats, @@ -1192,6 +1200,7 @@ bool MenuController::GetMenuPartByScreenCoordinateImpl( View::ConvertPointToView(NULL, menu, &menu_loc); part->menu = GetMenuItemAt(menu, menu_loc.x(), menu_loc.y()); part->type = MenuPart::MENU_ITEM; + part->submenu = menu; if (!part->menu) part->parent = menu->GetMenuItem(); return true; diff --git a/views/controls/menu/menu_controller.h b/views/controls/menu/menu_controller.h index 3838c45..577bda3 100644 --- a/views/controls/menu/menu_controller.h +++ b/views/controls/menu/menu_controller.h @@ -93,6 +93,10 @@ class MenuController : public MessageLoopForUI::Dispatcher { void OnMouseReleased(SubmenuView* source, const MouseEvent& event); void OnMouseMoved(SubmenuView* source, const MouseEvent& event); void OnMouseEntered(SubmenuView* source, const MouseEvent& event); +#if defined(OS_LINUX) + bool OnMouseWheel(SubmenuView* source, const MouseWheelEvent& event); +#endif + bool GetDropFormats( SubmenuView* source, int* formats, @@ -184,7 +188,7 @@ class MenuController : public MessageLoopForUI::Dispatcher { // parent of the menu item the user clicked on. Otherwise this is NULL. MenuItemView* parent; - // If type is SCROLL_*, this is the submenu the mouse is over. + // This is the submenu the mouse is over. SubmenuView* submenu; }; diff --git a/views/controls/menu/menu_host_root_view.cc b/views/controls/menu/menu_host_root_view.cc index bf2a997..0372261 100644 --- a/views/controls/menu/menu_host_root_view.cc +++ b/views/controls/menu/menu_host_root_view.cc @@ -74,9 +74,18 @@ void MenuHostRootView::OnMouseExited(const MouseEvent& event) { } bool MenuHostRootView::OnMouseWheel(const MouseWheelEvent& event) { +#if defined(OS_LINUX) + // ChromeOS uses MenuController to forward events like other + // mouse events. + return GetMenuController() && + GetMenuController()->OnMouseWheel(submenu_, event); +#else + // Windows uses focus_util_win::RerouteMouseWheel to forward events to + // the right menu. // RootView::OnMouseWheel forwards to the focused view. We don't have a // focused view, so we need to override this then forward to the menu. return submenu_->OnMouseWheel(event); +#endif } MenuController* MenuHostRootView::GetMenuController() { |