diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2011-02-14 12:51:01 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2011-02-15 12:42:41 +0100 |
| commit | 93e1a5a3904ef2f14110d8b807bcd7d107b3b2a4 (patch) | |
| tree | a50e22d57ae77bcaa7674b4ff4bf8b2b1c3f690f /src/frame-mtdev.c | |
| parent | a06bde2b7aec991b798de9a8e0d7972adaabb40d (diff) | |
Map device coordinates onto target surface
The current implementation outputs most touch attributes in device
coordinates. However, the primary use case is to map the input device
onto an area on the screen, needed in particular for multihead setups.
Moreover, the XI2.1 backend works with screen coordinates, creating
an unnecessary discrepancy between backends. This patch adds the basic
transformation layer to the utouch surface, thus serving as the master
point of device-to-surface mapping.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/frame-mtdev.c')
| -rw-r--r-- | src/frame-mtdev.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/frame-mtdev.c b/src/frame-mtdev.c index 9192510..caf90ae 100644 --- a/src/frame-mtdev.c +++ b/src/frame-mtdev.c | |||
| @@ -104,12 +104,12 @@ int utouch_frame_init_mtdev(utouch_frame_handle fh, | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | s->max_pressure = evemu_get_abs_maximum(dev, ABS_MT_PRESSURE); | 106 | s->max_pressure = evemu_get_abs_maximum(dev, ABS_MT_PRESSURE); |
| 107 | if (s->use_pressure && s->max_pressure == 0) | 107 | if (s->max_pressure == 0) |
| 108 | s->max_pressure = 256; | 108 | s->max_pressure = 256; |
| 109 | 109 | ||
| 110 | fh->max_orient = evemu_get_abs_maximum(dev, ABS_MT_ORIENTATION); | 110 | s->max_orient = evemu_get_abs_maximum(dev, ABS_MT_ORIENTATION); |
| 111 | if (s->use_orientation && fh->max_orient == 0) | 111 | if (s->max_orient == 0) |
| 112 | fh->max_orient = 1; | 112 | s->max_orient = 1; |
| 113 | 113 | ||
| 114 | tmp = evemu_get_abs_resolution(dev, ABS_MT_POSITION_X); | 114 | tmp = evemu_get_abs_resolution(dev, ABS_MT_POSITION_X); |
| 115 | if (tmp > 0) | 115 | if (tmp > 0) |
| @@ -133,12 +133,14 @@ int utouch_frame_init_mtdev(utouch_frame_handle fh, | |||
| 133 | else | 133 | else |
| 134 | s->phys_pressure = 10; | 134 | s->phys_pressure = 10; |
| 135 | 135 | ||
| 136 | return 0; | 136 | /* defaults expected by initial frame version */ |
| 137 | } | 137 | s->mapped_min_x = s->min_x; |
| 138 | s->mapped_min_y = s->min_y; | ||
| 139 | s->mapped_max_x = s->max_x; | ||
| 140 | s->mapped_max_y = s->max_y; | ||
| 141 | s->mapped_max_pressure = s->max_pressure; | ||
| 138 | 142 | ||
| 139 | static float touch_angle(utouch_frame_handle fh, int orient) | 143 | return 0; |
| 140 | { | ||
| 141 | return orient / fh->max_orient * M_PI_2; | ||
| 142 | } | 144 | } |
| 143 | 145 | ||
| 144 | static int handle_abs_event(utouch_frame_handle fh, | 146 | static int handle_abs_event(utouch_frame_handle fh, |
| @@ -169,7 +171,7 @@ static int handle_abs_event(utouch_frame_handle fh, | |||
| 169 | t->width_minor = ev->value; | 171 | t->width_minor = ev->value; |
| 170 | return 1; | 172 | return 1; |
| 171 | case ABS_MT_ORIENTATION: | 173 | case ABS_MT_ORIENTATION: |
| 172 | t->orientation = touch_angle(fh, ev->value); | 174 | t->orientation = ev->value; |
| 173 | return 1; | 175 | return 1; |
| 174 | case ABS_MT_PRESSURE: | 176 | case ABS_MT_PRESSURE: |
| 175 | t->pressure = ev->value; | 177 | t->pressure = ev->value; |
