summaryrefslogtreecommitdiffstats
path: root/libs/ui/InputReader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ui/InputReader.cpp')
-rw-r--r--libs/ui/InputReader.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/libs/ui/InputReader.cpp b/libs/ui/InputReader.cpp
index 4cd24859..7626b15 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>
@@ -331,8 +334,8 @@ InputDevice* InputReader::createDevice(int32_t deviceId, const String8& name, ui
}
if (keyboardSources != 0) {
- device->addMapper(new KeyboardInputMapper(device,
- associatedDisplayId, keyboardSources, keyboardType, mEventHub->getDeviceBluetooth(deviceId)));
+ device->addMapper(new KeyboardInputMapper(device, associatedDisplayId, keyboardSources,
+ keyboardType, mEventHub->getDeviceBusType(deviceId)));
}
// Trackball-like devices.
@@ -873,10 +876,12 @@ int32_t SwitchInputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCod
// --- KeyboardInputMapper ---
KeyboardInputMapper::KeyboardInputMapper(InputDevice* device, int32_t associatedDisplayId,
- uint32_t sources, int32_t keyboardType, bool bluetooth) :
+ uint32_t sources, int32_t keyboardType, uint32_t bustype) :
InputMapper(device), mAssociatedDisplayId(associatedDisplayId), mSources(sources),
- mKeyboardType(keyboardType), mBluetooth(bluetooth) {
+ mKeyboardType(keyboardType), mBusType(bustype) {
initializeLocked();
+ mBluetooth = (mBusType == BUS_BLUETOOTH);
+ mUSB = (mBusType == BUS_USB);
}
KeyboardInputMapper::~KeyboardInputMapper() {
@@ -965,7 +970,7 @@ void KeyboardInputMapper::processKey(nsecs_t when, bool down, int32_t keyCode,
if (down) {
// Rotate key codes according to orientation if needed.
// Note: getDisplayInfo is non-reentrant so we can continue holding the lock.
- if (!mBluetooth && mAssociatedDisplayId >= 0) {
+ if (!mBluetooth && !mUSB && mAssociatedDisplayId >= 0) {
int32_t orientation;
if (! getPolicy()->getDisplayInfo(mAssociatedDisplayId, NULL, NULL, & orientation)) {
return;
@@ -3514,10 +3519,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;