1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_WINDOW_MOVE_CLIENT_H_
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_WINDOW_MOVE_CLIENT_H_
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "base/message_loop/message_loop.h"
13 #include "ui/gfx/geometry/point.h"
14 #include "ui/views/views_export.h"
15 #include "ui/views/widget/desktop_aura/x11_move_loop_delegate.h"
16 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h"
17 #include "ui/wm/public/window_move_client.h"
25 // When we're dragging tabs, we need to manually position our window.
26 class VIEWS_EXPORT X11DesktopWindowMoveClient
:
27 public views::X11MoveLoopDelegate
,
28 public aura::client::WindowMoveClient
{
30 X11DesktopWindowMoveClient();
31 ~X11DesktopWindowMoveClient() override
;
33 // Overridden from X11WholeScreenMoveLoopDelegate:
34 void OnMouseMovement(const gfx::Point
& screen_point
,
36 base::TimeDelta event_time
) override
;
37 void OnMouseReleased() override
;
38 void OnMoveLoopEnded() override
;
40 // Overridden from aura::client::WindowMoveClient:
41 aura::client::WindowMoveResult
RunMoveLoop(
43 const gfx::Vector2d
& drag_offset
,
44 aura::client::WindowMoveSource move_source
) override
;
45 void EndMoveLoop() override
;
48 X11WholeScreenMoveLoop move_loop_
;
50 // We need to keep track of this so we can actually move it when reacting to
52 aura::WindowTreeHost
* host_
;
54 // Our cursor offset from the top left window origin when the drag
55 // started. Used to calculate the window's new bounds relative to the current
56 // location of the cursor.
57 gfx::Vector2d window_offset_
;
62 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_WINDOW_MOVE_CLIENT_H_