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

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

Issue 23484015: Added support of relative mouse motion in Chromoting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback and rebased 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/client/plugin/pepper_input_handler.cc ('k') | remoting/host/input_injector_win.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 <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 #include <X11/extensions/XTest.h> 8 #include <X11/extensions/XTest.h>
9 #include <X11/extensions/XInput.h> 9 #include <X11/extensions/XInput.h>
10 10
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 } 292 }
293 } 293 }
294 294
295 void InputInjectorLinux::Core::InjectMouseEvent(const MouseEvent& event) { 295 void InputInjectorLinux::Core::InjectMouseEvent(const MouseEvent& event) {
296 if (!task_runner_->BelongsToCurrentThread()) { 296 if (!task_runner_->BelongsToCurrentThread()) {
297 task_runner_->PostTask(FROM_HERE, 297 task_runner_->PostTask(FROM_HERE,
298 base::Bind(&Core::InjectMouseEvent, this, event)); 298 base::Bind(&Core::InjectMouseEvent, this, event));
299 return; 299 return;
300 } 300 }
301 301
302 if (event.has_x() && event.has_y()) { 302 if (event.has_delta_x() &&
303 event.has_delta_y() &&
304 (event.delta_x() != 0 || event.delta_y() != 0)) {
305 latest_mouse_position_ = SkIPoint::Make(-1, -1);
306 VLOG(3) << "Moving mouse by " << event.delta_x() << "," << event.delta_y();
307 XTestFakeRelativeMotionEvent(display_,
308 event.delta_x(), event.delta_y(),
309 CurrentTime);
310
311 } else if (event.has_x() && event.has_y()) {
303 // Injecting a motion event immediately before a button release results in 312 // Injecting a motion event immediately before a button release results in
304 // a MotionNotify even if the mouse position hasn't changed, which confuses 313 // a MotionNotify even if the mouse position hasn't changed, which confuses
305 // apps which assume MotionNotify implies movement. See crbug.com/138075. 314 // apps which assume MotionNotify implies movement. See crbug.com/138075.
306 bool inject_motion = true; 315 bool inject_motion = true;
307 SkIPoint new_mouse_position(SkIPoint::Make(event.x(), event.y())); 316 SkIPoint new_mouse_position(SkIPoint::Make(event.x(), event.y()));
308 if (event.has_button() && event.has_button_down() && !event.button_down()) { 317 if (event.has_button() && event.has_button_down() && !event.button_down()) {
309 if (new_mouse_position == latest_mouse_position_) 318 if (new_mouse_position == latest_mouse_position_)
310 inject_motion = false; 319 inject_motion = false;
311 } 320 }
312 321
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 516 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
508 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { 517 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
509 scoped_ptr<InputInjectorLinux> injector( 518 scoped_ptr<InputInjectorLinux> injector(
510 new InputInjectorLinux(main_task_runner)); 519 new InputInjectorLinux(main_task_runner));
511 if (!injector->Init()) 520 if (!injector->Init())
512 return scoped_ptr<InputInjector>(); 521 return scoped_ptr<InputInjector>();
513 return injector.PassAs<InputInjector>(); 522 return injector.PassAs<InputInjector>();
514 } 523 }
515 524
516 } // namespace remoting 525 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_input_handler.cc ('k') | remoting/host/input_injector_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698