OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chromeos/display/real_output_configurator_delegate.h" | 5 #include "chromeos/display/real_output_configurator_delegate.h" |
6 | 6 |
7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #include <X11/extensions/dpms.h> | 9 #include <X11/extensions/dpms.h> |
10 #include <X11/extensions/XInput.h> | 10 #include <X11/extensions/XInput.h> |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 RealOutputConfiguratorDelegate::InitOutputSnapshot( | 270 RealOutputConfiguratorDelegate::InitOutputSnapshot( |
271 RROutput id, | 271 RROutput id, |
272 XRROutputInfo* info, | 272 XRROutputInfo* info, |
273 RRCrtc* last_used_crtc, | 273 RRCrtc* last_used_crtc, |
274 int index) { | 274 int index) { |
275 OutputConfigurator::OutputSnapshot output; | 275 OutputConfigurator::OutputSnapshot output; |
276 output.output = id; | 276 output.output = id; |
277 output.width_mm = info->mm_width; | 277 output.width_mm = info->mm_width; |
278 output.height_mm = info->mm_height; | 278 output.height_mm = info->mm_height; |
279 output.has_display_id = base::GetDisplayId(id, index, &output.display_id); | 279 output.has_display_id = base::GetDisplayId(id, index, &output.display_id); |
280 output.is_internal = IsInternalOutput(info); | |
281 output.index = index; | 280 output.index = index; |
| 281 bool is_internal = IsInternalOutput(info); |
282 | 282 |
283 // Use the index as a valid display ID even if the internal | 283 // Use the index as a valid display ID even if the internal |
284 // display doesn't have valid EDID because the index | 284 // display doesn't have valid EDID because the index |
285 // will never change. | 285 // will never change. |
286 if (!output.has_display_id && output.is_internal) | 286 if (!output.has_display_id && is_internal) |
287 output.has_display_id = true; | 287 output.has_display_id = true; |
288 | 288 |
289 if (info->crtc) { | 289 if (info->crtc) { |
290 XRRCrtcInfo* crtc_info = XRRGetCrtcInfo(display_, screen_, info->crtc); | 290 XRRCrtcInfo* crtc_info = XRRGetCrtcInfo(display_, screen_, info->crtc); |
291 output.current_mode = crtc_info->mode; | 291 output.current_mode = crtc_info->mode; |
292 output.x = crtc_info->x; | 292 output.x = crtc_info->x; |
293 output.y = crtc_info->y; | 293 output.y = crtc_info->y; |
294 XRRFreeCrtcInfo(crtc_info); | 294 XRRFreeCrtcInfo(crtc_info); |
295 } | 295 } |
296 | 296 |
(...skipping 13 matching lines...) Expand all Loading... |
310 for (int i = 0; i < info->nmode; ++i) { | 310 for (int i = 0; i < info->nmode; ++i) { |
311 const RRMode mode = info->modes[i]; | 311 const RRMode mode = info->modes[i]; |
312 OutputConfigurator::ModeInfo mode_info; | 312 OutputConfigurator::ModeInfo mode_info; |
313 if (InitModeInfo(mode, &mode_info)) | 313 if (InitModeInfo(mode, &mode_info)) |
314 output.mode_infos.insert(std::make_pair(mode, mode_info)); | 314 output.mode_infos.insert(std::make_pair(mode, mode_info)); |
315 else | 315 else |
316 LOG(WARNING) << "Unable to find XRRModeInfo for mode " << mode; | 316 LOG(WARNING) << "Unable to find XRRModeInfo for mode " << mode; |
317 } | 317 } |
318 | 318 |
319 std::string name(info->name); | 319 std::string name(info->name); |
320 if (output.is_internal) { | 320 if (is_internal) { |
321 output.type = OUTPUT_TYPE_INTERNAL; | 321 output.type = OUTPUT_TYPE_INTERNAL; |
322 } else if (name.find(kOutputName_VGA) == 0) { | 322 } else if (name.find(kOutputName_VGA) == 0) { |
323 output.type = OUTPUT_TYPE_VGA; | 323 output.type = OUTPUT_TYPE_VGA; |
324 } else if (name.find(kOutputName_HDMI) == 0) { | 324 } else if (name.find(kOutputName_HDMI) == 0) { |
325 output.type = OUTPUT_TYPE_HDMI; | 325 output.type = OUTPUT_TYPE_HDMI; |
326 } else if (name.find(kOutputName_DVI) == 0) { | 326 } else if (name.find(kOutputName_DVI) == 0) { |
327 output.type = OUTPUT_TYPE_DVI; | 327 output.type = OUTPUT_TYPE_DVI; |
328 } else if (name.find(kOutputName_DisplayPort) == 0) { | 328 } else if (name.find(kOutputName_DisplayPort) == 0) { |
329 output.type = OUTPUT_TYPE_DISPLAYPORT; | 329 output.type = OUTPUT_TYPE_DISPLAYPORT; |
330 } else { | 330 } else { |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 } | 590 } |
591 | 591 |
592 // Sometimes we can't find a matching screen for the touchscreen, e.g. | 592 // Sometimes we can't find a matching screen for the touchscreen, e.g. |
593 // due to the touchscreen's reporting range having no correlation with the | 593 // due to the touchscreen's reporting range having no correlation with the |
594 // screen's resolution. In this case, we arbitrarily assign unmatched | 594 // screen's resolution. In this case, we arbitrarily assign unmatched |
595 // touchscreens to unmatched screens. | 595 // touchscreens to unmatched screens. |
596 for (std::set<int>::iterator it = no_match_touchscreen.begin(); | 596 for (std::set<int>::iterator it = no_match_touchscreen.begin(); |
597 it != no_match_touchscreen.end(); | 597 it != no_match_touchscreen.end(); |
598 it++) { | 598 it++) { |
599 for (size_t i = 0; i < outputs->size(); i++) { | 599 for (size_t i = 0; i < outputs->size(); i++) { |
600 if ((*outputs)[i].is_internal == false && | 600 if ((*outputs)[i].type != OUTPUT_TYPE_INTERNAL && |
601 (*outputs)[i].native_mode != None && | 601 (*outputs)[i].native_mode != None && |
602 (*outputs)[i].touch_device_id == None ) { | 602 (*outputs)[i].touch_device_id == None ) { |
603 (*outputs)[i].touch_device_id = *it; | 603 (*outputs)[i].touch_device_id = *it; |
604 VLOG(2) << "Arbitrarily matching touchscreen " | 604 VLOG(2) << "Arbitrarily matching touchscreen " |
605 << (*outputs)[i].touch_device_id << " to output #" << i; | 605 << (*outputs)[i].touch_device_id << " to output #" << i; |
606 break; | 606 break; |
607 } | 607 } |
608 } | 608 } |
609 } | 609 } |
610 | 610 |
611 XIFreeDeviceInfo(info); | 611 XIFreeDeviceInfo(info); |
612 } | 612 } |
613 | 613 |
614 } // namespace chromeos | 614 } // namespace chromeos |
OLD | NEW |