Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: remoting/host/input_injector_win.cc

Issue 112453002: Remove dependency on skia from remoting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/input_injector_mac.cc ('k') | remoting/host/ipc_desktop_environment_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/input_injector.h" 5 #include "remoting/host/input_injector.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "remoting/base/util.h" 14 #include "remoting/base/util.h"
15 #include "remoting/host/clipboard.h" 15 #include "remoting/host/clipboard.h"
16 #include "remoting/proto/event.pb.h" 16 #include "remoting/proto/event.pb.h"
17 // SkSize.h assumes that stdint.h-style types are already defined.
18 #include "third_party/skia/include/core/SkSize.h"
19 #include "third_party/skia/include/core/SkTypes.h"
20 #include "ui/events/keycodes/dom4/keycode_converter.h" 17 #include "ui/events/keycodes/dom4/keycode_converter.h"
21 18
22 namespace remoting { 19 namespace remoting {
23 20
24 namespace { 21 namespace {
25 22
26 using protocol::ClipboardEvent; 23 using protocol::ClipboardEvent;
27 using protocol::KeyEvent; 24 using protocol::KeyEvent;
28 using protocol::MouseEvent; 25 using protocol::MouseEvent;
29 26
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 214
218 INPUT input; 215 INPUT input;
219 memset(&input, 0, sizeof(input)); 216 memset(&input, 0, sizeof(input));
220 input.type = INPUT_MOUSE; 217 input.type = INPUT_MOUSE;
221 218
222 if (event.has_delta_x() && event.has_delta_y()) { 219 if (event.has_delta_x() && event.has_delta_y()) {
223 input.mi.dx = event.delta_x(); 220 input.mi.dx = event.delta_x();
224 input.mi.dy = event.delta_y(); 221 input.mi.dy = event.delta_y();
225 input.mi.dwFlags |= MOUSEEVENTF_MOVE | MOUSEEVENTF_VIRTUALDESK; 222 input.mi.dwFlags |= MOUSEEVENTF_MOVE | MOUSEEVENTF_VIRTUALDESK;
226 } else if (event.has_x() && event.has_y()) { 223 } else if (event.has_x() && event.has_y()) {
227 SkISize screen_size(SkISize::Make(GetSystemMetrics(SM_CXVIRTUALSCREEN), 224 int width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
228 GetSystemMetrics(SM_CYVIRTUALSCREEN))); 225 int height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
229 if ((screen_size.width() > 1) && (screen_size.height() > 1)) { 226 if (width > 1 && height > 1) {
230 int x = std::max(0, std::min(screen_size.width(), event.x())); 227 int x = std::max(0, std::min(width, event.x()));
231 int y = std::max(0, std::min(screen_size.height(), event.y())); 228 int y = std::max(0, std::min(height, event.y()));
232 input.mi.dx = static_cast<int>((x * 65535) / (screen_size.width() - 1)); 229 input.mi.dx = static_cast<int>((x * 65535) / (width - 1));
233 input.mi.dy = static_cast<int>((y * 65535) / (screen_size.height() - 1)); 230 input.mi.dy = static_cast<int>((y * 65535) / (height - 1));
234 input.mi.dwFlags |= 231 input.mi.dwFlags |=
235 MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK; 232 MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK;
236 } 233 }
237 } 234 }
238 235
239 int wheel_delta_x = 0; 236 int wheel_delta_x = 0;
240 int wheel_delta_y = 0; 237 int wheel_delta_y = 0;
241 if (event.has_wheel_delta_x() && event.has_wheel_delta_y()) { 238 if (event.has_wheel_delta_x() && event.has_wheel_delta_y()) {
242 wheel_delta_x = static_cast<int>(event.wheel_delta_x()); 239 wheel_delta_x = static_cast<int>(event.wheel_delta_x());
243 wheel_delta_y = static_cast<int>(event.wheel_delta_y()); 240 wheel_delta_y = static_cast<int>(event.wheel_delta_y());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } // namespace 285 } // namespace
289 286
290 scoped_ptr<InputInjector> InputInjector::Create( 287 scoped_ptr<InputInjector> InputInjector::Create(
291 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 288 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
292 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { 289 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
293 return scoped_ptr<InputInjector>( 290 return scoped_ptr<InputInjector>(
294 new InputInjectorWin(main_task_runner, ui_task_runner)); 291 new InputInjectorWin(main_task_runner, ui_task_runner));
295 } 292 }
296 293
297 } // namespace remoting 294 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/input_injector_mac.cc ('k') | remoting/host/ipc_desktop_environment_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698