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

Side by Side Diff: ui/aura/env_input_state_controller.cc

Issue 2933353003: Mark the ET_MOUSE_MOVED created from a pointer grab as synthesized. (Closed)
Patch Set: Clarify comment. Created 3 years, 5 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/aura/env_input_state_controller.h" 5 #include "ui/aura/env_input_state_controller.h"
6 6
7 #include "ui/aura/client/screen_position_client.h" 7 #include "ui/aura/client/screen_position_client.h"
8 #include "ui/aura/env.h" 8 #include "ui/aura/env.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/gfx/geometry/point.h" 10 #include "ui/gfx/geometry/point.h"
11 11
12 namespace aura { 12 namespace aura {
13 13
14 void EnvInputStateController::UpdateStateForMouseEvent( 14 void EnvInputStateController::UpdateStateForMouseEvent(
15 const Window* window, 15 const Window* window,
16 const ui::MouseEvent& event) { 16 const ui::MouseEvent& event) {
17 switch (event.type()) { 17 switch (event.type()) {
18 case ui::ET_MOUSE_PRESSED: 18 case ui::ET_MOUSE_PRESSED:
19 Env::GetInstance()->set_mouse_button_flags(event.button_flags()); 19 Env::GetInstance()->set_mouse_button_flags(event.button_flags());
20 break; 20 break;
21 case ui::ET_MOUSE_RELEASED: 21 case ui::ET_MOUSE_RELEASED:
22 Env::GetInstance()->set_mouse_button_flags( 22 Env::GetInstance()->set_mouse_button_flags(
23 event.button_flags() & ~event.changed_button_flags()); 23 event.button_flags() & ~event.changed_button_flags());
24 break; 24 break;
25 default: 25 default:
26 break; 26 break;
27 } 27 }
28 28
29 // If a synthesized event is created from a native event (e.g. EnterNotify
30 // XEvents), then we should take the location as we would for a
31 // non-synthesized event.
29 if (event.type() != ui::ET_MOUSE_CAPTURE_CHANGED && 32 if (event.type() != ui::ET_MOUSE_CAPTURE_CHANGED &&
30 !(event.flags() & ui::EF_IS_SYNTHESIZED)) { 33 (!(event.flags() & ui::EF_IS_SYNTHESIZED) || event.HasNativeEvent())) {
31 SetLastMouseLocation(window, event.root_location()); 34 SetLastMouseLocation(window, event.root_location());
32 } 35 }
33 } 36 }
34 37
35 void EnvInputStateController::UpdateStateForTouchEvent( 38 void EnvInputStateController::UpdateStateForTouchEvent(
36 const ui::TouchEvent& event) { 39 const ui::TouchEvent& event) {
37 switch (event.type()) { 40 switch (event.type()) {
38 case ui::ET_TOUCH_PRESSED: 41 case ui::ET_TOUCH_PRESSED:
39 touch_ids_down_ |= (1 << event.pointer_details().id); 42 touch_ids_down_ |= (1 << event.pointer_details().id);
40 Env::GetInstance()->set_touch_down(touch_ids_down_ != 0); 43 Env::GetInstance()->set_touch_down(touch_ids_down_ != 0);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if (client) { 76 if (client) {
74 gfx::Point location_in_screen = location_in_root; 77 gfx::Point location_in_screen = location_in_root;
75 client->ConvertPointToScreen(root_window, &location_in_screen); 78 client->ConvertPointToScreen(root_window, &location_in_screen);
76 Env::GetInstance()->set_last_mouse_location(location_in_screen); 79 Env::GetInstance()->set_last_mouse_location(location_in_screen);
77 } else { 80 } else {
78 Env::GetInstance()->set_last_mouse_location(location_in_root); 81 Env::GetInstance()->set_last_mouse_location(location_in_root);
79 } 82 }
80 } 83 }
81 84
82 } // namespace aura 85 } // namespace aura
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura_browsertest.cc ('k') | ui/aura/window_tree_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698