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

Unified Diff: ui/views/controls/menu/menu_controller.cc

Issue 1565013002: Don't send touch events to windows like menus when the touch occurs outside the menu bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove include Created 4 years, 11 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
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

Powered by Google App Engine
This is Rietveld 408576698