OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/host/local_input_monitor.h" | 5 #include "remoting/host/local_input_monitor.h" |
6 | 6 |
7 #include <sys/select.h> | 7 #include <sys/select.h> |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 #define XK_MISCELLANY | 9 #define XK_MISCELLANY |
10 #include <X11/keysymdef.h> | 10 #include <X11/keysymdef.h> |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 if (!XRecordEnableContextAsync(x_record_display_, x_record_context_, | 207 if (!XRecordEnableContextAsync(x_record_display_, x_record_context_, |
208 &Core::ProcessReply, | 208 &Core::ProcessReply, |
209 reinterpret_cast<XPointer>(this))) { | 209 reinterpret_cast<XPointer>(this))) { |
210 LOG(ERROR) << "XRecordEnableContextAsync failed."; | 210 LOG(ERROR) << "XRecordEnableContextAsync failed."; |
211 return; | 211 return; |
212 } | 212 } |
213 | 213 |
214 // Register OnFileCanReadWithoutBlocking() to be called every time there is | 214 // Register OnFileCanReadWithoutBlocking() to be called every time there is |
215 // something to read from |x_record_display_|. | 215 // something to read from |x_record_display_|. |
216 MessageLoopForIO* message_loop = MessageLoopForIO::current(); | 216 base::MessageLoopForIO* message_loop = base::MessageLoopForIO::current(); |
217 int result = message_loop->WatchFileDescriptor( | 217 int result = |
218 ConnectionNumber(x_record_display_), true, MessageLoopForIO::WATCH_READ, | 218 message_loop->WatchFileDescriptor(ConnectionNumber(x_record_display_), |
219 &controller_, this); | 219 true, |
| 220 base::MessageLoopForIO::WATCH_READ, |
| 221 &controller_, |
| 222 this); |
220 if (!result) { | 223 if (!result) { |
221 LOG(ERROR) << "Failed to create X record task."; | 224 LOG(ERROR) << "Failed to create X record task."; |
222 return; | 225 return; |
223 } | 226 } |
224 | 227 |
225 // Fetch pending events if any. | 228 // Fetch pending events if any. |
226 while (XPending(x_record_display_)) { | 229 while (XPending(x_record_display_)) { |
227 XEvent ev; | 230 XEvent ev; |
228 XNextEvent(x_record_display_, &ev); | 231 XNextEvent(x_record_display_, &ev); |
229 } | 232 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 323 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
321 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 324 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
322 base::WeakPtr<ClientSessionControl> client_session_control) { | 325 base::WeakPtr<ClientSessionControl> client_session_control) { |
323 return scoped_ptr<LocalInputMonitor>( | 326 return scoped_ptr<LocalInputMonitor>( |
324 new LocalInputMonitorLinux(caller_task_runner, | 327 new LocalInputMonitorLinux(caller_task_runner, |
325 input_task_runner, | 328 input_task_runner, |
326 client_session_control)); | 329 client_session_control)); |
327 } | 330 } |
328 | 331 |
329 } // namespace remoting | 332 } // namespace remoting |
OLD | NEW |