It derives from <GObject>.
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
<GdkToplevel> or <GdkPopup>,
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.
The mouse pointer for the <GdkSurface>.
Its value is a <GdkCursor>, or #f.
Set it with (set! (surface:cursor self) value).
The <GdkDisplay> connection of the surface.
Its value is a <GdkDisplay>, or #f.
It can only be set when the object is made, with #:display.
The <GdkFrameClock> of the surface.
Its value is a <GdkFrameClock>, or #f.
It can only be set when the object is made, with #:frame-clock.
The height of the surface, in pixels.
Its value is a 32-bit integer.
It is read only.
Whether the surface is mapped.
Its value is a boolean.
It is read only.
The scale of the surface.
Its value is a real number.
It is read only.
The scale factor of the surface.
The scale factor is the next larger integer, compared to
surface:scale.
Its value is a 32-bit integer.
It is read only.
The width of the surface in pixels.
Its value is a 32-bit integer.
It is read only.
Emits a short beep associated to self.
If the display of self does not support per-surface beeps, emits a
short beep on the display just as display:beep.
Passed: a <GdkSurface>.
a toplevel <GdkSurface>
Creates a new <GdkCairoContext> for rendering
on self.
Passed: a <GdkSurface>.
Returned: a <GdkCairoContext>.
the newly created <GdkCairoContext>
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
glcontext:make-current or
glcontext:realize?.
Passed: a <GdkSurface>.
Returned: a <GdkGLContext>.
the newly created <GdkGLContext>
Create a new Cairo surface that is as compatible as possible with the given self.
For example the new surface will have the same fallback resolution and
font options as self. Generally, the new surface will also use
the same backend as self, 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.
Passed: a <GdkSurface>.
surface to make new surface similar to
Passed: a <cairo_content_t>, or one of its
symbols.
the content for the new surface
Passed: a 32-bit integer.
width of the new surface
Passed: a 32-bit integer.
height of the new surface
Returned: a <CairoSurface>.
a pointer to the newly allocated surface. The caller owns the surface
and should call cairo_surface_destroy() when done with it.
Sets an error and returns #f.
Passed: a <GdkSurface>.
Returned: a <GdkVulkanContext>.
#f
Destroys the window system resources associated with self and decrements self’s reference count.
The window system resources for all children of self 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.
Passed: a <GdkSurface>.
Retrieves a <GdkCursor> pointer for the cursor
currently set on the <GdkSurface>.
If the return value is #f then there is no custom cursor set on
the surface, and it is using the cursor for its parent surface.
Use surface:set-cursor to unset the
cursor of the surface.
Passed: a <GdkSurface>.
Returned: a <GdkCursor>, or #f.
Retrieves a <GdkCursor> pointer for the
device currently set on the specified
<GdkSurface>.
If the return value is #f then there is no custom cursor set on
the specified surface, and it is using the cursor for its parent
surface.
Use surface:set-cursor to unset the
cursor of the surface.
Passed: a <GdkSurface>.
Passed: a <GdkDevice>.
a pointer <GdkDevice>
Returned: a <GdkCursor>, or #f.
Obtains the current device position and modifier state.
The position is given in coordinates relative to the upper left corner of self.
Passed: a <GdkSurface>.
Passed: a <GdkDevice>.
pointer <GdkDevice> to query to
Returned: a boolean.
#t if the device is over the surface
Returned: a real number.
return location for the X coordinate of device
Returned: a real number.
return location for the Y coordinate of device
Returned: a <GdkModifierType>.
return location for the modifier mask
Gets the <GdkDisplay> associated with a
<GdkSurface>.
Passed: a <GdkSurface>.
Returned: a <GdkDisplay>.
the <GdkDisplay> associated with self
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.
Passed: a <GdkSurface>.
surface to get frame clock for
Returned: a <GdkFrameClock>.
the frame clock
Returns the height of the given self.
Surface size is reported in ”application pixels”, not ”device pixels”
(see surface:get-scale-factor).
Passed: a <GdkSurface>.
Returned: a 32-bit integer.
The height of self
Checks whether the surface has been mapped.
A surface is mapped with toplevel:present
or popup:present?.
Passed: a <GdkSurface>.
Returned: a boolean.
#t if the surface is mapped
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 surface:get-scale-factor, which returns the next
larger integer.
The scale may change during the lifetime of the surface.
Passed: a <GdkSurface>.
surface to get scale for
Returned: a real number.
the scale
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.
Passed: a <GdkSurface>.
surface to get scale factor for
Returned: a 32-bit integer.
the scale factor
Returns the width of the given self.
Surface size is reported in ”application pixels”, not ”device pixels”
(see surface:get-scale-factor).
Passed: a <GdkSurface>.
Returned: a 32-bit integer.
The width of self
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().
Passed: a <GdkSurface>.
Check to see if a surface is destroyed.
Passed: a <GdkSurface>.
Returned: a boolean.
#t if the surface is destroyed
Create a new popup surface.
The surface will be attached to parent and can be positioned
relative to it using popup:present?.
Passed: a <GdkSurface>.
the parent surface to attach the surface to
Passed: a boolean.
whether to hide the surface on outside clicks
Returned: a <GdkSurface>.
a new <GdkSurface>
Creates a new toplevel surface.
Passed: a <GdkDisplay>.
the display to create the surface on
Returned: a <GdkSurface>.
the new <GdkSurface>
Forces a surface:render signal
emission for self to be scheduled.
This function is useful for implementations that track invalid regions on their own.
Passed: a <GdkSurface>.
Request a layout phase from the surface’s frame clock.
See frame-clock:request-phase.
Passed: a <GdkSurface>.
Sets the default mouse pointer for a <GdkSurface>.
Passing #f for the cursor argument means that self
will use the cursor of its parent surface. Most surfaces should use
this default. Note that cursor must be for the same display as
self.
Use cursor:new-from-name or
cursor:new-from-texture to create
the cursor. To make the cursor invisible, use GDK_BLANK_CURSOR.
Passed: a <GdkSurface>.
Passed, or left out: a <GdkCursor>, or #f.
Sets a specific <GdkCursor> for a given device when
it gets inside self.
Passing #f for the cursor argument means that self
will use the cursor of its parent surface. Most surfaces should use
this default.
Use cursor:new-from-name or
cursor:new-from-texture to create
the cursor. To make the cursor invisible, use GDK_BLANK_CURSOR.
Passed: a <GdkSurface>.
Passed: a <GdkDevice>.
a pointer <GdkDevice>
Passed: a <GdkCursor>.
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 self.
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 display:supports-input-shapes? to find out if a
particular backend supports input regions.
Passed: a <GdkSurface>.
Passed, or left out: a <CairoRegion>, or
#f.
region of surface to be reactive, or #f to make the entire
surface reactive
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 self 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.
Passed: a <GdkSurface>.
a top-level <GdkSurface>
Passed, or left out: a <CairoRegion>, or
#f.
a region, or #f to make the entire surface opaque
Translates coordinates between two surfaces.
Note that this only works if to and self are popups or transient-for to the same toplevel (directly or indirectly).
Passed: a <GdkSurface>.
the origin surface
Passed: a <GdkSurface>.
the target surface
Passed, and returned: a real number.
coordinates to translate
Passed, and returned: a real number.
coordinates to translate
Returned: a boolean.
#t if the coordinates were successfully translated
Connect a handler with (connect object surface:enter-monitor
handler). It is called as (handler self monitor).
Emitted when surface starts being present on the monitor.
Passed: a <GdkSurface>.
Passed: a <GdkMonitor>.
the monitor
Connect a handler with (connect object surface:event handler). It
is called as (handler self event) ⇒ %return.
Emitted when GDK receives an input event for surface.
Passed: a <GdkSurface>.
Passed: a <GdkEvent>.
an input event
Returned: a boolean.
#t to indicate that the event has been handled
Connect a handler with (connect object surface:layout handler).
It is called as (handler self width height).
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 surface:get-scale-factor).
Passed: a <GdkSurface>.
Passed: a 32-bit integer.
the current width
Passed: a 32-bit integer.
the current height
Connect a handler with (connect object surface:leave-monitor
handler). It is called as (handler self monitor).
Emitted when surface stops being present on the monitor.
Passed: a <GdkSurface>.
Passed: a <GdkMonitor>.
the monitor
Connect a handler with (connect object surface:render handler).
It is called as (handler self region) ⇒ %return.
Emitted when part of the surface needs to be redrawn.
Passed: a <GdkSurface>.
Passed: a <CairoRegion>.
the region that needs to be redrawn
Returned: a boolean.
#t to indicate that the signal has been handled