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 "ash/display/display_change_observer_x11.h" | 5 #include "ash/display/display_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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 base::MessagePumpAuraX11::Current()->AddDispatcherForRootWindow(this); | 87 base::MessagePumpAuraX11::Current()->AddDispatcherForRootWindow(this); |
88 } | 88 } |
89 | 89 |
90 DisplayChangeObserverX11::~DisplayChangeObserverX11() { | 90 DisplayChangeObserverX11::~DisplayChangeObserverX11() { |
91 base::MessagePumpAuraX11::Current()->RemoveDispatcherForRootWindow(this); | 91 base::MessagePumpAuraX11::Current()->RemoveDispatcherForRootWindow(this); |
92 } | 92 } |
93 | 93 |
94 bool DisplayChangeObserverX11::Dispatch(const base::NativeEvent& event) { | 94 bool DisplayChangeObserverX11::Dispatch(const base::NativeEvent& event) { |
95 if (event->type - xrandr_event_base_ == RRScreenChangeNotify) { | 95 if (event->type - xrandr_event_base_ == RRScreenChangeNotify) { |
96 NotifyDisplayChange(); | 96 NotifyDisplayChange(); |
97 XRRUpdateConfiguration(event); | |
oshima
2013/01/25 21:22:52
according to http://www.x.org/archive/current/doc/
| |
97 } | 98 } |
98 return true; | 99 return true; |
99 } | 100 } |
100 | 101 |
101 void DisplayChangeObserverX11::NotifyDisplayChange() { | 102 void DisplayChangeObserverX11::NotifyDisplayChange() { |
102 XRRScreenResources* screen_resources = | 103 XRRScreenResources* screen_resources = |
103 XRRGetScreenResources(xdisplay_, x_root_window_); | 104 XRRGetScreenResources(xdisplay_, x_root_window_); |
104 std::map<XID, XRRCrtcInfo*> crtc_info_map; | 105 std::map<XID, XRRCrtcInfo*> crtc_info_map; |
105 | 106 |
106 for (int c = 0; c < screen_resources->ncrtc; c++) { | 107 for (int c = 0; c < screen_resources->ncrtc; c++) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 iter->set_id(id); | 187 iter->set_id(id); |
187 ++id; | 188 ++id; |
188 } | 189 } |
189 } | 190 } |
190 // DisplayManager can be null during the boot. | 191 // DisplayManager can be null during the boot. |
191 Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged(displays); | 192 Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged(displays); |
192 } | 193 } |
193 | 194 |
194 } // namespace internal | 195 } // namespace internal |
195 } // namespace ash | 196 } // namespace ash |
OLD | NEW |