fefb9816a9
Mouse events position were unsigned (so negative values could not be
handled properly).
To avoid issues with negative values, mouse events outside the device
screen were ignored (commit a7fe9ad779
).
But as a consequence, drag&drop were "broken" if the "drop" occurred
outside the device screen.
Instead, use signed 32-bits to store the position, and forward events
outside the device screen.
Fixes <https://github.com/Genymobile/scrcpy/issues/357>.
27 lines
540 B
C
27 lines
540 B
C
#ifndef COMMON_H
|
|
#define COMMON_H
|
|
|
|
#include <SDL2/SDL_stdinc.h>
|
|
|
|
#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
|
|
#define MIN(X,Y) (X) < (Y) ? (X) : (Y)
|
|
#define MAX(X,Y) (X) > (Y) ? (X) : (Y)
|
|
|
|
struct size {
|
|
Uint16 width;
|
|
Uint16 height;
|
|
};
|
|
|
|
struct point {
|
|
Sint32 x;
|
|
Sint32 y;
|
|
};
|
|
|
|
struct position {
|
|
// 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 point point;
|
|
};
|
|
|
|
#endif
|