| 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/aura/monitor_change_observer_x11.h" | 5 #include "ui/aura/monitor_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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 WindowDispatcherDestroying(x_root_window_); | 55 WindowDispatcherDestroying(x_root_window_); |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool MonitorChangeObserverX11::Dispatch(const base::NativeEvent& event) { | 58 bool MonitorChangeObserverX11::Dispatch(const base::NativeEvent& event) { |
| 59 if (event->type - xrandr_event_base_ == RRScreenChangeNotify) { | 59 if (event->type - xrandr_event_base_ == RRScreenChangeNotify) { |
| 60 NotifyMonitorChange(); | 60 NotifyMonitorChange(); |
| 61 } | 61 } |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool MonitorChangeObserverX11::ShouldExit() { |
| 66 return false; |
| 67 } |
| 68 |
| 65 void MonitorChangeObserverX11::NotifyMonitorChange() { | 69 void MonitorChangeObserverX11::NotifyMonitorChange() { |
| 66 if (!MonitorManager::use_fullscreen_host_window()) | 70 if (!MonitorManager::use_fullscreen_host_window()) |
| 67 return; // Use the default monitor that monitor manager determined. | 71 return; // Use the default monitor that monitor manager determined. |
| 68 | 72 |
| 69 XRRScreenResources* screen_resources = | 73 XRRScreenResources* screen_resources = |
| 70 XRRGetScreenResources(xdisplay_, x_root_window_); | 74 XRRGetScreenResources(xdisplay_, x_root_window_); |
| 71 std::map<XID, XRRCrtcInfo*> crtc_info_map; | 75 std::map<XID, XRRCrtcInfo*> crtc_info_map; |
| 72 | 76 |
| 73 for (int c = 0; c < screen_resources->ncrtc; c++) { | 77 for (int c = 0; c < screen_resources->ncrtc; c++) { |
| 74 XID crtc_id = screen_resources->crtcs[c]; | 78 XID crtc_id = screen_resources->crtcs[c]; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // PowerManager lays out the outputs vertically. Sort them by Y | 120 // PowerManager lays out the outputs vertically. Sort them by Y |
| 117 // coordinates. | 121 // coordinates. |
| 118 std::sort(monitors.begin(), monitors.end(), CompareMonitorY); | 122 std::sort(monitors.begin(), monitors.end(), CompareMonitorY); |
| 119 Env::GetInstance()->monitor_manager() | 123 Env::GetInstance()->monitor_manager() |
| 120 ->OnNativeMonitorsChanged(monitors); | 124 ->OnNativeMonitorsChanged(monitors); |
| 121 STLDeleteContainerPointers(monitors.begin(), monitors.end()); | 125 STLDeleteContainerPointers(monitors.begin(), monitors.end()); |
| 122 } | 126 } |
| 123 | 127 |
| 124 } // namespace internal | 128 } // namespace internal |
| 125 } // namespace aura | 129 } // namespace aura |
| OLD | NEW |