| 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 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" |
| 6 | 6 |
| 7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 | 8 |
| 9 #include "base/event_types.h" | 9 #include "base/event_types.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // into |actions|. | 119 // into |actions|. |
| 120 void ReadActions(); | 120 void ReadActions(); |
| 121 | 121 |
| 122 // Creates a ui::DragDropTypes::DragOperation representation of the current | 122 // Creates a ui::DragDropTypes::DragOperation representation of the current |
| 123 // action list. | 123 // action list. |
| 124 int GetDragOperation() const; | 124 int GetDragOperation() const; |
| 125 | 125 |
| 126 private: | 126 private: |
| 127 // Masks the X11 atom |xdnd_operation|'s views representation onto | 127 // Masks the X11 atom |xdnd_operation|'s views representation onto |
| 128 // |drag_operation|. | 128 // |drag_operation|. |
| 129 void MaskOpeartion(::Atom xdnd_operation, int* drag_operation) const; | 129 void MaskOperation(::Atom xdnd_operation, int* drag_operation) const; |
| 130 | 130 |
| 131 // ui::PlatformEventDispatcher: | 131 // ui::PlatformEventDispatcher: |
| 132 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; | 132 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |
| 133 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; | 133 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |
| 134 | 134 |
| 135 // The atom cache owned by our parent. | 135 // The atom cache owned by our parent. |
| 136 ui::X11AtomCache* atom_cache_; | 136 ui::X11AtomCache* atom_cache_; |
| 137 | 137 |
| 138 // The XID of our chrome local aura window handling our events. | 138 // The XID of our chrome local aura window handling our events. |
| 139 ::Window local_window_; | 139 ::Window local_window_; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // their action list. Thankfully, the views interface is static and you | 299 // their action list. Thankfully, the views interface is static and you |
| 300 // can't change the action list after you enter StartDragAndDrop(). | 300 // can't change the action list after you enter StartDragAndDrop(). |
| 301 actions_ = client->GetOfferedDragOperations(); | 301 actions_ = client->GetOfferedDragOperations(); |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 int DesktopDragDropClientAuraX11::X11DragContext::GetDragOperation() const { | 305 int DesktopDragDropClientAuraX11::X11DragContext::GetDragOperation() const { |
| 306 int drag_operation = ui::DragDropTypes::DRAG_NONE; | 306 int drag_operation = ui::DragDropTypes::DRAG_NONE; |
| 307 for (std::vector<Atom>::const_iterator it = actions_.begin(); | 307 for (std::vector<Atom>::const_iterator it = actions_.begin(); |
| 308 it != actions_.end(); ++it) { | 308 it != actions_.end(); ++it) { |
| 309 MaskOpeartion(*it, &drag_operation); | 309 MaskOperation(*it, &drag_operation); |
| 310 } | 310 } |
| 311 | 311 |
| 312 MaskOpeartion(suggested_action_, &drag_operation); | 312 MaskOperation(suggested_action_, &drag_operation); |
| 313 | 313 |
| 314 return drag_operation; | 314 return drag_operation; |
| 315 } | 315 } |
| 316 | 316 |
| 317 void DesktopDragDropClientAuraX11::X11DragContext::MaskOpeartion( | 317 void DesktopDragDropClientAuraX11::X11DragContext::MaskOperation( |
| 318 ::Atom xdnd_operation, | 318 ::Atom xdnd_operation, |
| 319 int* drag_operation) const { | 319 int* drag_operation) const { |
| 320 if (xdnd_operation == atom_cache_->GetAtom(kXdndActionCopy)) | 320 if (xdnd_operation == atom_cache_->GetAtom(kXdndActionCopy)) |
| 321 *drag_operation |= ui::DragDropTypes::DRAG_COPY; | 321 *drag_operation |= ui::DragDropTypes::DRAG_COPY; |
| 322 else if (xdnd_operation == atom_cache_->GetAtom(kXdndActionMove)) | 322 else if (xdnd_operation == atom_cache_->GetAtom(kXdndActionMove)) |
| 323 *drag_operation |= ui::DragDropTypes::DRAG_MOVE; | 323 *drag_operation |= ui::DragDropTypes::DRAG_MOVE; |
| 324 else if (xdnd_operation == atom_cache_->GetAtom(kXdndActionLink)) | 324 else if (xdnd_operation == atom_cache_->GetAtom(kXdndActionLink)) |
| 325 *drag_operation |= ui::DragDropTypes::DRAG_LINK; | 325 *drag_operation |= ui::DragDropTypes::DRAG_LINK; |
| 326 } | 326 } |
| 327 | 327 |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 xev.xclient.window = dest_window; | 1025 xev.xclient.window = dest_window; |
| 1026 xev.xclient.data.l[0] = xwindow_; | 1026 xev.xclient.data.l[0] = xwindow_; |
| 1027 xev.xclient.data.l[1] = 0; | 1027 xev.xclient.data.l[1] = 0; |
| 1028 xev.xclient.data.l[2] = CurrentTime; | 1028 xev.xclient.data.l[2] = CurrentTime; |
| 1029 xev.xclient.data.l[3] = None; | 1029 xev.xclient.data.l[3] = None; |
| 1030 xev.xclient.data.l[4] = None; | 1030 xev.xclient.data.l[4] = None; |
| 1031 SendXClientEvent(dest_window, &xev); | 1031 SendXClientEvent(dest_window, &xev); |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 } // namespace views | 1034 } // namespace views |
| OLD | NEW |