Chromium Code Reviews| 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 24 matching lines...) Expand all Loading... | |
| 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; |
| 45 class Widget; | |
| 45 | 46 |
| 46 // Implements drag and drop on X11 for aura. On one side, this class takes raw | 47 // 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 | 48 // X11 events forwarded from DesktopWindowTreeHostLinux, while on the other, it |
| 48 // handles the views drag events. | 49 // handles the views drag events. |
| 49 class VIEWS_EXPORT DesktopDragDropClientAuraX11 | 50 class VIEWS_EXPORT DesktopDragDropClientAuraX11 |
| 50 : public aura::client::DragDropClient, | 51 : public aura::client::DragDropClient, |
| 51 public aura::WindowObserver, | 52 public aura::WindowObserver, |
| 52 public X11WholeScreenMoveLoopDelegate { | 53 public X11WholeScreenMoveLoopDelegate { |
| 53 public: | 54 public: |
| 54 DesktopDragDropClientAuraX11( | 55 DesktopDragDropClientAuraX11( |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 // During the blocking StartDragAndDrop() call, this converts the views-style | 147 // During the blocking StartDragAndDrop() call, this converts the views-style |
| 147 // |drag_operation_| bitfield into a vector of Atoms to offer to other | 148 // |drag_operation_| bitfield into a vector of Atoms to offer to other |
| 148 // processes. | 149 // processes. |
| 149 std::vector< ::Atom> GetOfferedDragOperations(); | 150 std::vector< ::Atom> GetOfferedDragOperations(); |
| 150 | 151 |
| 151 // This returns a representation of the data we're offering in this | 152 // This returns a representation of the data we're offering in this |
| 152 // drag. This is done to bypass an asynchronous roundtrip with the X11 | 153 // drag. This is done to bypass an asynchronous roundtrip with the X11 |
| 153 // server. | 154 // server. |
| 154 ui::SelectionFormatMap GetFormatMap() const; | 155 ui::SelectionFormatMap GetFormatMap() const; |
| 155 | 156 |
| 157 // Updates the cursor by re-grabbing the pointer while in the move loop. | |
| 158 void UpdateCursor(); | |
| 159 | |
| 156 // Handling XdndPosition can be paused while waiting for more data; this is | 160 // Handling XdndPosition can be paused while waiting for more data; this is |
| 157 // called either synchronously from OnXdndPosition, or asynchronously after | 161 // called either synchronously from OnXdndPosition, or asynchronously after |
| 158 // we've received data requested from the other window. | 162 // we've received data requested from the other window. |
| 159 void CompleteXdndPosition(::Window source_window, | 163 void CompleteXdndPosition(::Window source_window, |
| 160 const gfx::Point& screen_point); | 164 const gfx::Point& screen_point); |
| 161 | 165 |
| 162 void SendXdndEnter(::Window dest_window); | 166 void SendXdndEnter(::Window dest_window); |
| 163 void SendXdndLeave(::Window dest_window); | 167 void SendXdndLeave(::Window dest_window); |
| 164 void SendXdndPosition(::Window dest_window, | 168 void SendXdndPosition(::Window dest_window, |
| 165 const gfx::Point& screen_point, | 169 const gfx::Point& screen_point, |
| 166 unsigned long event_time); | 170 unsigned long event_time); |
| 167 void SendXdndDrop(::Window dest_window); | 171 void SendXdndDrop(::Window dest_window); |
| 168 | 172 |
| 169 // Sends |xev| to |xid|, optionally short circuiting the round trip to the X | 173 // Sends |xev| to |xid|, optionally short circuiting the round trip to the X |
| 170 // server. | 174 // server. |
| 171 void SendXClientEvent(::Window xid, XEvent* xev); | 175 void SendXClientEvent(::Window xid, XEvent* xev); |
| 172 | 176 |
| 177 // Sets an image to be used during the drag. | |
| 178 void SetDragImage(const gfx::ImageSkia& image, gfx::Vector2dF offset); | |
| 179 | |
| 180 // Creates a window to show the drag image during the drag. | |
| 181 void CreateDragImageWindow(); | |
| 182 | |
| 173 // A nested message loop that notifies this object of events through the | 183 // A nested message loop that notifies this object of events through the |
| 174 // X11WholeScreenMoveLoopDelegate interface. | 184 // X11WholeScreenMoveLoopDelegate interface. |
| 175 X11WholeScreenMoveLoop move_loop_; | 185 X11WholeScreenMoveLoop move_loop_; |
| 176 | 186 |
| 177 aura::Window* root_window_; | 187 aura::Window* root_window_; |
| 178 | 188 |
| 179 Display* xdisplay_; | 189 Display* xdisplay_; |
| 180 ::Window xwindow_; | 190 ::Window xwindow_; |
| 181 | 191 |
| 182 ui::X11AtomCache atom_cache_; | 192 ui::X11AtomCache atom_cache_; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 | 248 |
| 239 // Ends the move loop if the target is too slow to respond after the mouse is | 249 // Ends the move loop if the target is too slow to respond after the mouse is |
| 240 // released. | 250 // released. |
| 241 base::OneShotTimer<DesktopDragDropClientAuraX11> end_move_loop_timer_; | 251 base::OneShotTimer<DesktopDragDropClientAuraX11> end_move_loop_timer_; |
| 242 | 252 |
| 243 // We use these cursors while dragging. | 253 // We use these cursors while dragging. |
| 244 gfx::NativeCursor grab_cursor_; | 254 gfx::NativeCursor grab_cursor_; |
| 245 gfx::NativeCursor copy_grab_cursor_; | 255 gfx::NativeCursor copy_grab_cursor_; |
| 246 gfx::NativeCursor move_grab_cursor_; | 256 gfx::NativeCursor move_grab_cursor_; |
| 247 | 257 |
| 258 // A Widget is created during the drag if there is an image available to be | |
| 259 // used during the drag. | |
|
pkotwicz
2014/05/12 16:04:29
This comment is obsolete. Can you please update it
varkha
2014/05/20 17:13:35
Done.
| |
| 260 scoped_ptr<Widget> drag_widget_; | |
| 261 gfx::ImageSkia drag_image_; | |
| 262 gfx::Vector2dF drag_offset_; | |
| 263 | |
| 248 base::WeakPtrFactory<DesktopDragDropClientAuraX11> weak_ptr_factory_; | 264 base::WeakPtrFactory<DesktopDragDropClientAuraX11> weak_ptr_factory_; |
| 249 | 265 |
| 250 DISALLOW_COPY_AND_ASSIGN(DesktopDragDropClientAuraX11); | 266 DISALLOW_COPY_AND_ASSIGN(DesktopDragDropClientAuraX11); |
| 251 }; | 267 }; |
| 252 | 268 |
| 253 } // namespace views | 269 } // namespace views |
| 254 | 270 |
| 255 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ | 271 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ |
| OLD | NEW |