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/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" | 5 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" |
6 | 6 |
7 #include <gestures/gestures.h> | 7 #include <gestures/gestures.h> |
8 #include <libevdev/libevdev.h> | 8 #include <libevdev/libevdev.h> |
9 | 9 |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 DispatchMouseButton(EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON, true); | 243 DispatchMouseButton(EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON, true); |
244 if (buttons->up & GESTURES_BUTTON_LEFT) | 244 if (buttons->up & GESTURES_BUTTON_LEFT) |
245 DispatchMouseButton(EVDEV_MODIFIER_LEFT_MOUSE_BUTTON, false); | 245 DispatchMouseButton(EVDEV_MODIFIER_LEFT_MOUSE_BUTTON, false); |
246 if (buttons->up & GESTURES_BUTTON_MIDDLE) | 246 if (buttons->up & GESTURES_BUTTON_MIDDLE) |
247 DispatchMouseButton(EVDEV_MODIFIER_MIDDLE_MOUSE_BUTTON, false); | 247 DispatchMouseButton(EVDEV_MODIFIER_MIDDLE_MOUSE_BUTTON, false); |
248 if (buttons->up & GESTURES_BUTTON_RIGHT) | 248 if (buttons->up & GESTURES_BUTTON_RIGHT) |
249 DispatchMouseButton(EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON, false); | 249 DispatchMouseButton(EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON, false); |
250 } | 250 } |
251 | 251 |
252 void GestureInterpreterLibevdevCros::Dispatch(Event* event) { | 252 void GestureInterpreterLibevdevCros::Dispatch(Event* event) { |
| 253 event->set_window(cursor_->window()); |
253 dispatch_callback_.Run(event); | 254 dispatch_callback_.Run(event); |
254 } | 255 } |
255 | 256 |
256 void GestureInterpreterLibevdevCros::DispatchMouseButton(unsigned int modifier, | 257 void GestureInterpreterLibevdevCros::DispatchMouseButton(unsigned int modifier, |
257 bool down) { | 258 bool down) { |
258 const gfx::PointF& loc = cursor_->location(); | 259 const gfx::PointF& loc = cursor_->location(); |
259 int flag = modifiers_->GetEventFlagFromModifier(modifier); | 260 int flag = modifiers_->GetEventFlagFromModifier(modifier); |
260 EventType type = (down ? ET_MOUSE_PRESSED : ET_MOUSE_RELEASED); | 261 EventType type = (down ? ET_MOUSE_PRESSED : ET_MOUSE_RELEASED); |
261 modifiers_->UpdateModifier(modifier, down); | 262 modifiers_->UpdateModifier(modifier, down); |
262 MouseEvent event(type, loc, loc, modifiers_->GetModifierFlags() | flag, flag); | 263 MouseEvent event(type, loc, loc, modifiers_->GetModifierFlags() | flag, flag); |
263 Dispatch(&event); | 264 Dispatch(&event); |
264 } | 265 } |
265 | 266 |
266 } // namespace ui | 267 } // namespace ui |
OLD | NEW |