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

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

Issue 10408037: aura: Fix the sythentic mouse-event location. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: alternate-fix Created 8 years, 7 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 | Annotate | Revision Log
« 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 13 matching lines...) Expand all
24 #include "ui/aura/window.h" 24 #include "ui/aura/window.h"
25 #include "ui/aura/window_delegate.h" 25 #include "ui/aura/window_delegate.h"
26 #include "ui/base/gestures/gesture_recognizer.h" 26 #include "ui/base/gestures/gesture_recognizer.h"
27 #include "ui/base/gestures/gesture_types.h" 27 #include "ui/base/gestures/gesture_types.h"
28 #include "ui/base/hit_test.h" 28 #include "ui/base/hit_test.h"
29 #include "ui/compositor/compositor.h" 29 #include "ui/compositor/compositor.h"
30 #include "ui/compositor/dip_util.h" 30 #include "ui/compositor/dip_util.h"
31 #include "ui/compositor/layer.h" 31 #include "ui/compositor/layer.h"
32 #include "ui/compositor/layer_animator.h" 32 #include "ui/compositor/layer_animator.h"
33 #include "ui/gfx/monitor.h" 33 #include "ui/gfx/monitor.h"
34 #include "ui/gfx/point3.h"
34 #include "ui/gfx/screen.h" 35 #include "ui/gfx/screen.h"
35 36
36 using std::vector; 37 using std::vector;
37 38
38 namespace aura { 39 namespace aura {
39 40
40 namespace { 41 namespace {
41 42
42 // These are the mouse events generated when a gesture goes unprocessed. 43 // These are the mouse events generated when a gesture goes unprocessed.
43 const ui::EventType kScrollBeginTypes[] = { 44 const ui::EventType kScrollBeginTypes[] = {
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 base::Bind(&RootWindow::SynthesizeMouseMoveEvent, 997 base::Bind(&RootWindow::SynthesizeMouseMoveEvent,
997 event_factory_.GetWeakPtr())); 998 event_factory_.GetWeakPtr()));
998 } 999 }
999 1000
1000 void RootWindow::SynthesizeMouseMoveEvent() { 1001 void RootWindow::SynthesizeMouseMoveEvent() {
1001 if (!synthesize_mouse_move_) 1002 if (!synthesize_mouse_move_)
1002 return; 1003 return;
1003 synthesize_mouse_move_ = false; 1004 synthesize_mouse_move_ = false;
1004 #if !defined(OS_WIN) 1005 #if !defined(OS_WIN)
1005 // Temporarily disabled for windows. See crbug.com/112222. 1006 // Temporarily disabled for windows. See crbug.com/112222.
1006 gfx::Point orig_mouse_location = last_mouse_location_; 1007 gfx::Point3f point(last_mouse_location_);
1007 layer()->transform().TransformPoint(orig_mouse_location); 1008 ui::Transform transform = layer()->transform();
1009 float scale = ui::GetDeviceScaleFactor(layer());
1010 transform.ConcatScale(scale, scale);
1011 transform.TransformPoint(point);
1012 gfx::Point orig_mouse_location = point.AsPoint();
1008 1013
1009 // TODO(derat|oshima): Don't use mouse_button_flags_ as it's 1014 // TODO(derat|oshima): Don't use mouse_button_flags_ as it's
1010 // currently broken. See/ crbug.com/107931. 1015 // currently broken. See/ crbug.com/107931.
1011 MouseEvent event(ui::ET_MOUSE_MOVED, 1016 MouseEvent event(ui::ET_MOUSE_MOVED,
1012 orig_mouse_location, 1017 orig_mouse_location,
1013 orig_mouse_location, 1018 orig_mouse_location,
1014 ui::EF_IS_SYNTHESIZED); 1019 ui::EF_IS_SYNTHESIZED);
1015 DispatchMouseEvent(&event); 1020 DispatchMouseEvent(&event);
1016 #endif 1021 #endif
1017 } 1022 }
1018 1023
1019 void RootWindow::UnlockCompositor() { 1024 void RootWindow::UnlockCompositor() {
1020 DCHECK(compositor_lock_); 1025 DCHECK(compositor_lock_);
1021 compositor_lock_ = NULL; 1026 compositor_lock_ = NULL;
1022 if (draw_on_compositor_unlock_) { 1027 if (draw_on_compositor_unlock_) {
1023 draw_on_compositor_unlock_ = false; 1028 draw_on_compositor_unlock_ = false;
1024 ScheduleDraw(); 1029 ScheduleDraw();
1025 } 1030 }
1026 } 1031 }
1027 1032
1028 } // namespace aura 1033 } // namespace aura
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