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

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

Issue 83783003: linux aura: Show the drag-image when available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years 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/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "ui/gfx/image/image_skia.h"
10 #include "ui/gfx/native_widget_types.h" 11 #include "ui/gfx/native_widget_types.h"
12 #include "ui/gfx/vector2d_f.h"
11 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop_delegate.h" 13 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop_delegate.h"
12 14
15 typedef struct _XDisplay XDisplay;
16
13 namespace aura { 17 namespace aura {
14 class Window; 18 class Window;
15 } 19 }
16 20
17 namespace views { 21 namespace views {
18 22
23 class Widget;
24
19 // Runs a nested message loop and grabs the mouse. This is used to implement 25 // Runs a nested message loop and grabs the mouse. This is used to implement
20 // dragging. 26 // dragging.
21 class X11WholeScreenMoveLoop : public base::MessageLoop::Dispatcher { 27 class X11WholeScreenMoveLoop : public base::MessageLoop::Dispatcher {
22 public: 28 public:
23 explicit X11WholeScreenMoveLoop(X11WholeScreenMoveLoopDelegate* delegate); 29 explicit X11WholeScreenMoveLoop(X11WholeScreenMoveLoopDelegate* delegate);
24 virtual ~X11WholeScreenMoveLoop(); 30 virtual ~X11WholeScreenMoveLoop();
25 31
26 // Overridden from base::MessageLoop::Dispatcher: 32 // Overridden from base::MessageLoop::Dispatcher:
27 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; 33 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE;
28 34
29 // Runs the nested message loop. While the mouse is grabbed, use |cursor| as 35 // Runs the nested message loop. While the mouse is grabbed, use |cursor| as
30 // the mouse cursor. Returns true if there we were able to grab the pointer 36 // the mouse cursor. Returns true if there we were able to grab the pointer
31 // and run the move loop. 37 // and run the move loop.
32 bool RunMoveLoop(aura::Window* window, gfx::NativeCursor cursor); 38 bool RunMoveLoop(aura::Window* window, gfx::NativeCursor cursor);
33 39
34 // Updates the cursor while the move loop is running. 40 // Updates the cursor while the move loop is running.
35 void UpdateCursor(gfx::NativeCursor cursor); 41 void UpdateCursor(gfx::NativeCursor cursor);
36 42
37 // Ends the RunMoveLoop() that's currently in progress. 43 // Ends the RunMoveLoop() that's currently in progress.
38 void EndMoveLoop(); 44 void EndMoveLoop();
39 45
46 // Sets an image to be used during the drag.
47 void SetDragImage(const gfx::ImageSkia& image, gfx::Vector2dF offset);
48
40 private: 49 private:
41 // Grabs the pointer, setting the mouse cursor to |cursor|. Returns true if 50 // Grabs the pointer, setting the mouse cursor to |cursor|. Returns true if
42 // the grab was successful. 51 // the grab was successful.
43 bool GrabPointerWithCursor(gfx::NativeCursor cursor); 52 bool GrabPointerWithCursor(gfx::NativeCursor cursor);
44 53
54 // Creates an input-only window to be used during the drag.
55 Window CreateDragInputWindow(XDisplay* display);
56
57 // Creates a window to show the drag image during the drag.
58 void CreateDragImageWindow();
59
45 X11WholeScreenMoveLoopDelegate* delegate_; 60 X11WholeScreenMoveLoopDelegate* delegate_;
46 61
47 // Are we running a nested message loop from RunMoveLoop()? 62 // Are we running a nested message loop from RunMoveLoop()?
48 bool in_move_loop_; 63 bool in_move_loop_;
49 64
50 // An invisible InputOnly window . We create this window so we can track the 65 // An invisible InputOnly window . We create this window so we can track the
51 // cursor wherever it goes on screen during a drag, since normal windows 66 // cursor wherever it goes on screen during a drag, since normal windows
52 // don't receive pointer motion events outside of their bounds. 67 // don't receive pointer motion events outside of their bounds.
53 ::Window grab_input_window_; 68 ::Window grab_input_window_;
54 69
55 base::Closure quit_closure_; 70 base::Closure quit_closure_;
56 71
72 // A Widget is created during the drag if there is an image available to be
73 // used during the drag.
74 scoped_ptr<Widget> drag_widget_;
75 gfx::ImageSkia drag_image_;
76 gfx::Vector2dF drag_offset_;
77
57 DISALLOW_COPY_AND_ASSIGN(X11WholeScreenMoveLoop); 78 DISALLOW_COPY_AND_ASSIGN(X11WholeScreenMoveLoop);
58 }; 79 };
59 80
60 } // namespace views 81 } // namespace views
61 82
62 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_ 83 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_X11_WHOLE_SCREEN_MOVE_LOOP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698