| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 &mask); | 94 &mask); |
| 95 int modifiers = ui::EF_NONE; | 95 int modifiers = ui::EF_NONE; |
| 96 if (mask & ShiftMask) | 96 if (mask & ShiftMask) |
| 97 modifiers |= ui::EF_SHIFT_DOWN; | 97 modifiers |= ui::EF_SHIFT_DOWN; |
| 98 if (mask & ControlMask) | 98 if (mask & ControlMask) |
| 99 modifiers |= ui::EF_CONTROL_DOWN; | 99 modifiers |= ui::EF_CONTROL_DOWN; |
| 100 if (mask & Mod1Mask) | 100 if (mask & Mod1Mask) |
| 101 modifiers |= ui::EF_ALT_DOWN; | 101 modifiers |= ui::EF_ALT_DOWN; |
| 102 if (mask & Mod4Mask) | 102 if (mask & Mod4Mask) |
| 103 modifiers |= ui::EF_COMMAND_DOWN; | 103 modifiers |= ui::EF_COMMAND_DOWN; |
| 104 if (mask & Button1Mask) |
| 105 modifiers |= ui::EF_LEFT_MOUSE_BUTTON; |
| 106 if (mask & Button2Mask) |
| 107 modifiers |= ui::EF_MIDDLE_MOUSE_BUTTON; |
| 108 if (mask & Button3Mask) |
| 109 modifiers |= ui::EF_RIGHT_MOUSE_BUTTON; |
| 104 return modifiers; | 110 return modifiers; |
| 105 } | 111 } |
| 106 | 112 |
| 107 // The time to wait for the target to respond after the user has released the | 113 // The time to wait for the target to respond after the user has released the |
| 108 // mouse button before ending the move loop. | 114 // mouse button before ending the move loop. |
| 109 const int kEndMoveLoopTimeoutMs = 1000; | 115 const int kEndMoveLoopTimeoutMs = 1000; |
| 110 | 116 |
| 111 // The time to wait since sending the last XdndPosition message before | 117 // The time to wait since sending the last XdndPosition message before |
| 112 // reprocessing the most recent mouse move event in case that the window | 118 // reprocessing the most recent mouse move event in case that the window |
| 113 // stacking order has changed and |source_current_window_| needs to be updated. | 119 // stacking order has changed and |source_current_window_| needs to be updated. |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 int flags, | 763 int flags, |
| 758 base::TimeDelta event_time) { | 764 base::TimeDelta event_time) { |
| 759 if (drag_widget_.get()) { | 765 if (drag_widget_.get()) { |
| 760 drag_widget_->SetBounds( | 766 drag_widget_->SetBounds( |
| 761 gfx::Rect(screen_point - drag_widget_offset_, | 767 gfx::Rect(screen_point - drag_widget_offset_, |
| 762 drag_widget_->GetWindowBoundsInScreen().size())); | 768 drag_widget_->GetWindowBoundsInScreen().size())); |
| 763 drag_widget_->StackAtTop(); | 769 drag_widget_->StackAtTop(); |
| 764 } | 770 } |
| 765 | 771 |
| 766 const int kModifiers = ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | | 772 const int kModifiers = ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN | |
| 767 ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN; | 773 ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN | |
| 774 ui::EF_LEFT_MOUSE_BUTTON | |
| 775 ui::EF_MIDDLE_MOUSE_BUTTON | |
| 776 ui::EF_RIGHT_MOUSE_BUTTON; |
| 768 current_modifier_state_ = flags & kModifiers; | 777 current_modifier_state_ = flags & kModifiers; |
| 769 | 778 |
| 770 repeat_mouse_move_timer_.Stop(); | 779 repeat_mouse_move_timer_.Stop(); |
| 771 ProcessMouseMove(screen_point, event_time.InMilliseconds()); | 780 ProcessMouseMove(screen_point, event_time.InMilliseconds()); |
| 772 } | 781 } |
| 773 | 782 |
| 774 void DesktopDragDropClientAuraX11::OnMouseReleased() { | 783 void DesktopDragDropClientAuraX11::OnMouseReleased() { |
| 775 repeat_mouse_move_timer_.Stop(); | 784 repeat_mouse_move_timer_.Stop(); |
| 776 | 785 |
| 777 if (source_state_ != SOURCE_STATE_OTHER) { | 786 if (source_state_ != SOURCE_STATE_OTHER) { |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 for (int x = 0; x < in_bitmap->width(); ++x) { | 1218 for (int x = 0; x < in_bitmap->width(); ++x) { |
| 1210 if (SkColorGetA(in_row[x]) > kMinAlpha) | 1219 if (SkColorGetA(in_row[x]) > kMinAlpha) |
| 1211 return true; | 1220 return true; |
| 1212 } | 1221 } |
| 1213 } | 1222 } |
| 1214 | 1223 |
| 1215 return false; | 1224 return false; |
| 1216 } | 1225 } |
| 1217 | 1226 |
| 1218 } // namespace views | 1227 } // namespace views |
| OLD | NEW |