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

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, 8 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 | « ui/views/widget/desktop_aura/x11_window_event_filter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d6fbfc0fbd637fae65f7819bd45a7c5b19371605..887bb979e0b16f3facdf5037d93f315cf05cf882 100644
--- a/ui/views/widget/desktop_aura/x11_window_event_filter.cc
+++ b/ui/views/widget/desktop_aura/x11_window_event_filter.cc
@@ -68,7 +68,8 @@ X11WindowEventFilter::X11WindowEventFilter(
x_root_window_(DefaultRootWindow(xdisplay_)),
atom_cache_(xdisplay_, kAtomsToCache),
window_tree_host_(window_tree_host),
- is_active_(false) {
+ is_active_(false),
+ click_component_(HTNOWHERE) {
}
X11WindowEventFilter::~X11WindowEventFilter() {
@@ -102,8 +103,13 @@ void X11WindowEventFilter::OnMouseEvent(ui::MouseEvent* event) {
if (!target->delegate())
return;
+ int previous_click_component = HTNOWHERE;
int component =
target->delegate()->GetNonClientComponent(event->location());
+ if (event->IsLeftMouseButton()) {
+ previous_click_component = click_component_;
+ click_component_ = component;
+ }
if (component == HTCLIENT)
return;
@@ -134,15 +140,18 @@ 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).
- ToggleMaximizedState();
- event->SetHandled();
- return;
+ if (event->flags() & ui::EF_IS_DOUBLE_CLICK) {
+ click_component_ = HTNOWHERE;
+ if (component == HTCAPTION &&
+ target->GetProperty(aura::client::kCanMaximizeKey) &&
+ previous_click_component == component) {
+ // 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).
+ ToggleMaximizedState();
+ event->SetHandled();
+ return;
+ }
}
// Get the |x_root_window_| location out of the native event.
« no previous file with comments | « ui/views/widget/desktop_aura/x11_window_event_filter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698