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

Side by Side Diff: chromeos/display/output_util.cc

Issue 23880006: gtk: Allow building both the X11 and Gtk message-pumps for gtk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge Created 7 years, 3 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
OLDNEW
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/output_util.h" 5 #include "chromeos/display/output_util.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 #include <X11/extensions/Xrandr.h> 8 #include <X11/extensions/Xrandr.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 10
(...skipping 21 matching lines...) Expand all
32 uint32 product_code_hash, 32 uint32 product_code_hash,
33 uint8 output_index) { 33 uint8 output_index) {
34 return ((static_cast<int64>(manufacturer_id) << 40) | 34 return ((static_cast<int64>(manufacturer_id) << 40) |
35 (static_cast<int64>(product_code_hash) << 8) | output_index); 35 (static_cast<int64>(product_code_hash) << 8) | output_index);
36 } 36 }
37 37
38 bool IsRandRAvailable() { 38 bool IsRandRAvailable() {
39 int randr_version_major = 0; 39 int randr_version_major = 0;
40 int randr_version_minor = 0; 40 int randr_version_minor = 0;
41 static bool is_randr_available = XRRQueryVersion( 41 static bool is_randr_available = XRRQueryVersion(
42 base::MessagePumpAuraX11::GetDefaultXDisplay(), 42 base::MessagePumpX11::GetDefaultXDisplay(),
43 &randr_version_major, &randr_version_minor); 43 &randr_version_major, &randr_version_minor);
44 return is_randr_available; 44 return is_randr_available;
45 } 45 }
46 46
47 // Get the EDID data from the |output| and stores to |prop|. |nitem| will store 47 // Get the EDID data from the |output| and stores to |prop|. |nitem| will store
48 // the number of characters |prop| will have. It doesn't take the ownership of 48 // the number of characters |prop| will have. It doesn't take the ownership of
49 // |prop|, so caller must release it by XFree(). 49 // |prop|, so caller must release it by XFree().
50 // Returns true if EDID property is successfully obtained. Otherwise returns 50 // Returns true if EDID property is successfully obtained. Otherwise returns
51 // false and does not touch |prop| and |nitems|. 51 // false and does not touch |prop| and |nitems|.
52 bool GetEDIDProperty(XID output, unsigned long* nitems, unsigned char** prop) { 52 bool GetEDIDProperty(XID output, unsigned long* nitems, unsigned char** prop) {
53 if (!IsRandRAvailable()) 53 if (!IsRandRAvailable())
54 return false; 54 return false;
55 55
56 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); 56 Display* display = base::MessagePumpX11::GetDefaultXDisplay();
57 57
58 static Atom edid_property = XInternAtom( 58 static Atom edid_property = XInternAtom(
59 base::MessagePumpAuraX11::GetDefaultXDisplay(), 59 base::MessagePumpX11::GetDefaultXDisplay(),
60 RR_PROPERTY_RANDR_EDID, false); 60 RR_PROPERTY_RANDR_EDID, false);
61 61
62 bool has_edid_property = false; 62 bool has_edid_property = false;
63 int num_properties = 0; 63 int num_properties = 0;
64 Atom* properties = XRRListOutputProperties(display, output, &num_properties); 64 Atom* properties = XRRListOutputProperties(display, output, &num_properties);
65 for (int i = 0; i < num_properties; ++i) { 65 for (int i = 0; i < num_properties; ++i) {
66 if (properties[i] == edid_property) { 66 if (properties[i] == edid_property) {
67 has_edid_property = true; 67 has_edid_property = true;
68 break; 68 break;
69 } 69 }
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 mode_info.hTotal = 1; 396 mode_info.hTotal = 1;
397 mode_info.vTotal = 1; 397 mode_info.vTotal = 1;
398 mode_info.dotClock = refresh_rate; 398 mode_info.dotClock = refresh_rate;
399 } 399 }
400 return mode_info; 400 return mode_info;
401 } 401 }
402 402
403 } // namespace test 403 } // namespace test
404 404
405 } // namespace chromeos 405 } // namespace chromeos
OLDNEW
« no previous file with comments | « base/message_loop/message_pump_x11.cc ('k') | chromeos/display/real_output_configurator_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698