diff --git a/src/device_controller/mouse/mac/mouse_controller.cpp b/src/device_controller/mouse/mac/mouse_controller.cpp index f289790..5a5e521 100644 --- a/src/device_controller/mouse/mac/mouse_controller.cpp +++ b/src/device_controller/mouse/mac/mouse_controller.cpp @@ -8,18 +8,22 @@ MouseController::MouseController() {} MouseController::~MouseController() {} -int MouseController::Init(int screen_width, int screen_height) { - screen_width_ = screen_width; - screen_height_ = screen_height; +int MouseController::Init(std::vector display_info_list) { + display_info_list_ = display_info_list; return 0; } int MouseController::Destroy() { return 0; } -int MouseController::SendMouseCommand(RemoteAction remote_action) { - int mouse_pos_x = remote_action.m.x * screen_width_; - int mouse_pos_y = remote_action.m.y * screen_height_; +int MouseController::SendMouseCommand(RemoteAction remote_action, + int display_index) { + int mouse_pos_x = + remote_action.m.x * display_info_list_[display_index].width + + display_info_list_[display_index].left; + int mouse_pos_y = + remote_action.m.y * display_info_list_[display_index].height + + display_info_list_[display_index].top; if (remote_action.type == ControlType::mouse) { CGEventRef mouse_event = nullptr; diff --git a/src/device_controller/mouse/mac/mouse_controller.h b/src/device_controller/mouse/mac/mouse_controller.h index 276d5a1..b97e327 100644 --- a/src/device_controller/mouse/mac/mouse_controller.h +++ b/src/device_controller/mouse/mac/mouse_controller.h @@ -7,6 +7,8 @@ #ifndef _MOUSE_CONTROLLER_H_ #define _MOUSE_CONTROLLER_H_ +#include + #include "device_controller.h" class MouseController : public DeviceController { @@ -15,13 +17,12 @@ class MouseController : public DeviceController { virtual ~MouseController(); public: - virtual int Init(int screen_width, int screen_height); + virtual int Init(std::vector display_info_list); virtual int Destroy(); - virtual int SendMouseCommand(RemoteAction remote_action); + virtual int SendMouseCommand(RemoteAction remote_action, int display_index); private: - int screen_width_ = 0; - int screen_height_ = 0; + std::vector display_info_list_; }; #endif \ No newline at end of file diff --git a/src/screen_capturer/macosx/screen_capturer_sck.cpp b/src/screen_capturer/macosx/screen_capturer_sck.cpp index f90ea3f..43f2dcc 100644 --- a/src/screen_capturer/macosx/screen_capturer_sck.cpp +++ b/src/screen_capturer/macosx/screen_capturer_sck.cpp @@ -42,9 +42,9 @@ int ScreenCapturerSck::Start() { int ScreenCapturerSck::Stop() { return 0; } -int ScreenCapturerSck::Pause() { return 0; } +int ScreenCapturerSck::Pause(int monitor_index) { return 0; } -int ScreenCapturerSck::Resume() { return 0; } +int ScreenCapturerSck::Resume(int monitor_index) { return 0; } void ScreenCapturerSck::OnFrame() {} diff --git a/src/screen_capturer/macosx/screen_capturer_sck.h b/src/screen_capturer/macosx/screen_capturer_sck.h index a662bef..7e715aa 100644 --- a/src/screen_capturer/macosx/screen_capturer_sck.h +++ b/src/screen_capturer/macosx/screen_capturer_sck.h @@ -27,9 +27,13 @@ class ScreenCapturerSck : public ScreenCapturer { virtual int Start() override; virtual int Stop() override; - int Pause(); + int Pause(int monitor_index) override; - int Resume(); + int Resume(int monitor_index) override; + + int SwitchTo(int monitor_index) override { return 0; } + + std::vector GetDisplayInfoList() override { return {}; } void OnFrame(); diff --git a/src/screen_capturer/macosx/screen_capturer_sck_impl.mm b/src/screen_capturer/macosx/screen_capturer_sck_impl.mm index aaf12cd..db109f1 100644 --- a/src/screen_capturer/macosx/screen_capturer_sck_impl.mm +++ b/src/screen_capturer/macosx/screen_capturer_sck_impl.mm @@ -56,6 +56,14 @@ public: virtual int Stop() { return 0; } + virtual int Pause(int monitor_index) { return 0; } + + virtual int Resume(int monitor_index) { return 0; } + + virtual int SwitchTo(int monitor_index) { return 0; } + + virtual std::vector GetDisplayInfoList() { return {}; } + private: SckHelper *__strong helper_; SCStream *__strong stream_; @@ -246,7 +254,7 @@ void ScreenCapturerSckImpl::OnNewIOSurface(IOSurfaceRef io_surface, nv12_frame_ = static_cast(IOSurfaceGetBaseAddress(io_surface)); - _on_data(nv12_frame_, width * height * 3 / 2, width, height); + _on_data(nv12_frame_, width * height * 3 / 2, width, height, 0); IOSurfaceUnlock(io_surface, kIOSurfaceLockReadOnly, &aseed); }