| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef UI_VIEWS_WIDGET_X11_DESKTOP_WINDOW_MOVE_CLIENT_H_ | |
| 6 #define UI_VIEWS_WIDGET_X11_DESKTOP_WINDOW_MOVE_CLIENT_H_ | |
| 7 | |
| 8 #include <X11/Xlib.h> | |
| 9 | |
| 10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | |
| 11 #undef RootWindow | |
| 12 | |
| 13 #include "base/callback.h" | |
| 14 #include "base/compiler_specific.h" | |
| 15 #include "base/message_loop.h" | |
| 16 #include "ui/aura/client/window_move_client.h" | |
| 17 #include "ui/aura/event_filter.h" | |
| 18 #include "ui/views/views_export.h" | |
| 19 #include "ui/gfx/point.h" | |
| 20 | |
| 21 namespace aura { | |
| 22 class RootWindow; | |
| 23 } | |
| 24 | |
| 25 namespace views { | |
| 26 | |
| 27 // When we're dragging tabs, we need to manually position our window. | |
| 28 class VIEWS_EXPORT X11DesktopWindowMoveClient | |
| 29 : public MessageLoop::Dispatcher, | |
| 30 public aura::client::WindowMoveClient { | |
| 31 public: | |
| 32 X11DesktopWindowMoveClient(); | |
| 33 virtual ~X11DesktopWindowMoveClient(); | |
| 34 | |
| 35 // Overridden from MessageLoop::Dispatcher: | |
| 36 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | |
| 37 | |
| 38 // Overridden from aura::client::WindowMoveClient: | |
| 39 virtual aura::client::WindowMoveResult RunMoveLoop( | |
| 40 aura::Window* window, | |
| 41 const gfx::Vector2d& drag_offset) OVERRIDE; | |
| 42 virtual void EndMoveLoop() OVERRIDE; | |
| 43 | |
| 44 private: | |
| 45 // Are we running a nested message loop from RunMoveLoop()? | |
| 46 bool in_move_loop_; | |
| 47 | |
| 48 // An invisible InputOnly window . We create this window so we can track the | |
| 49 // cursor wherever it goes on screen during a drag, since normal windows | |
| 50 // don't receive pointer motion events outside of their bounds. | |
| 51 ::Window grab_input_window_; | |
| 52 | |
| 53 // We need to keep track of this so we can actually move it when reacting to | |
| 54 // events from |grab_input_window_| during Dispatch(). | |
| 55 aura::RootWindow* root_window_; | |
| 56 | |
| 57 // Our cursor offset from the top left window origin when the drag | |
| 58 // started. Used to calculate the window's new bounds relative to the current | |
| 59 // location of the cursor. | |
| 60 gfx::Vector2d window_offset_; | |
| 61 | |
| 62 base::Closure quit_closure_; | |
| 63 }; | |
| 64 | |
| 65 } // namespace views | |
| 66 | |
| 67 #endif // UI_VIEWS_WIDGET_X11_DESKTOP_WINDOW_MOVE_CLIENT_H_ | |
| OLD | NEW |