Surface

abstract class Surface(val gdkSurfacePointer: <Error class: unknown class><<Error class: unknown class>>)(source)

A GdkSurface is a rectangular region on the screen.

It’s a low-level object, used to implement high-level objects such as ../gtk4/class.Window.html.

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.

Skipped during bindings generation

  • parameter x: x: Out parameter is not supported

  • method translate_coordinates: In/Out parameter is not supported

Inheritors

Constructors

Link copied to clipboard
constructor(parent: Surface, autohide: Boolean)

Create a new popup surface.

constructor(display: Display)

Creates a new toplevel surface.

constructor(gdkSurfacePointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class SurfaceImpl(pointer: <Error class: unknown class><<Error class: unknown class>>) : Surface

The SurfaceImpl type represents a native instance of the abstract Surface class.

Properties

Link copied to clipboard
open var cursor: Cursor?

The mouse pointer for the GdkSurface.

Link copied to clipboard
open val display: Display

The GdkDisplay connection of the surface.

Link copied to clipboard

The GdkFrameClock of the surface.

Link copied to clipboard
val gdkSurfacePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val height: <Error class: unknown class>

The height of the surface, in pixels.

Link copied to clipboard
open val mapped: Boolean

Whether the surface is mapped.

Link copied to clipboard
open val scale: <Error class: unknown class>

The scale of the surface.

Link copied to clipboard
open val scaleFactor: <Error class: unknown class>

The scale factor of the surface.

Link copied to clipboard
open val width: <Error class: unknown class>

The width of the surface in pixels.

Functions

Link copied to clipboard
open fun beep()

Emits a short beep associated to @surface.

Link copied to clipboard

Creates a new GdkCairoContext for rendering on @surface.

Link copied to clipboard
open fun createGlContext(): <Error class: unknown class><GlContext>

Creates a new GdkGLContext for the GdkSurface.

Link copied to clipboard
open fun createSimilarSurface(    content: <Error class: unknown class>,     width: <Error class: unknown class>,     height: <Error class: unknown class>): <Error class: unknown class>

This is deprecated since version 4.12.

Link copied to clipboard
open fun createVulkanContext(): <Error class: unknown class><VulkanContext>

This is deprecated since version 4.14.

Link copied to clipboard
open fun destroy()

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

Link copied to clipboard

Emits the "enter-monitor" signal. See onEnterMonitor.

Link copied to clipboard
fun emitLayout(width: <Error class: unknown class>, height: <Error class: unknown class>)

Emits the "layout" signal. See onLayout.

Link copied to clipboard

Emits the "leave-monitor" signal. See onLeaveMonitor.

Link copied to clipboard
open fun getDeviceCursor(device: Device): Cursor?

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

Link copied to clipboard
open fun hide()

Hide the surface.

Link copied to clipboard
open fun isDestroyed(): Boolean

Check to see if a surface is destroyed.

Link copied to clipboard
fun onEnterMonitor(    connectFlags: <Error class: unknown class> = ConnectFlags(0u),     handler: (monitor: Monitor) -> Unit): <Error class: unknown class>

Emitted when @surface starts being present on the monitor.

Link copied to clipboard
fun onEvent(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (event: Event) -> Boolean): <Error class: unknown class>

Emitted when GDK receives an input event for @surface.

Link copied to clipboard
fun onLayout(    connectFlags: <Error class: unknown class> = ConnectFlags(0u),     handler: (<Error class: unknown class>, <Error class: unknown class>) -> Unit): <Error class: unknown class>

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

Link copied to clipboard
fun onLeaveMonitor(    connectFlags: <Error class: unknown class> = ConnectFlags(0u),     handler: (monitor: Monitor) -> Unit): <Error class: unknown class>

Emitted when @surface stops being present on the monitor.

Link copied to clipboard
fun onRender(    connectFlags: <Error class: unknown class> = ConnectFlags(0u),     handler: (<Error class: unknown class>) -> Boolean): <Error class: unknown class>

Emitted when part of the surface needs to be redrawn.

Link copied to clipboard
open fun queueRender()

Forces a signal@Gdk.Surface::render signal emission for @surface to be scheduled.

Link copied to clipboard
open fun requestLayout()

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

Link copied to clipboard
open fun setDeviceCursor(device: Device, cursor: Cursor)

Sets a specific GdkCursor for a given device when it gets inside @surface.

Link copied to clipboard
open fun setInputRegion(region: <Error class: unknown class>)

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

Link copied to clipboard
open fun setOpaqueRegion(region: <Error class: unknown class>? = null)

This is deprecated since version 4.16.