Commit 8be5b6f8 authored by Nick Diego Yamane's avatar Nick Diego Yamane Committed by Commit Bot

ozone/wayland: tabdrag: Ensure dragged window has focus after drop

A regression was introduced with initial extended-drag integration in
Ozone/Wayland as described in details at https://crbug.com/1148021.

This CL addresses the issue 2 described in the link above: When an
already mapped window is dragged, it is not supposed to get a
wl_pointer::enter again after the DND/extended session finishes (it
already had focus before it started), so it's client responsibility to
restore the focused window when upon drop event. That's like that
because it is updated by the window drag controller based on data device
events during the DND session.

This patch fixes it by explicitly restoring the focus to the dragged
window, if any, when the session finishes.

Bug: 1148021
Change-Id: I8315a873673c303fb7726ff98a4a247983225442
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533036
Commit-Queue: Nick Yamane <nickdiego@igalia.com>
Reviewed-by: default avatarAntonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#827053}
parent 748c6dcc
...@@ -284,6 +284,16 @@ void WaylandWindowDragController::OnDataSourceFinish(bool completed) { ...@@ -284,6 +284,16 @@ void WaylandWindowDragController::OnDataSourceFinish(bool completed) {
extended_drag_source_.reset(); extended_drag_source_.reset();
origin_surface_.reset(); origin_surface_.reset();
origin_window_ = nullptr; origin_window_ = nullptr;
// When extended-drag is available and the drop happens while a non-null
// surface was being dragged (i.e: detached mode) which had pointer focus
// before the drag session, we must reset focus to it, otherwise it would be
// wrongly kept to the latest surface received through wl_data_device::enter
// (see OnDragEnter function).
if (IsExtendedDragAvailable() && dragged_window_) {
pointer_delegate_->OnPointerFocusChanged(dragged_window_,
pointer_location_);
}
dragged_window_ = nullptr; dragged_window_ = nullptr;
// Transition to |kDropped| state and determine the next action to take. If // Transition to |kDropped| state and determine the next action to take. If
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment