Chromium Code Reviews| Index: ui/views/widget/widget.cc |
| diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc |
| index 4bf2a850f05b01e105f8afe61e534f34ea5077da..7d07b98020a84519a7bf25f212b2e503c3794094 100644 |
| --- a/ui/views/widget/widget.cc |
| +++ b/ui/views/widget/widget.cc |
| @@ -173,6 +173,7 @@ Widget::Widget() |
| is_mouse_button_pressed_(false), |
| is_touch_down_(false), |
| last_mouse_event_was_move_(false), |
| + capture_explicitly_set_(false), |
| root_layers_dirty_(false), |
| movement_disabled_(false) { |
| } |
| @@ -917,11 +918,13 @@ void Widget::SetCapture(View* view) { |
| root_view_->SetMouseHandler(view); |
| if (!native_widget_->HasCapture()) |
| native_widget_->SetCapture(); |
| + capture_explicitly_set_ = true; |
|
sky
2013/09/04 14:10:15
Do you verify all callers of SetCapture are ok wit
Evan Stade
2013/09/04 23:00:38
You are quite right. Do you like this new approach
|
| } |
| void Widget::ReleaseCapture() { |
| if (native_widget_->HasCapture()) |
| native_widget_->ReleaseCapture(); |
| + capture_explicitly_set_ = false; |
| } |
| bool Widget::HasCapture() { |
| @@ -1315,7 +1318,7 @@ void Widget::DestroyRootView() { |
| // Widget, private: |
| bool Widget::ShouldReleaseCaptureOnMouseReleased() const { |
| - return true; |
| + return !capture_explicitly_set_; |
| } |
| void Widget::SetInactiveRenderingDisabled(bool value) { |