From 6385b8c162e58ed167f317a333ceeb13f3979f8c Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 8 Jan 2021 19:15:29 +0100 Subject: [PATCH] Move common structs to coords.h The size, point and position structs were defined in common.h. Move them to coords.h so that common.h could be used for generic code to be included in all source files. --- app/src/common.h | 20 -------------------- app/src/control_msg.h | 2 +- app/src/coords.h | 24 ++++++++++++++++++++++++ app/src/device.h | 2 +- app/src/input_manager.h | 1 - app/src/recorder.h | 2 +- app/src/scrcpy.c | 1 - app/src/screen.h | 2 +- app/src/server.h | 1 - 9 files changed, 28 insertions(+), 27 deletions(-) create mode 100644 app/src/coords.h diff --git a/app/src/common.h b/app/src/common.h index e5cbe953..3f517d5b 100644 --- a/app/src/common.h +++ b/app/src/common.h @@ -1,30 +1,10 @@ #ifndef COMMON_H #define COMMON_H -#include - #include "config.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_t width; - uint16_t height; -}; - -struct point { - int32_t x; - int32_t 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 diff --git a/app/src/control_msg.h b/app/src/control_msg.h index 6e3f239c..5014a84c 100644 --- a/app/src/control_msg.h +++ b/app/src/control_msg.h @@ -8,7 +8,7 @@ #include "config.h" #include "android/input.h" #include "android/keycodes.h" -#include "common.h" +#include "coords.h" #define CONTROL_MSG_MAX_SIZE (1 << 18) // 256k diff --git a/app/src/coords.h b/app/src/coords.h new file mode 100644 index 00000000..7be6836d --- /dev/null +++ b/app/src/coords.h @@ -0,0 +1,24 @@ +#ifndef SC_COORDS +#define SC_COORDS + +#include + +struct size { + uint16_t width; + uint16_t height; +}; + +struct point { + int32_t x; + int32_t 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 diff --git a/app/src/device.h b/app/src/device.h index 8a94cd86..5f30194f 100644 --- a/app/src/device.h +++ b/app/src/device.h @@ -4,7 +4,7 @@ #include #include "config.h" -#include "common.h" +#include "coords.h" #include "util/net.h" #define DEVICE_NAME_FIELD_LENGTH 64 diff --git a/app/src/input_manager.h b/app/src/input_manager.h index df9b071f..ce53792b 100644 --- a/app/src/input_manager.h +++ b/app/src/input_manager.h @@ -6,7 +6,6 @@ #include #include "config.h" -#include "common.h" #include "controller.h" #include "fps_counter.h" #include "scrcpy.h" diff --git a/app/src/recorder.h b/app/src/recorder.h index bc87a23b..43a0a395 100644 --- a/app/src/recorder.h +++ b/app/src/recorder.h @@ -7,7 +7,7 @@ #include #include "config.h" -#include "common.h" +#include "coords.h" #include "scrcpy.h" #include "util/queue.h" diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 2d593234..c1aedcca 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -14,7 +14,6 @@ #endif #include "config.h" -#include "common.h" #include "compat.h" #include "controller.h" #include "decoder.h" diff --git a/app/src/screen.h b/app/src/screen.h index c4fbbf66..0e87d1c9 100644 --- a/app/src/screen.h +++ b/app/src/screen.h @@ -6,7 +6,7 @@ #include #include "config.h" -#include "common.h" +#include "coords.h" #include "opengl.h" struct video_buffer; diff --git a/app/src/server.h b/app/src/server.h index 48d8cd32..b607d691 100644 --- a/app/src/server.h +++ b/app/src/server.h @@ -8,7 +8,6 @@ #include "config.h" #include "adb.h" -#include "common.h" #include "scrcpy.h" #include "util/log.h" #include "util/net.h"