| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 XRenderPictFormat* pictformat = XRenderFindVisualFormat( | 151 XRenderPictFormat* pictformat = XRenderFindVisualFormat( |
| 152 display_, | 152 display_, |
| 153 attr.visual); | 153 attr.visual); |
| 154 CHECK(pictformat) << "XRENDER does not support default visual"; | 154 CHECK(pictformat) << "XRENDER does not support default visual"; |
| 155 | 155 |
| 156 picture_ = XRenderCreatePicture(display_, window_, pictformat, 0, NULL); | 156 picture_ = XRenderCreatePicture(display_, window_, pictformat, 0, NULL); |
| 157 CHECK(picture_) << "Backing picture not created"; | 157 CHECK(picture_) << "Backing picture not created"; |
| 158 } | 158 } |
| 159 | 159 |
| 160 void X11View::HandleBeginUpdateStream(HostMessage* msg) { | 160 void X11View::HandleBeginUpdateStream(ChromotingHostMessage* msg) { |
| 161 scoped_ptr<HostMessage> deleter(msg); | 161 scoped_ptr<ChromotingHostMessage> deleter(msg); |
| 162 | 162 |
| 163 // Make sure the |frame_| is initialized. | 163 // Make sure the |frame_| is initialized. |
| 164 if (!frame_) { | 164 if (!frame_) { |
| 165 media::VideoFrame::CreateFrame(media::VideoFrame::RGB32, | 165 media::VideoFrame::CreateFrame(media::VideoFrame::RGB32, |
| 166 frame_width_, frame_height_, | 166 frame_width_, frame_height_, |
| 167 base::TimeDelta(), base::TimeDelta(), | 167 base::TimeDelta(), base::TimeDelta(), |
| 168 &frame_); | 168 &frame_); |
| 169 CHECK(frame_); | 169 CHECK(frame_); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 void X11View::HandleUpdateStreamPacket(HostMessage* msg) { | 173 void X11View::HandleUpdateStreamPacket(ChromotingHostMessage* msg) { |
| 174 // Lazily initialize the decoder. | 174 // Lazily initialize the decoder. |
| 175 SetupDecoder(msg->update_stream_packet().begin_rect().encoding()); | 175 SetupDecoder(msg->update_stream_packet().begin_rect().encoding()); |
| 176 if (!decoder_->IsStarted()) { | 176 if (!decoder_->IsStarted()) { |
| 177 BeginDecoding(NewRunnableMethod(this, &X11View::OnPartialDecodeDone), | 177 BeginDecoding(NewRunnableMethod(this, &X11View::OnPartialDecodeDone), |
| 178 NewRunnableMethod(this, &X11View::OnDecodeDone)); | 178 NewRunnableMethod(this, &X11View::OnDecodeDone)); |
| 179 } | 179 } |
| 180 | 180 |
| 181 Decode(msg); | 181 Decode(msg); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void X11View::HandleEndUpdateStream(HostMessage* msg) { | 184 void X11View::HandleEndUpdateStream(ChromotingHostMessage* msg) { |
| 185 scoped_ptr<HostMessage> deleter(msg); | 185 scoped_ptr<HostMessage> deleter(msg); |
| 186 EndDecoding(); | 186 EndDecoding(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void X11View::OnPartialDecodeDone() { | 189 void X11View::OnPartialDecodeDone() { |
| 190 // Decoder has produced some output so schedule a paint. We'll get a Paint() | 190 // Decoder has produced some output so schedule a paint. We'll get a Paint() |
| 191 // call in the near future. Note that we can get UpdateStreamPacket during | 191 // call in the near future. Note that we can get UpdateStreamPacket during |
| 192 // this short period of time and we will perform decode again and the | 192 // this short period of time and we will perform decode again and the |
| 193 // information in updated rects will be lost. | 193 // information in updated rects will be lost. |
| 194 // There are several ways to solve this problem. | 194 // There are several ways to solve this problem. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 207 XEvent event; | 207 XEvent event; |
| 208 event.type = Expose; | 208 event.type = Expose; |
| 209 XSendEvent(display_, static_cast<int>(window_), true, ExposureMask, &event); | 209 XSendEvent(display_, static_cast<int>(window_), true, ExposureMask, &event); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void X11View::OnDecodeDone() { | 212 void X11View::OnDecodeDone() { |
| 213 // Since we do synchronous decoding here there's nothing in this method. | 213 // Since we do synchronous decoding here there's nothing in this method. |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace remoting | 216 } // namespace remoting |
| OLD | NEW |