Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(664)

Unified Diff: ui/views/widget/widget.cc

Issue 1953753002: Turn RootWindowController Menus Async (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/root_window_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget.cc
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 17675e73c44d8c90681eabff93600f6de4b5d1d4..6d93da70f430fb15c2ab84b4a3f81968b818952d 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -1174,16 +1174,22 @@ void Widget::OnMouseEvent(ui::MouseEvent* event) {
// Make sure we're still visible before we attempt capture as the mouse
// press processing may have made the window hide (as happens with menus).
- // It is possible for a View to show a context menu on mouse-press. Since
- // the menu does a capture and starts a nested message-loop, the release
- // would go to the menu. The next click (i.e. both mouse-press and release
- // events) also go to the menu. The menu (and the nested message-loop)
- // gets closed after this second release event. The code then resumes from
- // here. So make sure that the mouse-button is still down before doing a
- // capture.
+ // It is possible for a View to show a context menu on mouse-press, which
+ // takes capture.
+ //
+ // Menus which use a nested message-loop, receive the release. The next
+ // click (i.e. both mouse-press and release events) also go to the menu.
+ // The menu (and the nested message-loop) gets closed after this second
+ // release event. The code then resumes from here. So make sure that the
+ // mouse-button is still down before doing a capture.
+ //
+ // Menus which do not use a nested message-loop will return here, holding
+ // capture. If there is an active MenuController do not reassign capture
+ // to |native_widget_|.
if (root_view && root_view->OnMousePressed(*event) &&
widget_deletion_observer.IsWidgetAlive() && IsVisible() &&
- internal::NativeWidgetPrivate::IsMouseButtonDown()) {
+ internal::NativeWidgetPrivate::IsMouseButtonDown() &&
+ !MenuController::GetActiveInstance()) {
sky 2016/05/05 16:34:39 I don't like having to special case the check for
jonross 2016/05/05 17:50:42 I believe that could account for this. I'm not awa
is_mouse_button_pressed_ = true;
if (!native_widget_->HasCapture())
native_widget_->SetCapture();
« no previous file with comments | « ash/root_window_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698