| 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 if (new_it->bounds() != old_it->bounds()) { | 141 continue; |
| 142 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, | |
| 143 OnDisplayBoundsChanged(*new_it)); | |
| 144 } | |
| 145 | 142 |
| 146 found = true; | 143 int metrics = gfx::DisplayObserver::DISPLAY_METRICS_NONE; |
| 147 break; | 144 |
| 145 if (new_it->bounds() != old_it->bounds()) |
| 146 metrics |= gfx::DisplayObserver::DISPLAY_METRICS_BOUNDS; |
| 147 |
| 148 if (new_it->rotation() != old_it->rotation()) |
| 149 metrics |= gfx::DisplayObserver::DISPLAY_METRICS_ROTATION; |
| 150 |
| 151 if (new_it->work_area() != old_it->work_area()) |
| 152 metrics |= gfx::DisplayObserver::DISPLAY_METRICS_WORKAREA; |
| 153 |
| 154 if (metrics != gfx::DisplayObserver::DISPLAY_METRICS_NONE) { |
| 155 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, |
| 156 OnDisplayMetricsChanged(*new_it, |
| 157 static_cast<gfx::DisplayObserver::MetricsType>(metrics))); |
| 148 } | 158 } |
| 159 |
| 160 found = true; |
| 161 break; |
| 149 } | 162 } |
| 150 | 163 |
| 151 if (!found) { | 164 if (!found) { |
| 152 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, | 165 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, |
| 153 OnDisplayAdded(*new_it)); | 166 OnDisplayAdded(*new_it)); |
| 154 } | 167 } |
| 155 } | 168 } |
| 156 } | 169 } |
| 157 | 170 |
| 158 //////////////////////////////////////////////////////////////////////////////// | 171 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 ProcessDisplayChange(new_displays); | 401 ProcessDisplayChange(new_displays); |
| 389 } | 402 } |
| 390 | 403 |
| 391 //////////////////////////////////////////////////////////////////////////////// | 404 //////////////////////////////////////////////////////////////////////////////// |
| 392 | 405 |
| 393 gfx::Screen* CreateDesktopScreen() { | 406 gfx::Screen* CreateDesktopScreen() { |
| 394 return new DesktopScreenX11; | 407 return new DesktopScreenX11; |
| 395 } | 408 } |
| 396 | 409 |
| 397 } // namespace views | 410 } // namespace views |
| OLD | NEW |