summaryrefslogtreecommitdiff
path: root/chromium/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-10-26 13:57:00 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-11-02 11:31:01 +0000
commit1943b3c2a1dcee36c233724fc4ee7613d71b9cf6 (patch)
tree8c1b5f12357025c197da5427ae02cfdc2f3570d6 /chromium/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
parent21ba0c5d4bf8fba15dddd97cd693bad2358b77fd (diff)
downloadqtwebengine-chromium-1943b3c2a1dcee36c233724fc4ee7613d71b9cf6.tar.gz
BASELINE: Update Chromium to 94.0.4606.111
Change-Id: I924781584def20fc800bedf6ff41fdb96c438193 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h')
-rw-r--r--chromium/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h43
1 files changed, 37 insertions, 6 deletions
diff --git a/chromium/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/chromium/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
index 07078cbdf22..db129908916 100644
--- a/chromium/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
+++ b/chromium/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
@@ -59,11 +59,35 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
// A way of converting an HWND into a content window.
static aura::Window* GetContentWindowForHWND(HWND hwnd);
- // Set to true when DesktopDragDropClientWin starts a touch-initiated drag
- // drop and false when it finishes. While in touch drag, if pointer events are
- // received, the equivalent mouse events are generated, because ole32
- // ::DoDragDrop does not seem to handle pointer events.
- void SetInTouchDrag(bool in_touch_drag);
+ // When DesktopDragDropClientWin starts a touch-initiated drag, it calls
+ // this method to record that we're in touch drag mode, and synthesizes
+ // right mouse button down and move events to get ::DoDragDrop started.
+ void StartTouchDrag(gfx::Point screen_point);
+
+ // If in touch drag mode, this method synthesizes a left mouse button up
+ // event to match the left mouse button down event in StartTouchDrag. It
+ // also restores the cursor pos to where the drag started, to avoid leaving
+ // the cursor outside the Chrome window doing the drag drop. This allows
+ // subsequent touch drag drops to succeed. Touch drag drop requires that
+ // the cursor be over the same window as the touch drag point.
+ // This needs to be called in two cases:
+ // 1. The normal case is that ::DoDragDrop starts, we get touch move events,
+ // which we turn into mouse move events, and then we get a touch release
+ // event. Calling FinishTouchDragIfInDrag generates a mouse up, which stops
+ // the drag drop.
+ // 2. ::DoDragDrop exits immediately, w/o us handling any touch events. In
+ // this case, FinishTouchDragIfInDrag makes sure we have a mouse button up to
+ // match the mouse button down, because we won't get a touch release event. We
+ // don't know for sure if ::DoDragDrop exited immediately, other than by
+ // checking if `in_touch_drag_` has been set to false.
+ //
+ // So, we always call FinishTouchDragIfInDrag after ::DoDragDrop exits, to
+ // make sure it gets called, and we make it handle getting called multiple
+ // times. Most of the time, FinishTouchDrag will have already been called when
+ // we get a touch release event, in which case the second call needs to be a
+ // noop, which is accomplished by checking if `in_touch_drag_` is already
+ // false.
+ void FinishTouchDrag(gfx::Point screen_point);
protected:
// Overridden from DesktopWindowTreeHost:
@@ -152,6 +176,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
const gfx::Point& location_in_pixels) override;
std::unique_ptr<aura::ScopedEnableUnadjustedMouseEvents>
RequestUnadjustedMovement() override;
+ void LockMouse(aura::Window* window) override;
+ void UnlockMouse(aura::Window* window) override;
// Overridden from aura::client::AnimationHost
void SetHostTransitionOffsets(
@@ -200,7 +226,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
void HandleEndWMSizeMove() override;
void HandleMove() override;
void HandleWorkAreaChanged() override;
- void HandleVisibilityChanging(bool visible) override;
void HandleVisibilityChanged(bool visible) override;
void HandleWindowMinimizedOrRestored(bool restored) override;
void HandleClientSizeChanged(const gfx::Size& new_size) override;
@@ -316,6 +341,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
// when that stat is no longer tracked.
gfx::Point occluded_window_mouse_event_loc_;
+ // Set to true when DesktopDragDropClientWin starts a touch-initiated drag
+ // drop and false when it finishes. While in touch drag, if touch move events
+ // are received, the equivalent mouse events are generated, because ole32
+ // ::DoDragDrop does not seem to handle touch events. WinRT drag drop does
+ // support touch, but we've been unable to use it in Chrome. See
+ // https://crbug.com/1236783 for more info.
bool in_touch_drag_ = false;
// The z-order level of the window; the window exhibits "always on top"