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

Side by Side Diff: components/exo/pointer.cc

Issue 1750633002: components/exo: Extend pointer to use v5 protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit tests Created 4 years, 9 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
« no previous file with comments | « no previous file | components/exo/pointer_delegate.h » ('j') | components/exo/pointer_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/exo/pointer.h" 5 #include "components/exo/pointer.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "components/exo/pointer_delegate.h" 9 #include "components/exo/pointer_delegate.h"
10 #include "components/exo/surface.h" 10 #include "components/exo/surface.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // but OnPointerMotion should only be called if location changed since 110 // but OnPointerMotion should only be called if location changed since
111 // OnPointerEnter was called. 111 // OnPointerEnter was called.
112 if (focus_ && event->location() != location_) { 112 if (focus_ && event->location() != location_) {
113 delegate_->OnPointerMotion(event->time_stamp(), event->location()); 113 delegate_->OnPointerMotion(event->time_stamp(), event->location());
114 location_ = event->location(); 114 location_ = event->location();
115 } 115 }
116 break; 116 break;
117 case ui::ET_SCROLL: 117 case ui::ET_SCROLL:
118 if (focus_) { 118 if (focus_) {
119 ui::ScrollEvent* scroll_event = static_cast<ui::ScrollEvent*>(event); 119 ui::ScrollEvent* scroll_event = static_cast<ui::ScrollEvent*>(event);
120 delegate_->OnPointerWheel( 120 delegate_->OnPointerScroll(
121 event->time_stamp(), 121 event->time_stamp(),
122 gfx::Vector2d(scroll_event->x_offset(), scroll_event->y_offset())); 122 gfx::Vector2dF(scroll_event->x_offset(), scroll_event->y_offset()),
123 false);
123 } 124 }
124 break; 125 break;
125 case ui::ET_MOUSEWHEEL: 126 case ui::ET_MOUSEWHEEL:
126 if (focus_) { 127 if (focus_) {
127 delegate_->OnPointerWheel( 128 delegate_->OnPointerScroll(
128 event->time_stamp(), 129 event->time_stamp(),
129 static_cast<ui::MouseWheelEvent*>(event)->offset()); 130 static_cast<ui::MouseWheelEvent*>(event)->offset(), true);
131 }
132 break;
133 case ui::ET_SCROLL_FLING_START:
134 if (focus_) {
reveman 2016/03/02 04:16:53 nit: not need for "{" "}"
denniskempin 2016/03/02 20:47:58 Done.
135 delegate_->OnPointerScrollStop(event->time_stamp());
136 }
137 break;
138 case ui::ET_SCROLL_FLING_CANCEL:
139 if (focus_) {
140 // Wayland doesn't know the concept of a fling cancel. But we can send a
reveman 2016/03/02 04:16:52 nit: please add a OnPointerScrollStart (feel free
denniskempin 2016/03/02 20:47:58 Done.
141 // zero distance scroll to stop any kinetic scrolling that might be
142 // going on.
143 delegate_->OnPointerScroll(event->time_stamp(), gfx::Vector2dF(0, 0),
144 false);
130 } 145 }
131 break; 146 break;
132 case ui::ET_MOUSE_ENTERED: 147 case ui::ET_MOUSE_ENTERED:
133 case ui::ET_MOUSE_EXITED: 148 case ui::ET_MOUSE_EXITED:
134 case ui::ET_MOUSE_CAPTURE_CHANGED: 149 case ui::ET_MOUSE_CAPTURE_CHANGED:
135 case ui::ET_SCROLL_FLING_START:
136 case ui::ET_SCROLL_FLING_CANCEL:
137 break; 150 break;
138 default: 151 default:
139 NOTREACHED(); 152 NOTREACHED();
140 break; 153 break;
141 } 154 }
142 155
156 if (focus_) {
reveman 2016/03/02 04:16:52 nit: not need for "{" "}"
denniskempin 2016/03/02 20:47:58 Done.
157 delegate_->OnPointerFrame();
158 }
159
143 // Update cursor widget to reflect current focus and pointer location. 160 // Update cursor widget to reflect current focus and pointer location.
144 if (focus_) { 161 if (focus_) {
145 if (!widget_) 162 if (!widget_)
146 CreatePointerWidget(); 163 CreatePointerWidget();
147 widget_->SetBounds(gfx::Rect( 164 widget_->SetBounds(gfx::Rect(
148 focus_->GetBoundsInScreen().origin() + location_.OffsetFromOrigin(), 165 focus_->GetBoundsInScreen().origin() + location_.OffsetFromOrigin(),
149 gfx::Size(1, 1))); 166 gfx::Size(1, 1)));
150 if (!widget_->IsVisible()) 167 if (!widget_->IsVisible())
151 widget_->Show(); 168 widget_->Show();
152 } else { 169 } else {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 Surface* Pointer::GetEffectiveTargetForEvent(ui::Event* event) const { 226 Surface* Pointer::GetEffectiveTargetForEvent(ui::Event* event) const {
210 Surface* target = 227 Surface* target =
211 Surface::AsSurface(static_cast<aura::Window*>(event->target())); 228 Surface::AsSurface(static_cast<aura::Window*>(event->target()));
212 if (!target) 229 if (!target)
213 return nullptr; 230 return nullptr;
214 231
215 return delegate_->CanAcceptPointerEventsForSurface(target) ? target : nullptr; 232 return delegate_->CanAcceptPointerEventsForSurface(target) ? target : nullptr;
216 } 233 }
217 234
218 } // namespace exo 235 } // namespace exo
OLDNEW
« no previous file with comments | « no previous file | components/exo/pointer_delegate.h » ('j') | components/exo/pointer_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698