| 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/views/widget/desktop_aura/desktop_screen_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_screen_x11.h" |
| 6 | 6 |
| 7 #include <X11/extensions/Xrandr.h> | 7 #include <X11/extensions/Xrandr.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 | 9 |
| 10 // It clashes with out RootWindow. | 10 // It clashes with out RootWindow. |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, | 130 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, |
| 131 OnDisplayRemoved(*old_it)); | 131 OnDisplayRemoved(*old_it)); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 std::vector<gfx::Display>::const_iterator new_it = displays_.begin(); | 135 std::vector<gfx::Display>::const_iterator new_it = displays_.begin(); |
| 136 for (; new_it != displays_.end(); ++new_it) { | 136 for (; new_it != displays_.end(); ++new_it) { |
| 137 bool found = false; | 137 bool found = false; |
| 138 for (std::vector<gfx::Display>::const_iterator old_it = | 138 for (std::vector<gfx::Display>::const_iterator old_it = |
| 139 old_displays.begin(); old_it != old_displays.end(); ++old_it) { | 139 old_displays.begin(); old_it != old_displays.end(); ++old_it) { |
| 140 if (new_it->id() != old_it->id()) | 140 if (new_it->id() == old_it->id()) { |
| 141 continue; | 141 if (new_it->bounds() != old_it->bounds()) { |
| 142 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, |
| 143 OnDisplayBoundsChanged(*new_it)); |
| 144 } |
| 142 | 145 |
| 143 uint32_t metrics = gfx::DisplayObserver::DISPLAY_METRIC_NONE; | 146 found = true; |
| 144 | 147 break; |
| 145 if (new_it->bounds() != old_it->bounds()) | |
| 146 metrics |= gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS; | |
| 147 | |
| 148 if (new_it->rotation() != old_it->rotation()) | |
| 149 metrics |= gfx::DisplayObserver::DISPLAY_METRIC_ROTATION; | |
| 150 | |
| 151 if (new_it->work_area() != old_it->work_area()) | |
| 152 metrics |= gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA; | |
| 153 | |
| 154 if (new_it->device_scale_factor() != old_it->device_scale_factor()) | |
| 155 metrics |= gfx::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR; | |
| 156 | |
| 157 if (metrics != gfx::DisplayObserver::DISPLAY_METRIC_NONE) { | |
| 158 FOR_EACH_OBSERVER(gfx::DisplayObserver, | |
| 159 observer_list_, | |
| 160 OnDisplayMetricsChanged(*new_it, metrics)); | |
| 161 } | 148 } |
| 162 | |
| 163 found = true; | |
| 164 break; | |
| 165 } | 149 } |
| 166 | 150 |
| 167 if (!found) { | 151 if (!found) { |
| 168 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, | 152 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, |
| 169 OnDisplayAdded(*new_it)); | 153 OnDisplayAdded(*new_it)); |
| 170 } | 154 } |
| 171 } | 155 } |
| 172 } | 156 } |
| 173 | 157 |
| 174 //////////////////////////////////////////////////////////////////////////////// | 158 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 ProcessDisplayChange(new_displays); | 388 ProcessDisplayChange(new_displays); |
| 405 } | 389 } |
| 406 | 390 |
| 407 //////////////////////////////////////////////////////////////////////////////// | 391 //////////////////////////////////////////////////////////////////////////////// |
| 408 | 392 |
| 409 gfx::Screen* CreateDesktopScreen() { | 393 gfx::Screen* CreateDesktopScreen() { |
| 410 return new DesktopScreenX11; | 394 return new DesktopScreenX11; |
| 411 } | 395 } |
| 412 | 396 |
| 413 } // namespace views | 397 } // namespace views |
| OLD | NEW |