ozone/wayland: Fix drag offset when a tab is detached through the top edge
Detaching a tab by dragging it upwards was not supported until crrev.com/c/2362987, which modified wl_data_device::leave event handling so that it dispatches fake motion events with [-1,-1] location, so giving higher level GUI components (e.g Chrome's TabDragController) a chance to detect when the pointer leaves that window. Such approach works, but it turns out to cause an issue in the drag offset calculation as can be seen in screen cast [1]. This issue can be avoided by keeping the 'x' coordinate value and using -1 only for 'y'. NOTE: This is a workaround targeted specifically to Chrome's tab drag and should ideally be reworked in the future, with a broader change, in higher level layers, such that they handle platforms that do not support global screen coordinates appropriately. Further context: The aforementioned problem happens because //chrome code assumes global screen coordinates are available in platform located events, in this specific case, TabDragController uses a vertical "magnetism" constant to determine when to detach the dragged tab selection [2]. Such constant may result in coordinates outside the browser window boundaries, mainly when dragging upwards, which is ok in a platform where screen positions are available. That's not the case for Wayland, where DND is used for tab dragging, where neither implicit grab is supported. [1] https://youtu.be/NKv4h4Ut-gw [2] https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/ui/views/tabs/tab_drag_controller.cc;l=1105-1107;drc=6e8b402a6231405b753919029c9027404325ea00 R=msisov@igalia.com Test: Covered by ozone_unittests Bug: 896640 Change-Id: I4909acaa7e8a9fbb17968a4ec38632ac61915a0b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2388762Reviewed-by:Maksim Sisov (GMT+3) <msisov@igalia.com> Commit-Queue: Nick Yamane <nickdiego@igalia.com> Cr-Commit-Position: refs/heads/master@{#804799}
Showing
Please register or sign in to comment