summaryrefslogtreecommitdiff
path: root/usr/src/dkms_source_tree/hid-3m-pct.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-08-30 12:31:20 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-08-30 12:31:20 +0200
commitbeab739a36435048626c69861b3ad144bce23d5b (patch)
tree2d54e54b1f24f5b062240fbbc3b5d1955109846f /usr/src/dkms_source_tree/hid-3m-pct.c
parentb2dede96923654de8dfc41413e0f2fceda131efa (diff)
Adjust major / minor axes to scale
Adjust reported major/minor axis to better match visual size. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'usr/src/dkms_source_tree/hid-3m-pct.c')
-rw-r--r--usr/src/dkms_source_tree/hid-3m-pct.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr/src/dkms_source_tree/hid-3m-pct.c b/usr/src/dkms_source_tree/hid-3m-pct.c
index 65441e0..cd4b125 100644
--- a/usr/src/dkms_source_tree/hid-3m-pct.c
+++ b/usr/src/dkms_source_tree/hid-3m-pct.c
@@ -162,16 +162,18 @@ static void mmm_filter_event(struct mmm_data *md, struct input_dev *input)
162 if (f->touch) { 162 if (f->touch) {
163 /* this finger is on the screen */ 163 /* this finger is on the screen */
164 int wide = (f->w > f->h); 164 int wide = (f->w > f->h);
165 /* divided by two to match visual scale of touch */
166 int major = max(f->w, f->h) >> 1;
167 int minor = min(f->w, f->h) >> 1;
168
165 if (!f->prev_touch) 169 if (!f->prev_touch)
166 f->id = md->id++; 170 f->id = md->id++;
167 input_event(input, EV_ABS, ABS_MT_TRACKING_ID, f->id); 171 input_event(input, EV_ABS, ABS_MT_TRACKING_ID, f->id);
168 input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x); 172 input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x);
169 input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y); 173 input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y);
170 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide); 174 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
171 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, 175 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
172 wide ? f->w : f->h); 176 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
173 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR,
174 wide ? f->h : f->w);
175 /* touchscreen emulation: pick the oldest contact */ 177 /* touchscreen emulation: pick the oldest contact */
176 if (!oldest || ((f->id - oldest->id) & (SHRT_MAX + 1))) 178 if (!oldest || ((f->id - oldest->id) & (SHRT_MAX + 1)))
177 oldest = f; 179 oldest = f;