Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: SurfaceLeavemonitorCallback

[796:7] extends: object

Generated low-level callback wrapper for GIR callback leave-monitor.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • SurfaceLeavemonitorCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, monitor, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.

class: SurfaceEventCallback

[655:7] extends: object

Generated low-level callback wrapper for GIR callback event.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • SurfaceEventCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, event, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.

class: Surface

[19:7] extends: object

Represents a rectangular region on the screen. It’s a low-level object, used to implement high-level objects such as GtkWindow. The surfaces you see in practice are either [iface@Gdk.Toplevel] or [iface@Gdk.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.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • Surface (display = null)

    Creates a new toplevel surface.

    • @p display is the display to create the surface on.
  • 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.
  • asObject ()

    Wraps this handle as Object.

    • @r A Object object.
  • connectSignal (string Name, CallbackObj)

    Connects one generated callback wrapper to a named signal.

    • @p Name is the signal name.
    • @p CallbackObj is the generated callback wrapper to connect.
    • @r The connected handler id.
  • disconnectSignalHandler (int HandlerId)

    Disconnects one retained signal handler id.

    • @p HandlerId is the signal handler id to disconnect.
    • @r None.
  • setOnEntermonitor (callback Fn, UserData = null)

    Emitted when @surface starts being present on the monitor.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Surface Self, Monitor Monitor).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • setOnEvent (callback Fn, UserData = null)

    Emitted when GDK receives an input event for @surface.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Surface Self, Event Event).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • setOnLayout (callback Fn, UserData = null)

    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()).

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Surface Self, int Width, int Height).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • setOnLeavemonitor (callback Fn, UserData = null)

    Emitted when @surface stops being present on the monitor.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Surface Self, Monitor Monitor).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • setOnRender (callback Fn, UserData = null)

    Emitted when part of the surface needs to be redrawn.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Surface Self, Region Region).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • getProperty (string Name)

    Reads one generated property by name.

  • setProperty (string Name, Value)

    Writes one generated property by name.

  • setCursor (object Value)

    The mouse pointer for the GdkSurface.

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

    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 [method@Gdk.Display.beep].

    • @r None.
  • create_cairo_context ()

    Creates a new GdkCairoContext for rendering on @surface.

  • create_gl_context ()

    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 [method@Gdk.GLContext.make_current] or [method@Gdk.GLContext.realize].

  • create_similar_surface (string content, int width, int height)

    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.

    • @p content is the content for the new surface.
    • @p width is width of the new surface.
    • @p height is height of the new surface.
  • create_vulkan_context ()

    Sets an error and returns %NULL.

  • destroy ()

    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.

    • @r None.
  • get_cursor ()

    Retrieves a GdkCursor pointer for the cursor currently set on the GdkSurface. If the return value is %NULL then there is no custom cursor set on the surface, and it is using the cursor for its parent surface. Use [method@Gdk.Surface.set_cursor] to unset the cursor of the surface.

  • get_device_cursor (object device)

    Retrieves a GdkCursor pointer for the @device currently set on the specified GdkSurface. If the return value is %NULL then there is no custom cursor set on the specified surface, and it is using the cursor for its parent surface. Use [method@Gdk.Surface.set_cursor] to unset the cursor of the surface.

    • @p device is a pointer GdkDevice.
  • get_display ()

    Gets the GdkDisplay associated with a GdkSurface.

  • get_frame_clock ()

    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.

  • get_height ()

    Returns the height of the given @surface. Surface size is reported in ”application pixels”, not ”device pixels” (see [method@Gdk.Surface.get_scale_factor]).

  • get_mapped ()

    Checks whether the surface has been mapped. A surface is mapped with [method@Gdk.Toplevel.present] or [method@Gdk.Popup.present].

  • get_scale ()

    Returns the internal scale that maps from surface coordinates to the actual device pixels. When the scale is bigger than 1, the windowing system prefers to get buffers with a resolution that is bigger than the surface size (e.g. to show the surface on a high-resolution display, or in a magnifier). Compare with [method@Gdk.Surface.get_scale_factor], which returns the next larger integer. The scale may change during the lifetime of the surface.

  • get_scale_factor ()

    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 factor may change during the lifetime of the surface.

  • get_width ()

    Returns the width of the given @surface. Surface size is reported in ”application pixels”, not ”device pixels” (see [method@Gdk.Surface.get_scale_factor]).

  • hide ()

    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 gtk_widget_hide().

    • @r None.
  • is_destroyed ()

    Check to see if a surface is destroyed.

  • queue_render ()

    Forces a [signal@Gdk.Surface::render] signal emission for @surface to be scheduled. This function is useful for implementations that track invalid regions on their own.

    • @r None.
  • request_layout ()

    Request a layout phase from the surface's frame clock. See [method@Gdk.FrameClock.request_phase].

    • @r None.
  • set_cursor (object cursor)

    Sets the default mouse pointer for a GdkSurface. Passing %NULL 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 [ctor@Gdk.Cursor.new_from_name] or [ctor@Gdk.Cursor.new_from_texture] to create the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR.
    • @p cursor is a GdkCursor.
    • @r None.
  • set_device_cursor (object device, object cursor)

    Sets a specific GdkCursor for a given device when it gets inside

    • @surface. Passing %NULL for the @cursor argument means that @surface will use the cursor of its parent surface. Most surfaces should use this default. Use [ctor@Gdk.Cursor.new_from_name] or [ctor@Gdk.Cursor.new_from_texture] to create the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR.
    • @p device is a pointer GdkDevice.
    • @p cursor is a GdkCursor.
    • @r None.
  • set_input_region (object region)

    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 [method@Gdk.Display.supports_input_shapes] to find out if a particular backend supports input regions.

    • @p region is region of surface to be reactive, or %NULL to make the entire surface reactive.
    • @r None.
  • set_opaque_region (object region)

    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.

    • @p region is a region, or %NULL to make the entire surface opaque.
    • @r None.

class: SurfaceRenderCallback

[867:7] extends: object

Generated low-level callback wrapper for GIR callback render.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • SurfaceRenderCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, region, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.

class: SurfaceLayoutCallback

[726:7] extends: object

Generated low-level callback wrapper for GIR callback layout.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • SurfaceLayoutCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, width, height, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.

class: SurfaceEntermonitorCallback

[584:7] extends: object

Generated low-level callback wrapper for GIR callback enter-monitor.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • SurfaceEntermonitorCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, monitor, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.

class: SurfaceCtors

[563:14] static extends: object

Alternate constructors for Surface. Usage: SurfaceCtors.<name>(...). The primary constructor lives directly on Surface.

Methods

  • newPopup (object parent, bool autohide)

    Create a new popup surface. The surface will be attached to @parent and can be positioned relative to it using [method@Gdk.Popup.present].

    • @p parent is the parent surface to attach the surface to.
    • @p autohide is whether to hide the surface on outside clicks.
    • @r A new Surface.

class: SurfaceMeta

[938:14] static extends: object

Generated metadata helpers for Surface class surfaces.

Methods

  • properties ()

    Returns property metadata for Surface.

    • @r A list.
  • signals ()

    Returns signal metadata for Surface.

    • @r A list.