| 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 "ash/display/display_change_observer_x11.h" | 5 #include "ash/display/display_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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 XRRGetScreenResources(xdisplay_, x_root_window_); | 112 XRRGetScreenResources(xdisplay_, x_root_window_); |
| 113 for (int output_index = 0; output_index < screen_resources->noutput; | 113 for (int output_index = 0; output_index < screen_resources->noutput; |
| 114 output_index++) { | 114 output_index++) { |
| 115 XID output = screen_resources->outputs[output_index]; | 115 XID output = screen_resources->outputs[output_index]; |
| 116 XRROutputInfo *output_info = | 116 XRROutputInfo *output_info = |
| 117 XRRGetOutputInfo(xdisplay_, screen_resources, output); | 117 XRRGetOutputInfo(xdisplay_, screen_resources, output); |
| 118 bool is_internal = chromeos::OutputConfigurator::IsInternalOutputName( | 118 bool is_internal = chromeos::OutputConfigurator::IsInternalOutputName( |
| 119 std::string(output_info->name)); | 119 std::string(output_info->name)); |
| 120 XRRFreeOutputInfo(output_info); | 120 XRRFreeOutputInfo(output_info); |
| 121 if (is_internal) { | 121 if (is_internal) { |
| 122 // No need to check the return value of |GetDisplayID()| as | 122 int64 id = GetDisplayId(output, output_index); |
| 123 // the default value is |gfx::Display::kInvalidDisplayID| anyway. | 123 // Fallback to output index. crbug.com/180100 |
| 124 gfx::Display::SetInternalDisplayId(GetDisplayId(output, output_index)); | 124 gfx::Display::SetInternalDisplayId( |
| 125 id == gfx::Display::kInvalidDisplayID ? output_index : id); |
| 125 break; | 126 break; |
| 126 } | 127 } |
| 127 } | 128 } |
| 128 XRRFreeScreenResources(screen_resources); | 129 XRRFreeScreenResources(screen_resources); |
| 129 } | 130 } |
| 130 | 131 |
| 131 DisplayChangeObserverX11::~DisplayChangeObserverX11() { | 132 DisplayChangeObserverX11::~DisplayChangeObserverX11() { |
| 132 } | 133 } |
| 133 | 134 |
| 134 void DisplayChangeObserverX11::OnDisplayModeChanged() { | 135 void DisplayChangeObserverX11::OnDisplayModeChanged() { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // PowerManager lays out the outputs vertically. Sort them by Y | 218 // PowerManager lays out the outputs vertically. Sort them by Y |
| 218 // coordinates. | 219 // coordinates. |
| 219 std::sort(displays.begin(), displays.end(), CompareDisplayY); | 220 std::sort(displays.begin(), displays.end(), CompareDisplayY); |
| 220 | 221 |
| 221 // DisplayManager can be null during the boot. | 222 // DisplayManager can be null during the boot. |
| 222 Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged(displays); | 223 Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged(displays); |
| 223 } | 224 } |
| 224 | 225 |
| 225 } // namespace internal | 226 } // namespace internal |
| 226 } // namespace ash | 227 } // namespace ash |
| OLD | NEW |