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

Unified Diff: remoting/host/input_injector_win.cc

Issue 23484015: Added support of relative mouse motion in Chromoting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/input_injector_win.cc
diff --git a/remoting/host/input_injector_win.cc b/remoting/host/input_injector_win.cc
index 47cd7ef10df5f5f84c703705e7443948e937032c..352f82bd314d7f925ae84877d2a633e1dc0db7a1 100644
--- a/remoting/host/input_injector_win.cc
+++ b/remoting/host/input_injector_win.cc
@@ -219,20 +219,26 @@ void InputInjectorWin::Core::HandleMouse(const MouseEvent& event) {
// Reset the system idle suspend timeout.
SetThreadExecutionState(ES_SYSTEM_REQUIRED);
- // TODO(garykac) Collapse mouse (x,y) and button events into a single
+ // TODO(garykac) Collapse mouse movement and button events into a single
// input event when possible.
- if (event.has_x() && event.has_y()) {
- int x = event.x();
- int y = event.y();
-
+ if (event.has_delta_x() && event.has_delta_y()) {
+ INPUT input;
+ input.type = INPUT_MOUSE;
+ input.mi.time = 0;
+ input.mi.dx = event.delta_x();
+ input.mi.dy = event.delta_y();
+ input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_VIRTUALDESK;
+ if (SendInput(1, &input, sizeof(INPUT)) == 0)
Wez 2013/09/05 20:24:45 How does this interact with mouse acceleration?
alexeypa (please no reviews) 2013/09/06 20:00:17 MSDN: Relative mouse motion is subject to the eff
+ LOG_GETLASTERROR(ERROR) << "Failed to inject a mouse move event";
+ } else if (event.has_x() && event.has_y()) {
INPUT input;
input.type = INPUT_MOUSE;
input.mi.time = 0;
SkISize screen_size(SkISize::Make(GetSystemMetrics(SM_CXVIRTUALSCREEN),
GetSystemMetrics(SM_CYVIRTUALSCREEN)));
if ((screen_size.width() > 1) && (screen_size.height() > 1)) {
- x = std::max(0, std::min(screen_size.width(), x));
- y = std::max(0, std::min(screen_size.height(), y));
+ int x = std::max(0, std::min(screen_size.width(), event.x()));
+ int y = std::max(0, std::min(screen_size.height(), event.y()));
input.mi.dx = static_cast<int>((x * 65535) / (screen_size.width() - 1));
input.mi.dy = static_cast<int>((y * 65535) / (screen_size.height() - 1));
input.mi.dwFlags =

Powered by Google App Engine
This is Rietveld 408576698