diff options
author | David 'Digit' Turner <digit@android.com> | 2011-03-18 13:20:00 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2011-03-18 13:23:57 +0100 |
commit | 29e114d2cc511c02c7a3871619b4aeece3f9eded (patch) | |
tree | ba7c43f6a83d76f1d0c28f016526a14d070b8398 /hw | |
parent | 2144d2a0b3f2669b09e12533317f6aefb1536ff9 (diff) | |
download | external_qemu-29e114d2cc511c02c7a3871619b4aeece3f9eded.zip external_qemu-29e114d2cc511c02c7a3871619b4aeece3f9eded.tar.gz external_qemu-29e114d2cc511c02c7a3871619b4aeece3f9eded.tar.bz2 |
Fix touchscreen emulation to return correct min/max coordinate bounds.
This is needed by future changes in the input framework that depend on
touchscreen devices to properly return the min/max bounds of their
absolute pointer coordinates.
Fixes bug 4126574
Change-Id: I982c0d8e78fc59912e964af958929d2b0718eaa4
Diffstat (limited to 'hw')
-rw-r--r-- | hw/goldfish_events_device.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/hw/goldfish_events_device.c b/hw/goldfish_events_device.c index 340dc76..3072e3b 100644 --- a/hw/goldfish_events_device.c +++ b/hw/goldfish_events_device.c @@ -448,8 +448,44 @@ void events_dev_init(uint32_t base, qemu_irq irq) * EV_ABS events are sent when the touchscreen is pressed */ if (config->hw_touchScreen) { + int32_t* values; + events_set_bit (s, EV_SYN, EV_ABS ); events_set_bits(s, EV_ABS, ABS_X, ABS_Z); + /* Allocate the absinfo to report the min/max bounds for each + * absolute dimension. The array must contain 3 tuples + * of (min,max,fuzz,flat) 32-bit values. + * + * min and max are the bounds + * fuzz corresponds to the device's fuziness, we set it to 0 + * flat corresponds to the flat position for JOEYDEV devices, + * we also set it to 0. + * + * There is no need to save/restore this array in a snapshot + * since the values only depend on the hardware configuration. + */ + s->abs_info_count = 3*4; + s->abs_info = values = malloc(sizeof(uint32_t)*s->abs_info_count); + + /* ABS_X min/max/fuzz/flat */ + values[0] = 0; + values[1] = config->hw_lcd_width-1; + values[2] = 0; + values[3] = 0; + values += 4; + + /* ABS_Y */ + values[0] = 0; + values[1] = config->hw_lcd_height-1; + values[2] = 0; + values[3] = 0; + values += 4; + + /* ABS_Z */ + values[0] = 0; + values[1] = 1; + values[2] = 0; + values[3] = 0; } /* configure EV_SW array |