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 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class.
13 #include "base/callback.h"
14 #include "base/compiler_specific.h"
15 #include "base/message_loop/message_loop.h"
16 #include "ui/aura/client/window_move_client.h"
17 #include "ui/gfx/point.h"
18 #include "ui/views/views_export.h"
19 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h"
20 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop_delegate.h"
28 // When we're dragging tabs, we need to manually position our window.
29 class VIEWS_EXPORT X11DesktopWindowMoveClient :
30 public views::X11WholeScreenMoveLoopDelegate,
31 public aura::client::WindowMoveClient {
33 X11DesktopWindowMoveClient();
34 virtual ~X11DesktopWindowMoveClient();
36 // Overridden from X11WholeScreenMoveLoopDelegate:
37 virtual void OnMouseMovement(XMotionEvent* event) OVERRIDE;
38 virtual void OnMouseReleased() OVERRIDE;
39 virtual void OnMoveLoopEnded() OVERRIDE;
41 // Overridden from aura::client::WindowMoveClient:
42 virtual aura::client::WindowMoveResult RunMoveLoop(
44 const gfx::Vector2d& drag_offset,
45 aura::client::WindowMoveSource move_source) OVERRIDE;
46 virtual void EndMoveLoop() OVERRIDE;
49 X11WholeScreenMoveLoop move_loop_;
51 // We need to keep track of this so we can actually move it when reacting to
53 aura::RootWindow* root_window_;
55 // Our cursor offset from the top left window origin when the drag
56 // started. Used to calculate the window's new bounds relative to the current
57 // location of the cursor.
58 gfx::Vector2d window_offset_;
63 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_DESKTOP_WINDOW_MOVE_CLIENT_H_