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/views/controls/menu/menu_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windowsx.h> | 8 #include <windowsx.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 event_type = 0; // Unknown mouse press. | 2117 event_type = 0; // Unknown mouse press. |
2118 | 2118 |
2119 if (event_type) { | 2119 if (event_type) { |
2120 if (in_client_area) { | 2120 if (in_client_area) { |
2121 PostMessage(window, event_type, event.native_event().wParam, | 2121 PostMessage(window, event_type, event.native_event().wParam, |
2122 MAKELPARAM(window_x, window_y)); | 2122 MAKELPARAM(window_x, window_y)); |
2123 } else { | 2123 } else { |
2124 PostMessage(window, event_type, nc_hit_result, | 2124 PostMessage(window, event_type, nc_hit_result, |
2125 MAKELPARAM(screen_loc.x(), screen_loc.y())); | 2125 MAKELPARAM(screen_loc.x(), screen_loc.y())); |
2126 } | 2126 } |
| 2127 } else if (event.type() == ui::ET_GESTURE_TAP_DOWN) { |
| 2128 #if defined(USE_AURA) |
| 2129 // Gesture events need to be posted to the target root window. In |
| 2130 // desktop chrome there could be multiple root windows. |
| 2131 aura::RootWindow* target_root = |
| 2132 aura::RootWindow::GetForAcceleratedWidget(window); |
| 2133 if (target_root) |
| 2134 target_root->RepostEvent(event); |
| 2135 #endif |
2127 } | 2136 } |
2128 } | 2137 } |
2129 } | 2138 } |
2130 #elif defined(USE_AURA) | 2139 #elif defined(USE_AURA) |
2131 void MenuController::RepostEvent(SubmenuView* source, | 2140 void MenuController::RepostEvent(SubmenuView* source, |
2132 const ui::LocatedEvent& event) { | 2141 const ui::LocatedEvent& event) { |
2133 aura::RootWindow* root_window = | 2142 aura::RootWindow* root_window = |
2134 source->GetWidget()->GetNativeWindow()->GetRootWindow(); | 2143 source->GetWidget()->GetNativeWindow()->GetRootWindow(); |
2135 DCHECK(root_window); | 2144 DCHECK(root_window); |
2136 root_window->RepostEvent(event); | 2145 root_window->RepostEvent(event); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2289 (!pending_state_.item->HasSubmenu() || | 2298 (!pending_state_.item->HasSubmenu() || |
2290 !pending_state_.item->GetSubmenu()->IsShowing())) { | 2299 !pending_state_.item->GetSubmenu()->IsShowing())) { |
2291 // On exit if the user hasn't selected an item with a submenu, move the | 2300 // On exit if the user hasn't selected an item with a submenu, move the |
2292 // selection back to the parent menu item. | 2301 // selection back to the parent menu item. |
2293 SetSelection(pending_state_.item->GetParentMenuItem(), | 2302 SetSelection(pending_state_.item->GetParentMenuItem(), |
2294 SELECTION_OPEN_SUBMENU); | 2303 SELECTION_OPEN_SUBMENU); |
2295 } | 2304 } |
2296 } | 2305 } |
2297 | 2306 |
2298 } // namespace views | 2307 } // namespace views |
OLD | NEW |