| OLD | NEW |
| 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 "chromeos/display/output_configurator.h" | 20 #include "ui/display/chromeos/output_configurator.h" |
| 21 #endif // defined(OS_CHROMEOS) | 21 #endif // defined(OS_CHROMEOS) |
| 22 | 22 |
| 23 namespace ash { | 23 namespace ash { |
| 24 namespace internal { | 24 namespace internal { |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 // Boost factor for non-integrated displays. | 27 // Boost factor for non-integrated displays. |
| 28 const float kBoostForNonIntegrated = 1.20f; | 28 const float kBoostForNonIntegrated = 1.20f; |
| 29 } | 29 } |
| 30 | 30 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 53 } | 53 } |
| 54 | 54 |
| 55 #if defined(OS_CHROMEOS) | 55 #if defined(OS_CHROMEOS) |
| 56 // This is to scale the TouchEvent's radius when the touch display is in | 56 // This is to scale the TouchEvent's radius when the touch display is in |
| 57 // mirror mode. TouchEvent's radius is often reported in the touchscreen's | 57 // mirror mode. TouchEvent's radius is often reported in the touchscreen's |
| 58 // native resolution. In mirror mode, the touch display could be configured | 58 // native resolution. In mirror mode, the touch display could be configured |
| 59 // at a lower resolution. We scale down the radius using the ratio defined as | 59 // at a lower resolution. We scale down the radius using the ratio defined as |
| 60 // the sqrt of | 60 // the sqrt of |
| 61 // (mirror_width * mirror_height) / (native_width * native_height) | 61 // (mirror_width * mirror_height) / (native_width * native_height) |
| 62 void EventTransformationHandler::OnTouchEvent(ui::TouchEvent* event) { | 62 void EventTransformationHandler::OnTouchEvent(ui::TouchEvent* event) { |
| 63 using chromeos::OutputConfigurator; | 63 using ui::OutputConfigurator; |
| 64 OutputConfigurator* output_configurator = | 64 OutputConfigurator* output_configurator = |
| 65 ash::Shell::GetInstance()->output_configurator(); | 65 ash::Shell::GetInstance()->output_configurator(); |
| 66 | 66 |
| 67 // Check output_configurator's output_state instead of checking | 67 // Check output_configurator's output_state instead of checking |
| 68 // DisplayManager::IsMirrored() because the compositor based mirroring | 68 // DisplayManager::IsMirrored() because the compositor based mirroring |
| 69 // won't cause the scaling issue. | 69 // won't cause the scaling issue. |
| 70 if (output_configurator->output_state() != ui::OUTPUT_STATE_DUAL_MIRROR) | 70 if (output_configurator->output_state() != ui::OUTPUT_STATE_DUAL_MIRROR) |
| 71 return; | 71 return; |
| 72 | 72 |
| 73 const std::map<int, float>& area_ratio_map = | 73 const std::map<int, float>& area_ratio_map = |
| (...skipping 11 matching lines...) Expand all Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 float area_ratio_sqrt = std::sqrt(area_ratio_map.begin()->second); | 87 float area_ratio_sqrt = std::sqrt(area_ratio_map.begin()->second); |
| 88 event->set_radius_x(event->radius_x() * area_ratio_sqrt); | 88 event->set_radius_x(event->radius_x() * area_ratio_sqrt); |
| 89 event->set_radius_y(event->radius_y() * area_ratio_sqrt); | 89 event->set_radius_y(event->radius_y() * area_ratio_sqrt); |
| 90 } | 90 } |
| 91 #endif // defined(OS_CHROMEOS) | 91 #endif // defined(OS_CHROMEOS) |
| 92 | 92 |
| 93 } // namespace internal | 93 } // namespace internal |
| 94 } // namespace ash | 94 } // namespace ash |
| OLD | NEW |