SurfaceProtocol
public protocol SurfaceProtocol : ObjectProtocol
The SurfaceProtocol
protocol exposes the methods and properties of an underlying GdkSurface
instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see Surface
.
Alternatively, use SurfaceRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
A GdkSurface
is a rectangular region on the screen.
It’s a low-level object, used to implement high-level objects
such as [classGtk.Window
] or [classGtk.Dialog
] in GTK.
The surfaces you see in practice are either [classGdk.Toplevel
] or
[classGdk.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.
-
Untyped pointer to the underlying
GdkSurface
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
surface_ptr
Default implementationTyped pointer to the underlying
GdkSurface
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GdkSurface
instance.Declaration
Swift
var surface_ptr: UnsafeMutablePointer<GdkSurface>! { get }
-
Required Initialiser for types conforming to
SurfaceProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
SurfacePropertyName
source property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: SurfacePropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol
Parameters
source_property
the source property to bind
target
the target object to bind to
target_property
the target property to bind to
flags
the flags to pass to the
Binding
transform_from
ValueTransformer
to use for forward transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a Surface property
Declaration
Swift
@inlinable func get(property: SurfacePropertyName) -> GLibObject.Value
Parameters
property
the property to get the value for
Return Value
the value of the named property
-
set(property:
Extension methodvalue: ) Set the value of a Surface property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: SurfacePropertyName, value v: GLibObject.Value)
Parameters
property
the property to get the value for
Return Value
the value of the named property
-
connect(signal:
Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
SurfaceSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: SurfaceSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
handler
The Swift signal handler (function or callback) to invoke on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
connect(signal:
Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
SurfaceSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: SurfaceSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
signalHandler
The C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onEnterMonitor(flags:
Extension methodhandler: ) Emitted when
surface
starts being present on the monitor.Note
This represents the underlyingenter-monitor
signalDeclaration
Swift
@discardableResult @inlinable func onEnterMonitor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ monitor: MonitorRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
monitor
the monitor
handler
The signal handler to call Run the given callback whenever the
enterMonitor
signal is emitted -
enterMonitorSignal
Extension methodTyped
enter-monitor
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var enterMonitorSignal: SurfaceSignalName { get }
-
onEvent(flags:
Extension methodhandler: ) Emitted when GDK receives an input event for
surface
.Note
This represents the underlyingevent
signalDeclaration
Swift
@discardableResult @inlinable func onEvent(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ event: EventRef) -> Bool) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
event
an input event
handler
true
to indicate that the event has been handled Run the given callback whenever theevent
signal is emitted -
eventSignal
Extension methodTyped
event
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var eventSignal: SurfaceSignalName { get }
-
onLayout(flags:
Extension methodhandler: ) 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()
).Note
This represents the underlyinglayout
signalDeclaration
Swift
@discardableResult @inlinable func onLayout(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ width: Int, _ height: Int) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
width
the current width
height
the current height
handler
The signal handler to call Run the given callback whenever the
layout
signal is emitted -
layoutSignal
Extension methodTyped
layout
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var layoutSignal: SurfaceSignalName { get }
-
onLeaveMonitor(flags:
Extension methodhandler: ) Emitted when
surface
stops being present on the monitor.Note
This represents the underlyingleave-monitor
signalDeclaration
Swift
@discardableResult @inlinable func onLeaveMonitor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ monitor: MonitorRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
monitor
the monitor
handler
The signal handler to call Run the given callback whenever the
leaveMonitor
signal is emitted -
leaveMonitorSignal
Extension methodTyped
leave-monitor
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var leaveMonitorSignal: SurfaceSignalName { get }
-
onRender(flags:
Extension methodhandler: ) Emitted when part of the surface needs to be redrawn.
Note
This represents the underlyingrender
signalDeclaration
Swift
@discardableResult @inlinable func onRender(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ region: Cairo.RegionRef) -> Bool) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
region
the region that needs to be redrawn
handler
true
to indicate that the signal has been handled Run the given callback whenever therender
signal is emitted -
renderSignal
Extension methodTyped
render
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var renderSignal: SurfaceSignalName { get }
-
onNotifyCursor(flags:
Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property()
,g_object_set()
, et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY
, then any call tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_object_notify_by_pspec()
, and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()
call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)
It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::cursor
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyCursor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyCursor
signal is emitted -
notifyCursorSignal
Extension methodTyped
notify::cursor
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyCursorSignal: SurfaceSignalName { get }
-
onNotifyDisplay(flags:
Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property()
,g_object_set()
, et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY
, then any call tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_object_notify_by_pspec()
, and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()
call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)
It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::display
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyDisplay(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyDisplay
signal is emitted -
notifyDisplaySignal
Extension methodTyped
notify::display
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyDisplaySignal: SurfaceSignalName { get }
-
onNotifyFrameClock(flags:
Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property()
,g_object_set()
, et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY
, then any call tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_object_notify_by_pspec()
, and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()
call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)
It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::frame-clock
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyFrameClock(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyFrameClock
signal is emitted -
notifyFrameClockSignal
Extension methodTyped
notify::frame-clock
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyFrameClockSignal: SurfaceSignalName { get }
-
onNotifyHeight(flags:
Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property()
,g_object_set()
, et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY
, then any call tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_object_notify_by_pspec()
, and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()
call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)
It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::height
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyHeight(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyHeight
signal is emitted -
notifyHeightSignal
Extension methodTyped
notify::height
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyHeightSignal: SurfaceSignalName { get }
-
onNotifyMapped(flags:
Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property()
,g_object_set()
, et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY
, then any call tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_object_notify_by_pspec()
, and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()
call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)
It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::mapped
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyMapped(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyMapped
signal is emitted -
notifyMappedSignal
Extension methodTyped
notify::mapped
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyMappedSignal: SurfaceSignalName { get }
-
onNotifyScaleFactor(flags:
Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property()
,g_object_set()
, et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY
, then any call tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_object_notify_by_pspec()
, and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()
call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)
It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::scale-factor
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyScaleFactor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyScaleFactor
signal is emitted -
notifyScaleFactorSignal
Extension methodTyped
notify::scale-factor
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyScaleFactorSignal: SurfaceSignalName { get }
-
onNotifyWidth(flags:
Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property()
,g_object_set()
, et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY
, then any call tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_object_notify_by_pspec()
, and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()
call, like this: (C Language Example):g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)
It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::width
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyWidth(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SurfaceRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyWidth
signal is emitted -
notifyWidthSignal
Extension methodTyped
notify::width
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyWidthSignal: SurfaceSignalName { get }
-
beep()
Extension methodEmits 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 [methodGdk.Display.beep
].Declaration
Swift
@inlinable func beep()
-
createCairoContext()
Extension methodCreates a new
GdkCairoContext
for rendering onsurface
.Declaration
Swift
@inlinable func createCairoContext() -> CairoContextRef!
-
createGlContext()
Extension methodCreates a new
GdkGLContext
for theGdkSurface
.The context is disconnected from any particular surface or surface. If the creation of the
GdkGLContext
failed,error
will be set. Before using the returnedGdkGLContext
, you will need to call [methodGdk.GLContext.make_current
] or [methodGdk.GLContext.realize
].Declaration
Swift
@inlinable func createGlContext() throws -> GLContextRef!
-
createSimilarSurface(content:
Extension methodwidth: 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 assurface
, unless that is not possible for some reason. The type of the returned surface may be examined withcairo_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.Declaration
Swift
@inlinable func createSimilarSurface(content: cairo_content_t, width: Int, height: Int) -> Cairo.SurfaceRef!
-
createVulkanContext()
Extension methodCreates a new
GdkVulkanContext
for rendering onsurface
.If the creation of the
GdkVulkanContext
failed,error
will be set.Declaration
Swift
@inlinable func createVulkanContext() throws -> VulkanContextRef!
-
destroy()
Extension methodDestroys the window system resources associated with
surface
and decrementssurface
‘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.
Declaration
Swift
@inlinable func destroy()
-
getCursor()
Extension methodRetrieves a
GdkCursor
pointer for the cursor currently set on theGdkSurface
.If the return value is
nil
then there is no custom cursor set on the surface, and it is using the cursor for its parent surface.Declaration
Swift
@inlinable func getCursor() -> CursorRef!
-
getDeviceCursor(device:
Extension method) Retrieves a
GdkCursor
pointer for thedevice
currently set on the specifiedGdkSurface
.If the return value is
nil
then there is no custom cursor set on the specified surface, and it is using the cursor for its parent surface.Declaration
Swift
@inlinable func getDeviceCursor<DeviceT>(device: DeviceT) -> CursorRef! where DeviceT : DeviceProtocol
-
getDevicePosition(device:
Extension methodx: y: mask: ) Obtains the current device position and modifier state.
The position is given in coordinates relative to the upper left corner of
surface
.Declaration
Swift
@inlinable func getDevicePosition<DeviceT>(device: DeviceT, x: UnsafeMutablePointer<CDouble>! = nil, y: UnsafeMutablePointer<CDouble>! = nil, mask: UnsafeMutablePointer<GdkModifierType>! = nil) -> Bool where DeviceT : DeviceProtocol
-
getDisplay()
Extension methodGets the
GdkDisplay
associated with aGdkSurface
.Declaration
Swift
@inlinable func getDisplay() -> DisplayRef!
-
getFrameClock()
Extension methodGets the frame clock for the surface.
The frame clock for a surface never changes unless the surface is reparented to a new toplevel surface.
Declaration
Swift
@inlinable func getFrameClock() -> FrameClockRef!
-
getHeight()
Extension methodReturns the height of the given
surface
.Surface size is reported in ”application pixels”, not ”device pixels” (see [method
Gdk.Surface.get_scale_factor
]).Declaration
Swift
@inlinable func getHeight() -> Int
-
getMapped()
Extension methodChecks whether the surface has been mapped.
A surface is mapped with [method
Gdk.Toplevel.present
] or [methodGdk.Popup.present
].Declaration
Swift
@inlinable func getMapped() -> Bool
-
getScaleFactor()
Extension methodReturns 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 of a surface may change during runtime.
Declaration
Swift
@inlinable func getScaleFactor() -> Int
-
getWidth()
Extension methodReturns the width of the given
surface
.Surface size is reported in ”application pixels”, not ”device pixels” (see [method
Gdk.Surface.get_scale_factor
]).Declaration
Swift
@inlinable func getWidth() -> Int
-
hide()
Extension methodHide 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 [method
Gtk.Widget.hide
].Declaration
Swift
@inlinable func hide()
-
queueRender()
Extension methodForces a [signal
Gdk.Surface::render
] signal emission forsurface
to be scheduled.This function is useful for implementations that track invalid regions on their own.
Declaration
Swift
@inlinable func queueRender()
-
requestLayout()
Extension methodRequest a layout phase from the surface’s frame clock.
See [method
Gdk.FrameClock.request_phase
].Declaration
Swift
@inlinable func requestLayout()
-
set(cursor:
Extension method) Sets the default mouse pointer for a
GdkSurface
.Passing
nil
for thecursor
argument means thatsurface
will use the cursor of its parent surface. Most surfaces should use this default. Note thatcursor
must be for the same display assurface
.Use [ctor
Gdk.Cursor.new_from_name
] or [ctorGdk.Cursor.new_from_texture
] to create the cursor. To make the cursor invisible, useGDK_BLANK_CURSOR
.Declaration
Swift
@inlinable func set(cursor: CursorRef? = nil)
-
set(cursor:
Extension method) Sets the default mouse pointer for a
GdkSurface
.Passing
nil
for thecursor
argument means thatsurface
will use the cursor of its parent surface. Most surfaces should use this default. Note thatcursor
must be for the same display assurface
.Use [ctor
Gdk.Cursor.new_from_name
] or [ctorGdk.Cursor.new_from_texture
] to create the cursor. To make the cursor invisible, useGDK_BLANK_CURSOR
.Declaration
Swift
@inlinable func set<CursorT>(cursor: CursorT?) where CursorT : CursorProtocol
-
setDeviceCursor(device:
Extension methodcursor: ) Sets a specific
GdkCursor
for a given device when it gets insidesurface
.Passing
nil
for thecursor
argument means thatsurface
will use the cursor of its parent surface. Most surfaces should use this default.Use [ctor
Gdk.Cursor.new_from_name
] or [ctorGdk.Cursor.new_from_texture
] to create the cursor. To make the cursor invisible, useGDK_BLANK_CURSOR
.Declaration
Swift
@inlinable func setDeviceCursor<CursorT, DeviceT>(device: DeviceT, cursor: CursorT) where CursorT : CursorProtocol, DeviceT : DeviceProtocol
-
setInput(region:
Extension method) 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.Declaration
Swift
@inlinable func setInput<RegionT>(region: RegionT) where RegionT : RegionProtocol
-
setOpaque(region:
Extension method) 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 yourGtkWidgetClass.css_changed
()
handler.Declaration
Swift
@inlinable func setOpaque(region: Cairo.RegionRef? = nil)
-
setOpaque(region:
Extension method) 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 yourGtkWidgetClass.css_changed
()
handler.Declaration
Swift
@inlinable func setOpaque<RegionT>(region: RegionT?) where RegionT : RegionProtocol
-
translateCoordinates(to:
Extension methodx: y: ) Translates coordinates between two surfaces.
Note that this only works if
to
andfrom
are popups or transient-for to the same toplevel (directly or indirectly).Declaration
Swift
@inlinable func translateCoordinates<SurfaceT>(to: SurfaceT, x: UnsafeMutablePointer<CDouble>!, y: UnsafeMutablePointer<CDouble>!) -> Bool where SurfaceT : SurfaceProtocol
-
cairoDrawFromGl(cr:
Extension methodsource: sourceType: bufferScale: x: y: width: height: ) The main way to draw GL content in GTK.
It takes a render buffer ID (
source_type
==GL_RENDERBUFFER
) or a texture id (source_type
==GL_TEXTURE
) and draws it ontocr
with an OVER operation, respecting the current clip. The top left corner of the rectangle specified byx
,y
,width
andheight
will be drawn at the current (0,0) position of thecairo_t
.This will work for all
cairo_t
, as long assurface
is realized, but the fallback implementation that reads back the pixels from the buffer may be used in the general case. In the case of direct drawing to a surface with no special effects applied tocr
it will however use a more efficient approach.For
GL_RENDERBUFFER
the code will always fall back to software for buffers with alpha components, so make sure you useGL_TEXTURE
if using alpha.Calling this may change the current GL context.
Declaration
Swift
@inlinable func cairoDrawFromGl<ContextT>(cr: ContextT, source: Int, sourceType: Int, bufferScale: Int, x: Int, y: Int, width: Int, height: Int) where ContextT : ContextProtocol
-
cursor
Extension methodThe mouse pointer for the
GdkSurface
.Declaration
Swift
@inlinable var cursor: CursorRef! { get nonmutating set }
-
display
Extension methodThe
GdkDisplay
connection of the surface.Declaration
Swift
@inlinable var display: DisplayRef! { get }
-
frameClock
Extension methodGets the frame clock for the surface.
The frame clock for a surface never changes unless the surface is reparented to a new toplevel surface.
Declaration
Swift
@inlinable var frameClock: FrameClockRef! { get }
-
height
Extension methodThe height of the surface, in pixels.
Declaration
Swift
@inlinable var height: Int { get }
-
isDestroyed
Extension methodCheck to see if a surface is destroyed.
Declaration
Swift
@inlinable var isDestroyed: Bool { get }
-
mapped
Extension methodWhether the surface is mapped.
Declaration
Swift
@inlinable var mapped: Bool { get }
-
scaleFactor
Extension methodReturns 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 of a surface may change during runtime.
Declaration
Swift
@inlinable var scaleFactor: Int { get }
-
width
Extension methodThe width of the surface in pixels.
Declaration
Swift
@inlinable var width: Int { get }