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 25 matching lines...) Expand all Loading... |
36 public ui::PlatformEventDispatcher { | 36 public ui::PlatformEventDispatcher { |
37 public: | 37 public: |
38 explicit X11WholeScreenMoveLoop(X11MoveLoopDelegate* delegate); | 38 explicit X11WholeScreenMoveLoop(X11MoveLoopDelegate* delegate); |
39 ~X11WholeScreenMoveLoop() override; | 39 ~X11WholeScreenMoveLoop() override; |
40 | 40 |
41 // ui:::PlatformEventDispatcher: | 41 // ui:::PlatformEventDispatcher: |
42 bool CanDispatchEvent(const ui::PlatformEvent& event) override; | 42 bool CanDispatchEvent(const ui::PlatformEvent& event) override; |
43 uint32_t DispatchEvent(const ui::PlatformEvent& event) override; | 43 uint32_t DispatchEvent(const ui::PlatformEvent& event) override; |
44 | 44 |
45 // X11MoveLoop: | 45 // X11MoveLoop: |
46 bool RunMoveLoop(aura::Window* window, gfx::NativeCursor cursor) override; | 46 bool RunMoveLoop(aura::Window* window) override; |
47 void UpdateCursor(gfx::NativeCursor cursor) override; | 47 void UpdateCursor(gfx::NativeCursor cursor) override; |
48 void EndMoveLoop() override; | 48 void EndMoveLoop() override; |
49 | 49 |
50 private: | 50 private: |
51 // Grabs the pointer, setting the mouse cursor to |cursor|. Returns true if | 51 // Grabs the pointer, setting the mouse cursor to |cursor|. Returns true if |
52 // successful. | 52 // successful. |
53 bool GrabPointer(gfx::NativeCursor cursor); | 53 bool GrabPointer(); |
54 | 54 |
55 void GrabEscKey(); | 55 void GrabEscKey(); |
56 | 56 |
57 // Creates an input-only window to be used during the drag. | 57 // Creates an input-only window to be used during the drag. |
58 XID CreateDragInputWindow(XDisplay* display); | 58 XID CreateDragInputWindow(XDisplay* display); |
59 | 59 |
60 // Dispatch mouse movement event to |delegate_| in a posted task. | 60 // Dispatch mouse movement event to |delegate_| in a posted task. |
61 void DispatchMouseMovement(); | 61 void DispatchMouseMovement(); |
62 | 62 |
63 X11MoveLoopDelegate* delegate_; | 63 X11MoveLoopDelegate* delegate_; |
64 | 64 |
65 // Are we running a nested message loop from RunMoveLoop()? | 65 // Are we running a nested message loop from RunMoveLoop()? |
66 bool in_move_loop_; | 66 bool in_move_loop_; |
67 scoped_ptr<ui::ScopedEventDispatcher> nested_dispatcher_; | 67 scoped_ptr<ui::ScopedEventDispatcher> nested_dispatcher_; |
68 | 68 |
69 // Cursor in use prior to the move loop starting. Restored when the move loop | |
70 // quits. | |
71 gfx::NativeCursor initial_cursor_; | |
72 | |
73 bool should_reset_mouse_flags_; | 69 bool should_reset_mouse_flags_; |
74 | 70 |
75 // An invisible InputOnly window. Keyboard grab and sometimes mouse grab | 71 // An invisible InputOnly window. Keyboard grab and sometimes mouse grab |
76 // are set on this window. | 72 // are set on this window. |
77 XID grab_input_window_; | 73 XID grab_input_window_; |
78 | 74 |
79 // Whether the pointer was grabbed on |grab_input_window_|. | 75 // Whether the pointer was grabbed on |grab_input_window_|. |
80 bool grabbed_pointer_; | 76 bool grabbed_pointer_; |
81 | 77 |
82 base::Closure quit_closure_; | 78 base::Closure quit_closure_; |
83 | 79 |
84 // Keeps track of whether the move-loop is cancled by the user (e.g. by | 80 // Keeps track of whether the move-loop is cancled by the user (e.g. by |
85 // pressing escape). | 81 // pressing escape). |
86 bool canceled_; | 82 bool canceled_; |
87 | 83 |
88 scoped_ptr<ui::MouseEvent> last_motion_in_screen_; | 84 scoped_ptr<ui::MouseEvent> last_motion_in_screen_; |
89 base::WeakPtrFactory<X11WholeScreenMoveLoop> weak_factory_; | 85 base::WeakPtrFactory<X11WholeScreenMoveLoop> weak_factory_; |
90 | 86 |
91 DISALLOW_COPY_AND_ASSIGN(X11WholeScreenMoveLoop); | 87 DISALLOW_COPY_AND_ASSIGN(X11WholeScreenMoveLoop); |
92 }; | 88 }; |
93 | 89 |
94 } // namespace views | 90 } // namespace views |
95 | 91 |
96 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ | 92 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ |
OLD | NEW |