From 8269e7b1efb91c1c1be539fbc859a56eeb7d1906 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 11 Jul 2016 15:31:24 +0900 Subject: [PATCH] Suppress unresponsive event when showing menu --- atom/browser/api/atom_api_menu_mac.mm | 4 ++++ atom/browser/api/atom_api_menu_views.cc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/atom/browser/api/atom_api_menu_mac.mm b/atom/browser/api/atom_api_menu_mac.mm index 22a624988b7..6a7d43b4da2 100644 --- a/atom/browser/api/atom_api_menu_mac.mm +++ b/atom/browser/api/atom_api_menu_mac.mm @@ -5,6 +5,7 @@ #import "atom/browser/api/atom_api_menu_mac.h" #include "atom/browser/native_window.h" +#include "atom/browser/unresponsive_suppressor.h" #include "base/message_loop/message_loop.h" #include "base/strings/sys_string_conversions.h" #include "brightray/browser/inspectable_web_contents.h" @@ -67,6 +68,9 @@ void MenuMac::PopupAt(Window* window, int x, int y, int positioning_item) { if (rightmostMenuPoint > screenRight) position.x = position.x - [menu size].width; + // Don't emit unresponsive event when showing menu. + atom::UnresponsiveSuppressor suppressor; + // Show the menu. [menu popUpMenuPositioningItem:item atLocation:position inView:view]; } diff --git a/atom/browser/api/atom_api_menu_views.cc b/atom/browser/api/atom_api_menu_views.cc index 9340bc76732..ceee46360d7 100644 --- a/atom/browser/api/atom_api_menu_views.cc +++ b/atom/browser/api/atom_api_menu_views.cc @@ -5,6 +5,7 @@ #include "atom/browser/api/atom_api_menu_views.h" #include "atom/browser/native_window_views.h" +#include "atom/browser/unresponsive_suppressor.h" #include "content/public/browser/render_widget_host_view.h" #include "ui/gfx/screen.h" #include "ui/views/controls/menu/menu_runner.h" @@ -36,6 +37,9 @@ void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item) { location = gfx::Point(origin.x() + x, origin.y() + y); } + // Don't emit unresponsive event when showing menu. + atom::UnresponsiveSuppressor suppressor; + // Show the menu. views::MenuRunner menu_runner( model(),