diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2012-01-31 13:15:32 +0300 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.cyanogenmod.com> | 2012-01-31 13:15:32 +0300 |
commit | 033d3f3d29cc371ad01aa7f9aa00c6de3d466699 (patch) | |
tree | 66ff4ba5e9c01c2ed944e9ed24a20943160daeae | |
parent | 0905c3e13a88e30a13007061be47db68b4264e00 (diff) | |
parent | 777521251e8e1ad51adca3d05daff88e459ab96b (diff) | |
download | frameworks_base-033d3f3d29cc371ad01aa7f9aa00c6de3d466699.zip frameworks_base-033d3f3d29cc371ad01aa7f9aa00c6de3d466699.tar.gz frameworks_base-033d3f3d29cc371ad01aa7f9aa00c6de3d466699.tar.bz2 |
Merge "Fix mouse clicks which reset mouse cursor to the left of screen" into gingerbread
-rw-r--r-- | libs/ui/EventHub.cpp | 14 | ||||
-rw-r--r-- | libs/ui/InputReader.cpp | 13 |
2 files changed, 17 insertions, 10 deletions
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp index 01facbb..e9cd66e 100644 --- a/libs/ui/EventHub.cpp +++ b/libs/ui/EventHub.cpp @@ -77,6 +77,9 @@ #define INDENT2 " " #define INDENT3 " " +//#define DEBUG_SHOW_DEVICES +//#define DEBUG_SHOW_KEYSDOWN + namespace android { static const char *WAKE_LOCK_ID = "KeyEvents"; @@ -217,16 +220,13 @@ int32_t EventHub::getKeyCodeStateLocked(device_t* device, int32_t keyCode) const uint8_t key_bitmask[sizeof_bit_array(KEY_MAX + 1)]; memset(key_bitmask, 0, sizeof(key_bitmask)); if (ioctl(device->fd, EVIOCGKEY(sizeof(key_bitmask)), key_bitmask) >= 0) { - #if 0 - for (size_t i=0; i<=KEY_MAX; i++) { - LOGI("(Scan code %d: down=%d)", i, test_bit(i, key_bitmask)); - } - #endif const size_t N = scanCodes.size(); for (size_t i=0; i<N && i<=KEY_MAX; i++) { int32_t sc = scanCodes.itemAt(i); - //LOGI("Code %d: down=%d", sc, test_bit(sc, key_bitmask)); if (sc >= 0 && sc <= KEY_MAX && test_bit(sc, key_bitmask)) { + #ifdef DEBUG_SHOW_KEYSDOWN + LOGI("Code %d: down=%d", sc, test_bit(sc, key_bitmask)); + #endif return AKEY_STATE_DOWN; } } @@ -662,7 +662,7 @@ int EventHub::openDevice(const char *deviceName) { mFDs = new_mFDs; mDevices = new_devices; -#if 0 +#ifdef DEBUG_SHOW_DEVICES LOGI("add device %d: %s\n", mFDCount, deviceName); LOGI(" bus: %04x\n" " vendor %04x\n" diff --git a/libs/ui/InputReader.cpp b/libs/ui/InputReader.cpp index 4cd24859..623ba27 100644 --- a/libs/ui/InputReader.cpp +++ b/libs/ui/InputReader.cpp @@ -22,6 +22,9 @@ // Log debug messages about pointer assignment calculations. #define DEBUG_POINTER_ASSIGNMENT 0 +// Log mouse events +#define DEBUG_MOUSE_EVENTS 0 + #include <cutils/log.h> #include <ui/InputReader.h> @@ -3514,10 +3517,14 @@ void MouseInputMapper::sync(nsecs_t when) { float x = fields & Accumulator::FIELD_REL_X ? mAccumulator.relX : 0.0f; float y = fields & Accumulator::FIELD_REL_Y ? mAccumulator.relY : 0.0f; - int32_t screenWidth; - int32_t screenHeight; - int32_t orientation; + static int32_t screenWidth; + static int32_t screenHeight; + static int32_t orientation; +#if DEBUG_MOUSE_EVENTS + LOGI("MouseInputMapper: x,y=%.1f,%.1f abs %dx%d, screen %dx%d", + x, y, mAccumulator.absX, mAccumulator.absY, screenWidth, screenHeight); +#endif mAccumulator.absX = (mAccumulator.absX + x) > screenWidth ? screenWidth -1 : ((mAccumulator.absX + x) < 0 ? 0 : mAccumulator.absX + x); mAccumulator.absY = (mAccumulator.absY + y) > screenHeight ? screenHeight -1 : ((mAccumulator.absY + y) < 0 ? 0 : mAccumulator.absY + y); pointerCoords.x = mAccumulator.absX; |