| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/events/ozone/evdev/event_converter_evdev_impl.h" | 5 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <linux/input.h> | 8 #include <linux/input.h> |
| 9 | 9 |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 modifier = EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON; | 104 modifier = EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON; |
| 105 else if (input.code == BTN_MIDDLE) | 105 else if (input.code == BTN_MIDDLE) |
| 106 modifier = EVDEV_MODIFIER_MIDDLE_MOUSE_BUTTON; | 106 modifier = EVDEV_MODIFIER_MIDDLE_MOUSE_BUTTON; |
| 107 else | 107 else |
| 108 return; | 108 return; |
| 109 | 109 |
| 110 int flag = modifiers_->GetEventFlagFromModifier(modifier); | 110 int flag = modifiers_->GetEventFlagFromModifier(modifier); |
| 111 modifiers_->UpdateModifier(modifier, input.value); | 111 modifiers_->UpdateModifier(modifier, input.value); |
| 112 callback_.Run(make_scoped_ptr( | 112 callback_.Run(make_scoped_ptr( |
| 113 new MouseEvent(input.value ? ET_MOUSE_PRESSED : ET_MOUSE_RELEASED, | 113 new MouseEvent(input.value ? ET_MOUSE_PRESSED : ET_MOUSE_RELEASED, |
| 114 cursor_->location(), | 114 cursor_->GetLocation(), |
| 115 cursor_->location(), | 115 cursor_->GetRootLocation(), |
| 116 modifiers_->GetModifierFlags() | flag, | 116 modifiers_->GetModifierFlags() | flag, |
| 117 flag))); | 117 flag))); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void EventConverterEvdevImpl::FlushEvents() { | 120 void EventConverterEvdevImpl::FlushEvents() { |
| 121 if (!cursor_ || (x_offset_ == 0 && y_offset_ == 0)) | 121 if (!cursor_ || (x_offset_ == 0 && y_offset_ == 0)) |
| 122 return; | 122 return; |
| 123 | 123 |
| 124 cursor_->MoveCursor(gfx::Vector2dF(x_offset_, y_offset_)); | 124 cursor_->MoveCursor(gfx::Vector2dF(x_offset_, y_offset_)); |
| 125 | 125 |
| 126 callback_.Run(make_scoped_ptr( | 126 callback_.Run(make_scoped_ptr( |
| 127 new MouseEvent(ui::ET_MOUSE_MOVED, | 127 new MouseEvent(ui::ET_MOUSE_MOVED, |
| 128 cursor_->location(), | 128 cursor_->GetLocation(), |
| 129 cursor_->location(), | 129 cursor_->GetRootLocation(), |
| 130 modifiers_->GetModifierFlags(), | 130 modifiers_->GetModifierFlags(), |
| 131 /* changed_button_flags */ 0))); | 131 /* changed_button_flags */ 0))); |
| 132 x_offset_ = 0; | 132 x_offset_ = 0; |
| 133 y_offset_ = 0; | 133 y_offset_ = 0; |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace ui | 136 } // namespace ui |
| OLD | NEW |