diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2011-04-01 17:51:09 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2011-04-01 18:02:31 -0400 |
commit | 02fa6e0eeedd74db489641ee69d5d033a811ade8 (patch) | |
tree | 4ad5a4352bdd7068e52434a9bdd32c83083504c5 /src/input.h | |
parent | 5550538692b237f47109cf5657d486b4bd1ff9ac (diff) |
Scale absolute mouse coordinates up to the full display dimensions.
The values written into XenStore for the vkbd device width/height are
the full display dimensions. The vkbd frontend thus expects absolute
reports to range over those values, not the actual buffer dimensions.
Fixes absolute coordinates for undersized guest framebuffers.
Diffstat (limited to 'src/input.h')
-rw-r--r-- | src/input.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/input.h b/src/input.h index 7785274..eb02850 100644 --- a/src/input.h +++ b/src/input.h @@ -22,6 +22,16 @@ static inline int clamp_value(int val, int max) return val; } +static inline int scale_value(int val, int max, int scale) +{ + if (val <= 0) + return 0; + else if (val >= max) + return scale; + else + return (val * scale) / max; +} + int input_initialize(int argc, char *argv[]); |