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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 Env::GetInstance()->GetDispatcher())-> | 48 Env::GetInstance()->GetDispatcher())-> |
49 WindowDispatcherCreated(x_root_window_, this); | 49 WindowDispatcherCreated(x_root_window_, this); |
50 } | 50 } |
51 | 51 |
52 MonitorChangeObserverX11::~MonitorChangeObserverX11() { | 52 MonitorChangeObserverX11::~MonitorChangeObserverX11() { |
53 static_cast<DispatcherLinux*>( | 53 static_cast<DispatcherLinux*>( |
54 Env::GetInstance()->GetDispatcher())-> | 54 Env::GetInstance()->GetDispatcher())-> |
55 WindowDispatcherDestroying(x_root_window_); | 55 WindowDispatcherDestroying(x_root_window_); |
56 } | 56 } |
57 | 57 |
58 base::MessagePumpDispatcher::DispatchStatus | 58 base::DispatchStatus MonitorChangeObserverX11::Dispatch( |
59 MonitorChangeObserverX11::Dispatch(XEvent* event) { | 59 const base::NativeEvent& event) { |
60 if (event->type - xrandr_event_base_ == RRScreenChangeNotify) { | 60 if (event->type - xrandr_event_base_ == RRScreenChangeNotify) { |
61 NotifyMonitorChange(); | 61 NotifyMonitorChange(); |
62 return base::MessagePumpDispatcher::EVENT_PROCESSED; | 62 return base::EVENT_PROCESSED; |
63 } | 63 } |
64 return base::MessagePumpDispatcher::EVENT_IGNORED; | 64 return base::EVENT_IGNORED; |
65 } | 65 } |
66 | 66 |
67 void MonitorChangeObserverX11::NotifyMonitorChange() { | 67 void MonitorChangeObserverX11::NotifyMonitorChange() { |
68 if (!MonitorManager::use_fullscreen_host_window()) | 68 if (!MonitorManager::use_fullscreen_host_window()) |
69 return; // Use the default monitor that monitor manager determined. | 69 return; // Use the default monitor that monitor manager determined. |
70 | 70 |
71 XRRScreenResources* screen_resources = | 71 XRRScreenResources* screen_resources = |
72 XRRGetScreenResources(xdisplay_, x_root_window_); | 72 XRRGetScreenResources(xdisplay_, x_root_window_); |
73 std::map<XID, XRRCrtcInfo*> crtc_info_map; | 73 std::map<XID, XRRCrtcInfo*> crtc_info_map; |
74 | 74 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // PowerManager lays out the outputs vertically. Sort them by Y | 118 // PowerManager lays out the outputs vertically. Sort them by Y |
119 // coordinates. | 119 // coordinates. |
120 std::sort(monitors.begin(), monitors.end(), CompareMonitorY); | 120 std::sort(monitors.begin(), monitors.end(), CompareMonitorY); |
121 Env::GetInstance()->monitor_manager() | 121 Env::GetInstance()->monitor_manager() |
122 ->OnNativeMonitorsChanged(monitors); | 122 ->OnNativeMonitorsChanged(monitors); |
123 STLDeleteContainerPointers(monitors.begin(), monitors.end()); | 123 STLDeleteContainerPointers(monitors.begin(), monitors.end()); |
124 } | 124 } |
125 | 125 |
126 } // namespace internal | 126 } // namespace internal |
127 } // namespace aura | 127 } // namespace aura |
OLD | NEW |