Scale mouse events

The video screen size on the client may differ from the real device
screen size (e.g. the video stream may be scaled down). As a
consequence, mouse events must be scaled to match the real device
coordinates.

For this purpose, make the client send the video screen size along with
the absolute pointer location, and the server scale the location to
match the real device size before injecting mouse events.
This commit is contained in:
Romain Vimont
2018-01-22 16:50:08 +01:00
parent 11a60e5767
commit 8984c1a7c4
13 changed files with 246 additions and 96 deletions

26
app/src/common.h Normal file
View File

@@ -0,0 +1,26 @@
#ifndef COMMON_H
#define COMMON_H
#include <SDL2/SDL_stdinc.h>
#define MIN(X,Y) (X) < (Y) ? (X) : (Y)
#define MAX(X,Y) (X) > (Y) ? (X) : (Y)
struct size {
Uint16 width;
Uint16 height;
};
struct position {
Uint16 x;
Uint16 y;
};
struct point {
// The video screen size may be different from the real device screen size,
// so store to which size the absolute position apply, to scale it accordingly.
struct size screen_size;
struct position position;
};
#endif