Files
SimpleRemoter/macos
yuanyuanxianganddeepseek-flash 3ae6298746 Fix: Align macOS mouse coordinates with the captured display
The macOS client derived its logical screen size from [NSScreen mainScreen]
while it captured CGMainDisplayID. In clamshell mode with an external display
the former can still report the disabled built-in panel (1470x956) while the
captured frame is 1280x1024, so every injected point was scaled by
logical/encode and drifted linearly with the distance from the top left
corner, independently on each axis. Take the logical size from
CGDisplayBounds of the captured display instead, and report the same bounds
in the login resolution.

For hosts that still run the old client, the remote desktop dialog gains a
per-host mouse calibration in its system menu. The factors are stored by
client ID together with the reported resolution and the captured frame size,
so they stop applying once the client is upgraded or a different display is
captured, and come back automatically when the original display returns.
When no calibration has been saved the dialog pre-fills the factors from
frame/reported, but only for macOS clients, because the other clients derive
their conversion from the captured display itself and a mismatching report
there would be misleading.

Co-Authored-By: deepseek-flash
2026-10-22 11:33:39 +02:00
..

macOS Remote Desktop Client
===========================

Prerequisites:
  1. Xcode Command Line Tools: xcode-select --install
  2. CMake: brew install cmake

Build:
  chmod +x build.sh
  ./build.sh

Or manually:
  mkdir build && cd build
  cmake ..
  make

Run:
  ./build/bin/ghost

Configuration:
  Server address is configured in main.mm (g_SETTINGS variable).
  Modify before building if needed.

Permissions Required:
  1. Screen Recording - System Settings > Privacy & Security > Screen Recording
  2. Accessibility - System Settings > Privacy & Security > Accessibility

Features:
  [x] Screen capture (CGDisplayCreateImage)
  [x] H264 video encoding (VideoToolbox)
  [x] Mouse control (move, click, drag, scroll)
  [x] Keyboard control (full VK code mapping)
  [x] Retina display support (coordinate scaling)
  [x] Network connection (IOCPClient)
  [x] LOGIN_INFOR (system info reporting)
  [x] Heartbeat with RTT estimation
  [x] Active window tracking
  [x] Quality level adjustment (FPS/algorithm)

Files:
  CMakeLists.txt      - Build configuration
  Permissions.h/mm    - macOS permission handling
  ScreenHandler.h/mm  - Screen capture and H264 encoding
  InputHandler.h/mm   - Mouse/keyboard simulation
  H264Encoder.h/mm    - VideoToolbox H264 encoder
  SystemManager.h/mm  - Process management
  main.mm             - Entry point, LOGIN_INFOR, heartbeat

Quality Levels:
  Level 0: 5 FPS,  Grayscale (emergency low bandwidth)
  Level 1: 10 FPS, RGB565
  Level 2: 15 FPS, H264 (default, office work)
  Level 3: 20 FPS, H264
  Level 4: 25 FPS, H264
  Level 5: 30 FPS, H264 (smooth)

Notes:
  - First frame is always raw bitmap (TOKEN_FIRSTSCREEN)
  - Subsequent frames use H264 encoding (TOKEN_NEXTSCREEN)
  - Coordinates are scaled for Retina displays automatically
  - Windows VK codes are mapped to macOS key codes