diff options
author | cbdev <cb@cbcdn.com> | 2020-05-17 18:37:47 +0200 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2020-05-17 18:37:47 +0200 |
commit | 165fd82294090ea970e90c1b5436a5a98dc58eb9 (patch) | |
tree | fa110ae85f1514f9491bfa6cdebcee73e291ca84 /backends | |
parent | 100b8f2ea0f269094331ee39699ef5fb3e571584 (diff) | |
download | midimonster-165fd82294090ea970e90c1b5436a5a98dc58eb9.tar.gz midimonster-165fd82294090ea970e90c1b5436a5a98dc58eb9.tar.bz2 midimonster-165fd82294090ea970e90c1b5436a5a98dc58eb9.zip |
Include virtual screen origin offset in mouse normalization
Diffstat (limited to 'backends')
-rw-r--r-- | backends/wininput.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/backends/wininput.c b/backends/wininput.c index 0f35364..f044a7c 100644 --- a/backends/wininput.c +++ b/backends/wininput.c @@ -1,5 +1,5 @@ #define BACKEND_NAME "wininput" -//#define DEBUG +#define DEBUG #include <string.h> #include "wininput.h" @@ -262,9 +262,8 @@ static channel* wininput_channel(instance* inst, char* spec, uint8_t flags){ //for some reason, sendinput only takes "normalized absolute coordinates", which are never again used in the API static void wininput_mouse_normalize(long* x, long* y){ - //TODO this needs to take a possible origin offset into account - long normalized_x = (double) (*x) * (65535.0f / (double) cfg.virtual_width); - long normalized_y = (double) (*y) * (65535.0f / (double) cfg.virtual_height); + long normalized_x = (double) (*x + cfg.virtual_x) * (65535.0f / (double) cfg.virtual_width); + long normalized_y = (double) (*y + cfg.virtual_y) * (65535.0f / (double) cfg.virtual_height); *x = normalized_x; *y = normalized_y; |