/minput-hop

Compact client-only library written in C89 for talking to Synergy KVM server and its forks

Primary LanguageCGNU General Public License v3.0GPL-3.0

minput-hop

minput-hop (a play on input-leap) is a compact client-only library written in C89 for talking to Synergy KVM server and its forks.

Rough docs for API available at: https://indigoparadox.github.io/minput-hop/!

Purpose

To have something simple and (relatively) easy to port to obsolete or embedded operating systems so they can share input devices with a KVM server.

Architecture

The architecture is a little convoluted, but it's roughly like this:

  • Platform-specific startup happens in osio_*.c. This is WinMain() on Windows and main() elsewhere.
  • Platform-specific main sets up a common environment, gets configuration (server, client name, port, etc) into a NETIO_CFG struct which it then passes to minput_main() in main.c.
  • minput_main() initializes common subsystems (network, UI) in order and calls osio_loop(), again platform-specific in osio_*.c.
  • osio_loop() repeated calls the loop iteration; either by setting up a timer and then starting the message loop on Windows, or directly elsewhere.

This might be simplified somewhat later, but it works for now.

Ideas

  • Abstract socket send/recv/etc into layer that can be switched out for e.g. serial communication over RS-232.

Known Issues

  • Does not handle the mouse being held down gracefully, especially in MSPAINT.
  • Does not handle mouse interactions well inside of its own window.

Debug Defines

In addition to the DEBUG compile-time definition, some fine-grained debug statements have been placed inside the following definitions to keep verbosity in the logs down when not needed:

  • DEBUG_FLOW
  • DEBUG_CALV
  • DEBUG_SEND
  • DEBUG_PACKETS_IN
  • DEBUG_PROTO_MOUSE
  • DEBUG_PROTO_CLIP

References

  • Programming Windows, 3rd Edition - Petzold, Charles
  • qemu docs for Barrier protocol information.
  • @cvtsi2sd@hachyderm.io for undocumented *_event() calls in Windows 3.
  • Bobobobo's weblog for a detailed example of using the tray notification area.