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:
26
app/src/common.h
Normal file
26
app/src/common.h
Normal 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
|
||||
Reference in New Issue
Block a user