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 on |grab_input_window_|. Returns true if successful. |
52 // successful. | 52 bool GrabPointer(); |
53 bool GrabPointer(gfx::NativeCursor cursor); | |
54 | 53 |
55 void GrabEscKey(); | 54 void GrabEscKey(); |
56 | 55 |
57 // Creates an input-only window to be used during the drag. | 56 // Creates an input-only window to be used during the drag. |
58 XID CreateDragInputWindow(XDisplay* display); | 57 XID CreateDragInputWindow(XDisplay* display); |
59 | 58 |
60 // Dispatch mouse movement event to |delegate_| in a posted task. | 59 // Dispatch mouse movement event to |delegate_| in a posted task. |
61 void DispatchMouseMovement(); | 60 void DispatchMouseMovement(); |
62 | 61 |
63 X11MoveLoopDelegate* delegate_; | 62 X11MoveLoopDelegate* delegate_; |
64 | 63 |
65 // Are we running a nested message loop from RunMoveLoop()? | 64 // Are we running a nested message loop from RunMoveLoop()? |
66 bool in_move_loop_; | 65 bool in_move_loop_; |
67 scoped_ptr<ui::ScopedEventDispatcher> nested_dispatcher_; | 66 scoped_ptr<ui::ScopedEventDispatcher> nested_dispatcher_; |
68 | 67 |
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_; | 68 bool should_reset_mouse_flags_; |
74 | 69 |
75 // An invisible InputOnly window. Keyboard grab and sometimes mouse grab | 70 // An invisible InputOnly window. Keyboard grab and sometimes mouse grab |
76 // are set on this window. | 71 // are set on this window. |
77 XID grab_input_window_; | 72 XID grab_input_window_; |
78 | 73 |
79 // Whether the pointer was grabbed on |grab_input_window_|. | 74 // Whether the pointer was grabbed on |grab_input_window_|. |
80 bool grabbed_pointer_; | 75 bool grabbed_pointer_; |
81 | 76 |
82 base::Closure quit_closure_; | 77 base::Closure quit_closure_; |
83 | 78 |
84 // Keeps track of whether the move-loop is cancled by the user (e.g. by | 79 // Keeps track of whether the move-loop is cancled by the user (e.g. by |
85 // pressing escape). | 80 // pressing escape). |
86 bool canceled_; | 81 bool canceled_; |
87 | 82 |
88 scoped_ptr<ui::MouseEvent> last_motion_in_screen_; | 83 scoped_ptr<ui::MouseEvent> last_motion_in_screen_; |
89 base::WeakPtrFactory<X11WholeScreenMoveLoop> weak_factory_; | 84 base::WeakPtrFactory<X11WholeScreenMoveLoop> weak_factory_; |
90 | 85 |
91 DISALLOW_COPY_AND_ASSIGN(X11WholeScreenMoveLoop); | 86 DISALLOW_COPY_AND_ASSIGN(X11WholeScreenMoveLoop); |
92 }; | 87 }; |
93 | 88 |
94 } // namespace views | 89 } // namespace views |
95 | 90 |
96 #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 |