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

Unified Diff: remoting/host/input_injector_x11.cc

Issue 756643006: Remote assistance on Chrome OS Part IX - Input injection on Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Ozone_input_injection
Patch Set: Fix rotation on X11 devices Created 6 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/input_injector_x11.cc
diff --git a/remoting/host/input_injector_x11.cc b/remoting/host/input_injector_x11.cc
index 3b5d2b46922014716fd862676de4a6c3f9c6ebd2..7c665eefa0b4bb756a332a8bb9c8d5b2f7b175d4 100644
--- a/remoting/host/input_injector_x11.cc
+++ b/remoting/host/input_injector_x11.cc
@@ -18,6 +18,9 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversion_utils.h"
#include "remoting/base/logging.h"
+#if defined(OS_CHROMEOS)
+#include "remoting/host/chromeos/display_transform_util.h"
+#endif
#include "remoting/host/clipboard.h"
#include "remoting/host/linux/unicode_to_keysym.h"
#include "remoting/proto/internal.pb.h"
@@ -401,8 +404,18 @@ void InputInjectorX11::Core::InjectMouseEvent(const MouseEvent& event) {
// a MotionNotify even if the mouse position hasn't changed, which confuses
// apps which assume MotionNotify implies movement. See crbug.com/138075.
bool inject_motion = true;
- webrtc::DesktopVector new_mouse_position(
- webrtc::DesktopVector(event.x(), event.y()));
+ webrtc::DesktopVector new_mouse_position(event.x(), event.y());
+#if defined(OS_CHROMEOS)
+ // When a physical display (1280 x 850) is rotated 90 degs (it is
+ // effectively an 850 x 1280) display, Chromoting clients sends mouse events
+ // in the rotated co-ordinates system (850 x 1280). However, ChromeOS
+ // expects the raw events to match the native resolution.
+ // Rotates the co-ordinates of the input events appropriately for the
+ // current display rotation settings.
+ gfx::PointF screen_location =
+ ConvertPointToNativeScreen(gfx::PointF(event.x(), event.y()));
+ new_mouse_position.set(screen_location.x(), screen_location.y());
Wez 2014/12/04 01:28:25 Can we do this rotation in the InputInjectorChrome
kelvinp 2014/12/05 03:17:28 This is going to be an interim hack, that will be
+#endif
if (event.has_button() && event.has_button_down() && !event.button_down()) {
if (new_mouse_position.equals(latest_mouse_position_))
inject_motion = false;

Powered by Google App Engine
This is Rietveld 408576698