Chromium Code Reviews| OLD | NEW |
|---|---|
| 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; | 5 package org.chromium.chromoting; |
| 6 | 6 |
| 7 import android.app.ActionBar; | 7 import android.app.ActionBar; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
| 10 import android.graphics.Canvas; | 10 import android.graphics.Canvas; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 | 78 |
| 79 private int mMouseButton; | 79 private int mMouseButton; |
| 80 private boolean mMousePressed; | 80 private boolean mMousePressed; |
| 81 | 81 |
| 82 public DesktopView(Activity context) { | 82 public DesktopView(Activity context) { |
| 83 super(context); | 83 super(context); |
| 84 mActionBar = context.getActionBar(); | 84 mActionBar = context.getActionBar(); |
| 85 | 85 |
| 86 getHolder().addCallback(this); | 86 getHolder().addCallback(this); |
| 87 DesktopListener listener = new DesktopListener(); | 87 DesktopListener listener = new DesktopListener(); |
| 88 mScroller = new GestureDetector(context, listener); | 88 mScroller = new GestureDetector(context, listener, null, false); |
| 89 mZoomer = new ScaleGestureDetector(context, listener); | 89 mZoomer = new ScaleGestureDetector(context, listener); |
| 90 | 90 |
| 91 mTransform = new Matrix(); | 91 mTransform = new Matrix(); |
| 92 mScreenWidth = 0; | 92 mScreenWidth = 0; |
| 93 mScreenHeight = 0; | 93 mScreenHeight = 0; |
| 94 | 94 |
| 95 mConstraint = Constraint.UNDEFINED; | 95 mConstraint = Constraint.UNDEFINED; |
| 96 mRecheckConstraint = false; | 96 mRecheckConstraint = false; |
| 97 | 97 |
| 98 mRightUsedToBeOut = false; | 98 mRightUsedToBeOut = false; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 mMouseButton = BUTTON_LEFT; | 307 mMouseButton = BUTTON_LEFT; |
| 308 mMousePressed = true; | 308 mMousePressed = true; |
| 309 } | 309 } |
| 310 break; | 310 break; |
| 311 | 311 |
| 312 case MotionEvent.ACTION_UP: | 312 case MotionEvent.ACTION_UP: |
| 313 Log.i("mouse", "Lost the finger"); | 313 Log.i("mouse", "Lost the finger"); |
| 314 if (mMouseButton == BUTTON_UNDEFINED) { | 314 if (mMouseButton == BUTTON_UNDEFINED) { |
| 315 // The user pressed and released without moving: do left click and release. | 315 // The user pressed and released without moving: do left click and release. |
| 316 Log.i("mouse", "\tStarting and finishing left click"); | 316 Log.i("mouse", "\tStarting and finishing left click"); |
| 317 handleMouseMovement(coordinates, BUTTON_LEFT, true); | 317 handleMouseMovement(new float[] {coordinates[0], coordin ates[1]}, |
| 318 BUTTON_LEFT, true); | |
|
garykac
2013/07/30 17:50:05
indent
solb
2013/07/30 18:28:54
http://source.android.com/source/code-style.html#u
| |
| 318 mMouseButton = BUTTON_LEFT; | 319 mMouseButton = BUTTON_LEFT; |
| 319 mMousePressed = false; | 320 mMousePressed = false; |
| 320 } | 321 } |
| 321 else if (mMousePressed) { | 322 else if (mMousePressed) { |
| 322 Log.i("mouse", "\tReleasing the currently-pressed button "); | 323 Log.i("mouse", "\tReleasing the currently-pressed button "); |
| 323 mMousePressed = false; | 324 mMousePressed = false; |
| 324 } | 325 } |
| 325 else { | 326 else { |
| 326 Log.w("mouse", "Button already in released state before gesture ended"); | 327 Log.w("mouse", "Button already in released state before gesture ended"); |
| 327 } | 328 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 handleMouseMovement(coordinates, mMouseButton, false); | 414 handleMouseMovement(coordinates, mMouseButton, false); |
| 414 } | 415 } |
| 415 | 416 |
| 416 Log.i("mouse", "\tStarting right click"); | 417 Log.i("mouse", "\tStarting right click"); |
| 417 mMouseButton = BUTTON_RIGHT; | 418 mMouseButton = BUTTON_RIGHT; |
| 418 mMousePressed = true; | 419 mMousePressed = true; |
| 419 handleMouseMovement(coordinates, mMouseButton, mMousePressed); | 420 handleMouseMovement(coordinates, mMouseButton, mMousePressed); |
| 420 } | 421 } |
| 421 } | 422 } |
| 422 } | 423 } |
| OLD | NEW |