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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/location.h" | 16 #include "base/location.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
19 #include "base/message_loop/message_pump_libevent.h" | 19 #include "base/message_loop/message_pump_libevent.h" |
20 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
21 #include "base/threading/non_thread_safe.h" | 21 #include "base/threading/non_thread_safe.h" |
22 #include "remoting/host/client_session_control.h" | 22 #include "remoting/host/client_session_control.h" |
23 #include "third_party/skia/include/core/SkPoint.h" | 23 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
24 | 24 |
25 // These includes need to be later than dictated by the style guide due to | 25 // These includes need to be later than dictated by the style guide due to |
26 // Xlib header pollution, specifically the min, max, and Status macros. | 26 // Xlib header pollution, specifically the min, max, and Status macros. |
27 #include <X11/XKBlib.h> | 27 #include <X11/XKBlib.h> |
28 #include <X11/Xlibint.h> | 28 #include <X11/Xlibint.h> |
29 #include <X11/extensions/record.h> | 29 #include <X11/extensions/record.h> |
30 | 30 |
31 namespace remoting { | 31 namespace remoting { |
32 | 32 |
33 namespace { | 33 namespace { |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 276 } |
277 | 277 |
278 void LocalInputMonitorLinux::Core::OnFileCanWriteWithoutBlocking(int fd) { | 278 void LocalInputMonitorLinux::Core::OnFileCanWriteWithoutBlocking(int fd) { |
279 NOTREACHED(); | 279 NOTREACHED(); |
280 } | 280 } |
281 | 281 |
282 void LocalInputMonitorLinux::Core::ProcessXEvent(xEvent* event) { | 282 void LocalInputMonitorLinux::Core::ProcessXEvent(xEvent* event) { |
283 DCHECK(input_task_runner_->BelongsToCurrentThread()); | 283 DCHECK(input_task_runner_->BelongsToCurrentThread()); |
284 | 284 |
285 if (event->u.u.type == MotionNotify) { | 285 if (event->u.u.type == MotionNotify) { |
286 SkIPoint position(SkIPoint::Make(event->u.keyButtonPointer.rootX, | 286 webrtc::DesktopVector position(event->u.keyButtonPointer.rootX, |
287 event->u.keyButtonPointer.rootY)); | 287 event->u.keyButtonPointer.rootY); |
288 caller_task_runner_->PostTask( | 288 caller_task_runner_->PostTask( |
289 FROM_HERE, base::Bind(&ClientSessionControl::OnLocalMouseMoved, | 289 FROM_HERE, base::Bind(&ClientSessionControl::OnLocalMouseMoved, |
290 client_session_control_, | 290 client_session_control_, |
291 position)); | 291 position)); |
292 } else { | 292 } else { |
293 int key_code = event->u.u.detail; | 293 int key_code = event->u.u.detail; |
294 bool down = event->u.u.type == KeyPress; | 294 bool down = event->u.u.type == KeyPress; |
295 KeySym key_sym = XkbKeycodeToKeysym(display_, key_code, 0, 0); | 295 KeySym key_sym = XkbKeycodeToKeysym(display_, key_code, 0, 0); |
296 if (key_sym == XK_Control_L || key_sym == XK_Control_R) { | 296 if (key_sym == XK_Control_L || key_sym == XK_Control_R) { |
297 ctrl_pressed_ = down; | 297 ctrl_pressed_ = down; |
(...skipping 24 matching lines...) Expand all Loading... |
322 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 322 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
323 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 323 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
324 base::WeakPtr<ClientSessionControl> client_session_control) { | 324 base::WeakPtr<ClientSessionControl> client_session_control) { |
325 return scoped_ptr<LocalInputMonitor>( | 325 return scoped_ptr<LocalInputMonitor>( |
326 new LocalInputMonitorLinux(caller_task_runner, | 326 new LocalInputMonitorLinux(caller_task_runner, |
327 input_task_runner, | 327 input_task_runner, |
328 client_session_control)); | 328 client_session_control)); |
329 } | 329 } |
330 | 330 |
331 } // namespace remoting | 331 } // namespace remoting |
OLD | NEW |