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 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 } | 758 } |
759 | 759 |
760 void DesktopDragDropClientAuraX11::OnWindowDestroyed(aura::Window* window) { | 760 void DesktopDragDropClientAuraX11::OnWindowDestroyed(aura::Window* window) { |
761 DCHECK_EQ(target_window_, window); | 761 DCHECK_EQ(target_window_, window); |
762 target_window_ = NULL; | 762 target_window_ = NULL; |
763 } | 763 } |
764 | 764 |
765 void DesktopDragDropClientAuraX11::OnMouseMovement( | 765 void DesktopDragDropClientAuraX11::OnMouseMovement( |
766 const gfx::Point& screen_point, | 766 const gfx::Point& screen_point, |
767 int flags, | 767 int flags, |
768 base::TimeDelta event_time) { | 768 base::TimeTicks event_time) { |
769 if (drag_widget_.get()) { | 769 if (drag_widget_.get()) { |
770 display::Display display = | 770 display::Display display = |
771 display::Screen::GetScreen()->GetDisplayNearestWindow( | 771 display::Screen::GetScreen()->GetDisplayNearestWindow( |
772 drag_widget_->GetNativeWindow()); | 772 drag_widget_->GetNativeWindow()); |
773 gfx::Point scaled_point = gfx::ScaleToRoundedPoint( | 773 gfx::Point scaled_point = gfx::ScaleToRoundedPoint( |
774 screen_point, 1.f / display.device_scale_factor()); | 774 screen_point, 1.f / display.device_scale_factor()); |
775 drag_widget_->SetBounds( | 775 drag_widget_->SetBounds( |
776 gfx::Rect(scaled_point - drag_widget_offset_, drag_image_size_)); | 776 gfx::Rect(scaled_point - drag_widget_offset_, drag_image_size_)); |
777 drag_widget_->StackAtTop(); | 777 drag_widget_->StackAtTop(); |
778 } | 778 } |
779 | 779 |
780 const int kModifiers = ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | | 780 const int kModifiers = ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | |
781 ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN | | 781 ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN | |
782 ui::EF_LEFT_MOUSE_BUTTON | | 782 ui::EF_LEFT_MOUSE_BUTTON | |
783 ui::EF_MIDDLE_MOUSE_BUTTON | | 783 ui::EF_MIDDLE_MOUSE_BUTTON | |
784 ui::EF_RIGHT_MOUSE_BUTTON; | 784 ui::EF_RIGHT_MOUSE_BUTTON; |
785 current_modifier_state_ = flags & kModifiers; | 785 current_modifier_state_ = flags & kModifiers; |
786 | 786 |
787 repeat_mouse_move_timer_.Stop(); | 787 repeat_mouse_move_timer_.Stop(); |
788 ProcessMouseMove(screen_point, event_time.InMilliseconds()); | 788 ProcessMouseMove(screen_point, |
| 789 (event_time - base::TimeTicks()).InMilliseconds()); |
789 } | 790 } |
790 | 791 |
791 void DesktopDragDropClientAuraX11::OnMouseReleased() { | 792 void DesktopDragDropClientAuraX11::OnMouseReleased() { |
792 repeat_mouse_move_timer_.Stop(); | 793 repeat_mouse_move_timer_.Stop(); |
793 | 794 |
794 if (source_state_ != SOURCE_STATE_OTHER) { | 795 if (source_state_ != SOURCE_STATE_OTHER) { |
795 // The user has previously released the mouse and is clicking in | 796 // The user has previously released the mouse and is clicking in |
796 // frustration. | 797 // frustration. |
797 move_loop_->EndMoveLoop(); | 798 move_loop_->EndMoveLoop(); |
798 return; | 799 return; |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 for (int x = 0; x < in_bitmap->width(); ++x) { | 1228 for (int x = 0; x < in_bitmap->width(); ++x) { |
1228 if (SkColorGetA(in_row[x]) > kMinAlpha) | 1229 if (SkColorGetA(in_row[x]) > kMinAlpha) |
1229 return true; | 1230 return true; |
1230 } | 1231 } |
1231 } | 1232 } |
1232 | 1233 |
1233 return false; | 1234 return false; |
1234 } | 1235 } |
1235 | 1236 |
1236 } // namespace views | 1237 } // namespace views |
OLD | NEW |