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

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

Issue 222203006: Prevents double-clicks on a tab close button from aslo maximizing the browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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/widget/desktop_aura/x11_window_event_filter.cc
diff --git a/ui/views/widget/desktop_aura/x11_window_event_filter.cc b/ui/views/widget/desktop_aura/x11_window_event_filter.cc
index 9cb6834313d55bfa5f575810145ea3fa7b34c289..aec9d5d00c34b79846a90265a24fc315927e0747 100644
--- a/ui/views/widget/desktop_aura/x11_window_event_filter.cc
+++ b/ui/views/widget/desktop_aura/x11_window_event_filter.cc
@@ -67,7 +67,8 @@ X11WindowEventFilter::X11WindowEventFilter(
x_root_window_(DefaultRootWindow(xdisplay_)),
atom_cache_(xdisplay_, kAtomsToCache),
window_tree_host_(window_tree_host),
- is_active_(false) {
+ is_active_(false),
+ mouse_target_component_(HTNOWHERE) {
}
X11WindowEventFilter::~X11WindowEventFilter() {
@@ -101,8 +102,10 @@ void X11WindowEventFilter::OnMouseEvent(ui::MouseEvent* event) {
if (!target->delegate())
return;
+ int previous_target_component = mouse_target_component_;
int component =
target->delegate()->GetNonClientComponent(event->location());
+ mouse_target_component_ = component;
if (component == HTCLIENT)
return;
@@ -115,10 +118,12 @@ void X11WindowEventFilter::OnMouseEvent(ui::MouseEvent* event) {
// Left button case.
if (event->flags() & ui::EF_IS_DOUBLE_CLICK &&
component == HTCAPTION &&
- target->GetProperty(aura::client::kCanMaximizeKey)) {
- // Our event is a double click in the caption area in a window that can be
- // maximized. We are responsible for dispatching this as a minimize/
- // maximize on X11 (Windows converts this to min/max events for us).
+ target->GetProperty(aura::client::kCanMaximizeKey) &&
+ previous_target_component == component) {
varkha 2014/04/03 04:13:21 Should mouse_target_component_ variable be reset t
jonross 2014/04/07 15:49:30 Done.
+ // Our event is a double click, with both clicks in the caption area of a
+ // window that can be maximized. We are responsible for dispatching this as
+ // a minimize/maximize on X11 (Windows converts this to min/max events for
varkha 2014/04/03 04:13:21 s/minimize/restore and s/min/restore?
jonross 2014/04/07 15:49:30 Done.
+ // us).
if (window_tree_host_->IsMaximized())
window_tree_host_->Restore();
else

Powered by Google App Engine
This is Rietveld 408576698