Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(664)

Side by Side Diff: ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h

Issue 254573002: Sets X11WholeScreenMoveLoop as OverrideDispatcher to get events even before grab is granted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sets X11WholeScreenMoveLoop as OverrideDispatcher to get events even before grab is granted Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "ui/events/platform/platform_event_dispatcher.h" 11 #include "ui/events/platform/platform_event_dispatcher.h"
12 #include "ui/gfx/image/image_skia.h" 12 #include "ui/gfx/image/image_skia.h"
13 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
14 #include "ui/gfx/vector2d_f.h" 14 #include "ui/gfx/vector2d_f.h"
15 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop_delegate.h" 15 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop_delegate.h"
16 16
17 typedef struct _XDisplay XDisplay; 17 typedef struct _XDisplay XDisplay;
18 18
19 namespace aura { 19 namespace aura {
20 class Window; 20 class Window;
21 } 21 }
22 22
23 namespace ui {
24 class ScopedEventDispatcher;
25 }
26
23 namespace views { 27 namespace views {
24 28
25 class Widget; 29 class Widget;
26 30
27 // Runs a nested message loop and grabs the mouse. This is used to implement 31 // Runs a nested message loop and grabs the mouse. This is used to implement
28 // dragging. 32 // dragging.
29 class X11WholeScreenMoveLoop : public ui::PlatformEventDispatcher { 33 class X11WholeScreenMoveLoop : public ui::PlatformEventDispatcher {
30 public: 34 public:
31 explicit X11WholeScreenMoveLoop(X11WholeScreenMoveLoopDelegate* delegate); 35 explicit X11WholeScreenMoveLoop(X11WholeScreenMoveLoopDelegate* delegate);
32 virtual ~X11WholeScreenMoveLoop(); 36 virtual ~X11WholeScreenMoveLoop();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // (defined as having a pixel with alpha > 32). If so, return true. 69 // (defined as having a pixel with alpha > 32). If so, return true.
66 bool CheckIfIconValid(); 70 bool CheckIfIconValid();
67 71
68 // Dispatch mouse movement event to |delegate_| in a posted task. 72 // Dispatch mouse movement event to |delegate_| in a posted task.
69 void DispatchMouseMovement(); 73 void DispatchMouseMovement();
70 74
71 X11WholeScreenMoveLoopDelegate* delegate_; 75 X11WholeScreenMoveLoopDelegate* delegate_;
72 76
73 // Are we running a nested message loop from RunMoveLoop()? 77 // Are we running a nested message loop from RunMoveLoop()?
74 bool in_move_loop_; 78 bool in_move_loop_;
79 scoped_ptr<ui::ScopedEventDispatcher> nested_dispatcher_;
75 80
76 bool should_reset_mouse_flags_; 81 bool should_reset_mouse_flags_;
77 82
78 // An invisible InputOnly window . We create this window so we can track the 83 // 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 84 // cursor wherever it goes on screen during a drag, since normal windows
80 // don't receive pointer motion events outside of their bounds. 85 // don't receive pointer motion events outside of their bounds.
81 ::Window grab_input_window_; 86 ::Window grab_input_window_;
82 87
83 base::Closure quit_closure_; 88 base::Closure quit_closure_;
84 89
85 // Keeps track of whether the move-loop is cancled by the user (e.g. by 90 // Keeps track of whether the move-loop is cancled by the user (e.g. by
86 // pressing escape). 91 // pressing escape).
87 bool canceled_; 92 bool canceled_;
88 93
89 // A Widget is created during the drag if there is an image available to be 94 // A Widget is created during the drag if there is an image available to be
90 // used during the drag. 95 // used during the drag.
91 scoped_ptr<Widget> drag_widget_; 96 scoped_ptr<Widget> drag_widget_;
92 gfx::ImageSkia drag_image_; 97 gfx::ImageSkia drag_image_;
93 gfx::Vector2dF drag_offset_; 98 gfx::Vector2dF drag_offset_;
94 XMotionEvent last_xmotion_; 99 XMotionEvent last_xmotion_;
95 base::WeakPtrFactory<X11WholeScreenMoveLoop> weak_factory_; 100 base::WeakPtrFactory<X11WholeScreenMoveLoop> weak_factory_;
96 101
97 DISALLOW_COPY_AND_ASSIGN(X11WholeScreenMoveLoop); 102 DISALLOW_COPY_AND_ASSIGN(X11WholeScreenMoveLoop);
98 }; 103 };
99 104
100 } // namespace views 105 } // namespace views
101 106
102 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ 107 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698