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/host/event_executor_win.h" | 5 #include "remoting/host/event_executor_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include "base/keyboard_codes.h" | 8 #include "base/keyboard_codes.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 | 10 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 EventExecutorWin::EventExecutorWin() { | 350 EventExecutorWin::EventExecutorWin() { |
351 } | 351 } |
352 | 352 |
353 EventExecutorWin::~EventExecutorWin() { | 353 EventExecutorWin::~EventExecutorWin() { |
354 } | 354 } |
355 | 355 |
356 void EventExecutorWin::HandleInputEvents(ClientMessageList* messages) { | 356 void EventExecutorWin::HandleInputEvents(ClientMessageList* messages) { |
357 for (size_t i = 0; i < messages->size(); ++i) { | 357 for (size_t i = 0; i < messages->size(); ++i) { |
358 ChromotingClientMessage* msg = (*messages)[i]; | 358 ChromotingClientMessage* msg = (*messages)[i]; |
359 if (msg->has_mouse_set_position_event()) { | 359 if (msg->has_mouse_set_position_event()) { |
360 mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, | 360 // TODO(garykac) Updated Windows host mouse support in following cl. |
361 static_cast<int>((msg->mouse_set_position_event().x() * 65535)), | |
362 static_cast<int>((msg->mouse_set_position_event().y() * 65535)), | |
363 0, 0); | |
364 } else if (msg->has_mouse_move_event()) { | 361 } else if (msg->has_mouse_move_event()) { |
365 mouse_event(MOUSEEVENTF_MOVE, | 362 // TODO(garykac) Updated Windows host mouse support in following cl. |
366 msg->mouse_move_event().offset_x(), | |
367 msg->mouse_move_event().offset_y(), 0, 0); | |
368 } else if (msg->has_mouse_wheel_event()) { | 363 } else if (msg->has_mouse_wheel_event()) { |
369 // TODO(hclam): Handle wheel events. | 364 // TODO(garykac) Updated Windows host wheel support in following cl. |
370 } else if (msg->has_mouse_down_event()) { | 365 } else if (msg->has_mouse_down_event()) { |
371 if (msg->mouse_down_event().button() == | 366 // TODO(garykac) Updated Windows host mouse support in following cl. |
372 MouseDownEvent::LEFT) { | |
373 mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); | |
374 } else if (msg->mouse_down_event().button() == | |
375 MouseDownEvent::RIGHT) { | |
376 mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0); | |
377 } else { | |
378 // TODO(hclam): Handle other buttons. | |
379 } | |
380 } else if (msg->has_mouse_up_event()) { | 367 } else if (msg->has_mouse_up_event()) { |
381 if (msg->mouse_up_event().button() == | 368 // TODO(garykac) Updated Windows host mouse support in following cl. |
382 MouseUpEvent::LEFT) { | |
383 mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); | |
384 } else if (msg->mouse_up_event().button() == | |
385 MouseUpEvent::RIGHT) { | |
386 mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0); | |
387 } else { | |
388 // TODO(hclam): Handle other buttons. | |
389 } | |
390 } else if (msg->has_key_event()) { | 369 } else if (msg->has_key_event()) { |
391 base::KeyboardCode key_code = | 370 base::KeyboardCode key_code = |
392 WindowsKeyCodeForPosixKeyCode(msg->key_event().key()); | 371 WindowsKeyCodeForPosixKeyCode(msg->key_event().key()); |
393 if (key_code != base::VKEY_UNKNOWN) { | 372 if (key_code != base::VKEY_UNKNOWN) { |
394 keybd_event(key_code, MapVirtualKey(key_code, 0), | 373 keybd_event(key_code, MapVirtualKey(key_code, 0), |
395 msg->key_event().pressed() ? 0 : KEYEVENTF_KEYUP, | 374 msg->key_event().pressed() ? 0 : KEYEVENTF_KEYUP, |
396 NULL); | 375 NULL); |
397 } | 376 } |
398 } | 377 } |
399 } | 378 } |
400 // We simply delete all messages. | 379 // We simply delete all messages. |
401 // TODO(hclam): Delete messages processed. | 380 // TODO(hclam): Delete messages processed. |
402 STLDeleteElements<ClientMessageList>(messages); | 381 STLDeleteElements<ClientMessageList>(messages); |
403 } | 382 } |
404 | 383 |
405 } // namespace remoting | 384 } // namespace remoting |
OLD | NEW |