Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GraphicsOffload

[32:7] extends: object

Bypasses gsk rendering by passing the content of its child directly to the compositor. Graphics offload is an optimization to reduce overhead and battery use that is most useful for video content. It only works on some platforms and in certain situations. GTK will automatically fall back to normal rendering if it doesn't. Graphics offload is most efficient if there are no controls drawn on top of the video content. You should consider using graphics offload for your main widget if it shows frequently changing content (such as a video, or a VM display) and you provide the content in the form of dmabuf textures (see [class@Gdk.DmabufTextureBuilder]), in particular if it may be fullscreen. Numerous factors can prohibit graphics offload: - Unsupported platforms. Currently, graphics offload only works on Linux with Wayland. - Clipping, such as rounded corners that cause the video content to not be rectangular - Unsupported dmabuf formats (see [method@Gdk.Display.get_dmabuf_formats]) - Translucent video content (content with an alpha channel, even if it isn't used) - Transforms that are more complex than translations and scales - Filters such as opacity, grayscale or similar To investigate problems related graphics offload, GTK offers debug flags to print out information about graphics offload and dmabuf use: GDK_DEBUG=offload GDK_DEBUG=dmabuf The GTK inspector provides a visual debugging tool for graphics offload.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • GraphicsOffload (child = null)

    Creates a new GtkGraphicsOffload widget.

    • @p child is the child widget.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asWidget ()

    Wraps this handle as Widget.

    • @r A Widget object.
  • asAccessible ()

    Wraps this handle as Accessible.

    • @r A Accessible object.
  • asBuildable ()

    Wraps this handle as Buildable.

    • @r A Buildable object.
  • asConstraintTarget ()

    Wraps this handle as ConstraintTarget.

    • @r A ConstraintTarget object.
  • getProperty (string Name)

    Reads one generated property by name.

  • setProperty (string Name, Value)

    Writes one generated property by name.

  • setBlackbackground (bool Value)

    Whether to draw a black background.

    • @p Value is the new property value.
    • @r None.
  • setChild (object Value)

    The child widget.

    • @p Value is the new property value.
    • @r None.
  • setEnabled (string Value)

    Whether graphics offload is enabled.

    • @p Value is the new property value.
    • @r None.
  • get_black_background ()

    Returns whether the widget draws a black background. See [method@Gtk.GraphicsOffload.set_black_background].

  • get_child ()

    Gets the child of @self.

  • get_enabled ()

    Returns whether offload is enabled for @self.

  • set_black_background (bool value)

    Sets whether this GtkGraphicsOffload widget will draw a black background. A main use case for this is letterboxing where black bars are visible next to the content if the aspect ratio of the content does not match the dimensions of the monitor. Using this property for letterboxing instead of CSS allows compositors to show content with maximum efficiency, using direct scanout to avoid extra copies in the compositor. On Wayland, this is implemented using the single-pixel buffer protocol.

    • @p value is whether to draw a black background behind the content.
    • @r None.
  • set_child (object child)

    Sets the child of @self.

    • @p child is the child widget.
    • @r None.
  • set_enabled (string enabled)

    Sets whether this GtkGraphicsOffload widget will attempt to offload the content of its child widget.

    • @p enabled is whether to enable offload.
    • @r None.

class: GraphicsOffloadMeta

[274:14] static extends: object

Generated metadata helpers for GraphicsOffload class surfaces.

Methods

  • properties ()

    Returns property metadata for GraphicsOffload.

    • @r A list.