SurfaceProtocol

public protocol SurfaceProtocol : ObjectProtocol

The SurfaceProtocol protocol exposes the methods and properties of an underlying GdkSurface instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see Surface. Alternatively, use SurfaceRef as a lighweight, unowned reference if you already have an instance you just want to use.

A GdkSurface is a rectangular region on the screen.

It’s a low-level object, used to implement high-level objects such as [classGtk.Window] or [classGtk.Dialog] in GTK.

The surfaces you see in practice are either [classGdk.Toplevel] or [classGdk.Popup], and those interfaces provide much of the required API to interact with these surfaces. Other, more specialized surface types exist, but you will rarely interact with them directly.

  • ptr

    Untyped pointer to the underlying GdkSurface instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • surface_ptr Default implementation

    Typed pointer to the underlying GdkSurface instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GdkSurface instance.

    Declaration

    Swift

    var surface_ptr: UnsafeMutablePointer<GdkSurface>! { get }
  • Required Initialiser for types conforming to SurfaceProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Surface Class

  • Bind a SurfacePropertyName source property to a given target object.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: SurfacePropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a Surface property

    Declaration

    Swift

    @inlinable
    func get(property: SurfacePropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    Set the value of a Surface property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

    @inlinable
    func set(property: SurfacePropertyName, value v: GLibObject.Value)

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

Surface signals

  • Connect a Swift signal handler to the given, typed SurfaceSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: SurfaceSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    handler

    The Swift signal handler (function or callback) to invoke on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • Connect a C signal handler to the given, typed SurfaceSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: SurfaceSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    signalHandler

    The C function to be called on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • Emitted when surface starts being present on the monitor.

    Note

    This represents the underlying enter-monitor signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onEnterMonitor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ monitor: MonitorRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    monitor

    the monitor

    handler

    The signal handler to call Run the given callback whenever the enterMonitor signal is emitted

  • enterMonitorSignal Extension method

    Typed enter-monitor signal for using the connect(signal:) methods

    Declaration

    Swift

    static var enterMonitorSignal: SurfaceSignalName { get }
  • onEvent(flags:handler:) Extension method

    Emitted when GDK receives an input event for surface.

    Note

    This represents the underlying event signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onEvent(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ event: EventRef) -> Bool) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    event

    an input event

    handler

    true to indicate that the event has been handled Run the given callback whenever the event signal is emitted

  • eventSignal Extension method

    Typed event signal for using the connect(signal:) methods

    Declaration

    Swift

    static var eventSignal: SurfaceSignalName { get }
  • onLayout(flags:handler:) Extension method

    Emitted when the size of surface is changed, or when relayout should be performed.

    Surface size is reported in ”application pixels”, not ”device pixels” (see gdk_surface_get_scale_factor()).

    Note

    This represents the underlying layout signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onLayout(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ width: Int, _ height: Int) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    width

    the current width

    height

    the current height

    handler

    The signal handler to call Run the given callback whenever the layout signal is emitted

  • layoutSignal Extension method

    Typed layout signal for using the connect(signal:) methods

    Declaration

    Swift

    static var layoutSignal: SurfaceSignalName { get }
  • Emitted when surface stops being present on the monitor.

    Note

    This represents the underlying leave-monitor signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onLeaveMonitor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ monitor: MonitorRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    monitor

    the monitor

    handler

    The signal handler to call Run the given callback whenever the leaveMonitor signal is emitted

  • leaveMonitorSignal Extension method

    Typed leave-monitor signal for using the connect(signal:) methods

    Declaration

    Swift

    static var leaveMonitorSignal: SurfaceSignalName { get }
  • onRender(flags:handler:) Extension method

    Emitted when part of the surface needs to be redrawn.

    Note

    This represents the underlying render signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onRender(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ region: Cairo.RegionRef) -> Bool) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    region

    the region that needs to be redrawn

    handler

    true to indicate that the signal has been handled Run the given callback whenever the render signal is emitted

  • renderSignal Extension method

    Typed render signal for using the connect(signal:) methods

    Declaration

    Swift

    static var renderSignal: SurfaceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::cursor signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyCursor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyCursor signal is emitted

  • notifyCursorSignal Extension method

    Typed notify::cursor signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyCursorSignal: SurfaceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::display signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyDisplay(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyDisplay signal is emitted

  • notifyDisplaySignal Extension method

    Typed notify::display signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyDisplaySignal: SurfaceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::frame-clock signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyFrameClock(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyFrameClock signal is emitted

  • notifyFrameClockSignal Extension method

    Typed notify::frame-clock signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyFrameClockSignal: SurfaceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::height signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyHeight(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyHeight signal is emitted

  • notifyHeightSignal Extension method

    Typed notify::height signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyHeightSignal: SurfaceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::mapped signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyMapped(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyMapped signal is emitted

  • notifyMappedSignal Extension method

    Typed notify::mapped signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyMappedSignal: SurfaceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::scale-factor signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyScaleFactor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyScaleFactor signal is emitted

  • notifyScaleFactorSignal Extension method

    Typed notify::scale-factor signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyScaleFactorSignal: SurfaceSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this: (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::width signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyWidth(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyWidth signal is emitted

  • notifyWidthSignal Extension method

    Typed notify::width signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyWidthSignal: SurfaceSignalName { get }

Surface Class: SurfaceProtocol extension (methods and fields)

  • beep() Extension method

    Emits a short beep associated to surface.

    If the display of surface does not support per-surface beeps, emits a short beep on the display just as [methodGdk.Display.beep].

    Declaration

    Swift

    @inlinable
    func beep()
  • createCairoContext() Extension method

    Creates a new GdkCairoContext for rendering on surface.

    Declaration

    Swift

    @inlinable
    func createCairoContext() -> CairoContextRef!
  • createGlContext() Extension method

    Creates a new GdkGLContext for the GdkSurface.

    The context is disconnected from any particular surface or surface. If the creation of the GdkGLContext failed, error will be set. Before using the returned GdkGLContext, you will need to call [methodGdk.GLContext.make_current] or [methodGdk.GLContext.realize].

    Declaration

    Swift

    @inlinable
    func createGlContext() throws -> GLContextRef!
  • Create a new Cairo surface that is as compatible as possible with the given surface.

    For example the new surface will have the same fallback resolution and font options as surface. Generally, the new surface will also use the same backend as surface, unless that is not possible for some reason. The type of the returned surface may be examined with cairo_surface_get_type().

    Initially the surface contents are all 0 (transparent if contents have transparency, black otherwise.)

    This function always returns a valid pointer, but it will return a pointer to a “nil” surface if other is already in an error state or any other error occurs.

    Declaration

    Swift

    @inlinable
    func createSimilarSurface(content: cairo_content_t, width: Int, height: Int) -> Cairo.SurfaceRef!
  • createVulkanContext() Extension method

    Creates a new GdkVulkanContext for rendering on surface.

    If the creation of the GdkVulkanContext failed, error will be set.

    Declaration

    Swift

    @inlinable
    func createVulkanContext() throws -> VulkanContextRef!
  • destroy() Extension method

    Destroys the window system resources associated with surface and decrements surface‘s reference count.

    The window system resources for all children of surface are also destroyed, but the children’s reference counts are not decremented.

    Note that a surface will not be destroyed automatically when its reference count reaches zero. You must call this function yourself before that happens.

    Declaration

    Swift

    @inlinable
    func destroy()
  • getCursor() Extension method

    Retrieves a GdkCursor pointer for the cursor currently set on the GdkSurface.

    If the return value is nil then there is no custom cursor set on the surface, and it is using the cursor for its parent surface.

    Declaration

    Swift

    @inlinable
    func getCursor() -> CursorRef!
  • getDeviceCursor(device:) Extension method

    Retrieves a GdkCursor pointer for the device currently set on the specified GdkSurface.

    If the return value is nil then there is no custom cursor set on the specified surface, and it is using the cursor for its parent surface.

    Declaration

    Swift

    @inlinable
    func getDeviceCursor<DeviceT>(device: DeviceT) -> CursorRef! where DeviceT : DeviceProtocol
  • Obtains the current device position and modifier state.

    The position is given in coordinates relative to the upper left corner of surface.

    Declaration

    Swift

    @inlinable
    func getDevicePosition<DeviceT>(device: DeviceT, x: UnsafeMutablePointer<CDouble>! = nil, y: UnsafeMutablePointer<CDouble>! = nil, mask: UnsafeMutablePointer<GdkModifierType>! = nil) -> Bool where DeviceT : DeviceProtocol
  • getDisplay() Extension method

    Gets the GdkDisplay associated with a GdkSurface.

    Declaration

    Swift

    @inlinable
    func getDisplay() -> DisplayRef!
  • getFrameClock() Extension method

    Gets the frame clock for the surface.

    The frame clock for a surface never changes unless the surface is reparented to a new toplevel surface.

    Declaration

    Swift

    @inlinable
    func getFrameClock() -> FrameClockRef!
  • getHeight() Extension method

    Returns the height of the given surface.

    Surface size is reported in ”application pixels”, not ”device pixels” (see [methodGdk.Surface.get_scale_factor]).

    Declaration

    Swift

    @inlinable
    func getHeight() -> Int
  • getMapped() Extension method

    Checks whether the surface has been mapped.

    A surface is mapped with [methodGdk.Toplevel.present] or [methodGdk.Popup.present].

    Declaration

    Swift

    @inlinable
    func getMapped() -> Bool
  • getScaleFactor() Extension method

    Returns the internal scale factor that maps from surface coordinates to the actual device pixels.

    On traditional systems this is 1, but on very high density outputs this can be a higher value (often 2). A higher value means that drawing is automatically scaled up to a higher resolution, so any code doing drawing will automatically look nicer. However, if you are supplying pixel-based data the scale value can be used to determine whether to use a pixel resource with higher resolution data.

    The scale of a surface may change during runtime.

    Declaration

    Swift

    @inlinable
    func getScaleFactor() -> Int
  • getWidth() Extension method

    Returns the width of the given surface.

    Surface size is reported in ”application pixels”, not ”device pixels” (see [methodGdk.Surface.get_scale_factor]).

    Declaration

    Swift

    @inlinable
    func getWidth() -> Int
  • hide() Extension method

    Hide the surface.

    For toplevel surfaces, withdraws them, so they will no longer be known to the window manager; for all surfaces, unmaps them, so they won’t be displayed. Normally done automatically as part of [methodGtk.Widget.hide].

    Declaration

    Swift

    @inlinable
    func hide()
  • queueRender() Extension method

    Forces a [signalGdk.Surface::render] signal emission for surface to be scheduled.

    This function is useful for implementations that track invalid regions on their own.

    Declaration

    Swift

    @inlinable
    func queueRender()
  • requestLayout() Extension method

    Request a layout phase from the surface’s frame clock.

    See [methodGdk.FrameClock.request_phase].

    Declaration

    Swift

    @inlinable
    func requestLayout()
  • set(cursor:) Extension method

    Sets the default mouse pointer for a GdkSurface.

    Passing nil for the cursor argument means that surface will use the cursor of its parent surface. Most surfaces should use this default. Note that cursor must be for the same display as surface.

    Use [ctorGdk.Cursor.new_from_name] or [ctorGdk.Cursor.new_from_texture] to create the cursor. To make the cursor invisible, use GDK_BLANK_CURSOR.

    Declaration

    Swift

    @inlinable
    func set(cursor: CursorRef? = nil)
  • set(cursor:) Extension method

    Sets the default mouse pointer for a GdkSurface.

    Passing nil for the cursor argument means that surface will use the cursor of its parent surface. Most surfaces should use this default. Note that cursor must be for the same display as surface.

    Use [ctorGdk.Cursor.new_from_name] or [ctorGdk.Cursor.new_from_texture] to create the cursor. To make the cursor invisible, use GDK_BLANK_CURSOR.

    Declaration

    Swift

    @inlinable
    func set<CursorT>(cursor: CursorT?) where CursorT : CursorProtocol
  • Sets a specific GdkCursor for a given device when it gets inside surface.

    Passing nil for the cursor argument means that surface will use the cursor of its parent surface. Most surfaces should use this default.

    Use [ctorGdk.Cursor.new_from_name] or [ctorGdk.Cursor.new_from_texture] to create the cursor. To make the cursor invisible, use GDK_BLANK_CURSOR.

    Declaration

    Swift

    @inlinable
    func setDeviceCursor<CursorT, DeviceT>(device: DeviceT, cursor: CursorT) where CursorT : CursorProtocol, DeviceT : DeviceProtocol
  • setInput(region:) Extension method

    Apply the region to the surface for the purpose of event handling.

    Mouse events which happen while the pointer position corresponds to an unset bit in the mask will be passed on the surface below surface.

    An input region is typically used with RGBA surfaces. The alpha channel of the surface defines which pixels are invisible and allows for nicely antialiased borders, and the input region controls where the surface is “clickable”.

    Use [methodGdk.Display.supports_input_shapes] to find out if a particular backend supports input regions.

    Declaration

    Swift

    @inlinable
    func setInput<RegionT>(region: RegionT) where RegionT : RegionProtocol
  • setOpaque(region:) Extension method

    Marks a region of the GdkSurface as opaque.

    For optimisation purposes, compositing window managers may like to not draw obscured regions of surfaces, or turn off blending during for these regions. With RGB windows with no transparency, this is just the shape of the window, but with ARGB32 windows, the compositor does not know what regions of the window are transparent or not.

    This function only works for toplevel surfaces.

    GTK will update this property automatically if the surface background is opaque, as we know where the opaque regions are. If your surface background is not opaque, please update this property in your GtkWidgetClass.css_changed() handler.

    Declaration

    Swift

    @inlinable
    func setOpaque(region: Cairo.RegionRef? = nil)
  • setOpaque(region:) Extension method

    Marks a region of the GdkSurface as opaque.

    For optimisation purposes, compositing window managers may like to not draw obscured regions of surfaces, or turn off blending during for these regions. With RGB windows with no transparency, this is just the shape of the window, but with ARGB32 windows, the compositor does not know what regions of the window are transparent or not.

    This function only works for toplevel surfaces.

    GTK will update this property automatically if the surface background is opaque, as we know where the opaque regions are. If your surface background is not opaque, please update this property in your GtkWidgetClass.css_changed() handler.

    Declaration

    Swift

    @inlinable
    func setOpaque<RegionT>(region: RegionT?) where RegionT : RegionProtocol
  • Translates coordinates between two surfaces.

    Note that this only works if to and from are popups or transient-for to the same toplevel (directly or indirectly).

    Declaration

    Swift

    @inlinable
    func translateCoordinates<SurfaceT>(to: SurfaceT, x: UnsafeMutablePointer<CDouble>!, y: UnsafeMutablePointer<CDouble>!) -> Bool where SurfaceT : SurfaceProtocol
  • The main way to draw GL content in GTK.

    It takes a render buffer ID (source_type == GL_RENDERBUFFER) or a texture id (source_type == GL_TEXTURE) and draws it onto cr with an OVER operation, respecting the current clip. The top left corner of the rectangle specified by x, y, width and height will be drawn at the current (0,0) position of the cairo_t.

    This will work for all cairo_t, as long as surface is realized, but the fallback implementation that reads back the pixels from the buffer may be used in the general case. In the case of direct drawing to a surface with no special effects applied to cr it will however use a more efficient approach.

    For GL_RENDERBUFFER the code will always fall back to software for buffers with alpha components, so make sure you use GL_TEXTURE if using alpha.

    Calling this may change the current GL context.

    Declaration

    Swift

    @inlinable
    func cairoDrawFromGl<ContextT>(cr: ContextT, source: Int, sourceType: Int, bufferScale: Int, x: Int, y: Int, width: Int, height: Int) where ContextT : ContextProtocol
  • cursor Extension method

    The mouse pointer for the GdkSurface.

    Declaration

    Swift

    @inlinable
    var cursor: CursorRef! { get nonmutating set }
  • display Extension method

    The GdkDisplay connection of the surface.

    Declaration

    Swift

    @inlinable
    var display: DisplayRef! { get }
  • frameClock Extension method

    Gets the frame clock for the surface.

    The frame clock for a surface never changes unless the surface is reparented to a new toplevel surface.

    Declaration

    Swift

    @inlinable
    var frameClock: FrameClockRef! { get }
  • height Extension method

    The height of the surface, in pixels.

    Declaration

    Swift

    @inlinable
    var height: Int { get }
  • isDestroyed Extension method

    Check to see if a surface is destroyed.

    Declaration

    Swift

    @inlinable
    var isDestroyed: Bool { get }
  • mapped Extension method

    Whether the surface is mapped.

    Declaration

    Swift

    @inlinable
    var mapped: Bool { get }
  • scaleFactor Extension method

    Returns the internal scale factor that maps from surface coordinates to the actual device pixels.

    On traditional systems this is 1, but on very high density outputs this can be a higher value (often 2). A higher value means that drawing is automatically scaled up to a higher resolution, so any code doing drawing will automatically look nicer. However, if you are supplying pixel-based data the scale value can be used to determine whether to use a pixel resource with higher resolution data.

    The scale of a surface may change during runtime.

    Declaration

    Swift

    @inlinable
    var scaleFactor: Int { get }
  • width Extension method

    The width of the surface in pixels.

    Declaration

    Swift

    @inlinable
    var width: Int { get }