FrameClockRef

public struct FrameClockRef : FrameClockProtocol, GWeakCapturing

The FrameClockRef type acts as a lightweight Swift reference to an underlying GdkFrameClock instance. It exposes methods that can operate on this data type through FrameClockProtocol conformance. Use FrameClockRef only as an unowned reference to an existing GdkFrameClock instance.

A GdkFrameClock tells the application when to update and repaint a window. This may be synced to the vertical refresh rate of the monitor, for example. Even when the frame clock uses a simple timer rather than a hardware-based vertical sync, the frame clock helps because it ensures everything paints at the same time (reducing the total number of frames). The frame clock can also automatically stop painting when it knows the frames will not be visible, or scale back animation framerates.

GdkFrameClock is designed to be compatible with an OpenGL-based implementation or with mozRequestAnimationFrame in Firefox, for example.

A frame clock is idle until someone requests a frame with gdk_frame_clock_request_phase(). At some later point that makes sense for the synchronization being implemented, the clock will process a frame and emit signals for each phase that has been requested. (See the signals of the GdkFrameClock class for documentation of the phases. GDK_FRAME_CLOCK_PHASE_UPDATE and the GdkFrameClock::update signal are most interesting for application writers, and are used to update the animations, using the frame time given by gdk_frame_clock_get_frame_time().

The frame time is reported in microseconds and generally in the same timescale as g_get_monotonic_time(), however, it is not the same as g_get_monotonic_time(). The frame time does not advance during the time a frame is being painted, and outside of a frame, an attempt is made so that all calls to gdk_frame_clock_get_frame_time() that are called at a “similar” time get the same value. This means that if different animations are timed by looking at the difference in time between an initial value from gdk_frame_clock_get_frame_time() and the value inside the GdkFrameClock::update signal of the clock, they will stay exactly synchronized.

  • ptr
    Untyped pointer to the underlying `GdkFrameClock` instance.
    

    For type-safe access, use the generated, typed pointer frame_clock_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

FrameClock Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GdkFrameClock>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GdkFrameClock>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GdkFrameClock>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GdkFrameClock>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements FrameClockProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : FrameClockProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> FrameClockRef where T : FrameClockProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to FrameClockProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to FrameClockProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to FrameClockProtocol.

    Declaration

    Swift

    @inlinable
    init(mutating raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to FrameClockProtocol.

    Declaration

    Swift

    @inlinable
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to FrameClockProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)