| 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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 unsigned long source_window = event.data.l[0]; | 599 unsigned long source_window = event.data.l[0]; |
| 600 | 600 |
| 601 int drag_operation = ui::DragDropTypes::DRAG_NONE; | 601 int drag_operation = ui::DragDropTypes::DRAG_NONE; |
| 602 if (target_window_) { | 602 if (target_window_) { |
| 603 aura::client::DragDropDelegate* delegate = | 603 aura::client::DragDropDelegate* delegate = |
| 604 aura::client::GetDragDropDelegate(target_window_); | 604 aura::client::GetDragDropDelegate(target_window_); |
| 605 if (delegate) { | 605 if (delegate) { |
| 606 ui::OSExchangeData data(new ui::OSExchangeDataProviderAuraX11( | 606 ui::OSExchangeData data(new ui::OSExchangeDataProviderAuraX11( |
| 607 xwindow_, target_current_context_->fetched_targets())); | 607 xwindow_, target_current_context_->fetched_targets())); |
| 608 | 608 |
| 609 ui::DropTargetEvent event(data, | 609 ui::DropTargetEvent event(data, gfx::PointF(target_window_location_), |
| 610 target_window_location_, | 610 gfx::PointF(target_window_root_location_), |
| 611 target_window_root_location_, | |
| 612 target_current_context_->GetDragOperation()); | 611 target_current_context_->GetDragOperation()); |
| 613 if (target_current_context_->source_client()) { | 612 if (target_current_context_->source_client()) { |
| 614 event.set_flags(target_current_context_->source_client() | 613 event.set_flags(target_current_context_->source_client() |
| 615 ->current_modifier_state()); | 614 ->current_modifier_state()); |
| 616 } else { | 615 } else { |
| 617 event.set_flags(XGetModifiers()); | 616 event.set_flags(XGetModifiers()); |
| 618 } | 617 } |
| 619 | 618 |
| 620 if (!IsDragDropInProgress()) { | 619 if (!IsDragDropInProgress()) { |
| 621 UMA_HISTOGRAM_COUNTS("Event.DragDrop.ExternalOriginDrop", 1); | 620 UMA_HISTOGRAM_COUNTS("Event.DragDrop.ExternalOriginDrop", 1); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 // on whether alt/ctrl/shift was pressed. However once Chromium gets control | 984 // on whether alt/ctrl/shift was pressed. However once Chromium gets control |
| 986 // over the X11 events, the source application does no longer receive X11 | 985 // over the X11 events, the source application does no longer receive X11 |
| 987 // events for key modifier changes, so the dnd operation gets stuck in an | 986 // events for key modifier changes, so the dnd operation gets stuck in an |
| 988 // incorrect state. Blink can only dnd-open files of type DRAG_COPY, so the | 987 // incorrect state. Blink can only dnd-open files of type DRAG_COPY, so the |
| 989 // DRAG_COPY mask is added if the dnd object is a file. | 988 // DRAG_COPY mask is added if the dnd object is a file. |
| 990 if (drag_op & (ui::DragDropTypes::DRAG_MOVE | ui::DragDropTypes::DRAG_LINK) && | 989 if (drag_op & (ui::DragDropTypes::DRAG_MOVE | ui::DragDropTypes::DRAG_LINK) && |
| 991 data->get()->HasFile()) { | 990 data->get()->HasFile()) { |
| 992 drag_op |= ui::DragDropTypes::DRAG_COPY; | 991 drag_op |= ui::DragDropTypes::DRAG_COPY; |
| 993 } | 992 } |
| 994 | 993 |
| 995 event->reset(new ui::DropTargetEvent( | 994 event->reset(new ui::DropTargetEvent(*(data->get()), gfx::PointF(location), |
| 996 *(data->get()), | 995 gfx::PointF(root_location), drag_op)); |
| 997 location, | |
| 998 root_location, | |
| 999 drag_op)); | |
| 1000 if (target_current_context_->source_client()) { | 996 if (target_current_context_->source_client()) { |
| 1001 (*event)->set_flags( | 997 (*event)->set_flags( |
| 1002 target_current_context_->source_client()->current_modifier_state()); | 998 target_current_context_->source_client()->current_modifier_state()); |
| 1003 } else { | 999 } else { |
| 1004 (*event)->set_flags(XGetModifiers()); | 1000 (*event)->set_flags(XGetModifiers()); |
| 1005 } | 1001 } |
| 1006 if (target_window_changed) | 1002 if (target_window_changed) |
| 1007 (*delegate)->OnDragEntered(*event->get()); | 1003 (*delegate)->OnDragEntered(*event->get()); |
| 1008 } | 1004 } |
| 1009 | 1005 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 for (int x = 0; x < in_bitmap->width(); ++x) { | 1214 for (int x = 0; x < in_bitmap->width(); ++x) { |
| 1219 if (SkColorGetA(in_row[x]) > kMinAlpha) | 1215 if (SkColorGetA(in_row[x]) > kMinAlpha) |
| 1220 return true; | 1216 return true; |
| 1221 } | 1217 } |
| 1222 } | 1218 } |
| 1223 | 1219 |
| 1224 return false; | 1220 return false; |
| 1225 } | 1221 } |
| 1226 | 1222 |
| 1227 } // namespace views | 1223 } // namespace views |
| OLD | NEW |