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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 if (event->type == PropertyNotify && | 359 if (event->type == PropertyNotify && |
360 event->xproperty.atom == atom_cache_->GetAtom("XdndActionList")) { | 360 event->xproperty.atom == atom_cache_->GetAtom("XdndActionList")) { |
361 ReadActions(); | 361 ReadActions(); |
362 } | 362 } |
363 return true; | 363 return true; |
364 } | 364 } |
365 | 365 |
366 /////////////////////////////////////////////////////////////////////////////// | 366 /////////////////////////////////////////////////////////////////////////////// |
367 | 367 |
368 DesktopDragDropClientAuraX11::DesktopDragDropClientAuraX11( | 368 DesktopDragDropClientAuraX11::DesktopDragDropClientAuraX11( |
369 aura::RootWindow* root_window, | 369 aura::Window* root_window, |
370 views::DesktopNativeCursorManager* cursor_manager, | 370 views::DesktopNativeCursorManager* cursor_manager, |
371 Display* xdisplay, | 371 Display* xdisplay, |
372 ::Window xwindow) | 372 ::Window xwindow) |
373 : move_loop_(this), | 373 : move_loop_(this), |
374 root_window_(root_window), | 374 root_window_(root_window), |
375 xdisplay_(xdisplay), | 375 xdisplay_(xdisplay), |
376 xwindow_(xwindow), | 376 xwindow_(xwindow), |
377 atom_cache_(xdisplay_, kAtomsToCache), | 377 atom_cache_(xdisplay_, kAtomsToCache), |
378 target_window_(NULL), | 378 target_window_(NULL), |
379 source_provider_(NULL), | 379 source_provider_(NULL), |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 if (!target_current_context_) { | 555 if (!target_current_context_) { |
556 NOTIMPLEMENTED(); | 556 NOTIMPLEMENTED(); |
557 return; | 557 return; |
558 } | 558 } |
559 | 559 |
560 target_current_context_->OnSelectionNotify(xselection); | 560 target_current_context_->OnSelectionNotify(xselection); |
561 } | 561 } |
562 | 562 |
563 int DesktopDragDropClientAuraX11::StartDragAndDrop( | 563 int DesktopDragDropClientAuraX11::StartDragAndDrop( |
564 const ui::OSExchangeData& data, | 564 const ui::OSExchangeData& data, |
565 aura::RootWindow* root_window, | 565 aura::Window* root_window, |
566 aura::Window* source_window, | 566 aura::Window* source_window, |
567 const gfx::Point& root_location, | 567 const gfx::Point& root_location, |
568 int operation, | 568 int operation, |
569 ui::DragDropTypes::DragEventSource source) { | 569 ui::DragDropTypes::DragEventSource source) { |
570 source_current_window_ = None; | 570 source_current_window_ = None; |
571 drag_drop_in_progress_ = true; | 571 drag_drop_in_progress_ = true; |
572 drag_operation_ = operation; | 572 drag_operation_ = operation; |
573 resulting_operation_ = ui::DragDropTypes::DRAG_NONE; | 573 resulting_operation_ = ui::DragDropTypes::DRAG_NONE; |
574 | 574 |
575 const ui::OSExchangeData::Provider* provider = &data.provider(); | 575 const ui::OSExchangeData::Provider* provider = &data.provider(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 void DesktopDragDropClientAuraX11::OnMoveLoopEnded() { | 674 void DesktopDragDropClientAuraX11::OnMoveLoopEnded() { |
675 target_current_context_.reset(); | 675 target_current_context_.reset(); |
676 } | 676 } |
677 | 677 |
678 void DesktopDragDropClientAuraX11::DragTranslate( | 678 void DesktopDragDropClientAuraX11::DragTranslate( |
679 const gfx::Point& root_window_location, | 679 const gfx::Point& root_window_location, |
680 scoped_ptr<ui::OSExchangeData>* data, | 680 scoped_ptr<ui::OSExchangeData>* data, |
681 scoped_ptr<ui::DropTargetEvent>* event, | 681 scoped_ptr<ui::DropTargetEvent>* event, |
682 aura::client::DragDropDelegate** delegate) { | 682 aura::client::DragDropDelegate** delegate) { |
683 gfx::Point root_location = root_window_location; | 683 gfx::Point root_location = root_window_location; |
684 root_window_->ConvertPointFromNativeScreen(&root_location); | 684 root_window_->GetRootWindow()->ConvertPointFromNativeScreen(&root_location); |
685 aura::Window* target_window = | 685 aura::Window* target_window = |
686 root_window_->GetEventHandlerForPoint(root_location); | 686 root_window_->GetEventHandlerForPoint(root_location); |
687 bool target_window_changed = false; | 687 bool target_window_changed = false; |
688 if (target_window != target_window_) { | 688 if (target_window != target_window_) { |
689 if (target_window_) | 689 if (target_window_) |
690 NotifyDragLeave(); | 690 NotifyDragLeave(); |
691 target_window_ = target_window; | 691 target_window_ = target_window; |
692 if (target_window_) | 692 if (target_window_) |
693 target_window_->AddObserver(this); | 693 target_window_->AddObserver(this); |
694 target_window_changed = true; | 694 target_window_changed = true; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 // GdkEvent about the failed drag. (And sending this message doesn't appear | 914 // GdkEvent about the failed drag. (And sending this message doesn't appear |
915 // to go through normal xlib machinery, but instead passes through the low | 915 // to go through normal xlib machinery, but instead passes through the low |
916 // level xProto (the x11 wire format) that I don't understand. | 916 // level xProto (the x11 wire format) that I don't understand. |
917 // | 917 // |
918 // I'm unsure if I have to jump through those hoops, or if XSendEvent is | 918 // I'm unsure if I have to jump through those hoops, or if XSendEvent is |
919 // sufficient. | 919 // sufficient. |
920 XSendEvent(xdisplay_, xid, False, 0, xev); | 920 XSendEvent(xdisplay_, xid, False, 0, xev); |
921 } | 921 } |
922 | 922 |
923 } // namespace views | 923 } // namespace views |
OLD | NEW |