Index: ui/views/controls/menu/menu_controller.cc |
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc |
index cae826f46607a06da30b946d49b0ec98578cb9e4..740c328cfbcbd754fba99d8842f510f3965163ba 100644 |
--- a/ui/views/controls/menu/menu_controller.cc |
+++ b/ui/views/controls/menu/menu_controller.cc |
@@ -10,6 +10,8 @@ |
#include "base/strings/utf_string_conversions.h" |
#include "base/time/time.h" |
#include "build/build_config.h" |
+#include "ui/aura/client/aura_constants.h" |
+#include "ui/aura/window_tree_host.h" |
#include "ui/base/dragdrop/drag_utils.h" |
#include "ui/base/dragdrop/os_exchange_data.h" |
#include "ui/events/event.h" |
@@ -1215,6 +1217,13 @@ MenuController::~MenuController() { |
} |
void MenuController::RunMessageLoop(bool nested_menu) { |
+#if defined(OS_WIN) |
+ // Menus should be dismissed if we touch outside their bounds. |
+ if (owner_ && owner_->GetNativeView()) { |
+ owner_->GetNativeView()->SetProperty( |
+ aura::client::kReleaseCaptureOnTouchOutside, true); |
+ } |
+#endif |
message_loop_->Run(this, owner_, nested_menu); |
} |
@@ -2428,6 +2437,10 @@ MenuItemView* MenuController::ExitMenuRun() { |
SetSelection(nullptr, SELECTION_UPDATE_IMMEDIATELY | SELECTION_EXIT); |
#if defined(OS_WIN) |
+ if (owner_ && owner_->GetNativeView()) { |
+ owner_->GetNativeView()->ClearProperty( |
+ aura::client::kReleaseCaptureOnTouchOutside); |
+ } |
// On Windows, if we select the menu item by touch and if the window at the |
// location is another window on the same thread, that window gets a |
// WM_MOUSEACTIVATE message and ends up activating itself, which is not |