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

Side by Side Diff: ash/display/event_transformation_handler.cc

Issue 226183004: Renamed OutputConfigurator to DisplayConfigurator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/display/output_configurator_animation.h » ('j') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ash/display/event_transformation_handler.h" 5 #include "ash/display/event_transformation_handler.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/coordinate_conversion.h" 10 #include "ash/wm/coordinate_conversion.h"
11 #include "ash/wm/window_util.h" 11 #include "ash/wm/window_util.h"
12 #include "ui/aura/window.h" 12 #include "ui/aura/window.h"
13 #include "ui/aura/window_event_dispatcher.h" 13 #include "ui/aura/window_event_dispatcher.h"
14 #include "ui/compositor/dip_util.h" 14 #include "ui/compositor/dip_util.h"
15 #include "ui/events/event.h" 15 #include "ui/events/event.h"
16 #include "ui/gfx/display.h" 16 #include "ui/gfx/display.h"
17 #include "ui/gfx/screen.h" 17 #include "ui/gfx/screen.h"
18 18
19 #if defined(OS_CHROMEOS) 19 #if defined(OS_CHROMEOS)
20 #include "ui/display/chromeos/output_configurator.h" 20 #include "ui/display/chromeos/display_configurator.h"
21 #endif // defined(OS_CHROMEOS) 21 #endif // defined(OS_CHROMEOS)
22 22
23 namespace ash { 23 namespace ash {
24 namespace { 24 namespace {
25 25
26 // Boost factor for non-integrated displays. 26 // Boost factor for non-integrated displays.
27 const float kBoostForNonIntegrated = 1.20f; 27 const float kBoostForNonIntegrated = 1.20f;
28 } 28 }
29 29
30 EventTransformationHandler::EventTransformationHandler() 30 EventTransformationHandler::EventTransformationHandler()
(...skipping 21 matching lines...) Expand all
52 } 52 }
53 53
54 #if defined(OS_CHROMEOS) 54 #if defined(OS_CHROMEOS)
55 // This is to scale the TouchEvent's radius when the touch display is in 55 // This is to scale the TouchEvent's radius when the touch display is in
56 // mirror mode. TouchEvent's radius is often reported in the touchscreen's 56 // mirror mode. TouchEvent's radius is often reported in the touchscreen's
57 // native resolution. In mirror mode, the touch display could be configured 57 // native resolution. In mirror mode, the touch display could be configured
58 // at a lower resolution. We scale down the radius using the ratio defined as 58 // at a lower resolution. We scale down the radius using the ratio defined as
59 // the sqrt of 59 // the sqrt of
60 // (mirror_width * mirror_height) / (native_width * native_height) 60 // (mirror_width * mirror_height) / (native_width * native_height)
61 void EventTransformationHandler::OnTouchEvent(ui::TouchEvent* event) { 61 void EventTransformationHandler::OnTouchEvent(ui::TouchEvent* event) {
62 using ui::OutputConfigurator; 62 using ui::DisplayConfigurator;
63 OutputConfigurator* output_configurator = 63 DisplayConfigurator* display_configurator =
64 ash::Shell::GetInstance()->output_configurator(); 64 ash::Shell::GetInstance()->display_configurator();
65 65
66 // Check output_configurator's output_state instead of checking 66 // Check display_configurator's output_state instead of checking
67 // DisplayManager::IsMirrored() because the compositor based mirroring 67 // DisplayManager::IsMirrored() because the compositor based mirroring
68 // won't cause the scaling issue. 68 // won't cause the scaling issue.
69 if (output_configurator->output_state() != ui::OUTPUT_STATE_DUAL_MIRROR) 69 if (display_configurator->output_state() != ui::OUTPUT_STATE_DUAL_MIRROR)
70 return; 70 return;
71 71
72 const std::map<int, float>& area_ratio_map = 72 const std::map<int, float>& area_ratio_map =
73 output_configurator->GetMirroredDisplayAreaRatioMap(); 73 display_configurator->GetMirroredDisplayAreaRatioMap();
74 74
75 // TODO(miletus): When there are more than 1 touchscreen (e.g. Link connected 75 // TODO(miletus): When there are more than 1 touchscreen (e.g. Link connected
76 // to an external touchscreen), the correct way to do is to have a way 76 // to an external touchscreen), the correct way to do is to have a way
77 // to find out which touchscreen is the event originating from and use the 77 // to find out which touchscreen is the event originating from and use the
78 // area ratio of that touchscreen to scale the event's radius. 78 // area ratio of that touchscreen to scale the event's radius.
79 // Tracked here crbug.com/233245 79 // Tracked here crbug.com/233245
80 if (area_ratio_map.size() != 1) { 80 if (area_ratio_map.size() != 1) {
81 LOG(ERROR) << "Mirroring mode with " << area_ratio_map.size() 81 LOG(ERROR) << "Mirroring mode with " << area_ratio_map.size()
82 << " touch display found"; 82 << " touch display found";
83 return; 83 return;
84 } 84 }
85 85
86 float area_ratio_sqrt = std::sqrt(area_ratio_map.begin()->second); 86 float area_ratio_sqrt = std::sqrt(area_ratio_map.begin()->second);
87 event->set_radius_x(event->radius_x() * area_ratio_sqrt); 87 event->set_radius_x(event->radius_x() * area_ratio_sqrt);
88 event->set_radius_y(event->radius_y() * area_ratio_sqrt); 88 event->set_radius_y(event->radius_y() * area_ratio_sqrt);
89 } 89 }
90 #endif // defined(OS_CHROMEOS) 90 #endif // defined(OS_CHROMEOS)
91 91
92 } // namespace ash 92 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/display/output_configurator_animation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698