From 7c0d828afffe5df721cef690a5bb575ee73a14b4 Mon Sep 17 00:00:00 2001 From: Olivier Samyn Date: Wed, 24 Feb 2010 00:40:04 +0100 Subject: [PATCH] aiptek: Generate only key press or key release depending on kernel event. This patch keeps track of the kernel key event value to generate the correct X event: key press or release. Signed-off-by: Olivier Samyn --- src/xf86Aiptek.c | 20 ++++++++++++-------- src/xf86Aiptek.h | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/xf86Aiptek.c b/src/xf86Aiptek.c index f0a816d..bbe05cf 100644 --- a/src/xf86Aiptek.c +++ b/src/xf86Aiptek.c @@ -460,12 +460,8 @@ xf86AiptekSendEvents(LocalDevicePtr local, int r_z) * positions of the KeySym map... */ - /* Keyboard 'make' (press) event */ - xf86PostKeyEvent(local->dev, i+8, TRUE, - bAbsolute, 0, 5, - x, y, common->currentValues.button, xTilt, yTilt); - /* Keyboard 'break' (depress) event */ - xf86PostKeyEvent(local->dev, i+8, FALSE, + /* Keyboard 'make' event */ + xf86PostKeyEvent(local->dev, i+8, common->currentValues.pressed, bAbsolute, 0, 5, x, y, common->currentValues.button, xTilt, yTilt); break; @@ -867,6 +863,8 @@ xf86AiptekHIDReadInput(LocalDevicePtr local) { ++eventsInMessage; common->currentValues.macroKey = event->code; + common->currentValues.pressed = + (event->value) ? TRUE: FALSE; } break; } @@ -932,12 +930,14 @@ xf86AiptekHIDReadInput(LocalDevicePtr local) <= device->xTiltThreshold && ABS(common->currentValues.yTilt - common->previousValues.yTilt) <= device->yTiltThreshold && - common->currentValues.proximity == + common->currentValues.proximity == common->previousValues.proximity && common->currentValues.button == common->previousValues.button && common->currentValues.macroKey == - common->previousValues.macroKey) + common->previousValues.macroKey && + common->currentValues.pressed == + common->previousValues.pressed) { DBG(10, ErrorF("Event Filtered Out by Thresholds\n")); continue; @@ -1007,8 +1007,10 @@ xf86AiptekHIDReadInput(LocalDevicePtr local) common->previousValues.yTilt = common->currentValues.yTilt; common->previousValues.distance = common->currentValues.distance; common->previousValues.wheel = common->currentValues.wheel; + common->previousValues.pressed = common->currentValues.pressed; common->currentValues.macroKey = VALUE_NA; + common->currentValues.pressed = FALSE; } } @@ -1950,6 +1952,7 @@ xf86AiptekAllocate(char* name, common->currentValues.button = 0; /* bitmask of buttons pressed */ common->currentValues.distance = 0; /* currently unsupported */ common->currentValues.wheel = 0; /* likewise */ + common->currentValues.pressed = FALSE; /* Record of the event previously read off of the queue */ common->previousValues.eventType = 0; /* Same comments as above */ @@ -1963,6 +1966,7 @@ xf86AiptekAllocate(char* name, common->previousValues.button = 0; common->previousValues.distance = 0; common->previousValues.wheel = 0; + common->previousValues.pressed = FALSE; common->deviceName = ""; /* device file name */ common->flags = 0; /* various flags */ diff --git a/src/xf86Aiptek.h b/src/xf86Aiptek.h index 2842775..89e41d0 100644 --- a/src/xf86Aiptek.h +++ b/src/xf86Aiptek.h @@ -204,6 +204,7 @@ typedef struct int button; /* Button bitmask */ int distance; /* Future capacity */ int wheel; /* Future capacity */ + Bool pressed; /* macroKey state (True=pressed, False=released) */ } AiptekStateRec, *AiptekStatePtr; /***************************************************************************** -- 1.6.3.3