Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: ui/ozone/platform/wayland/wayland_pointer.cc

Issue 2786693002: Add PointerDetails to ui::MouseEvent's constructors (Closed)
Patch Set: mouse event constructor Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ozone/platform/wayland/wayland_pointer.h" 5 #include "ui/ozone/platform/wayland/wayland_pointer.h"
6 6
7 #include <linux/input.h> 7 #include <linux/input.h>
8 #include <wayland-client.h> 8 #include <wayland-client.h>
9 9
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 void WaylandPointer::Motion(void* data, 54 void WaylandPointer::Motion(void* data,
55 wl_pointer* obj, 55 wl_pointer* obj,
56 uint32_t time, 56 uint32_t time,
57 wl_fixed_t surface_x, 57 wl_fixed_t surface_x,
58 wl_fixed_t surface_y) { 58 wl_fixed_t surface_y) {
59 WaylandPointer* pointer = static_cast<WaylandPointer*>(data); 59 WaylandPointer* pointer = static_cast<WaylandPointer*>(data);
60 pointer->location_.SetPoint(wl_fixed_to_double(surface_x), 60 pointer->location_.SetPoint(wl_fixed_to_double(surface_x),
61 wl_fixed_to_double(surface_y)); 61 wl_fixed_to_double(surface_y));
62 MouseEvent event(ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), 62 MouseEvent event(ET_MOUSE_MOVED, gfx::Point(), gfx::Point(),
63 base::TimeTicks() + base::TimeDelta::FromMilliseconds(time), 63 base::TimeTicks() + base::TimeDelta::FromMilliseconds(time),
64 pointer->flags_, 0); 64 pointer->flags_, 0,
65 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
66 ui::PointerEvent::kMousePointerId));
65 event.set_location_f(pointer->location_); 67 event.set_location_f(pointer->location_);
66 event.set_root_location_f(pointer->location_); 68 event.set_root_location_f(pointer->location_);
67 pointer->callback_.Run(&event); 69 pointer->callback_.Run(&event);
68 } 70 }
69 71
70 // static 72 // static
71 void WaylandPointer::Button(void* data, 73 void WaylandPointer::Button(void* data,
72 wl_pointer* obj, 74 wl_pointer* obj,
73 uint32_t serial, 75 uint32_t serial,
74 uint32_t time, 76 uint32_t time,
(...skipping 24 matching lines...) Expand all
99 EventType type; 101 EventType type;
100 if (state == WL_POINTER_BUTTON_STATE_PRESSED) { 102 if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
101 type = ET_MOUSE_PRESSED; 103 type = ET_MOUSE_PRESSED;
102 pointer->flags_ |= flag; 104 pointer->flags_ |= flag;
103 } else { 105 } else {
104 type = ET_MOUSE_RELEASED; 106 type = ET_MOUSE_RELEASED;
105 pointer->flags_ &= ~flag; 107 pointer->flags_ &= ~flag;
106 } 108 }
107 MouseEvent event(type, gfx::Point(), gfx::Point(), 109 MouseEvent event(type, gfx::Point(), gfx::Point(),
108 base::TimeTicks() + base::TimeDelta::FromMilliseconds(time), 110 base::TimeTicks() + base::TimeDelta::FromMilliseconds(time),
109 flags, flag); 111 flags, flag,
112 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
113 ui::PointerEvent::kMousePointerId));
110 event.set_location_f(pointer->location_); 114 event.set_location_f(pointer->location_);
111 event.set_root_location_f(pointer->location_); 115 event.set_root_location_f(pointer->location_);
112 pointer->callback_.Run(&event); 116 pointer->callback_.Run(&event);
113 } 117 }
114 118
115 // static 119 // static
116 void WaylandPointer::Axis(void* data, 120 void WaylandPointer::Axis(void* data,
117 wl_pointer* obj, 121 wl_pointer* obj,
118 uint32_t time, 122 uint32_t time,
119 uint32_t axis, 123 uint32_t axis,
(...skipping 17 matching lines...) Expand all
137 MouseWheelEvent event( 141 MouseWheelEvent event(
138 offset, gfx::Point(), gfx::Point(), 142 offset, gfx::Point(), gfx::Point(),
139 base::TimeTicks() + base::TimeDelta::FromMilliseconds(time), 143 base::TimeTicks() + base::TimeDelta::FromMilliseconds(time),
140 pointer->flags_, 0); 144 pointer->flags_, 0);
141 event.set_location_f(pointer->location_); 145 event.set_location_f(pointer->location_);
142 event.set_root_location_f(pointer->location_); 146 event.set_root_location_f(pointer->location_);
143 pointer->callback_.Run(&event); 147 pointer->callback_.Run(&event);
144 } 148 }
145 149
146 } // namespace ui 150 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698