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

Issue 262893002: Removes grab input window and extra grab and ungrab in X11WholeScreenMoveLoop

Created:
6 years, 7 months ago by varkha
Modified:
6 years, 6 months ago
Reviewers:
pkotwicz, sadrul, sky
CC:
chromium-reviews, tfarina, ben+views_chromium.org, tdanderson+views_chromium.org
Visibility:
Public.

Description

Removes grab input window and extra grab and ungrab in X11WholeScreenMoveLoop. It is made possible by the change https://codereview.chromium.org/254573002/ which allows all events to be dispatched first to X11WholeScreenMoveLoop without extra grab using OverrideDispatcher. It also effectively reverts CL https://codereview.chromium.org/140663013/ which should be no longer necessary. This is an alternative to https://codereview.chromium.org/265843004/ We used to have a separate drag input window that would have capture during tab drag or drag and drop. This is now replaced with the drag widget for drag and drop (which gets the capture) or by the dragged browser widget for the tab dragging (which gets the capture). Doing this allowed removing a lot of code (capture management and additional input window) and more importantly avoids changing or releasing capture during the drag. With this refactoring X11WholeScreenMoveLoop does not grab pointer or release the grab and hence there should be less side effects when using it. X11WholeScreenMoveLoop contained code that was specific to just drag and drop or to just tab dragging. This code got moved to X11DesktopWindowMoveClient (setting capture on the drag widget), DesktopDragDropClientAuraX11 (creating, moving and destroying the drag widget, updating cursor) and TabDragController (making sure that the capture is set to the attached tabstrip after it gets shown). The only visible behavior change is fixing symptoms described in bug http://crbug.com/363503 - i.e. not cancelling drag when exiting one move loop before going into another one. BUG=363503 TEST=Follow the exact steps in the bug description. TEST=interactive_ui_tests --gtest_filter=*TabDragging*

Patch Set 1 #

Total comments: 10

Patch Set 2 : Removes grab input window and extra grab and ungrab in X11WholeScreenMoveLoop (review) #

Patch Set 3 : Removes grab input window and extra grab and ungrab in X11WholeScreenMoveLoop (refactored) #

Total comments: 11

Patch Set 4 : Removes grab input window and extra grab and ungrab in X11WholeScreenMoveLoop (review) #

Patch Set 5 : More refactoring of CreateDragImageWindow into DesktopDragDropClientAuraX11 #

Total comments: 7

Patch Set 6 : Additional SetCapture after Attach and Show in TabDragController #

Total comments: 12

Patch Set 7 : Removes grab input window and extra grab and ungrab in X11WholeScreenMoveLoop (null image case) #

Total comments: 30

Patch Set 8 : Removes grab input window and extra grab and ungrab in X11WholeScreenMoveLoop (nits and comments) #

Total comments: 5

Patch Set 9 : Removes grab input window and extra grab and ungrab in X11WholeScreenMoveLoop (nits) #

Total comments: 2

Patch Set 10 : Removes grab input window and extra grab and ungrab in X11WholeScreenMoveLoop (order in TabDragCont… #

Total comments: 2

Patch Set 11 : Removes grab input window and extra grab and ungrab in X11WholeScreenMoveLoop (no more changes in T… #

Unified diffs Side-by-side diffs Delta from patch set Stats (+175 lines, -282 lines) Patch
M ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h View 1 2 3 4 5 6 7 8 5 chunks +20 lines, -0 lines 0 comments Download
M ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc View 1 2 3 4 5 6 7 8 9 10 chunks +121 lines, -15 lines 0 comments Download
M ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h View 1 2 3 4 5 6 7 8 3 chunks +7 lines, -48 lines 0 comments Download
M ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc View 1 2 3 4 5 6 7 8 10 chunks +25 lines, -218 lines 0 comments Download

Messages

Total messages: 29 (0 generated)
varkha
pkotwicz@ what do you think of this?
6 years, 7 months ago (2014-05-02 03:16:08 UTC) #1
pkotwicz
I think it might be worthwhile to post a hack for review. I am going ...
6 years, 7 months ago (2014-05-02 19:50:39 UTC) #2
pkotwicz
One last thing. I am not yet sure if it is possible to use _NET_WM_MOVERESIZE ...
6 years, 7 months ago (2014-05-02 19:54:45 UTC) #3
varkha
I've posted the other CL for review as well. https://codereview.chromium.org/262893002/diff/1/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc File ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc (right): https://codereview.chromium.org/262893002/diff/1/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc#newcode179 ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc:179: ...
6 years, 7 months ago (2014-05-02 23:58:11 UTC) #4
pkotwicz
https://codereview.chromium.org/262893002/diff/1/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc File ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc (right): https://codereview.chromium.org/262893002/diff/1/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc#newcode162 ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc:162: return ui::POST_DISPATCH_NONE; This should be: "return DispatchEvent(&xevent);" https://codereview.chromium.org/262893002/diff/1/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc#newcode179 ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc:179: ...
6 years, 7 months ago (2014-05-05 00:09:05 UTC) #5
pkotwicz
If I were you I would look into crbug.com/358504 to figure out what fixing that ...
6 years, 7 months ago (2014-05-05 00:14:19 UTC) #6
varkha
I'll look into http://crbug.com/358504 but I think as long as this CL simplifies the capture ...
6 years, 7 months ago (2014-05-05 16:37:14 UTC) #7
pkotwicz
Looks really good. A few comments. https://codereview.chromium.org/262893002/diff/60001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc File ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc (right): https://codereview.chromium.org/262893002/diff/60001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc#newcode899 ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc:899: // EndMoveLoop() was ...
6 years, 7 months ago (2014-05-05 18:14:37 UTC) #8
varkha
https://codereview.chromium.org/262893002/diff/60001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc File ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc (right): https://codereview.chromium.org/262893002/diff/60001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc#newcode899 ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc:899: // EndMoveLoop() was called, but before we return from ...
6 years, 7 months ago (2014-05-05 19:06:04 UTC) #9
varkha
https://codereview.chromium.org/262893002/diff/60001/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc File ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc (right): https://codereview.chromium.org/262893002/diff/60001/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc#newcode165 ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc:165: source = drag_widget_->GetNativeWindow(); On 2014/05/05 18:14:37, pkotwicz wrote: > ...
6 years, 7 months ago (2014-05-06 22:02:41 UTC) #10
pkotwicz
https://codereview.chromium.org/262893002/diff/120001/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc File ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc (right): https://codereview.chromium.org/262893002/diff/120001/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc#newcode51 ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc:51: host_->SetCapture(); Did you end up figuring out why this ...
6 years, 7 months ago (2014-05-07 02:22:23 UTC) #11
varkha
https://codereview.chromium.org/262893002/diff/120001/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc File ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc (right): https://codereview.chromium.org/262893002/diff/120001/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc#newcode51 ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc:51: host_->SetCapture(); On 2014/05/07 02:22:24, pkotwicz wrote: > Did you ...
6 years, 7 months ago (2014-05-07 02:28:54 UTC) #12
sadrul
Note that using the override dispatcher to receive all events instead of doing a grab ...
6 years, 7 months ago (2014-05-07 14:18:16 UTC) #13
varkha
https://codereview.chromium.org/262893002/diff/120001/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc File ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc (right): https://codereview.chromium.org/262893002/diff/120001/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc#newcode51 ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc:51: host_->SetCapture(); On 2014/05/07 02:22:24, pkotwicz wrote: > Did you ...
6 years, 7 months ago (2014-05-07 19:54:28 UTC) #14
pkotwicz
https://codereview.chromium.org/262893002/diff/160001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc File ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc (right): https://codereview.chromium.org/262893002/diff/160001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc#newcode643 ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc:643: // track all cursor movement and reroute events to ...
6 years, 7 months ago (2014-05-08 00:03:49 UTC) #15
varkha
PTAL. https://codereview.chromium.org/262893002/diff/160001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc File ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc (right): https://codereview.chromium.org/262893002/diff/160001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc#newcode643 ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc:643: // track all cursor movement and reroute events ...
6 years, 7 months ago (2014-05-09 19:01:00 UTC) #16
pkotwicz
I think you can get sadrul@ to do the next review. https://codereview.chromium.org/262893002/diff/180001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc File ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc (right): ...
6 years, 7 months ago (2014-05-12 16:04:28 UTC) #17
varkha
sadrul@, can you please take another look? https://codereview.chromium.org/262893002/diff/180001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc File ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc (right): https://codereview.chromium.org/262893002/diff/180001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc#newcode43 ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc:43: const gfx::Point ...
6 years, 7 months ago (2014-05-20 17:13:35 UTC) #18
varkha
sadrul@, ping?
6 years, 7 months ago (2014-05-21 18:14:41 UTC) #19
sadrul
Can you explain more clearly what's happening in this CL? I see that some things ...
6 years, 7 months ago (2014-05-21 18:57:07 UTC) #20
varkha
I have added a few points about motivation for this CL (other than fixing the ...
6 years, 7 months ago (2014-05-21 19:59:00 UTC) #21
varkha
Explaining the change in TabDragController::DetachIntoNewBrowserAndRunMoveLoop(). https://codereview.chromium.org/262893002/diff/200001/chrome/browser/ui/views/tabs/tab_drag_controller.cc File chrome/browser/ui/views/tabs/tab_drag_controller.cc (right): https://codereview.chromium.org/262893002/diff/200001/chrome/browser/ui/views/tabs/tab_drag_controller.cc#newcode1181 chrome/browser/ui/views/tabs/tab_drag_controller.cc:1181: attached_tabstrip_->GetWidget()->SetCapture(attached_tabstrip_); This makes sure ...
6 years, 7 months ago (2014-05-21 20:07:19 UTC) #22
sadrul
views changes lgtm https://codereview.chromium.org/262893002/diff/200001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc File ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc (right): https://codereview.chromium.org/262893002/diff/200001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc#newcode1082 ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc:1082: params.opacity = Widget::InitParams::OPAQUE_WINDOW; Should this be ...
6 years, 7 months ago (2014-05-23 14:39:53 UTC) #23
varkha
https://codereview.chromium.org/262893002/diff/200001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc File ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc (right): https://codereview.chromium.org/262893002/diff/200001/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc#newcode1082 ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc:1082: params.opacity = Widget::InitParams::OPAQUE_WINDOW; On 2014/05/23 14:39:53, sadrul wrote: > ...
6 years, 7 months ago (2014-05-23 15:38:36 UTC) #24
varkha
+sky@, for OWNERS in chrome/browser/ui/views/tabs/tab_drag_controller.cc
6 years, 7 months ago (2014-05-23 15:39:40 UTC) #25
sky
https://codereview.chromium.org/262893002/diff/240001/chrome/browser/ui/views/tabs/tab_drag_controller.cc File chrome/browser/ui/views/tabs/tab_drag_controller.cc (right): https://codereview.chromium.org/262893002/diff/240001/chrome/browser/ui/views/tabs/tab_drag_controller.cc#newcode1181 chrome/browser/ui/views/tabs/tab_drag_controller.cc:1181: attached_tabstrip_->GetWidget()->SetCapture(attached_tabstrip_); Did you verify this doesn't cause any issues ...
6 years, 7 months ago (2014-05-23 15:56:12 UTC) #26
varkha
I'll verify (takes time to sync and build on Windows). I have changed the order ...
6 years, 7 months ago (2014-05-23 23:57:48 UTC) #27
sky
https://codereview.chromium.org/262893002/diff/310001/chrome/browser/ui/views/tabs/tab_drag_controller.cc File chrome/browser/ui/views/tabs/tab_drag_controller.cc (right): https://codereview.chromium.org/262893002/diff/310001/chrome/browser/ui/views/tabs/tab_drag_controller.cc#newcode1183 chrome/browser/ui/views/tabs/tab_drag_controller.cc:1183: attached_tabstrip_->GetWidget()->SetCapture(attached_tabstrip_); Couple of questions. Why is this needed here ...
6 years, 7 months ago (2014-05-27 13:27:03 UTC) #28
varkha
6 years, 6 months ago (2014-05-28 19:11:46 UTC) #29
I've reverted the part in TabDragController, making the changes linux-only but
unfortunately this CL regresses on Linux in a scenario when a tab is repeatedly
dragged out and back in. In this scenario previous code path would do multiple
captures and releases (more than in the new) and has more chance to cancel the
drag when a focus loss notification (which releases the capture and kills the
TabDragController) arrives asynchronously after the new drag has yet to get
started (but the mouse button has not been released).
I am still thinking how to handle this so this is not yet ready.

https://codereview.chromium.org/262893002/diff/310001/chrome/browser/ui/views...
File chrome/browser/ui/views/tabs/tab_drag_controller.cc (right):

https://codereview.chromium.org/262893002/diff/310001/chrome/browser/ui/views...
chrome/browser/ui/views/tabs/tab_drag_controller.cc:1183:
attached_tabstrip_->GetWidget()->SetCapture(attached_tabstrip_);
On 2014/05/27 13:27:04, sky wrote:
> Couple of questions. Why is this needed here since Attach should set capture?

I had this comment here before, but it is higher up the review chain:
This makes sure that capture is really where we think it is after calling
Attach(). Attach() would normally set capture on attached widget but with Aura
fails to do so because of IsVisible() check in Window::SetCapture(). This was
wrong before but worked because of additional capture in X11WholeScreenMoveLoop.
Simplifying X11WholeScreenMoveLoop exposed this.
It worked on other Aura platforms because NativeWidgetAura::RunMoveLoop calls
SetCapture.

> Since this seems X11 specific, can it be moved to
> DesktopWindowTreeHostX11::RunMoveLoop?

There is already SetCapture in X11DesktopWindowMoveClient::RunMoveLoop which is
called from DesktopWindowTreeHostX11::RunMoveLoop so this should not be
necessary and I reverted this part of the change.

Powered by Google App Engine
This is Rietveld 408576698