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