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

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

Issue 2342413002: exo: Send pointer location before button event (Closed)
Patch Set: Created 4 years, 3 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 | no next file » | no next file with comments »
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/common/shell_window_ids.h" 7 #include "ash/common/shell_window_ids.h"
8 #include "ash/display/display_manager.h" 8 #include "ash/display/display_manager.h"
9 #include "components/exo/pointer_delegate.h" 9 #include "components/exo/pointer_delegate.h"
10 #include "components/exo/pointer_stylus_delegate.h" 10 #include "components/exo/pointer_stylus_delegate.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 // Report changes in pointer type. 168 // Report changes in pointer type.
169 if (focus_ && stylus_delegate_ && new_pointer_type != pointer_type_) { 169 if (focus_ && stylus_delegate_ && new_pointer_type != pointer_type_) {
170 stylus_delegate_->OnPointerToolChange(new_pointer_type); 170 stylus_delegate_->OnPointerToolChange(new_pointer_type);
171 pointer_type_ = new_pointer_type; 171 pointer_type_ = new_pointer_type;
172 } 172 }
173 173
174 switch (event->type()) { 174 switch (event->type()) {
175 case ui::ET_MOUSE_PRESSED: 175 case ui::ET_MOUSE_PRESSED:
176 case ui::ET_MOUSE_RELEASED: 176 case ui::ET_MOUSE_RELEASED:
177 if (focus_) {
178 delegate_->OnPointerButton(event->time_stamp(),
179 event->changed_button_flags(),
180 event->type() == ui::ET_MOUSE_PRESSED);
181 delegate_->OnPointerFrame();
182 }
183 break;
184 case ui::ET_MOUSE_MOVED: 177 case ui::ET_MOUSE_MOVED:
185 case ui::ET_MOUSE_DRAGGED: 178 case ui::ET_MOUSE_DRAGGED:
186 if (focus_) { 179 if (focus_) {
187 bool send_frame = false; 180 bool send_frame = false;
188 // Generate motion event if location changed. We need to check location 181 // Generate motion event if location changed. We need to check location
189 // here as mouse movement can generate both "moved" and "entered" events 182 // here as mouse movement can generate both "moved" and "entered" events
190 // but OnPointerMotion should only be called if location changed since 183 // but OnPointerMotion should only be called if location changed since
191 // OnPointerEnter was called. 184 // OnPointerEnter was called.
192 if (!SameLocation(event, location_)) { 185 if (!SameLocation(event, location_)) {
193 location_ = event->location_f(); 186 location_ = event->location_f();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 break; 242 break;
250 case ui::ET_MOUSE_ENTERED: 243 case ui::ET_MOUSE_ENTERED:
251 case ui::ET_MOUSE_EXITED: 244 case ui::ET_MOUSE_EXITED:
252 case ui::ET_MOUSE_CAPTURE_CHANGED: 245 case ui::ET_MOUSE_CAPTURE_CHANGED:
253 break; 246 break;
254 default: 247 default:
255 NOTREACHED(); 248 NOTREACHED();
256 break; 249 break;
257 } 250 }
258 251
252 if (focus_ && (event->type() == ui::ET_MOUSE_PRESSED ||
253 event->type() == ui::ET_MOUSE_RELEASED)) {
254 delegate_->OnPointerButton(event->time_stamp(),
255 event->changed_button_flags(),
256 event->type() == ui::ET_MOUSE_PRESSED);
257 delegate_->OnPointerFrame();
258 }
reveman 2016/09/16 17:11:26 I'm failing to see how this change makes any diffe
259
259 if ((event->flags() & ui::EF_IS_SYNTHESIZED) == 0) 260 if ((event->flags() & ui::EF_IS_SYNTHESIZED) == 0)
260 is_direct_input_ = (event->flags() & ui::EF_DIRECT_INPUT) != 0; 261 is_direct_input_ = (event->flags() & ui::EF_DIRECT_INPUT) != 0;
261 262
262 // Update cursor widget to reflect current focus and pointer location. 263 // Update cursor widget to reflect current focus and pointer location.
263 if (focus_ && !is_direct_input_) { 264 if (focus_ && !is_direct_input_) {
264 if (!widget_) 265 if (!widget_)
265 CreatePointerWidget(); 266 CreatePointerWidget();
266 267
267 // Update cursor location if mouse event caused it to change. 268 // Update cursor location if mouse event caused it to change.
268 gfx::Point mouse_location = aura::Env::GetInstance()->last_mouse_location(); 269 gfx::Point mouse_location = aura::Env::GetInstance()->last_mouse_location();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 363
363 if (ui_scale != cursor_scale_) { 364 if (ui_scale != cursor_scale_) {
364 gfx::Transform transform; 365 gfx::Transform transform;
365 transform.Scale(ui_scale, ui_scale); 366 transform.Scale(ui_scale, ui_scale);
366 widget_->GetNativeWindow()->SetTransform(transform); 367 widget_->GetNativeWindow()->SetTransform(transform);
367 cursor_scale_ = ui_scale; 368 cursor_scale_ = ui_scale;
368 } 369 }
369 } 370 }
370 371
371 } // namespace exo 372 } // namespace exo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698