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

Issue 1876553002: mash: Close system tray bubble on click outside its bounds, part 1 (Closed)

Created:
4 years, 8 months ago by James Cook
Modified:
4 years, 8 months ago
Reviewers:
msw, sadrul, sky
CC:
chromium-reviews, msw+watch_chromium.org, sadrul, tfarina, groby+bubble_chromium.org, hcarmona+bubble_chromium.org, kalyank, rouslan+bubble_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

mash: Close system tray bubble on click outside its bounds, part 1 Mus does not support global event handlers, so the existing TrayEventFilter cannot be used to close the bubble. Instead we use mouse capture. * Capture the mouse explicitly when the bubble is spawned and release it on clicks outside its bounds. * Always close the bubble on capture loss, in case some other part of the window system breaks capture. Also fix an issue with auto-release-capture at the widget level. If a view explicitly requested capture via Widget::SetCapture(my_view) and explicitly did not request auto-release-capture, then any mouse release event would cause the view to lose capture (that is, being an explicit mouse handler target at the RootView level). Fix this so that these sorts of views will continue to receive events until they explicit release capture. Note that this code still eats the mousedown event that causes the bubble to close. Fixing that is part 2. BUG=599142 Committed: https://crrev.com/5eb778dc5a2a4762fe95d67f2adc151f928d7939 Cr-Commit-Position: refs/heads/master@{#386402}

Patch Set 1 #

Patch Set 2 : rebase and add test #

Patch Set 3 : tweak comments #

Total comments: 1

Patch Set 4 : review comments #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+115 lines, -23 lines) Patch
M ash/system/tray/system_tray.cc View 2 chunks +4 lines, -0 lines 0 comments Download
M ui/views/bubble/tray_bubble_view.h View 2 chunks +6 lines, -0 lines 0 comments Download
M ui/views/bubble/tray_bubble_view.cc View 1 2 4 chunks +26 lines, -2 lines 2 comments Download
M ui/views/mus/platform_window_mus.cc View 1 chunk +3 lines, -0 lines 0 comments Download
M ui/views/widget/root_view.h View 2 chunks +11 lines, -1 line 1 comment Download
M ui/views/widget/root_view.cc View 1 2 3 5 chunks +14 lines, -6 lines 0 comments Download
M ui/views/widget/widget.cc View 1 chunk +1 line, -1 line 0 comments Download
M ui/views/widget/widget_interactive_uitest.cc View 1 5 chunks +50 lines, -13 lines 0 comments Download

Messages

Total messages: 23 (10 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1876553002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1876553002/1
4 years, 8 months ago (2016-04-08 21:47:06 UTC) #2
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 8 months ago (2016-04-08 23:02:20 UTC) #4
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1876553002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1876553002/40001
4 years, 8 months ago (2016-04-09 17:14:19 UTC) #6
James Cook
sky, please take a look. I tried again to get widget_interactive_uitests.cc to run in views_mus_unittests ...
4 years, 8 months ago (2016-04-09 17:28:21 UTC) #8
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 8 months ago (2016-04-09 17:52:38 UTC) #10
sky
LGTM https://codereview.chromium.org/1876553002/diff/40001/ui/views/widget/root_view.cc File ui/views/widget/root_view.cc (right): https://codereview.chromium.org/1876553002/diff/40001/ui/views/widget/root_view.cc#newcode445 ui/views/widget/root_view.cc:445: if (clear_mouse_handler_on_release_) { nit: no {}
4 years, 8 months ago (2016-04-11 15:25:45 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1876553002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1876553002/60001
4 years, 8 months ago (2016-04-11 15:39:08 UTC) #14
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 8 months ago (2016-04-11 16:30:42 UTC) #15
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/5eb778dc5a2a4762fe95d67f2adc151f928d7939 Cr-Commit-Position: refs/heads/master@{#386402}
4 years, 8 months ago (2016-04-11 16:32:04 UTC) #17
msw
driveby comment nit https://codereview.chromium.org/1876553002/diff/60001/ui/views/widget/root_view.h File ui/views/widget/root_view.h (right): https://codereview.chromium.org/1876553002/diff/60001/ui/views/widget/root_view.h#newcode165 ui/views/widget/root_view.h:165: // must be explicitly by calling ...
4 years, 8 months ago (2016-04-11 16:52:20 UTC) #19
sadrul
https://codereview.chromium.org/1876553002/diff/60001/ui/views/bubble/tray_bubble_view.cc File ui/views/bubble/tray_bubble_view.cc (right): https://codereview.chromium.org/1876553002/diff/60001/ui/views/bubble/tray_bubble_view.cc#newcode363 ui/views/bubble/tray_bubble_view.cc:363: GetWidget()->SetCapture(this); This unfortunately breaks clicking in the tray-bubble. This ...
4 years, 8 months ago (2016-04-14 20:08:35 UTC) #21
James Cook
A revert of this CL (patchset #4 id:60001) has been created in https://codereview.chromium.org/1887263002/ by jamescook@chromium.org. ...
4 years, 8 months ago (2016-04-14 22:52:19 UTC) #22
James Cook
4 years, 8 months ago (2016-04-14 23:05:12 UTC) #23
Message was sent while issue was closed.
https://codereview.chromium.org/1876553002/diff/60001/ui/views/bubble/tray_bu...
File ui/views/bubble/tray_bubble_view.cc (right):

https://codereview.chromium.org/1876553002/diff/60001/ui/views/bubble/tray_bu...
ui/views/bubble/tray_bubble_view.cc:363: GetWidget()->SetCapture(this);
On 2016/04/14 20:08:35, sadrul wrote:
> This unfortunately breaks clicking in the tray-bubble. This is because
> mouse-press etc. events in the bubble go to |this| (TrayBubbleView), instead
of
> the view under the cursor. As a result, clicking on the bluetooth row, it
> doesn't take us to the relevant submenu.
> 
> If you use nullptr instead of |this|, then I think that would fix this.

Unfortunately setting the capture to a nullptr view doesn't work - clicking in
the bubble works, but it doesn't close, because no view is notified of events
outside the widget's bounds. I don't see a good way around this problem.

I talked to Scott - I'm going to revert this. We need a different approach.

Powered by Google App Engine
This is Rietveld 408576698