| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/display/util/x11/edid_parser_x11.h" | 5 #include "ui/display/util/x11/edid_parser_x11.h" |
| 6 | 6 |
| 7 #include <X11/extensions/Xrandr.h> | 7 #include <X11/extensions/Xrandr.h> |
| 8 #include <X11/Xatom.h> | 8 #include <X11/Xatom.h> |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 return false; | 32 return false; |
| 33 | 33 |
| 34 Display* display = gfx::GetXDisplay(); | 34 Display* display = gfx::GetXDisplay(); |
| 35 | 35 |
| 36 static Atom edid_property = XInternAtom( | 36 static Atom edid_property = XInternAtom( |
| 37 gfx::GetXDisplay(), | 37 gfx::GetXDisplay(), |
| 38 RR_PROPERTY_RANDR_EDID, false); | 38 RR_PROPERTY_RANDR_EDID, false); |
| 39 | 39 |
| 40 bool has_edid_property = false; | 40 bool has_edid_property = false; |
| 41 int num_properties = 0; | 41 int num_properties = 0; |
| 42 Atom* properties = XRRListOutputProperties(display, output, &num_properties); | 42 gfx::XScopedPtr<Atom[]> properties( |
| 43 XRRListOutputProperties(display, output, &num_properties)); |
| 43 for (int i = 0; i < num_properties; ++i) { | 44 for (int i = 0; i < num_properties; ++i) { |
| 44 if (properties[i] == edid_property) { | 45 if (properties[i] == edid_property) { |
| 45 has_edid_property = true; | 46 has_edid_property = true; |
| 46 break; | 47 break; |
| 47 } | 48 } |
| 48 } | 49 } |
| 49 XFree(properties); | |
| 50 if (!has_edid_property) | 50 if (!has_edid_property) |
| 51 return false; | 51 return false; |
| 52 | 52 |
| 53 Atom actual_type; | 53 Atom actual_type; |
| 54 int actual_format; | 54 int actual_format; |
| 55 unsigned long bytes_after; | 55 unsigned long bytes_after; |
| 56 unsigned long nitems = 0; | 56 unsigned long nitems = 0; |
| 57 unsigned char* prop = nullptr; | 57 unsigned char* prop = nullptr; |
| 58 XRRGetOutputProperty(display, | 58 XRRGetOutputProperty(display, |
| 59 output, | 59 output, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 bool GetOutputOverscanFlag(RROutput output, bool* flag) { | 112 bool GetOutputOverscanFlag(RROutput output, bool* flag) { |
| 113 std::vector<uint8_t> edid; | 113 std::vector<uint8_t> edid; |
| 114 if (!GetEDIDProperty(output, &edid)) | 114 if (!GetEDIDProperty(output, &edid)) |
| 115 return false; | 115 return false; |
| 116 | 116 |
| 117 bool found = ParseOutputOverscanFlag(edid, flag); | 117 bool found = ParseOutputOverscanFlag(edid, flag); |
| 118 return found; | 118 return found; |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace ui | 121 } // namespace ui |
| OLD | NEW |