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_WORK_AREA; | |
153 | |
154 if (new_it->device_scale_factor() != old_it->device_scale_factor()) | |
155 metrics |= gfx::DisplayObserver::DISPLAY_METRICS_DEVICE_SCALE_FACTOR; | |
156 | |
157 if (metrics != gfx::DisplayObserver::DISPLAY_METRICS_NONE) { | |
158 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, | |
159 OnDisplayMetricsChanged(*new_it, | |
160 static_cast<gfx::DisplayObserver::DisplayMetrics>(metrics))); | |
Elliot Glaysher
2014/05/12 17:47:11
That you have to make this cast should be a sign t
| |
148 } | 161 } |
162 | |
163 found = true; | |
164 break; | |
149 } | 165 } |
150 | 166 |
151 if (!found) { | 167 if (!found) { |
152 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, | 168 FOR_EACH_OBSERVER(gfx::DisplayObserver, observer_list_, |
153 OnDisplayAdded(*new_it)); | 169 OnDisplayAdded(*new_it)); |
154 } | 170 } |
155 } | 171 } |
156 } | 172 } |
157 | 173 |
158 //////////////////////////////////////////////////////////////////////////////// | 174 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
388 ProcessDisplayChange(new_displays); | 404 ProcessDisplayChange(new_displays); |
389 } | 405 } |
390 | 406 |
391 //////////////////////////////////////////////////////////////////////////////// | 407 //////////////////////////////////////////////////////////////////////////////// |
392 | 408 |
393 gfx::Screen* CreateDesktopScreen() { | 409 gfx::Screen* CreateDesktopScreen() { |
394 return new DesktopScreenX11; | 410 return new DesktopScreenX11; |
395 } | 411 } |
396 | 412 |
397 } // namespace views | 413 } // namespace views |
OLD | NEW |