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/tablet_event_converter_evdev.h" | 5 #include "ui/events/ozone/evdev/tablet_event_converter_evdev.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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 else | 134 else |
135 return; | 135 return; |
136 | 136 |
137 if (abs_value_dirty_) { | 137 if (abs_value_dirty_) { |
138 UpdateCursor(); | 138 UpdateCursor(); |
139 abs_value_dirty_ = false; | 139 abs_value_dirty_ = false; |
140 } | 140 } |
141 | 141 |
142 int flag = modifiers_->GetEventFlagFromModifier(modifier); | 142 int flag = modifiers_->GetEventFlagFromModifier(modifier); |
143 modifiers_->UpdateModifier(modifier, input.value); | 143 modifiers_->UpdateModifier(modifier, input.value); |
144 callback_.Run(make_scoped_ptr(new MouseEvent( | 144 callback_.Run(make_scoped_ptr( |
145 input.value ? ET_MOUSE_PRESSED : ET_MOUSE_RELEASED, cursor_->location(), | 145 new MouseEvent(input.value ? ET_MOUSE_PRESSED : ET_MOUSE_RELEASED, |
146 cursor_->location(), modifiers_->GetModifierFlags() | flag, flag))); | 146 cursor_->GetLocation(), cursor_->GetLocation(), |
| 147 modifiers_->GetModifierFlags() | flag, flag))); |
147 } | 148 } |
148 | 149 |
149 void TabletEventConverterEvdev::FlushEvents() { | 150 void TabletEventConverterEvdev::FlushEvents() { |
150 if (!cursor_) | 151 if (!cursor_) |
151 return; | 152 return; |
152 | 153 |
153 // Prevent propagation of invalid data on stylus lift off | 154 // Prevent propagation of invalid data on stylus lift off |
154 if (stylus_ == 0) { | 155 if (stylus_ == 0) { |
155 abs_value_dirty_ = false; | 156 abs_value_dirty_ = false; |
156 return; | 157 return; |
157 } | 158 } |
158 | 159 |
159 if (!abs_value_dirty_) | 160 if (!abs_value_dirty_) |
160 return; | 161 return; |
161 | 162 |
162 UpdateCursor(); | 163 UpdateCursor(); |
163 | 164 |
164 callback_.Run(make_scoped_ptr( | 165 callback_.Run(make_scoped_ptr( |
165 new MouseEvent(ui::ET_MOUSE_MOVED, cursor_->location(), | 166 new MouseEvent(ui::ET_MOUSE_MOVED, cursor_->GetLocation(), |
166 cursor_->location(), modifiers_->GetModifierFlags(), | 167 cursor_->GetLocation(), modifiers_->GetModifierFlags(), |
167 /* changed_button_flags */ 0))); | 168 /* changed_button_flags */ 0))); |
168 | 169 |
169 abs_value_dirty_ = false; | 170 abs_value_dirty_ = false; |
170 } | 171 } |
171 | 172 |
172 } // namespace ui | 173 } // namespace ui |
OLD | NEW |