OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ |
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... | |
34 | 34 |
35 namespace ui { | 35 namespace ui { |
36 class DragSource; | 36 class DragSource; |
37 class DropTargetEvent; | 37 class DropTargetEvent; |
38 class OSExchangeData; | 38 class OSExchangeData; |
39 class OSExchangeDataProviderAuraX11; | 39 class OSExchangeDataProviderAuraX11; |
40 class SelectionFormatMap; | 40 class SelectionFormatMap; |
41 } | 41 } |
42 | 42 |
43 namespace views { | 43 namespace views { |
44 class DesktopNativeCursorManager; | 44 class DesktopNativeCursorManager; |
pkotwicz
2014/05/08 00:03:49
Nit: forward declare views::Widget
varkha
2014/05/09 19:01:01
Done (is also forward declared in ui/views/widget/
| |
45 | 45 |
46 // Implements drag and drop on X11 for aura. On one side, this class takes raw | 46 // Implements drag and drop on X11 for aura. On one side, this class takes raw |
47 // X11 events forwarded from DesktopWindowTreeHostLinux, while on the other, it | 47 // X11 events forwarded from DesktopWindowTreeHostLinux, while on the other, it |
48 // handles the views drag events. | 48 // handles the views drag events. |
49 class VIEWS_EXPORT DesktopDragDropClientAuraX11 | 49 class VIEWS_EXPORT DesktopDragDropClientAuraX11 |
50 : public aura::client::DragDropClient, | 50 : public aura::client::DragDropClient, |
51 public aura::WindowObserver, | 51 public aura::WindowObserver, |
52 public X11WholeScreenMoveLoopDelegate { | 52 public X11WholeScreenMoveLoopDelegate { |
53 public: | 53 public: |
54 DesktopDragDropClientAuraX11( | 54 DesktopDragDropClientAuraX11( |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 // During the blocking StartDragAndDrop() call, this converts the views-style | 142 // During the blocking StartDragAndDrop() call, this converts the views-style |
143 // |drag_operation_| bitfield into a vector of Atoms to offer to other | 143 // |drag_operation_| bitfield into a vector of Atoms to offer to other |
144 // processes. | 144 // processes. |
145 std::vector< ::Atom> GetOfferedDragOperations(); | 145 std::vector< ::Atom> GetOfferedDragOperations(); |
146 | 146 |
147 // This returns a representation of the data we're offering in this | 147 // This returns a representation of the data we're offering in this |
148 // drag. This is done to bypass an asynchronous roundtrip with the X11 | 148 // drag. This is done to bypass an asynchronous roundtrip with the X11 |
149 // server. | 149 // server. |
150 ui::SelectionFormatMap GetFormatMap() const; | 150 ui::SelectionFormatMap GetFormatMap() const; |
151 | 151 |
152 // Updates the cursor by re-grabbing the pointer while in the move loop. | |
153 void UpdateCursor(); | |
154 | |
152 // Handling XdndPosition can be paused while waiting for more data; this is | 155 // Handling XdndPosition can be paused while waiting for more data; this is |
153 // called either synchronously from OnXdndPosition, or asynchronously after | 156 // called either synchronously from OnXdndPosition, or asynchronously after |
154 // we've received data requested from the other window. | 157 // we've received data requested from the other window. |
155 void CompleteXdndPosition(::Window source_window, | 158 void CompleteXdndPosition(::Window source_window, |
156 const gfx::Point& screen_point); | 159 const gfx::Point& screen_point); |
157 | 160 |
158 void SendXdndEnter(::Window dest_window); | 161 void SendXdndEnter(::Window dest_window); |
159 void SendXdndLeave(::Window dest_window); | 162 void SendXdndLeave(::Window dest_window); |
160 void SendXdndPosition(::Window dest_window, | 163 void SendXdndPosition(::Window dest_window, |
161 const gfx::Point& screen_point, | 164 const gfx::Point& screen_point, |
162 unsigned long time); | 165 unsigned long time); |
163 void SendXdndDrop(::Window dest_window); | 166 void SendXdndDrop(::Window dest_window); |
164 | 167 |
165 // Sends |xev| to |xid|, optionally short circuiting the round trip to the X | 168 // Sends |xev| to |xid|, optionally short circuiting the round trip to the X |
166 // server. | 169 // server. |
167 void SendXClientEvent(::Window xid, XEvent* xev); | 170 void SendXClientEvent(::Window xid, XEvent* xev); |
168 | 171 |
172 // Sets an image to be used during the drag. | |
173 void SetDragImage(const gfx::ImageSkia& image, gfx::Vector2dF offset); | |
174 | |
175 // Creates a window to show the drag image during the drag. | |
176 void CreateDragImageWindow(); | |
177 | |
169 // A nested message loop that notifies this object of events through the | 178 // A nested message loop that notifies this object of events through the |
170 // X11WholeScreenMoveLoopDelegate interface. | 179 // X11WholeScreenMoveLoopDelegate interface. |
171 X11WholeScreenMoveLoop move_loop_; | 180 X11WholeScreenMoveLoop move_loop_; |
172 | 181 |
173 aura::Window* root_window_; | 182 aura::Window* root_window_; |
174 | 183 |
175 Display* xdisplay_; | 184 Display* xdisplay_; |
176 ::Window xwindow_; | 185 ::Window xwindow_; |
177 | 186 |
178 ui::X11AtomCache atom_cache_; | 187 ui::X11AtomCache atom_cache_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 | 233 |
225 // Ends the move loop if the target is too slow to respond after the mouse is | 234 // Ends the move loop if the target is too slow to respond after the mouse is |
226 // released. | 235 // released. |
227 base::OneShotTimer<DesktopDragDropClientAuraX11> end_move_loop_timer_; | 236 base::OneShotTimer<DesktopDragDropClientAuraX11> end_move_loop_timer_; |
228 | 237 |
229 // We use these cursors while dragging. | 238 // We use these cursors while dragging. |
230 gfx::NativeCursor grab_cursor_; | 239 gfx::NativeCursor grab_cursor_; |
231 gfx::NativeCursor copy_grab_cursor_; | 240 gfx::NativeCursor copy_grab_cursor_; |
232 gfx::NativeCursor move_grab_cursor_; | 241 gfx::NativeCursor move_grab_cursor_; |
233 | 242 |
243 // A Widget is created during the drag if there is an image available to be | |
244 // used during the drag. | |
245 scoped_ptr<Widget> drag_widget_; | |
246 gfx::ImageSkia drag_image_; | |
247 gfx::Vector2dF drag_offset_; | |
248 | |
234 base::WeakPtrFactory<DesktopDragDropClientAuraX11> weak_ptr_factory_; | 249 base::WeakPtrFactory<DesktopDragDropClientAuraX11> weak_ptr_factory_; |
235 | 250 |
236 DISALLOW_COPY_AND_ASSIGN(DesktopDragDropClientAuraX11); | 251 DISALLOW_COPY_AND_ASSIGN(DesktopDragDropClientAuraX11); |
237 }; | 252 }; |
238 | 253 |
239 } // namespace views | 254 } // namespace views |
240 | 255 |
241 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ | 256 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ |
OLD | NEW |