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

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java

Issue 21236002: Chromoting Android app mouse/keyboard bugfixes and enhancements (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 package org.chromium.chromoting.jni; 5 package org.chromium.chromoting.jni;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.app.AlertDialog; 8 import android.app.AlertDialog;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.DialogInterface; 10 import android.content.DialogInterface;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (sRedrawCallback != null) 191 if (sRedrawCallback != null)
192 sRedrawCallback.run(); 192 sRedrawCallback.run();
193 } 193 }
194 194
195 /** 195 /**
196 * Obtains the image buffer. 196 * Obtains the image buffer.
197 * This should not be called from the UI thread. (We prefer the native graph ics thread.) 197 * This should not be called from the UI thread. (We prefer the native graph ics thread.)
198 */ 198 */
199 public static Bitmap retrieveVideoFrame() { 199 public static Bitmap retrieveVideoFrame() {
200 if (Looper.myLooper() == Looper.getMainLooper()) { 200 if (Looper.myLooper() == Looper.getMainLooper()) {
201 Log.w("deskview", "Canvas being redrawn on UI thread"); 201 Log.w("jniiface", "Canvas being redrawn on UI thread");
202 } 202 }
203 203
204 if (!sConnected) { 204 if (!sConnected) {
205 return null; 205 return null;
206 } 206 }
207 207
208 int[] frame = new int[sWidth * sHeight]; 208 int[] frame = new int[sWidth * sHeight];
209 209
210 sBuffer.order(ByteOrder.LITTLE_ENDIAN); 210 sBuffer.order(ByteOrder.LITTLE_ENDIAN);
211 sBuffer.asIntBuffer().get(frame, 0, frame.length); 211 sBuffer.asIntBuffer().get(frame, 0, frame.length);
212 212
213 return Bitmap.createBitmap(frame, 0, sWidth, sWidth, sHeight, Bitmap.Con fig.ARGB_8888); 213 return Bitmap.createBitmap(frame, 0, sWidth, sWidth, sHeight, Bitmap.Con fig.ARGB_8888);
214 } 214 }
215 215
216 /** Moves the mouse cursor, possibly while clicking. */ 216 /** Moves the mouse cursor, possibly while clicking the specified (nonnegati ve) button. */
217 public static void mouseAction(int x, int y, int whichButton, boolean button Down) { 217 public static void mouseAction(int x, int y, int whichButton, boolean button Down) {
218 if (whichButton < 0) {
219 Log.e("jniiface", "Attempted to press a negative mouse button");
garykac 2013/07/30 17:50:05 Why are there negative buttons? Isn't this constr
solb 2013/07/30 18:28:54 Yes, it is constrained thusly. However, I added th
220 return;
221 }
218 if (!sConnected) { 222 if (!sConnected) {
219 return; 223 return;
220 } 224 }
221 225
222 mouseActionNative(x, y, whichButton, buttonDown); 226 mouseActionNative(x, y, whichButton, buttonDown);
223 } 227 }
224 228
225 /** Presses and releases the specified key. */ 229 /** Presses and releases the specified (nonnegative) key. */
226 public static void keyboardAction(int keyCode, boolean keyDown) { 230 public static void keyboardAction(int keyCode, boolean keyDown) {
231 if (keyCode < 0) {
232 Log.e("jniiface", "Attempted to hit a negative key");
233 return;
234 }
227 if (!sConnected) { 235 if (!sConnected) {
228 return; 236 return;
229 } 237 }
230 238
231 keyboardActionNative(keyCode, keyDown); 239 keyboardActionNative(keyCode, keyDown);
232 } 240 }
233 241
234 /** Performs the native response to the user's PIN. */ 242 /** Performs the native response to the user's PIN. */
235 private static native void authenticationResponse(String pin); 243 private static native void authenticationResponse(String pin);
236 244
237 /** Schedules a redraw on the native graphics thread. */ 245 /** Schedules a redraw on the native graphics thread. */
238 private static native void scheduleRedrawNative(); 246 private static native void scheduleRedrawNative();
239 247
240 /** Passes mouse information to the native handling code. */ 248 /** Passes mouse information to the native handling code. */
241 private static native void mouseActionNative(int x, int y, int whichButton, boolean buttonDown); 249 private static native void mouseActionNative(int x, int y, int whichButton, boolean buttonDown);
242 250
243 /** Passes key press information to the native handling code. */ 251 /** Passes key press information to the native handling code. */
244 private static native void keyboardActionNative(int keyCode, boolean keyDown ); 252 private static native void keyboardActionNative(int keyCode, boolean keyDown );
245 } 253 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698