summaryrefslogtreecommitdiffstats
path: root/libs/ui/EventHub.cpp
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-07-14 12:06:54 -0700
committerDianne Hackborn <hackbod@google.com>2009-07-14 18:51:53 -0700
commite3dd884815b2aaeec4241859722ab603e0b1466b (patch)
treeab595122c085720a236251afbfe78af248d87bc5 /libs/ui/EventHub.cpp
parent334a67740c9f7f35fa9ee93cf0f8051d41ce2d7a (diff)
downloadframeworks_base-e3dd884815b2aaeec4241859722ab603e0b1466b.zip
frameworks_base-e3dd884815b2aaeec4241859722ab603e0b1466b.tar.gz
frameworks_base-e3dd884815b2aaeec4241859722ab603e0b1466b.tar.bz2
Implement virtual button support.
The kernel can now publish a property describing the layout of virtual hardware buttons on the touchscreen. These outside of the display area (outside of the absolute x and y controller range the driver reports), and when the user presses on them a key event will be generated rather than a touch event. This also includes a number of tweaks to the absolute controller processing to make things work better on the new screens. For example, we now reject down events outside of the display area. Still left to be done is the ability to cancel a key down event, so the user can slide up from the virtual keys to the touch screen without causing a virtual key to execute.
Diffstat (limited to 'libs/ui/EventHub.cpp')
-rw-r--r--libs/ui/EventHub.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index 13c30a7..a72f055 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -240,6 +240,35 @@ int EventHub::getKeycodeState(int32_t deviceId, int code) const
return 0;
}
+status_t EventHub::scancodeToKeycode(int32_t deviceId, int scancode,
+ int32_t* outKeycode, uint32_t* outFlags) const
+{
+ AutoMutex _l(mLock);
+ device_t* device = getDevice(deviceId);
+
+ if (device != NULL && device->layoutMap != NULL) {
+ status_t err = device->layoutMap->map(scancode, outKeycode, outFlags);
+ if (err == NO_ERROR) {
+ return NO_ERROR;
+ }
+ }
+
+ if (mHaveFirstKeyboard) {
+ device = getDevice(mFirstKeyboardId);
+
+ if (device != NULL && device->layoutMap != NULL) {
+ status_t err = device->layoutMap->map(scancode, outKeycode, outFlags);
+ if (err == NO_ERROR) {
+ return NO_ERROR;
+ }
+ }
+ }
+
+ *outKeycode = 0;
+ *outFlags = 0;
+ return NAME_NOT_FOUND;
+}
+
EventHub::device_t* EventHub::getDevice(int32_t deviceId) const
{
if (deviceId == 0) deviceId = mFirstKeyboardId;