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 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 #include <X11/Xutil.h> | 8 #include <X11/Xutil.h> |
9 #include <X11/extensions/Xrender.h> | 9 #include <X11/extensions/Xrender.h> |
10 #include <X11/extensions/Xcomposite.h> | 10 #include <X11/extensions/Xcomposite.h> |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 XRenderPictFormat* pictformat = XRenderFindVisualFormat( | 163 XRenderPictFormat* pictformat = XRenderFindVisualFormat( |
164 display_, | 164 display_, |
165 attr.visual); | 165 attr.visual); |
166 CHECK(pictformat) << "XRENDER does not support default visual"; | 166 CHECK(pictformat) << "XRENDER does not support default visual"; |
167 | 167 |
168 picture_ = XRenderCreatePicture(display_, window_, pictformat, 0, NULL); | 168 picture_ = XRenderCreatePicture(display_, window_, pictformat, 0, NULL); |
169 CHECK(picture_) << "Backing picture not created"; | 169 CHECK(picture_) << "Backing picture not created"; |
170 } | 170 } |
171 | 171 |
172 void X11View::HandleBeginUpdateStream(ChromotingHostMessage* msg) { | 172 void X11View::HandleBeginUpdateStream(HostMessage* msg) { |
173 scoped_ptr<ChromotingHostMessage> deleter(msg); | 173 scoped_ptr<HostMessage> deleter(msg); |
174 | 174 |
175 // TODO(hclam): Use the information from the message to create the decoder. | 175 // TODO(hclam): Use the information from the message to create the decoder. |
176 // We lazily construct the decoder. | 176 // We lazily construct the decoder. |
177 if (!decoder_.get()) { | 177 if (!decoder_.get()) { |
178 decoder_.reset(new DecoderZlib()); | 178 decoder_.reset(new DecoderZlib()); |
179 } | 179 } |
180 | 180 |
181 // Tell the decoder to do start decoding. | 181 // Tell the decoder to do start decoding. |
182 decoder_->BeginDecode(frame_, &update_rects_, | 182 decoder_->BeginDecode(frame_, &update_rects_, |
183 NewRunnableMethod(this, &X11View::OnPartialDecodeDone), | 183 NewRunnableMethod(this, &X11View::OnPartialDecodeDone), |
184 NewRunnableMethod(this, &X11View::OnDecodeDone)); | 184 NewRunnableMethod(this, &X11View::OnDecodeDone)); |
185 } | 185 } |
186 | 186 |
187 void X11View::HandleUpdateStreamPacket(ChromotingHostMessage* msg) { | 187 void X11View::HandleUpdateStreamPacket(HostMessage* msg) { |
188 decoder_->PartialDecode(msg); | 188 decoder_->PartialDecode(msg); |
189 } | 189 } |
190 | 190 |
191 void X11View::HandleEndUpdateStream(ChromotingHostMessage* msg) { | 191 void X11View::HandleEndUpdateStream(HostMessage* msg) { |
192 scoped_ptr<ChromotingHostMessage> deleter(msg); | 192 scoped_ptr<HostMessage> deleter(msg); |
193 decoder_->EndDecode(); | 193 decoder_->EndDecode(); |
194 } | 194 } |
195 | 195 |
196 void X11View::OnPartialDecodeDone() { | 196 void X11View::OnPartialDecodeDone() { |
197 // Decoder has produced some output so schedule a paint. We'll get a Paint() | 197 // Decoder has produced some output so schedule a paint. We'll get a Paint() |
198 // call in the near future. Note that we can get UpdateStreamPacket during | 198 // call in the near future. Note that we can get UpdateStreamPacket during |
199 // this short period of time and we will perform decode again and the | 199 // this short period of time and we will perform decode again and the |
200 // information in updated rects will be lost. | 200 // information in updated rects will be lost. |
201 // There are several ways to solve this problem. | 201 // There are several ways to solve this problem. |
202 // 1. Merge the updated rects and perform one paint. | 202 // 1. Merge the updated rects and perform one paint. |
(...skipping 11 matching lines...) Expand all Loading... |
214 XEvent event; | 214 XEvent event; |
215 event.type = Expose; | 215 event.type = Expose; |
216 XSendEvent(display_, static_cast<int>(window_), true, ExposureMask, &event); | 216 XSendEvent(display_, static_cast<int>(window_), true, ExposureMask, &event); |
217 } | 217 } |
218 | 218 |
219 void X11View::OnDecodeDone() { | 219 void X11View::OnDecodeDone() { |
220 // Since we do synchronous decoding here there's nothing in this method. | 220 // Since we do synchronous decoding here there's nothing in this method. |
221 } | 221 } |
222 | 222 |
223 } // namespace remoting | 223 } // namespace remoting |
OLD | NEW |