diff options
author | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-25 22:30:13 +0000 |
---|---|---|
committer | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-25 22:30:13 +0000 |
commit | fd945afc896f3e8799c12c2a5a421e6881463c90 (patch) | |
tree | 90562ddb1aac1c310fae12896b8bf90b0f27c901 /remoting/client | |
parent | aab6cf20141bd293affb74fc8480b36efcc8ee56 (diff) | |
download | chromium_src-fd945afc896f3e8799c12c2a5a421e6881463c90.zip chromium_src-fd945afc896f3e8799c12c2a5a421e6881463c90.tar.gz chromium_src-fd945afc896f3e8799c12c2a5a421e6881463c90.tar.bz2 |
Add plumbing for mouse-wheel support in Android Chromoting client
This will allow the TouchInputHandler code to inject mouse-wheel
events.
Review URL: https://codereview.chromium.org/80033003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237159 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client')
-rw-r--r-- | remoting/client/jni/chromoting_jni_instance.cc | 16 | ||||
-rw-r--r-- | remoting/client/jni/chromoting_jni_instance.h | 2 | ||||
-rw-r--r-- | remoting/client/jni/chromoting_jni_runtime.cc | 9 |
3 files changed, 27 insertions, 0 deletions
diff --git a/remoting/client/jni/chromoting_jni_instance.cc b/remoting/client/jni/chromoting_jni_instance.cc index bd0a063..59b9d38 100644 --- a/remoting/client/jni/chromoting_jni_instance.cc +++ b/remoting/client/jni/chromoting_jni_instance.cc @@ -141,6 +141,22 @@ void ChromotingJniInstance::PerformMouseAction( connection_->input_stub()->InjectMouseEvent(action); } +void ChromotingJniInstance::PerformMouseWheelDeltaAction(int delta_x, + int delta_y) { + if (!jni_runtime_->network_task_runner()->BelongsToCurrentThread()) { + jni_runtime_->network_task_runner()->PostTask( + FROM_HERE, + base::Bind(&ChromotingJniInstance::PerformMouseWheelDeltaAction, this, + delta_x, delta_y)); + return; + } + + protocol::MouseEvent action; + action.set_wheel_delta_x(delta_x); + action.set_wheel_delta_y(delta_y); + connection_->input_stub()->InjectMouseEvent(action); +} + void ChromotingJniInstance::PerformKeyboardAction(int key_code, bool key_down) { if (!jni_runtime_->network_task_runner()->BelongsToCurrentThread()) { jni_runtime_->network_task_runner()->PostTask( diff --git a/remoting/client/jni/chromoting_jni_instance.h b/remoting/client/jni/chromoting_jni_instance.h index 1c4ef43..db409f6 100644 --- a/remoting/client/jni/chromoting_jni_instance.h +++ b/remoting/client/jni/chromoting_jni_instance.h @@ -67,6 +67,8 @@ class ChromotingJniInstance protocol::MouseEvent_MouseButton button, bool button_down); + void PerformMouseWheelDeltaAction(int delta_x, int delta_y); + // Sends the provided keyboard scan code to the host. void PerformKeyboardAction(int key_code, bool key_down); diff --git a/remoting/client/jni/chromoting_jni_runtime.cc b/remoting/client/jni/chromoting_jni_runtime.cc index 09af790..22f4e47 100644 --- a/remoting/client/jni/chromoting_jni_runtime.cc +++ b/remoting/client/jni/chromoting_jni_runtime.cc @@ -117,6 +117,15 @@ static void MouseAction(JNIEnv* env, buttonDown); } +static void MouseWheelDeltaAction(JNIEnv* env, + jclass clazz, + jint delta_x, + jint delta_y) { + remoting::ChromotingJniRuntime::GetInstance() + ->session() + ->PerformMouseWheelDeltaAction(delta_x, delta_y); +} + static void KeyboardAction(JNIEnv* env, jclass clazz, jint keyCode, |