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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
14 #include "base/win/message_window.h" | 14 #include "base/win/message_window.h" |
15 #include "remoting/host/client_session_control.h" | 15 #include "remoting/host/client_session_control.h" |
16 #include "third_party/skia/include/core/SkPoint.h" | |
17 | 16 |
18 namespace remoting { | 17 namespace remoting { |
19 | 18 |
20 namespace { | 19 namespace { |
21 | 20 |
22 const wchar_t kWindowClassFormat[] = L"Chromoting_LocalInputMonitorWin_%p"; | 21 const wchar_t kWindowClassFormat[] = L"Chromoting_LocalInputMonitorWin_%p"; |
23 | 22 |
24 // From the HID Usage Tables specification. | 23 // From the HID Usage Tables specification. |
25 const USHORT kGenericDesktopPage = 1; | 24 const USHORT kGenericDesktopPage = 1; |
26 const USHORT kMouseUsage = 2; | 25 const USHORT kMouseUsage = 2; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 input->header.hDevice != NULL) { | 190 input->header.hDevice != NULL) { |
192 POINT position; | 191 POINT position; |
193 if (!GetCursorPos(&position)) { | 192 if (!GetCursorPos(&position)) { |
194 position.x = 0; | 193 position.x = 0; |
195 position.y = 0; | 194 position.y = 0; |
196 } | 195 } |
197 | 196 |
198 caller_task_runner_->PostTask( | 197 caller_task_runner_->PostTask( |
199 FROM_HERE, base::Bind(&ClientSessionControl::OnLocalMouseMoved, | 198 FROM_HERE, base::Bind(&ClientSessionControl::OnLocalMouseMoved, |
200 client_session_control_, | 199 client_session_control_, |
201 SkIPoint::Make(position.x, position.y))); | 200 webrtc::DesktopVector(position.x, position.y))); |
202 } | 201 } |
203 | 202 |
204 return DefRawInputProc(&input, 1, sizeof(RAWINPUTHEADER)); | 203 return DefRawInputProc(&input, 1, sizeof(RAWINPUTHEADER)); |
205 } | 204 } |
206 | 205 |
207 bool LocalInputMonitorWin::Core::HandleMessage( | 206 bool LocalInputMonitorWin::Core::HandleMessage( |
208 UINT message, WPARAM wparam, LPARAM lparam, LRESULT* result) { | 207 UINT message, WPARAM wparam, LPARAM lparam, LRESULT* result) { |
209 switch (message) { | 208 switch (message) { |
210 case WM_CREATE: { | 209 case WM_CREATE: { |
211 // Register to receive raw mouse input. | 210 // Register to receive raw mouse input. |
(...skipping 27 matching lines...) Expand all Loading... |
239 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 238 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
240 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 239 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
241 base::WeakPtr<ClientSessionControl> client_session_control) { | 240 base::WeakPtr<ClientSessionControl> client_session_control) { |
242 return scoped_ptr<LocalInputMonitor>( | 241 return scoped_ptr<LocalInputMonitor>( |
243 new LocalInputMonitorWin(caller_task_runner, | 242 new LocalInputMonitorWin(caller_task_runner, |
244 ui_task_runner, | 243 ui_task_runner, |
245 client_session_control)); | 244 client_session_control)); |
246 } | 245 } |
247 | 246 |
248 } // namespace remoting | 247 } // namespace remoting |
OLD | NEW |