Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: ui/aura/display_change_observer_x11.cc

Issue 10974014: Disable extended desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated comments. keep pointer inside root Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/display/output_configurator.cc ('k') | ui/aura/root_window_host_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/display_change_observer_x11.h" 5 #include "ui/aura/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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 screen_resources->outputs[o]); 123 screen_resources->outputs[o]);
124 if (output_info->connection != RR_Connected) { 124 if (output_info->connection != RR_Connected) {
125 XRRFreeOutputInfo(output_info); 125 XRRFreeOutputInfo(output_info);
126 continue; 126 continue;
127 } 127 }
128 XRRCrtcInfo* crtc_info = crtc_info_map[output_info->crtc]; 128 XRRCrtcInfo* crtc_info = crtc_info_map[output_info->crtc];
129 if (!crtc_info) { 129 if (!crtc_info) {
130 LOG(WARNING) << "Crtc not found for output: output=" << o; 130 LOG(WARNING) << "Crtc not found for output: output=" << o;
131 continue; 131 continue;
132 } 132 }
133 // TODO(oshima): Temporarily ignore all displays other than
134 // primary, which has y = 0 to disable extended desktop.
135 // crbug.com/152003.
136 if (crtc_info->y != 0)
137 continue;
138
133 XRRModeInfo* mode = FindMode(screen_resources, crtc_info->mode); 139 XRRModeInfo* mode = FindMode(screen_resources, crtc_info->mode);
134 if (!mode) { 140 if (!mode) {
135 LOG(WARNING) << "Could not find a mode for the output: output=" << o; 141 LOG(WARNING) << "Could not find a mode for the output: output=" << o;
136 continue; 142 continue;
137 } 143 }
138 // Mirrored monitors have the same y coordinates. 144 // Mirrored monitors have the same y coordinates.
139 if (y_coords.find(crtc_info->y) != y_coords.end()) 145 if (y_coords.find(crtc_info->y) != y_coords.end())
140 continue; 146 continue;
141 displays.push_back(gfx::Display()); 147 displays.push_back(gfx::Display());
142 148
(...skipping 15 matching lines...) Expand all
158 // fails. 164 // fails.
159 int64 new_id = gfx::Display::GetID(manufacturer_id, serial_number); 165 int64 new_id = gfx::Display::GetID(manufacturer_id, serial_number);
160 if (ids.find(new_id) == ids.end()) { 166 if (ids.find(new_id) == ids.end()) {
161 displays.back().set_id(new_id); 167 displays.back().set_id(new_id);
162 ids.insert(new_id); 168 ids.insert(new_id);
163 } 169 }
164 } 170 }
165 171
166 y_coords.insert(crtc_info->y); 172 y_coords.insert(crtc_info->y);
167 XRRFreeOutputInfo(output_info); 173 XRRFreeOutputInfo(output_info);
174
175 // TODO(oshima): There is only one display in m23.
176 // Set the id to 0. crbug.com/152003.
177 displays.back().set_id(0);
168 } 178 }
169 179
170 // Free all allocated resources. 180 // Free all allocated resources.
171 for (std::map<XID, XRRCrtcInfo*>::const_iterator iter = crtc_info_map.begin(); 181 for (std::map<XID, XRRCrtcInfo*>::const_iterator iter = crtc_info_map.begin();
172 iter != crtc_info_map.end(); ++iter) { 182 iter != crtc_info_map.end(); ++iter) {
173 XRRFreeCrtcInfo(iter->second); 183 XRRFreeCrtcInfo(iter->second);
174 } 184 }
175 XRRFreeScreenResources(screen_resources); 185 XRRFreeScreenResources(screen_resources);
176 186
177 // PowerManager lays out the outputs vertically. Sort them by Y 187 // PowerManager lays out the outputs vertically. Sort them by Y
178 // coordinates. 188 // coordinates.
179 std::sort(displays.begin(), displays.end(), CompareDisplayY); 189 std::sort(displays.begin(), displays.end(), CompareDisplayY);
180 int64 id = 0; 190 int64 id = 0;
181 for (std::vector<gfx::Display>::iterator iter = displays.begin(); 191 for (std::vector<gfx::Display>::iterator iter = displays.begin();
182 iter != displays.end(); ++iter) { 192 iter != displays.end(); ++iter) {
183 if (iter->id() == gfx::Display::kInvalidDisplayID) { 193 if (iter->id() == gfx::Display::kInvalidDisplayID) {
184 iter->set_id(id); 194 iter->set_id(id);
185 ++id; 195 ++id;
186 } 196 }
187 } 197 }
188 198
189 Env::GetInstance()->display_manager()->OnNativeDisplaysChanged(displays); 199 Env::GetInstance()->display_manager()->OnNativeDisplaysChanged(displays);
190 } 200 }
191 201
192 } // namespace internal 202 } // namespace internal
193 } // namespace aura 203 } // namespace aura
OLDNEW
« no previous file with comments | « chromeos/display/output_configurator.cc ('k') | ui/aura/root_window_host_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698