Loading include/ui/EventHub.h +2 −2 Original line number Diff line number Diff line Loading @@ -109,8 +109,8 @@ enum { /* The input device is a touchscreen (either single-touch or multi-touch). */ INPUT_DEVICE_CLASS_TOUCHSCREEN = 0x00000004, /* The input device is a trackball. */ INPUT_DEVICE_CLASS_TRACKBALL = 0x00000008, /* The input device is a cursor device such as a trackball or mouse. */ INPUT_DEVICE_CLASS_CURSOR = 0x00000008, /* The input device is a multi-touch touchscreen. */ INPUT_DEVICE_CLASS_TOUCHSCREEN_MT= 0x00000010, Loading include/ui/InputReader.h +18 −3 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <ui/EventHub.h> #include <ui/Input.h> #include <ui/InputDispatcher.h> #include <ui/PointerController.h> #include <utils/KeyedVector.h> #include <utils/threads.h> #include <utils/Timers.h> Loading Loading @@ -77,6 +78,9 @@ public: /* Gets the excluded device names for the platform. */ virtual void getExcludedDeviceNames(Vector<String8>& outExcludedDeviceNames) = 0; /* Gets a pointer controller associated with the specified cursor device (ie. a mouse). */ virtual sp<PointerControllerInterface> obtainPointerController(int32_t deviceId) = 0; }; Loading Loading @@ -421,10 +425,10 @@ private: }; class TrackballInputMapper : public InputMapper { class CursorInputMapper : public InputMapper { public: TrackballInputMapper(InputDevice* device); virtual ~TrackballInputMapper(); CursorInputMapper(InputDevice* device); virtual ~CursorInputMapper(); virtual uint32_t getSources(); virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo); Loading @@ -443,6 +447,12 @@ private: // Immutable configuration parameters. struct Parameters { enum Mode { MODE_POINTER, MODE_NAVIGATION, }; Mode mode; int32_t associatedDisplayId; bool orientationAware; } mParameters; Loading @@ -465,10 +475,12 @@ private: } } mAccumulator; int32_t mSources; float mXScale; float mYScale; float mXPrecision; float mYPrecision; sp<PointerControllerInterface> mPointerController; struct LockedState { bool down; Loading Loading @@ -572,6 +584,9 @@ protected: } }; // Input sources supported by the device. int32_t mSources; // Immutable configuration parameters. struct Parameters { enum DeviceType { Loading include/ui/PointerController.h 0 → 100644 +63 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _UI_POINTER_CONTROLLER_H #define _UI_POINTER_CONTROLLER_H #include <utils/RefBase.h> namespace android { enum { POINTER_BUTTON_1 = 1 << 0, }; /** * Interface for tracking a single (mouse) pointer. * * The pointer controller is responsible for providing synchronization and for tracking * display orientation changes if needed. */ class PointerControllerInterface : public virtual RefBase { protected: PointerControllerInterface() { } virtual ~PointerControllerInterface() { } public: /* Gets the bounds of the region that the pointer can traverse. * Returns true if the bounds are available. */ virtual bool getBounds(float* outMinX, float* outMinY, float* outMaxX, float* outMaxY) const = 0; /* Move the pointer. */ virtual void move(float deltaX, float deltaY) = 0; /* Sets a mask that indicates which buttons are pressed. */ virtual void setButtonState(uint32_t buttonState) = 0; /* Gets a mask that indicates which buttons are pressed. */ virtual uint32_t getButtonState() const = 0; /* Sets the absolute location of the pointer. */ virtual void setPosition(float x, float y) = 0; /* Gets the absolute location of the pointer. */ virtual void getPosition(float* outX, float* outY) const = 0; }; } // namespace android #endif // _UI_POINTER_CONTROLLER_H include/utils/PropertyMap.h +6 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,12 @@ public: bool tryGetProperty(const String8& key, int32_t& outValue) const; bool tryGetProperty(const String8& key, float& outValue) const; /* Adds all values from the specified property map. */ void addAll(const PropertyMap* map); /* Gets the underlying property map. */ inline const KeyedVector<String8, String8>& getProperties() const { return mProperties; } /* Loads a property map from a file. */ static status_t load(const String8& filename, PropertyMap** outMap); Loading libs/ui/EventHub.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -755,14 +755,14 @@ int EventHub::openDevice(const char *devicePath) { } } // See if this is a trackball (or mouse). // See if this is a cursor device such as a trackball or mouse. if (test_bit(BTN_MOUSE, key_bitmask)) { uint8_t rel_bitmask[sizeof_bit_array(REL_MAX + 1)]; memset(rel_bitmask, 0, sizeof(rel_bitmask)); LOGV("Getting relative controllers..."); if (ioctl(fd, EVIOCGBIT(EV_REL, sizeof(rel_bitmask)), rel_bitmask) >= 0) { if (test_bit(REL_X, rel_bitmask) && test_bit(REL_Y, rel_bitmask)) { device->classes |= INPUT_DEVICE_CLASS_TRACKBALL; device->classes |= INPUT_DEVICE_CLASS_CURSOR; } } } Loading Loading
include/ui/EventHub.h +2 −2 Original line number Diff line number Diff line Loading @@ -109,8 +109,8 @@ enum { /* The input device is a touchscreen (either single-touch or multi-touch). */ INPUT_DEVICE_CLASS_TOUCHSCREEN = 0x00000004, /* The input device is a trackball. */ INPUT_DEVICE_CLASS_TRACKBALL = 0x00000008, /* The input device is a cursor device such as a trackball or mouse. */ INPUT_DEVICE_CLASS_CURSOR = 0x00000008, /* The input device is a multi-touch touchscreen. */ INPUT_DEVICE_CLASS_TOUCHSCREEN_MT= 0x00000010, Loading
include/ui/InputReader.h +18 −3 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <ui/EventHub.h> #include <ui/Input.h> #include <ui/InputDispatcher.h> #include <ui/PointerController.h> #include <utils/KeyedVector.h> #include <utils/threads.h> #include <utils/Timers.h> Loading Loading @@ -77,6 +78,9 @@ public: /* Gets the excluded device names for the platform. */ virtual void getExcludedDeviceNames(Vector<String8>& outExcludedDeviceNames) = 0; /* Gets a pointer controller associated with the specified cursor device (ie. a mouse). */ virtual sp<PointerControllerInterface> obtainPointerController(int32_t deviceId) = 0; }; Loading Loading @@ -421,10 +425,10 @@ private: }; class TrackballInputMapper : public InputMapper { class CursorInputMapper : public InputMapper { public: TrackballInputMapper(InputDevice* device); virtual ~TrackballInputMapper(); CursorInputMapper(InputDevice* device); virtual ~CursorInputMapper(); virtual uint32_t getSources(); virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo); Loading @@ -443,6 +447,12 @@ private: // Immutable configuration parameters. struct Parameters { enum Mode { MODE_POINTER, MODE_NAVIGATION, }; Mode mode; int32_t associatedDisplayId; bool orientationAware; } mParameters; Loading @@ -465,10 +475,12 @@ private: } } mAccumulator; int32_t mSources; float mXScale; float mYScale; float mXPrecision; float mYPrecision; sp<PointerControllerInterface> mPointerController; struct LockedState { bool down; Loading Loading @@ -572,6 +584,9 @@ protected: } }; // Input sources supported by the device. int32_t mSources; // Immutable configuration parameters. struct Parameters { enum DeviceType { Loading
include/ui/PointerController.h 0 → 100644 +63 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _UI_POINTER_CONTROLLER_H #define _UI_POINTER_CONTROLLER_H #include <utils/RefBase.h> namespace android { enum { POINTER_BUTTON_1 = 1 << 0, }; /** * Interface for tracking a single (mouse) pointer. * * The pointer controller is responsible for providing synchronization and for tracking * display orientation changes if needed. */ class PointerControllerInterface : public virtual RefBase { protected: PointerControllerInterface() { } virtual ~PointerControllerInterface() { } public: /* Gets the bounds of the region that the pointer can traverse. * Returns true if the bounds are available. */ virtual bool getBounds(float* outMinX, float* outMinY, float* outMaxX, float* outMaxY) const = 0; /* Move the pointer. */ virtual void move(float deltaX, float deltaY) = 0; /* Sets a mask that indicates which buttons are pressed. */ virtual void setButtonState(uint32_t buttonState) = 0; /* Gets a mask that indicates which buttons are pressed. */ virtual uint32_t getButtonState() const = 0; /* Sets the absolute location of the pointer. */ virtual void setPosition(float x, float y) = 0; /* Gets the absolute location of the pointer. */ virtual void getPosition(float* outX, float* outY) const = 0; }; } // namespace android #endif // _UI_POINTER_CONTROLLER_H
include/utils/PropertyMap.h +6 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,12 @@ public: bool tryGetProperty(const String8& key, int32_t& outValue) const; bool tryGetProperty(const String8& key, float& outValue) const; /* Adds all values from the specified property map. */ void addAll(const PropertyMap* map); /* Gets the underlying property map. */ inline const KeyedVector<String8, String8>& getProperties() const { return mProperties; } /* Loads a property map from a file. */ static status_t load(const String8& filename, PropertyMap** outMap); Loading
libs/ui/EventHub.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -755,14 +755,14 @@ int EventHub::openDevice(const char *devicePath) { } } // See if this is a trackball (or mouse). // See if this is a cursor device such as a trackball or mouse. if (test_bit(BTN_MOUSE, key_bitmask)) { uint8_t rel_bitmask[sizeof_bit_array(REL_MAX + 1)]; memset(rel_bitmask, 0, sizeof(rel_bitmask)); LOGV("Getting relative controllers..."); if (ioctl(fd, EVIOCGBIT(EV_REL, sizeof(rel_bitmask)), rel_bitmask) >= 0) { if (test_bit(REL_X, rel_bitmask) && test_bit(REL_Y, rel_bitmask)) { device->classes |= INPUT_DEVICE_CLASS_TRACKBALL; device->classes |= INPUT_DEVICE_CLASS_CURSOR; } } } Loading