portico/Sources/Portico/MainLoop/SourcePriority.swift

26 lines
1.1 KiB
Swift

import GLib
/// Scheduling priority of a GLib main-loop source. Lower values run first;
/// GLib's default priority is `0`.
nonisolated public struct SourcePriority: RawRepresentable, Hashable, Sendable {
/// The raw GLib priority value.
public let rawValue: Int32
/// Creates a priority from a raw GLib priority value.
public init(rawValue: Int32) { self.rawValue = rawValue }
/// `G_PRIORITY_HIGH` (-100). Not used by GLib or GTK itself.
public static let high = SourcePriority(rawValue: GLib.priorityHigh)
/// `G_PRIORITY_DEFAULT` (0) - the default for timeouts.
public static let `default` = SourcePriority(rawValue: GLib.priorityDefault)
/// `G_PRIORITY_HIGH_IDLE` (100). GTK uses this range for resize and redraw.
public static let highIdle = SourcePriority(rawValue: GLib.priorityHighIdle)
/// `G_PRIORITY_DEFAULT_IDLE` (200) - the default for idle callbacks.
public static let defaultIdle = SourcePriority(rawValue: GLib.priorityDefaultIdle)
/// `G_PRIORITY_LOW` (300) - very low priority background work.
public static let low = SourcePriority(rawValue: GLib.priorityLow)
}