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

Side by Side Diff: ui/gfx/x/x11_types.cc

Issue 2199063003: Linux: Add xcb FD to glib event loop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor Created 4 years, 4 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
« no previous file with comments | « ui/gfx/x/BUILD.gn ('k') | no next file » | 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) 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 "ui/gfx/x/x11_types.h" 5 #include "ui/gfx/x/x11_types.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 #include <xcb/xcb.h>
9 #include <X11/Xlib-xcb.h>
8 10
9 #include "base/command_line.h" 11 #include "base/command_line.h"
10 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
11 #include "build/build_config.h" 13 #include "build/build_config.h"
12 #include "ui/gfx/x/x11_switches.h" 14 #include "ui/gfx/x/x11_switches.h"
13 15
14 namespace gfx { 16 namespace gfx {
15 17
16 XDisplay* GetXDisplay() { 18 XDisplay* GetXDisplay() {
17 static XDisplay* display = NULL; 19 static XDisplay* display = NULL;
18 if (!display) 20 if (!display)
19 display = OpenNewXDisplay(); 21 display = OpenNewXDisplay();
20 return display; 22 return display;
21 } 23 }
22 24
23 XDisplay* OpenNewXDisplay() { 25 XDisplay* OpenNewXDisplay() {
24 #if defined(OS_CHROMEOS) 26 #if defined(OS_CHROMEOS)
25 return XOpenDisplay(NULL); 27 return XOpenDisplay(NULL);
26 #else 28 #else
27 std::string display_str = base::CommandLine::ForCurrentProcess()-> 29 std::string display_str = base::CommandLine::ForCurrentProcess()->
28 GetSwitchValueASCII(switches::kX11Display); 30 GetSwitchValueASCII(switches::kX11Display);
29 return XOpenDisplay(display_str.empty() ? NULL : display_str.c_str()); 31 // TODO(thomasanderson): Do not upload this. Remove once builders pass.
32 xcb_connection_t* connection =
33 xcb_connect(display_str.empty() ? NULL : display_str.c_str(), nullptr);
34 (void)connection;
35 XDisplay* display =
36 XOpenDisplay(display_str.empty() ? NULL : display_str.c_str());
37 (void)XGetXCBConnection(display);
38 return display;
30 #endif 39 #endif
31 } 40 }
32 41
33 void PutARGBImage(XDisplay* display, 42 void PutARGBImage(XDisplay* display,
34 void* visual, 43 void* visual,
35 int depth, 44 int depth,
36 XID pixmap, 45 XID pixmap,
37 void* pixmap_gc, 46 void* pixmap_gc,
38 const uint8_t* data, 47 const uint8_t* data,
39 int width, 48 int width,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 copy_width, copy_height); 175 copy_width, copy_height);
167 free(orig_bitmap16); 176 free(orig_bitmap16);
168 } else { 177 } else {
169 LOG(FATAL) << "Sorry, we don't support your visual depth without " 178 LOG(FATAL) << "Sorry, we don't support your visual depth without "
170 "Xrender support (depth:" << depth 179 "Xrender support (depth:" << depth
171 << " bpp:" << pixmap_bpp << ")"; 180 << " bpp:" << pixmap_bpp << ")";
172 } 181 }
173 } 182 }
174 183
175 } // namespace gfx 184 } // namespace gfx
176
OLDNEW
« no previous file with comments | « ui/gfx/x/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698