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 gfx::DisplayObserver::DisplayMetrics metrics = |
147 break; | 144 gfx::DisplayObserver::DISPLAY_METRIC_NONE; |
| 145 |
| 146 if (new_it->bounds() != old_it->bounds()) |
| 147 metrics |= gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS; |
| 148 |
| 149 if (new_it->rotation() != old_it->rotation()) |
| 150 metrics |= gfx::DisplayObserver::DISPLAY_METRIC_ROTATION; |
| 151 |
| 152 if (new_it->work_area() != old_it->work_area()) |
| 153 metrics |= gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA; |
| 154 |
| 155 if (new_it->device_scale_factor() != old_it->device_scale_factor()) |
| 156 metrics |= gfx::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR; |
| 157 |
| 158 if (metrics != gfx::DisplayObserver::DISPLAY_METRIC_NONE) { |
| 159 FOR_EACH_OBSERVER(gfx::DisplayObserver, |
| 160 observer_list_, |
| 161 OnDisplayMetricsChanged(*new_it, metrics)); |
148 } | 162 } |
| 163 |
| 164 found = true; |
| 165 break; |
149 } | 166 } |
150 | 167 |
151 if (!found) { | 168 if (!found) { |
152 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, | 169 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, |
153 OnDisplayAdded(*new_it)); | 170 OnDisplayAdded(*new_it)); |
154 } | 171 } |
155 } | 172 } |
156 } | 173 } |
157 | 174 |
158 //////////////////////////////////////////////////////////////////////////////// | 175 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 ProcessDisplayChange(new_displays); | 405 ProcessDisplayChange(new_displays); |
389 } | 406 } |
390 | 407 |
391 //////////////////////////////////////////////////////////////////////////////// | 408 //////////////////////////////////////////////////////////////////////////////// |
392 | 409 |
393 gfx::Screen* CreateDesktopScreen() { | 410 gfx::Screen* CreateDesktopScreen() { |
394 return new DesktopScreenX11; | 411 return new DesktopScreenX11; |
395 } | 412 } |
396 | 413 |
397 } // namespace views | 414 } // namespace views |
OLD | NEW |