| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ |
| 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // ui:::PlatformEventDispatcher: | 40 // ui:::PlatformEventDispatcher: |
| 41 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; | 41 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |
| 42 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; | 42 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |
| 43 | 43 |
| 44 // X11MoveLoop: | 44 // X11MoveLoop: |
| 45 virtual bool RunMoveLoop(aura::Window* window, | 45 virtual bool RunMoveLoop(aura::Window* window, |
| 46 gfx::NativeCursor cursor) OVERRIDE; | 46 gfx::NativeCursor cursor) OVERRIDE; |
| 47 virtual void UpdateCursor(gfx::NativeCursor cursor) OVERRIDE; | 47 virtual void UpdateCursor(gfx::NativeCursor cursor) OVERRIDE; |
| 48 virtual void EndMoveLoop() OVERRIDE; | 48 virtual void EndMoveLoop() OVERRIDE; |
| 49 virtual void SetDragImage(const gfx::ImageSkia& image, | |
| 50 const gfx::Vector2dF& offset) OVERRIDE; | |
| 51 | 49 |
| 52 private: | 50 private: |
| 53 // Grabs the pointer and keyboard, setting the mouse cursor to |cursor|. | 51 // Grabs the pointer and keyboard, setting the mouse cursor to |cursor|. |
| 54 // Returns true if the grab was successful. | 52 // Returns true if the grab was successful. |
| 55 bool GrabPointerAndKeyboard(gfx::NativeCursor cursor); | 53 bool GrabPointerAndKeyboard(gfx::NativeCursor cursor); |
| 56 | 54 |
| 57 // Creates an input-only window to be used during the drag. | 55 // Creates an input-only window to be used during the drag. |
| 58 Window CreateDragInputWindow(XDisplay* display); | 56 Window CreateDragInputWindow(XDisplay* display); |
| 59 | 57 |
| 60 // Creates a window to show the drag image during the drag. | |
| 61 void CreateDragImageWindow(); | |
| 62 | |
| 63 // Checks to see if |in_image| is an image that has any visible regions | |
| 64 // (defined as having a pixel with alpha > 32). If so, return true. | |
| 65 bool CheckIfIconValid(); | |
| 66 | |
| 67 // Dispatch mouse movement event to |delegate_| in a posted task. | 58 // Dispatch mouse movement event to |delegate_| in a posted task. |
| 68 void DispatchMouseMovement(); | 59 void DispatchMouseMovement(); |
| 69 | 60 |
| 70 X11MoveLoopDelegate* delegate_; | 61 X11MoveLoopDelegate* delegate_; |
| 71 | 62 |
| 72 // Are we running a nested message loop from RunMoveLoop()? | 63 // Are we running a nested message loop from RunMoveLoop()? |
| 73 bool in_move_loop_; | 64 bool in_move_loop_; |
| 74 scoped_ptr<ui::ScopedEventDispatcher> nested_dispatcher_; | 65 scoped_ptr<ui::ScopedEventDispatcher> nested_dispatcher_; |
| 75 | 66 |
| 76 bool should_reset_mouse_flags_; | 67 bool should_reset_mouse_flags_; |
| 77 | 68 |
| 78 // An invisible InputOnly window . We create this window so we can track the | 69 // An invisible InputOnly window . We create this window so we can track the |
| 79 // cursor wherever it goes on screen during a drag, since normal windows | 70 // cursor wherever it goes on screen during a drag, since normal windows |
| 80 // don't receive pointer motion events outside of their bounds. | 71 // don't receive pointer motion events outside of their bounds. |
| 81 ::Window grab_input_window_; | 72 ::Window grab_input_window_; |
| 82 | 73 |
| 83 base::Closure quit_closure_; | 74 base::Closure quit_closure_; |
| 84 | 75 |
| 85 // Keeps track of whether the move-loop is cancled by the user (e.g. by | 76 // Keeps track of whether the move-loop is cancled by the user (e.g. by |
| 86 // pressing escape). | 77 // pressing escape). |
| 87 bool canceled_; | 78 bool canceled_; |
| 88 | 79 |
| 89 // Keeps track of whether we still have a pointer grab at the end of the loop. | 80 // Keeps track of whether we still have a pointer grab at the end of the loop. |
| 90 bool has_grab_; | 81 bool has_grab_; |
| 91 | 82 |
| 92 // A Widget is created during the drag if there is an image available to be | |
| 93 // used during the drag. | |
| 94 scoped_ptr<Widget> drag_widget_; | |
| 95 gfx::ImageSkia drag_image_; | |
| 96 gfx::Vector2dF drag_offset_; | |
| 97 XMotionEvent last_xmotion_; | 83 XMotionEvent last_xmotion_; |
| 98 base::WeakPtrFactory<X11WholeScreenMoveLoop> weak_factory_; | 84 base::WeakPtrFactory<X11WholeScreenMoveLoop> weak_factory_; |
| 99 | 85 |
| 100 DISALLOW_COPY_AND_ASSIGN(X11WholeScreenMoveLoop); | 86 DISALLOW_COPY_AND_ASSIGN(X11WholeScreenMoveLoop); |
| 101 }; | 87 }; |
| 102 | 88 |
| 103 } // namespace views | 89 } // namespace views |
| 104 | 90 |
| 105 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ | 91 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ |
| OLD | NEW |