Surface
Object Hierarchy:
Description:
A `GdkSurface` is a rectangular region on the screen.
It’s a low-level object, used to implement high-level objects such as [GtkWindow](../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.
Required by:
Namespace: Gdk
Package: gtk4
Content:
Properties:
- public Cursor cursor { get; set; }
The mouse pointer for the `GdkSurface`.
- public Display display { get; construct; }
The `GdkDisplay` connection of the surface.
- public FrameClock frame_clock { get; construct; }
The `GdkFrameClock` of the surface.
- public int height { get; }
The height of the surface, in pixels.
- public bool mapped { get; }
Whether the surface is mapped.
- public double scale { get; }
The scale of the surface.
- public int scale_factor { get; }
The scale factor of the surface.
- public int width { get; }
The width of the surface in pixels.
Creation methods:
- protected Surface ()
- public Surface.popup (Surface parent, bool autohide)
Create a new popup surface.
- public Surface.toplevel (Display display)
Creates a new toplevel surface.
Methods:
- public void beep ()
Emits a short beep associated to this.
- public CairoContext create_cairo_context ()
Creates a new `GdkCairoContext` for rendering on this.
- public GLContext create_gl_context () throws Error
Creates a new `GdkGLContext` for the `GdkSurface`.
- public Surface create_similar_surface (Content content, int width, int height)
Create a new Cairo surface that is as compatible as possible with the given this.
- public VulkanContext create_vulkan_context () throws Error
Sets an error and returns null.
- public void destroy ()
Destroys the window system resources associated with this and decrements this's reference count.
- public unowned Cursor? get_cursor ()
Retrieves a `GdkCursor` pointer for the cursor currently set on the `GdkSurface`.
- public unowned Cursor? get_device_cursor (Device device)
Retrieves a `GdkCursor` pointer for the
device
currently set on the specified `GdkSurface`. - public bool get_device_position (Device device, out double x, out double y, out ModifierType mask)
Obtains the current device position and modifier state.
- public unowned Display get_display ()
Gets the `GdkDisplay` associated with a `GdkSurface`.
- public unowned FrameClock get_frame_clock ()
Gets the frame clock for the surface.
- public int get_height ()
Returns the height of the given this.
- public bool get_mapped ()
Checks whether the surface has been mapped.
- public double get_scale ()
Returns the internal scale that maps from surface coordinates to the actual device pixels.
- public int get_scale_factor ()
Returns the internal scale factor that maps from surface coordinates to the actual device pixels.
- public int get_width ()
Returns the width of the given this.
- public void hide ()
Hide the surface.
- public bool is_destroyed ()
Check to see if a surface is destroyed.
- public void queue_render ()
Forces a [signal@Gdk.
- public void request_layout ()
Request a layout phase from the surface's frame clock.
- public void set_cursor (Cursor? cursor)
Sets the default mouse pointer for a `GdkSurface`.
- public void set_device_cursor (Device device, Cursor cursor)
Sets a specific `GdkCursor` for a given device when it gets inside this.
- public void set_input_region (Region region)
Apply the region to the surface for the purpose of event handling.
- public void set_opaque_region (Region? region)
Marks a region of the `GdkSurface` as opaque.
- public bool translate_coordinates (Surface to, ref double x, ref double y)
Translates coordinates between two surfaces.
Signals:
- public signal void enter_monitor (Monitor monitor)
Emitted when
surface
starts being present on the monitor. - public signal bool event (Event event)
Emitted when GDK receives an input event for
surface
. - public signal void layout (int width, int height)
Emitted when the size of
surface
is changed, or when relayout should be performed. - public signal void leave_monitor (Monitor monitor)
Emitted when
surface
stops being present on the monitor. - public signal bool render (Region region)
Emitted when part of the surface needs to be redrawn.
Inherited Members:
All known members inherited from class GLib.Object