| 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 <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 9 | 10 |
| 10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | |
| 11 #undef RootWindow | |
| 12 | |
| 13 #include <set> | |
| 14 | |
| 15 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 16 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 18 #include "ui/aura/client/drag_drop_client.h" | 14 #include "ui/aura/client/drag_drop_client.h" |
| 19 #include "ui/aura/window_observer.h" | 15 #include "ui/aura/window_observer.h" |
| 20 #include "ui/base/cursor/cursor.h" | 16 #include "ui/base/cursor/cursor.h" |
| 21 #include "ui/gfx/point.h" | 17 #include "ui/gfx/point.h" |
| 22 #include "ui/gfx/x/x11_atom_cache.h" | 18 #include "ui/gfx/x/x11_atom_cache.h" |
| 23 #include "ui/views/views_export.h" | 19 #include "ui/views/views_export.h" |
| 24 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h" | 20 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h" |
| 25 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop_delegate.h" | 21 #include "ui/views/widget/desktop_aura/x11_whole_screen_move_loop_delegate.h" |
| 26 | 22 |
| 27 namespace aura { | 23 namespace aura { |
| 28 class RootWindow; | |
| 29 namespace client { | 24 namespace client { |
| 30 class DragDropDelegate; | 25 class DragDropDelegate; |
| 31 } | 26 } |
| 32 } | 27 } |
| 33 | 28 |
| 34 namespace gfx { | 29 namespace gfx { |
| 35 class Point; | 30 class Point; |
| 36 } | 31 } |
| 37 | 32 |
| 38 namespace ui { | 33 namespace ui { |
| 39 class DragSource; | 34 class DragSource; |
| 40 class DropTargetEvent; | 35 class DropTargetEvent; |
| 41 class OSExchangeData; | 36 class OSExchangeData; |
| 42 class OSExchangeDataProviderAuraX11; | 37 class OSExchangeDataProviderAuraX11; |
| 43 class RootWindow; | |
| 44 class SelectionFormatMap; | 38 class SelectionFormatMap; |
| 45 } | 39 } |
| 46 | 40 |
| 47 namespace views { | 41 namespace views { |
| 48 class DesktopNativeCursorManager; | 42 class DesktopNativeCursorManager; |
| 49 | 43 |
| 50 // Implements drag and drop on X11 for aura. On one side, this class takes raw | 44 // Implements drag and drop on X11 for aura. On one side, this class takes raw |
| 51 // X11 events forwarded from DesktopRootWindowHostLinux, while on the other, it | 45 // X11 events forwarded from DesktopRootWindowHostLinux, while on the other, it |
| 52 // handles the views drag events. | 46 // handles the views drag events. |
| 53 class VIEWS_EXPORT DesktopDragDropClientAuraX11 | 47 class VIEWS_EXPORT DesktopDragDropClientAuraX11 |
| 54 : public aura::client::DragDropClient, | 48 : public aura::client::DragDropClient, |
| 55 public aura::WindowObserver, | 49 public aura::WindowObserver, |
| 56 public X11WholeScreenMoveLoopDelegate { | 50 public X11WholeScreenMoveLoopDelegate { |
| 57 public: | 51 public: |
| 58 DesktopDragDropClientAuraX11( | 52 DesktopDragDropClientAuraX11( |
| 59 aura::RootWindow* root_window, | 53 aura::Window* root_window, |
| 60 views::DesktopNativeCursorManager* cursor_manager, | 54 views::DesktopNativeCursorManager* cursor_manager, |
| 61 Display* xdisplay, | 55 Display* xdisplay, |
| 62 ::Window xwindow); | 56 ::Window xwindow); |
| 63 virtual ~DesktopDragDropClientAuraX11(); | 57 virtual ~DesktopDragDropClientAuraX11(); |
| 64 | 58 |
| 65 // We maintain a mapping of live DesktopDragDropClientAuraX11 objects to | 59 // We maintain a mapping of live DesktopDragDropClientAuraX11 objects to |
| 66 // their ::Windows. We do this so that we're able to short circuit sending | 60 // their ::Windows. We do this so that we're able to short circuit sending |
| 67 // X11 messages to windows in our process. | 61 // X11 messages to windows in our process. |
| 68 static DesktopDragDropClientAuraX11* GetForWindow(::Window window); | 62 static DesktopDragDropClientAuraX11* GetForWindow(::Window window); |
| 69 | 63 |
| 70 // These methods handle the various X11 client messages from the platform. | 64 // These methods handle the various X11 client messages from the platform. |
| 71 void OnXdndEnter(const XClientMessageEvent& event); | 65 void OnXdndEnter(const XClientMessageEvent& event); |
| 72 void OnXdndLeave(const XClientMessageEvent& event); | 66 void OnXdndLeave(const XClientMessageEvent& event); |
| 73 void OnXdndPosition(const XClientMessageEvent& event); | 67 void OnXdndPosition(const XClientMessageEvent& event); |
| 74 void OnXdndStatus(const XClientMessageEvent& event); | 68 void OnXdndStatus(const XClientMessageEvent& event); |
| 75 void OnXdndFinished(const XClientMessageEvent& event); | 69 void OnXdndFinished(const XClientMessageEvent& event); |
| 76 void OnXdndDrop(const XClientMessageEvent& event); | 70 void OnXdndDrop(const XClientMessageEvent& event); |
| 77 | 71 |
| 78 // Called when XSelection data has been copied to our process. | 72 // Called when XSelection data has been copied to our process. |
| 79 void OnSelectionNotify(const XSelectionEvent& xselection); | 73 void OnSelectionNotify(const XSelectionEvent& xselection); |
| 80 | 74 |
| 81 // Overridden from aura::client::DragDropClient: | 75 // Overridden from aura::client::DragDropClient: |
| 82 virtual int StartDragAndDrop( | 76 virtual int StartDragAndDrop( |
| 83 const ui::OSExchangeData& data, | 77 const ui::OSExchangeData& data, |
| 84 aura::RootWindow* root_window, | 78 aura::Window* root_window, |
| 85 aura::Window* source_window, | 79 aura::Window* source_window, |
| 86 const gfx::Point& root_location, | 80 const gfx::Point& root_location, |
| 87 int operation, | 81 int operation, |
| 88 ui::DragDropTypes::DragEventSource source) OVERRIDE; | 82 ui::DragDropTypes::DragEventSource source) OVERRIDE; |
| 89 virtual void DragUpdate(aura::Window* target, | 83 virtual void DragUpdate(aura::Window* target, |
| 90 const ui::LocatedEvent& event) OVERRIDE; | 84 const ui::LocatedEvent& event) OVERRIDE; |
| 91 virtual void Drop(aura::Window* target, | 85 virtual void Drop(aura::Window* target, |
| 92 const ui::LocatedEvent& event) OVERRIDE; | 86 const ui::LocatedEvent& event) OVERRIDE; |
| 93 virtual void DragCancel() OVERRIDE; | 87 virtual void DragCancel() OVERRIDE; |
| 94 virtual bool IsDragDropInProgress() OVERRIDE; | 88 virtual bool IsDragDropInProgress() OVERRIDE; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 void SendXdndDrop(::Window dest_window); | 142 void SendXdndDrop(::Window dest_window); |
| 149 | 143 |
| 150 // Sends |xev| to |xid|, optionally short circuiting the round trip to the X | 144 // Sends |xev| to |xid|, optionally short circuiting the round trip to the X |
| 151 // server. | 145 // server. |
| 152 void SendXClientEvent(::Window xid, XEvent* xev); | 146 void SendXClientEvent(::Window xid, XEvent* xev); |
| 153 | 147 |
| 154 // A nested message loop that notifies this object of events through the | 148 // A nested message loop that notifies this object of events through the |
| 155 // X11WholeScreenMoveLoopDelegate interface. | 149 // X11WholeScreenMoveLoopDelegate interface. |
| 156 X11WholeScreenMoveLoop move_loop_; | 150 X11WholeScreenMoveLoop move_loop_; |
| 157 | 151 |
| 158 aura::RootWindow* root_window_; | 152 aura::Window* root_window_; |
| 159 | 153 |
| 160 Display* xdisplay_; | 154 Display* xdisplay_; |
| 161 ::Window xwindow_; | 155 ::Window xwindow_; |
| 162 | 156 |
| 163 ui::X11AtomCache atom_cache_; | 157 ui::X11AtomCache atom_cache_; |
| 164 | 158 |
| 165 // Target side information. | 159 // Target side information. |
| 166 class X11DragContext; | 160 class X11DragContext; |
| 167 scoped_ptr<X11DragContext> target_current_context_; | 161 scoped_ptr<X11DragContext> target_current_context_; |
| 168 | 162 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 gfx::NativeCursor move_grab_cursor_; | 216 gfx::NativeCursor move_grab_cursor_; |
| 223 | 217 |
| 224 static std::map< ::Window, DesktopDragDropClientAuraX11*> g_live_client_map; | 218 static std::map< ::Window, DesktopDragDropClientAuraX11*> g_live_client_map; |
| 225 | 219 |
| 226 DISALLOW_COPY_AND_ASSIGN(DesktopDragDropClientAuraX11); | 220 DISALLOW_COPY_AND_ASSIGN(DesktopDragDropClientAuraX11); |
| 227 }; | 221 }; |
| 228 | 222 |
| 229 } // namespace views | 223 } // namespace views |
| 230 | 224 |
| 231 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ | 225 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DRAG_DROP_CLIENT_AURAX11_H_ |
| OLD | NEW |