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..7ed6143993f026cecb2d6ab97523520e3185cec1 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), |
+ click_component_(HTNOWHERE) { |
} |
X11WindowEventFilter::~X11WindowEventFilter() { |
@@ -101,8 +102,13 @@ void X11WindowEventFilter::OnMouseEvent(ui::MouseEvent* event) { |
if (!target->delegate()) |
return; |
+ int previous_target_component = HTNOWHERE; |
int component = |
target->delegate()->GetNonClientComponent(event->location()); |
+ if (event->IsLeftMouseButton()) { |
+ previous_target_component = click_component_; |
varkha
2014/04/11 19:00:12
nit: The names should match (and possibly match th
jonross
2014/04/14 18:36:15
Done.
|
+ click_component_ = component; |
+ } |
if (component == HTCLIENT) |
return; |
@@ -113,18 +119,22 @@ 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). |
- if (window_tree_host_->IsMaximized()) |
- window_tree_host_->Restore(); |
- else |
- window_tree_host_->Maximize(); |
- event->SetHandled(); |
- return; |
+ if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { |
+ click_component_ = HTNOWHERE; |
+ if (component == HTCAPTION && |
+ target->GetProperty(aura::client::kCanMaximizeKey) && |
+ previous_target_component == component) { |
+ // 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 restore/maximize on X11 (Windows converts this to restore/max |
+ // events for us). |
+ if (window_tree_host_->IsMaximized()) |
+ window_tree_host_->Restore(); |
+ else |
+ window_tree_host_->Maximize(); |
+ event->SetHandled(); |
+ return; |
+ } |
} |
// Get the |x_root_window_| location out of the native event. |