| OLD | NEW |
| 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/monitor_change_observer_x11.h" | 5 #include "ui/aura/monitor_change_observer_x11.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 CHECK(mode); | 105 CHECK(mode); |
| 106 // Mirrored monitors have the same y coordinates. | 106 // Mirrored monitors have the same y coordinates. |
| 107 if (y_coords.find(crtc_info->y) != y_coords.end()) | 107 if (y_coords.find(crtc_info->y) != y_coords.end()) |
| 108 continue; | 108 continue; |
| 109 // TODO(oshima): Create unique ID for the monitor. | 109 // TODO(oshima): Create unique ID for the monitor. |
| 110 monitors.push_back(gfx::Monitor( | 110 monitors.push_back(gfx::Monitor( |
| 111 0, | 111 0, |
| 112 gfx::Rect(crtc_info->x, crtc_info->y, mode->width, mode->height))); | 112 gfx::Rect(crtc_info->x, crtc_info->y, mode->width, mode->height))); |
| 113 | 113 |
| 114 float device_scale_factor = 1.0f; | 114 float device_scale_factor = 1.0f; |
| 115 if (ui::IsDIPEnabled() && | 115 if (output_info->mm_width > 0 && |
| 116 output_info->mm_width > 0 && | |
| 117 (kInchInMm * mode->width / output_info->mm_width) > | 116 (kInchInMm * mode->width / output_info->mm_width) > |
| 118 kHighDensityDIPThreshold) { | 117 kHighDensityDIPThreshold) { |
| 119 device_scale_factor = 2.0f; | 118 device_scale_factor = 2.0f; |
| 120 } | 119 } |
| 121 monitors.back().set_device_scale_factor(device_scale_factor); | 120 monitors.back().set_device_scale_factor(device_scale_factor); |
| 122 y_coords.insert(crtc_info->y); | 121 y_coords.insert(crtc_info->y); |
| 123 XRRFreeOutputInfo(output_info); | 122 XRRFreeOutputInfo(output_info); |
| 124 } | 123 } |
| 125 | 124 |
| 126 // Free all allocated resources. | 125 // Free all allocated resources. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 138 for (std::vector<gfx::Monitor>::iterator iter = monitors.begin(); | 137 for (std::vector<gfx::Monitor>::iterator iter = monitors.begin(); |
| 139 iter != monitors.end(); ++iter, ++id) | 138 iter != monitors.end(); ++iter, ++id) |
| 140 (*iter).set_id(id); | 139 (*iter).set_id(id); |
| 141 | 140 |
| 142 Env::GetInstance()->monitor_manager() | 141 Env::GetInstance()->monitor_manager() |
| 143 ->OnNativeMonitorsChanged(monitors); | 142 ->OnNativeMonitorsChanged(monitors); |
| 144 } | 143 } |
| 145 | 144 |
| 146 } // namespace internal | 145 } // namespace internal |
| 147 } // namespace aura | 146 } // namespace aura |
| OLD | NEW |