osy 52b1535824 display: re-introduce hack to reduce latency
I thought the new renderer backend could handle it without the hack but
that was wrong. Adding it back with clear comments about what to do next.
2026-02-27 14:50:21 -08:00
2022-02-07 16:55:56 -08:00
2022-02-07 16:55:56 -08:00
2022-02-08 13:31:21 -08:00
2022-02-08 14:26:56 -08:00
2022-02-08 13:03:15 -08:00

CocoaSpice

CocoaSpice brings native Cocoa bindings to SPICE GTK and is used to build SPICE clients for macOS and iOS.

Features

  • Renders displays and cursor into Metal textures
  • Support copy/paste through custom pasteboard binding
  • TCP socket connections and Unix socket file
  • Cursor and scroll-wheel channel
  • Take screenshot of current display
  • USB sharing and enumeration

Usage

  1. Add this repository to your project through Xcode: File -> Add Packages...
  2. Link your target with: libglib-2.0, libgstreamer-1.0, libusb-1.0 (optional), libspice-client-glib-2.0.
  3. Either add target CocoaSpiceNoUsb or CocoaSpice to your dependencies.

Start SPICE GTK

You must do this before using any other API. This starts a worker thread for SPICE GTK.

import CocoaSwift

guard CSMain.shared.spiceStart() else {
    // handle worker failed to start
    ...
}

defer {
    // use this to stop and clean up worker 
    CSMain.shared.spiceStop()
}

Open a connection

CSConnection is the main interface to CocoaSpice. You can create a connection from TCP (shown below) or with a Unix socket file.

import CocoaSwift

let connection = CSConnection(host: "127.0.0.1", port: "4444")
connection.delegate = yourConnectionDelegate;
guard connection.connect() else {
    // handle connection failed to be created
    ...
}

CocoaSpice follows the delegate model so connection events are handled through delegate methods. Implement the CSConnectionDelegate to be informed to SPICE client events.

Testing

TODO: Implement testing

S
Description
Cocoa bindings for SPICE client GTK
Readme Apache-2.0 1.5 MiB
Languages
Objective-C 95%
C 2.1%
Metal 1.9%
Swift 1%