Display and control your Android device
Move common structs to coords.h
Romain Vimont6385b8c162e5
diff --git a/app/src/common.h b/app/src/common.hindex e5cbe953..3f517d5b 100644--- a/app/src/common.h+++ b/app/src/common.h@@ -1,30 +1,10 @@#ifndef COMMON_H#define COMMON_H-#include <stdint.h>-#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;-};-#endifdiff --git a/app/src/control_msg.h b/app/src/control_msg.hindex 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) // 256kdiff --git a/app/src/coords.h b/app/src/coords.hnew file mode 100644index 00000000..7be6836d--- /dev/null+++ b/app/src/coords.h@@ -0,0 +1,24 @@+#ifndef SC_COORDS+#define SC_COORDS++#include <stdint.h>++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;+};++#endifdiff --git a/app/src/device.h b/app/src/device.hindex 8a94cd86..5f30194f 100644--- a/app/src/device.h+++ b/app/src/device.h@@ -4,7 +4,7 @@#include <stdbool.h>#include "config.h"-#include "common.h"+#include "coords.h"#include "util/net.h"#define DEVICE_NAME_FIELD_LENGTH 64diff --git a/app/src/input_manager.h b/app/src/input_manager.hindex df9b071f..ce53792b 100644--- a/app/src/input_manager.h+++ b/app/src/input_manager.h@@ -6,7 +6,6 @@#include <SDL2/SDL.h>#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.hindex bc87a23b..43a0a395 100644--- a/app/src/recorder.h+++ b/app/src/recorder.h@@ -7,7 +7,7 @@#include <SDL2/SDL_thread.h>#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.cindex 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.hindex c4fbbf66..0e87d1c9 100644--- a/app/src/screen.h+++ b/app/src/screen.h@@ -6,7 +6,7 @@#include <libavformat/avformat.h>#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.hindex 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"