OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "remoting/client/x11_view.h" | 5 #include "remoting/client/x11_view.h" |
6 | 6 |
| 7 // Cursor defined in Quickdraw.h on mac conflicts with X.h. |
| 8 #if defined(OS_MAC) |
| 9 #define Cursor X11_Cursor |
| 10 #endif |
7 #include <X11/Xlib.h> | 11 #include <X11/Xlib.h> |
8 #include <X11/Xutil.h> | 12 #include <X11/Xutil.h> |
9 #include <X11/extensions/Xrender.h> | 13 #include <X11/extensions/Xrender.h> |
10 #include <X11/extensions/Xcomposite.h> | 14 #include <X11/extensions/Xcomposite.h> |
| 15 #if defined(OS_MAC) |
| 16 #undef Cursor |
| 17 #endif |
| 18 |
11 #include "remoting/client/decoder_verbatim.h" | 19 #include "remoting/client/decoder_verbatim.h" |
12 | 20 |
13 namespace remoting { | 21 namespace remoting { |
14 | 22 |
15 X11View::X11View(Display* display, int window, int width, int height) | 23 X11View::X11View(Display* display, XID window, int width, int height) |
16 : display_(display), | 24 : display_(display), |
17 window_(window), | 25 window_(window), |
18 picture_(0), | 26 picture_(0), |
19 width_(width), | 27 width_(width), |
20 height_(height) { | 28 height_(height) { |
21 } | 29 } |
22 | 30 |
23 X11View::~X11View() { | 31 X11View::~X11View() { |
24 } | 32 } |
25 | 33 |
(...skipping 27 matching lines...) Expand all Loading... |
53 frame_->data(media::VideoFrame::kRGBPlane)); | 61 frame_->data(media::VideoFrame::kRGBPlane)); |
54 | 62 |
55 // Creates a pixmap and uploads from the XImage. | 63 // Creates a pixmap and uploads from the XImage. |
56 unsigned long pixmap = XCreatePixmap(display_, window_, width_, height_, 32); | 64 unsigned long pixmap = XCreatePixmap(display_, window_, width_, height_, 32); |
57 | 65 |
58 GC gc = XCreateGC(display_, pixmap, 0, NULL); | 66 GC gc = XCreateGC(display_, pixmap, 0, NULL); |
59 XPutImage(display_, pixmap, gc, &image, 0, 0, 0, 0, width_, height_); | 67 XPutImage(display_, pixmap, gc, &image, 0, 0, 0, 0, width_, height_); |
60 XFreeGC(display_, gc); | 68 XFreeGC(display_, gc); |
61 | 69 |
62 // Creates the picture representing the pixmap. | 70 // Creates the picture representing the pixmap. |
63 unsigned long picture = XRenderCreatePicture( | 71 XID picture = XRenderCreatePicture( |
64 display_, pixmap, | 72 display_, pixmap, |
65 XRenderFindStandardFormat(display_, PictStandardARGB32), | 73 XRenderFindStandardFormat(display_, PictStandardARGB32), |
66 0, NULL); | 74 0, NULL); |
67 | 75 |
68 // Composite the picture over the picture representing the window. | 76 // Composite the picture over the picture representing the window. |
69 XRenderComposite(display_, PictOpSrc, picture, 0, | 77 XRenderComposite(display_, PictOpSrc, picture, 0, |
70 picture_, 0, 0, 0, 0, 0, 0, | 78 picture_, 0, 0, 0, 0, 0, 0, |
71 width_, height_); | 79 width_, height_); |
72 | 80 |
73 XRenderFreePicture(display_, picture); | 81 XRenderFreePicture(display_, picture); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 XEvent event; | 150 XEvent event; |
143 event.type = Expose; | 151 event.type = Expose; |
144 XSendEvent(display_, static_cast<int>(window_), true, ExposureMask, &event); | 152 XSendEvent(display_, static_cast<int>(window_), true, ExposureMask, &event); |
145 } | 153 } |
146 | 154 |
147 void X11View::OnDecodeDone() { | 155 void X11View::OnDecodeDone() { |
148 // Since we do synchronous decoding here there's nothing in this method. | 156 // Since we do synchronous decoding here there's nothing in this method. |
149 } | 157 } |
150 | 158 |
151 } // namespace remoting | 159 } // namespace remoting |
OLD | NEW |