Defines all possible DND actions.
This can be used in [method@Gdk.Drop.status] messages when any drop
can be accepted or a more specific drop method is not yet known.
Positioning hints for aligning a surface relative to a rectangle.
These hints determine how the surface should be positioned in the case that
the surface would fall off-screen if placed in its ideal position.
For example, %GDK_ANCHOR_FLIP_X will replace %GDK_GRAVITY_NORTH_WEST with
%GDK_GRAVITY_NORTH_EAST and vice versa if the surface extends beyond the left
or right edges of the monitor.
If %GDK_ANCHOR_SLIDE_X is set, the surface can be shifted horizontally to fit
on-screen. If %GDK_ANCHOR_RESIZE_X is set, the surface can be shrunken
horizontally to fit.
In general, when multiple flags are set, flipping should take precedence over
sliding, which should take precedence over resizing.
allow flipping anchors horizontally
allow flipping anchors vertically
allow sliding surface horizontally
allow sliding surface vertically
allow resizing surface horizontally
allow resizing surface vertically
allow flipping anchors on both axes
allow sliding surface on both axes
allow resizing surface on both axes
`GdkAppLaunchContext` handles launching an application in a graphical context.
It is an implementation of `GAppLaunchContext` that provides startup
notification and allows to launch applications on a specific workspace.
## Launching an application
```c
GdkAppLaunchContext *context;
context = gdk_display_get_app_launch_context (display);
gdk_app_launch_context_set_timestamp (gdk_event_get_time (event));
if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error))
g_warning ("Launching failed: %s\n", error->message);
g_object_unref (context);
```
Gets the `GdkDisplay` that @context is for.
the display of @context
a `GdkAppLaunchContext`
Sets the workspace on which applications will be launched.
This only works when running under a window manager that
supports multiple workspaces, as described in the
[Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec).
Specifically this sets the `_NET_WM_DESKTOP` property described
in that spec.
This only works when using the X11 backend.
When the workspace is not specified or @desktop is set to -1,
it is up to the window manager to pick one, typically it will
be the current workspace.
a `GdkAppLaunchContext`
the number of a workspace, or -1
Sets the icon for applications that are launched with this
context.
Window Managers can use this information when displaying startup
notification.
See also [method@Gdk.AppLaunchContext.set_icon_name].
a `GdkAppLaunchContext`
a `GIcon`
Sets the icon for applications that are launched with this context.
The @icon_name will be interpreted in the same way as the Icon field
in desktop files. See also [method@Gdk.AppLaunchContext.set_icon].
If both @icon and @icon_name are set, the @icon_name takes priority.
If neither @icon or @icon_name is set, the icon is taken from either
the file that is passed to launched application or from the `GAppInfo`
for the launched application itself.
a `GdkAppLaunchContext`
an icon name
Sets the timestamp of @context.
The timestamp should ideally be taken from the event that
triggered the launch.
Window managers can use this information to avoid moving the
focus to the newly launched application when the user is busy
typing in another window. This is also known as 'focus stealing
prevention'.
a `GdkAppLaunchContext`
a timestamp
The display that the `GdkAppLaunchContext` is on.
Flags describing the current capabilities of a device/tool.
X axis is present
Y axis is present
Scroll X delta axis is present
Scroll Y delta axis is present
Pressure axis is present
X tilt axis is present
Y tilt axis is present
Wheel axis is present
Distance axis is present
Z-axis rotation is present
Slider axis is present
Defines how device axes are interpreted by GTK.
Note that the X and Y axes are not really needed; pointer devices
report their location via the x/y members of events regardless. Whether
X and Y are present as axes depends on the GDK backend.
the axis is ignored.
the axis is used as the x axis.
the axis is used as the y axis.
the axis is used as the scroll x delta
the axis is used as the scroll y delta
the axis is used for pressure information.
the axis is used for x tilt information.
the axis is used for y tilt information.
the axis is used for wheel information.
the axis is used for pen/tablet distance information
the axis is used for pen rotation information
the axis is used for pen slider information
a constant equal to the numerically highest axis value.
The middle button.
The primary button. This is typically the left mouse button, or the
right button in a left-handed setup.
The secondary button. This is typically the right mouse button, or the
left button in a left-handed setup.
An event related to a button on a pointer device.
Extract the button number from a button event.
the button of @event
a button event
Represents the current time, and can be used anywhere a time is expected.
`GdkCairoContext` is an object representing the platform-specific
draw context.
`GdkCairoContext`s are created for a surface using
[method@Gdk.Surface.create_cairo_context], and the context
can then be used to draw on that surface.
Retrieves a Cairo context to be used to draw on the `GdkSurface`
of @context.
A call to [method@Gdk.DrawContext.begin_frame] with this
@context must have been done or this function will return %NULL.
The returned context is guaranteed to be valid until
[method@Gdk.DrawContext.end_frame] is called.
a Cairo context
to draw on `GdkSurface
a `GdkCairoContext` that is currently drawing
The `GdkClipboard` object represents data shared between applications or
inside an application.
To get a `GdkClipboard` object, use [method@Gdk.Display.get_clipboard] or
[method@Gdk.Display.get_primary_clipboard]. You can find out about the data
that is currently available in a clipboard using
[method@Gdk.Clipboard.get_formats].
To make text or image data available in a clipboard, use
[method@Gdk.Clipboard.set_text] or [method@Gdk.Clipboard.set_texture].
For other data, you can use [method@Gdk.Clipboard.set_content], which
takes a [class@Gdk.ContentProvider] object.
To read textual or image data from a clipboard, use
[method@Gdk.Clipboard.read_text_async] or
[method@Gdk.Clipboard.read_texture_async]. For other data, use
[method@Gdk.Clipboard.read_async], which provides a `GInputStream` object.
Returns the `GdkContentProvider` currently set on @clipboard.
If the @clipboard is empty or its contents are not owned by the
current process, %NULL will be returned.
The content of a clipboard
if the clipboard does not maintain any content
a `GdkClipboard`
Gets the `GdkDisplay` that the clipboard was created for.
a `GdkDisplay`
a `GdkClipboard`
Gets the formats that the clipboard can provide its current contents in.
The formats of the clipboard
a `GdkClipboard`
Returns if the clipboard is local.
A clipboard is considered local if it was last claimed
by the running application.
Note that [method@Gdk.Clipboard.get_content] may return %NULL
even on a local clipboard. In this case the clipboard is empty.
%TRUE if the clipboard is local
a `GdkClipboard`
Asynchronously requests an input stream to read the @clipboard's
contents from.
The clipboard will choose the most suitable mime type from the given list
to fulfill the request, preferring the ones listed first.
a `GdkClipboard`
a %NULL-terminated array of mime types to choose from
the I/O priority of the request
optional `GCancellable` object
callback to call when the request is satisfied
the data to pass to callback function
Finishes an asynchronous clipboard read.
See [method@Gdk.Clipboard.read_async].
a `GInputStream`
a `GdkClipboard`
a `GAsyncResult`
location to store
the chosen mime type
Asynchronously request the @clipboard contents converted to a string.
This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
Use that function or [method@Gdk.Clipboard.read_async] directly if you
need more control over the operation.
a `GdkClipboard`
optional `GCancellable` object
callback to call when the request is satisfied
the data to pass to callback function
Finishes an asynchronous clipboard read.
See [method@Gdk.Clipboard.read_text_async].
a new string
a `GdkClipboard`
a `GAsyncResult`
Asynchronously request the @clipboard contents converted to a `GdkPixbuf`.
This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
Use that function or [method@Gdk.Clipboard.read_async] directly if you
need more control over the operation.
a `GdkClipboard`
optional `GCancellable` object, %NULL to ignore.
callback to call when the request is satisfied
the data to pass to callback function
Finishes an asynchronous clipboard read.
See [method@Gdk.Clipboard.read_texture_async].
a new `GdkTexture`
a `GdkClipboard`
a `GAsyncResult`
Asynchronously request the @clipboard contents converted to the given
@type.
For local clipboard contents that are available in the given `GType`,
the value will be copied directly. Otherwise, GDK will try to use
[func@content_deserialize_async] to convert the clipboard's data.
a `GdkClipboard`
a `GType` to read
the I/O priority of the request
optional `GCancellable` object
callback to call when the request is satisfied
the data to pass to callback function
Finishes an asynchronous clipboard read.
See [method@Gdk.Clipboard.read_value_async].
a `GValue` containing the result.
a `GdkClipboard`
a `GAsyncResult`
Sets the clipboard to contain the value collected from the given varargs.
Values should be passed the same way they are passed to other value
collecting APIs, such as [method@GObject.Object.set] or
[func@GObject.signal_emit].
```c
gdk_clipboard_set (clipboard, GTK_TYPE_STRING, "Hello World");
gdk_clipboard_set (clipboard, GDK_TYPE_TEXTURE, some_texture);
```
a `GdkClipboard`
type of value to set
value contents conforming to @type
Sets a new content provider on @clipboard.
The clipboard will claim the `GdkDisplay`'s resources and advertise
these new contents to other applications.
In the rare case of a failure, this function will return %FALSE. The
clipboard will then continue reporting its old contents and ignore
@provider.
If the contents are read by either an external application or the
@clipboard's read functions, @clipboard will select the best format to
transfer the contents and then request that format from @provider.
%TRUE if setting the clipboard succeeded
a `GdkClipboard`
the new contents of @clipboard
or %NULL to clear the clipboard
Puts the given @text into the clipboard.
a `GdkClipboard`
Text to put into the clipboard
Puts the given @texture into the clipboard.
a `GdkClipboard`
a `GdkTexture` to put into the clipboard
Sets the clipboard to contain the value collected from the given @args.
a `GdkClipboard`
type of value to set
varargs containing the value of @type
Sets the @clipboard to contain the given @value.
a `GdkClipboard`
a `GValue` to set
Asynchronously instructs the @clipboard to store its contents remotely.
If the clipboard is not local, this function does nothing but report success.
The purpose of this call is to preserve clipboard contents beyond the
lifetime of an application, so this function is typically called on
exit. Depending on the platform, the functionality may not be available
unless a "clipboard manager" is running.
This function is called automatically when a
[GtkApplication](../gtk4/class.Application.html)
is shut down, so you likely don't need to call it.
a `GdkClipboard`
the I/O priority of the request
optional `GCancellable` object
callback to call when the request is satisfied
the data to pass to callback function
Finishes an asynchronous clipboard store.
See [method@Gdk.Clipboard.store_async].
%TRUE if storing was successful.
a `GdkClipboard`
a `GAsyncResult`
The `GdkContentProvider` or %NULL if the clipboard is empty or contents are
provided otherwise.
The `GdkDisplay` that the clipboard belongs to.
The possible formats that the clipboard can provide its data in.
%TRUE if the contents of the clipboard are owned by this process.
Emitted when the clipboard changes ownership.
A `GdkColorState` object provides the information to interpret
colors and pixels in a variety of ways.
They are also known as
[*color spaces*](https://en.wikipedia.org/wiki/Color_space).
Crucially, GTK knows how to convert colors from one color
state to another.
`GdkColorState objects are immutable and therefore threadsafe.
Since 4.16
Compares two `GdkColorStates` for equality.
Note that this function is not guaranteed to be perfect and two objects
describing the same color state may compare not equal. However, different
color states will never compare equal.
%TRUE if the two color states compare equal
a `GdkColorState`
another `GdkColorStatee`
Increase the reference count of @self.
the object that was passed in
a `GdkColorState`
Decrease the reference count of @self.
Unless @self is static, it will be freed
when the reference count reaches zero.
a `GdkColorState`
Returns the color state object representing the sRGB color space.
the color state object for sRGB
Returns the color state object representing the linearized sRGB color space.
the color state object for linearized sRGB
The type of a function that can be registered with gdk_content_register_deserializer().
When the function gets called to operate on content, it can call functions on the
@deserializer object to obtain the mime type, input stream, user data, etc. for its
operation.
a `GdkContentDeserializer`
A `GdkContentDeserializer` is used to deserialize content received via
inter-application data transfers.
The `GdkContentDeserializer` transforms serialized content that is
identified by a mime type into an object identified by a GType.
GTK provides serializers and deserializers for common data types
such as text, colors, images or file lists. To register your own
deserialization functions, use [func@content_register_deserializer].
Also see [class@Gdk.ContentSerializer].
Gets the cancellable for the current operation.
This is the `GCancellable` that was passed to [func@Gdk.content_deserialize_async].
the cancellable for the current operation
a `GdkContentDeserializer`
Gets the `GType` to create an instance of.
the `GType` for the current operation
a `GdkContentDeserializer`
Gets the input stream for the current operation.
This is the stream that was passed to [func@Gdk.content_deserialize_async].
the input stream for the current operation
a `GdkContentDeserializer`
Gets the mime type to deserialize from.
the mime type for the current operation
a `GdkContentDeserializer`
Gets the I/O priority for the current operation.
This is the priority that was passed to [func@Gdk.content_deserialize_async].
the I/O priority for the current operation
a `GdkContentDeserializer`
Gets the data that was associated with the current operation.
See [method@Gdk.ContentDeserializer.set_task_data].
the task data for @deserializer
a `GdkContentDeserializer`
Gets the user data that was passed when the deserializer was registered.
the user data for this deserializer
a `GdkContentDeserializer`
Gets the `GValue` to store the deserialized object in.
the `GValue` for the current operation
a `GdkContentDeserializer`
Indicate that the deserialization has ended with an error.
This function consumes @error.
a `GdkContentDeserializer`
a `GError`
Indicate that the deserialization has been successfully completed.
a `GdkContentDeserializer`
Associate data with the current deserialization operation.
a `GdkContentDeserializer`
data to associate with this operation
destroy notify for @data
The `GdkContentFormats` structure is used to advertise and negotiate the
format of content.
You will encounter `GdkContentFormats` when interacting with objects
controlling operations that pass data between different widgets, window
or application, like [class@Gdk.Drag], [class@Gdk.Drop],
[class@Gdk.Clipboard] or [class@Gdk.ContentProvider].
GDK supports content in 2 forms: `GType` and mime type.
Using `GTypes` is meant only for in-process content transfers. Mime types
are meant to be used for data passing both in-process and out-of-process.
The details of how data is passed is described in the documentation of
the actual implementations. To transform between the two forms,
[class@Gdk.ContentSerializer] and [class@Gdk.ContentDeserializer] are used.
A `GdkContentFormats` describes a set of possible formats content can be
exchanged in. It is assumed that this set is ordered. `GTypes` are more
important than mime types. Order between different `GTypes` or mime types
is the order they were added in, most important first. Functions that
care about order, such as [method@Gdk.ContentFormats.union], will describe
in their documentation how they interpret that order, though in general the
order of the first argument is considered the primary order of the result,
followed by the order of further arguments.
For debugging purposes, the function [method@Gdk.ContentFormats.to_string]
exists. It will print a comma-separated list of formats from most important
to least important.
`GdkContentFormats` is an immutable struct. After creation, you cannot change
the types it represents. Instead, new `GdkContentFormats` have to be created.
The [struct@Gdk.ContentFormatsBuilder] structure is meant to help in this
endeavor.
Creates a new `GdkContentFormats` from an array of mime types.
The mime types must be valid and different from each other or the
behavior of the return value is undefined. If you cannot guarantee
this, use [struct@Gdk.ContentFormatsBuilder] instead.
the new `GdkContentFormats`.
Pointer to an
array of mime types
number of entries in @mime_types.
Creates a new `GdkContentFormats` for a given `GType`.
a new `GdkContentFormats`
a `GType`
Checks if a given `GType` is part of the given @formats.
%TRUE if the `GType` was found
a `GdkContentFormats`
the `GType` to search for
Checks if a given mime type is part of the given @formats.
%TRUE if the mime_type was found
a `GdkContentFormats`
the mime type to search for
Gets the `GType`s included in @formats.
Note that @formats may not contain any `GType`s, in particular when
they are empty. In that case %NULL will be returned.
%G_TYPE_INVALID-terminated array of types included in @formats
a `GdkContentFormats`
optional pointer to take the
number of `GType`s contained in the return value
Gets the mime types included in @formats.
Note that @formats may not contain any mime types, in particular
when they are empty. In that case %NULL will be returned.
%NULL-terminated array of interned strings of mime types included
in @formats
a `GdkContentFormats`
optional pointer to take the
number of mime types contained in the return value
Checks if @first and @second have any matching formats.
%TRUE if a matching format was found.
the primary `GdkContentFormats` to intersect
the `GdkContentFormats` to intersect with
Finds the first `GType` from @first that is also contained
in @second.
If no matching `GType` is found, %G_TYPE_INVALID is returned.
The first common `GType` or %G_TYPE_INVALID if none.
the primary `GdkContentFormats` to intersect
the `GdkContentFormats` to intersect with
Finds the first mime type from @first that is also contained
in @second.
If no matching mime type is found, %NULL is returned.
The first common mime type or %NULL if none
the primary `GdkContentFormats` to intersect
the `GdkContentFormats` to intersect with
Prints the given @formats into a string for human consumption.
The result of this function can later be parsed with
[func@Gdk.ContentFormats.parse].
a `GdkContentFormats`
a `GString` to print into
Increases the reference count of a `GdkContentFormats` by one.
the passed in `GdkContentFormats`.
a `GdkContentFormats`
Prints the given @formats into a human-readable string.
The resulting string can be parsed with [func@Gdk.ContentFormats.parse].
This is a small wrapper around [method@Gdk.ContentFormats.print]
to help when debugging.
a new string
a `GdkContentFormats`
Append all missing types from @second to @first, in the order
they had in @second.
a new `GdkContentFormats`
the `GdkContentFormats` to merge into
the `GdkContentFormats` to merge from
Add GTypes for mime types in @formats for which deserializers are
registered.
a new `GdkContentFormats`
a `GdkContentFormats`
Add mime types for GTypes in @formats for which deserializers are
registered.
a new `GdkContentFormats`
a `GdkContentFormats`
Add GTypes for the mime types in @formats for which serializers are
registered.
a new `GdkContentFormats`
a `GdkContentFormats`
Add mime types for GTypes in @formats for which serializers are
registered.
a new `GdkContentFormats`
a `GdkContentFormats`
Decreases the reference count of a `GdkContentFormats` by one.
If the resulting reference count is zero, frees the formats.
a `GdkContentFormats`
Parses the given @string into `GdkContentFormats` and
returns the formats.
Strings printed via [method@Gdk.ContentFormats.to_string]
can be read in again successfully using this function.
If @string does not describe valid content formats, %NULL
is returned.
the content formats if @string is valid
the string to parse
A `GdkContentFormatsBuilder` is an auxiliary struct used to create
new `GdkContentFormats`, and should not be kept around.
Create a new `GdkContentFormatsBuilder` object.
The resulting builder would create an empty `GdkContentFormats`.
Use addition functions to add types to it.
a new `GdkContentFormatsBuilder`
Appends all formats from @formats to @builder, skipping those that
already exist.
a `GdkContentFormatsBuilder`
the formats to add
Appends @type to @builder if it has not already been added.
a `GdkContentFormats`Builder
a `GType`
Appends @mime_type to @builder if it has not already been added.
a `GdkContentFormatsBuilder`
a mime type
Creates a new `GdkContentFormats` from the current state of the
given @builder, and frees the @builder instance.
the newly created `GdkContentFormats`
with all the formats added to @builder
a `GdkContentFormatsBuilder`
Acquires a reference on the given @builder.
This function is intended primarily for bindings.
`GdkContentFormatsBuilder` objects should not be kept around.
the given `GdkContentFormatsBuilder`
with its reference count increased
a `GdkContentFormatsBuilder`
Creates a new `GdkContentFormats` from the given @builder.
The given `GdkContentFormatsBuilder` is reset once this function returns;
you cannot call this function multiple times on the same @builder instance.
This function is intended primarily for bindings. C code should use
[method@Gdk.ContentFormatsBuilder.free_to_formats].
the newly created `GdkContentFormats`
with all the formats added to @builder
a `GdkContentFormats`Builder
Releases a reference on the given @builder.
a `GdkContentFormatsBuilder`
A `GdkContentProvider` is used to provide content for the clipboard or
for drag-and-drop operations in a number of formats.
To create a `GdkContentProvider`, use [ctor@Gdk.ContentProvider.new_for_value]
or [ctor@Gdk.ContentProvider.new_for_bytes].
GDK knows how to handle common text and image formats out-of-the-box. See
[class@Gdk.ContentSerializer] and [class@Gdk.ContentDeserializer] if you want
to add support for application-specific data formats.
Create a content provider that provides the given @bytes as data for
the given @mime_type.
a new `GdkContentProvider`
the mime type
a `GBytes` with the data for @mime_type
Create a content provider that provides the given @value.
a new `GdkContentProvider`
a `GValue`
Create a content provider that provides the value of the given
@type.
The value is provided using G_VALUE_COLLECT(), so the same rules
apply as when calling g_object_new() or g_object_set().
a new `GdkContentProvider`
Type of value to follow
value
Creates a content provider that represents all the given @providers.
Whenever data needs to be written, the union provider will try the given
@providers in the given order and the first one supporting a format will
be chosen to provide it.
This allows an easy way to support providing data in different formats.
For example, an image may be provided by its file and by the image
contents with a call such as
```c
gdk_content_provider_new_union ((GdkContentProvider *[2]) {
gdk_content_provider_new_typed (G_TYPE_FILE, file),
gdk_content_provider_new_typed (G_TYPE_TEXTURE, texture)
}, 2);
```
a new `GdkContentProvider`
The `GdkContentProvider`s to present the union of
the number of providers
Emits the ::content-changed signal.
a `GdkContentProvider`
Gets the contents of @provider stored in @value.
The @value will have been initialized to the `GType` the value should be
provided in. This given `GType` does not need to be listed in the formats
returned by [method@Gdk.ContentProvider.ref_formats]. However, if the
given `GType` is not supported, this operation can fail and
`G_IO_ERROR_NOT_SUPPORTED` will be reported.
%TRUE if the value was set successfully. Otherwise
@error will be set to describe the failure.
a `GdkContentProvider`
the `GValue` to fill
Gets the formats that the provider can provide its current contents in.
The formats of the provider
a `GdkContentProvider`
Gets the formats that the provider suggests other applications to store
the data in.
An example of such an application would be a clipboard manager.
This can be assumed to be a subset of [method@Gdk.ContentProvider.ref_formats].
The storable formats of the provider
a `GdkContentProvider`
Asynchronously writes the contents of @provider to @stream in the given
@mime_type.
The given mime type does not need to be listed in the formats returned by
[method@Gdk.ContentProvider.ref_formats]. However, if the given `GType` is
not supported, `G_IO_ERROR_NOT_SUPPORTED` will be reported.
The given @stream will not be closed.
a `GdkContentProvider`
the mime type to provide the data in
the `GOutputStream` to write to
I/O priority of the request.
optional `GCancellable` object, %NULL to ignore.
callback to call when the request is satisfied
the data to pass to callback function
Finishes an asynchronous write operation.
See [method@Gdk.ContentProvider.write_mime_type_async].
%TRUE if the operation was completed successfully. Otherwise
@error will be set to describe the failure.
a `GdkContentProvider`
a `GAsyncResult`
Emits the ::content-changed signal.
a `GdkContentProvider`
Gets the contents of @provider stored in @value.
The @value will have been initialized to the `GType` the value should be
provided in. This given `GType` does not need to be listed in the formats
returned by [method@Gdk.ContentProvider.ref_formats]. However, if the
given `GType` is not supported, this operation can fail and
`G_IO_ERROR_NOT_SUPPORTED` will be reported.
%TRUE if the value was set successfully. Otherwise
@error will be set to describe the failure.
a `GdkContentProvider`
the `GValue` to fill
Gets the formats that the provider can provide its current contents in.
The formats of the provider
a `GdkContentProvider`
Gets the formats that the provider suggests other applications to store
the data in.
An example of such an application would be a clipboard manager.
This can be assumed to be a subset of [method@Gdk.ContentProvider.ref_formats].
The storable formats of the provider
a `GdkContentProvider`
Asynchronously writes the contents of @provider to @stream in the given
@mime_type.
The given mime type does not need to be listed in the formats returned by
[method@Gdk.ContentProvider.ref_formats]. However, if the given `GType` is
not supported, `G_IO_ERROR_NOT_SUPPORTED` will be reported.
The given @stream will not be closed.
a `GdkContentProvider`
the mime type to provide the data in
the `GOutputStream` to write to
I/O priority of the request.
optional `GCancellable` object, %NULL to ignore.
callback to call when the request is satisfied
the data to pass to callback function
Finishes an asynchronous write operation.
See [method@Gdk.ContentProvider.write_mime_type_async].
%TRUE if the operation was completed successfully. Otherwise
@error will be set to describe the failure.
a `GdkContentProvider`
a `GAsyncResult`
The possible formats that the provider can provide its data in.
The subset of formats that clipboard managers should store this provider's data in.
Emitted whenever the content provided by this provider has changed.
Class structure for `GdkContentProvider`.
Signal class closure for `GdkContentProvider::content-changed`
a `GdkContentProvider`
The formats of the provider
a `GdkContentProvider`
The storable formats of the provider
a `GdkContentProvider`
a `GdkContentProvider`
the mime type to provide the data in
the `GOutputStream` to write to
I/O priority of the request.
optional `GCancellable` object, %NULL to ignore.
callback to call when the request is satisfied
the data to pass to callback function
%TRUE if the operation was completed successfully. Otherwise
@error will be set to describe the failure.
a `GdkContentProvider`
a `GAsyncResult`
%TRUE if the value was set successfully. Otherwise
@error will be set to describe the failure.
a `GdkContentProvider`
the `GValue` to fill
The type of a function that can be registered with gdk_content_register_serializer().
When the function gets called to operate on content, it can call functions on the
@serializer object to obtain the mime type, output stream, user data, etc. for its
operation.
a `GdkContentSerializer`
A `GdkContentSerializer` is used to serialize content for
inter-application data transfers.
The `GdkContentSerializer` transforms an object that is identified
by a GType into a serialized form (i.e. a byte stream) that is
identified by a mime type.
GTK provides serializers and deserializers for common data types
such as text, colors, images or file lists. To register your own
serialization functions, use [func@Gdk.content_register_serializer].
Also see [class@Gdk.ContentDeserializer].
Gets the cancellable for the current operation.
This is the `GCancellable` that was passed to [func@content_serialize_async].
the cancellable for the current operation
a `GdkContentSerializer`
Gets the `GType` to of the object to serialize.
the `GType` for the current operation
a `GdkContentSerializer`
Gets the mime type to serialize to.
the mime type for the current operation
a `GdkContentSerializer`
Gets the output stream for the current operation.
This is the stream that was passed to [func@content_serialize_async].
the output stream for the current operation
a `GdkContentSerializer`
Gets the I/O priority for the current operation.
This is the priority that was passed to [func@content_serialize_async].
the I/O priority for the current operation
a `GdkContentSerializer`
Gets the data that was associated with the current operation.
See [method@Gdk.ContentSerializer.set_task_data].
the task data for @serializer
a `GdkContentSerializer`
Gets the user data that was passed when the serializer was registered.
the user data for this serializer
a `GdkContentSerializer`
Gets the `GValue` to read the object to serialize from.
the `GValue` for the current operation
a `GdkContentSerializer`
Indicate that the serialization has ended with an error.
This function consumes @error.
a `GdkContentSerializer`
a `GError`
Indicate that the serialization has been successfully completed.
a `GdkContentSerializer`
Associate data with the current serialization operation.
a `GdkContentSerializer`
data to associate with this operation
destroy notify for @data
An event caused by a pointing device moving between surfaces.
Extracts the notify detail from a crossing event.
the notify detail of @event
a crossing event
Checks if the @event surface is the focus surface.
%TRUE if the surface is the focus surface
a crossing event
Extracts the crossing mode from a crossing event.
the mode of @event
a crossing event
Specifies the crossing mode for enter and leave events.
crossing because of pointer motion.
crossing because a grab is activated.
crossing because a grab is deactivated.
crossing because a GTK grab is activated.
crossing because a GTK grab is deactivated.
crossing because a GTK widget changed
state (e.g. sensitivity).
crossing because a touch sequence has begun,
this event is synthetic as the pointer might have not left the surface.
crossing because a touch sequence has ended,
this event is synthetic as the pointer might have not left the surface.
crossing because of a device switch (i.e.
a mouse taking control of the pointer after a touch device), this event
is synthetic as the pointer didn’t leave the surface.
`GdkCursor` is used to create and destroy cursors.
Cursors are immutable objects, so once you created them, there is no way
to modify them later. You should create a new cursor when you want to change
something about it.
Cursors by themselves are not very interesting: they must be bound to a
window for users to see them. This is done with [method@Gdk.Surface.set_cursor]
or [method@Gdk.Surface.set_device_cursor]. Applications will typically
use higher-level GTK functions such as [gtk_widget_set_cursor()](../gtk4/method.Widget.set_cursor.html)
instead.
Cursors are not bound to a given [class@Gdk.Display], so they can be shared.
However, the appearance of cursors may vary when used on different
platforms.
## Named and texture cursors
There are multiple ways to create cursors. The platform's own cursors
can be created with [ctor@Gdk.Cursor.new_from_name]. That function lists
the commonly available names that are shared with the CSS specification.
Other names may be available, depending on the platform in use. On some
platforms, what images are used for named cursors may be influenced by
the cursor theme.
Another option to create a cursor is to use [ctor@Gdk.Cursor.new_from_texture]
and provide an image to use for the cursor.
To ease work with unsupported cursors, a fallback cursor can be provided.
If a [class@Gdk.Surface] cannot use a cursor because of the reasons mentioned
above, it will try the fallback cursor. Fallback cursors can themselves have
fallback cursors again, so it is possible to provide a chain of progressively
easier to support cursors. If none of the provided cursors can be supported,
the default cursor will be the ultimate fallback.
Creates a new callback-based cursor object.
Cursors of this kind produce textures for the cursor
image on demand, when the @callback is called.
a new `GdkCursor`
the `GdkCursorGetTextureCallback`
data to pass to @callback
destroy notify for @data
the `GdkCursor` to fall back to when
this one cannot be supported
Creates a new cursor by looking up @name in the current cursor
theme.
A recommended set of cursor names that will work across different
platforms can be found in the CSS specification:
| | | | |
| --- | --- | ---- | --- |
| "none" | ![](default_cursor.png) "default" | ![](help_cursor.png) "help" | ![](pointer_cursor.png) "pointer" |
| ![](context_menu_cursor.png) "context-menu" | ![](progress_cursor.png) "progress" | ![](wait_cursor.png) "wait" | ![](cell_cursor.png) "cell" |
| ![](crosshair_cursor.png) "crosshair" | ![](text_cursor.png) "text" | ![](vertical_text_cursor.png) "vertical-text" | ![](alias_cursor.png) "alias" |
| ![](copy_cursor.png) "copy" | ![](no_drop_cursor.png) "no-drop" | ![](move_cursor.png) "move" | ![](not_allowed_cursor.png) "not-allowed" |
| ![](grab_cursor.png) "grab" | ![](grabbing_cursor.png) "grabbing" | ![](all_scroll_cursor.png) "all-scroll" | ![](col_resize_cursor.png) "col-resize" |
| ![](row_resize_cursor.png) "row-resize" | ![](n_resize_cursor.png) "n-resize" | ![](e_resize_cursor.png) "e-resize" | ![](s_resize_cursor.png) "s-resize" |
| ![](w_resize_cursor.png) "w-resize" | ![](ne_resize_cursor.png) "ne-resize" | ![](nw_resize_cursor.png) "nw-resize" | ![](sw_resize_cursor.png) "sw-resize" |
| ![](se_resize_cursor.png) "se-resize" | ![](ew_resize_cursor.png) "ew-resize" | ![](ns_resize_cursor.png) "ns-resize" | ![](nesw_resize_cursor.png) "nesw-resize" |
| ![](nwse_resize_cursor.png) "nwse-resize" | ![](zoom_in_cursor.png) "zoom-in" | ![](zoom_out_cursor.png) "zoom-out" | |
a new `GdkCursor`, or %NULL if there is no
cursor with the given name
the name of the cursor
%NULL or the `GdkCursor` to fall back to when
this one cannot be supported
Creates a new cursor from a `GdkTexture`.
a new `GdkCursor`
the texture providing the pixel data
the horizontal offset of the “hotspot” of the cursor
the vertical offset of the “hotspot” of the cursor
the `GdkCursor` to fall back to when
this one cannot be supported
Returns the fallback for this @cursor.
The fallback will be used if this cursor is not available on a given
`GdkDisplay`. For named cursors, this can happen when using nonstandard
names or when using an incomplete cursor theme. For textured cursors,
this can happen when the texture is too large or when the `GdkDisplay`
it is used on does not support textured cursors.
the fallback of the cursor or %NULL
to use the default cursor as fallback
a `GdkCursor`
Returns the horizontal offset of the hotspot.
The hotspot indicates the pixel that will be directly above the cursor.
Note that named cursors may have a nonzero hotspot, but this function
will only return the hotspot position for cursors created with
[ctor@Gdk.Cursor.new_from_texture].
the horizontal offset of the hotspot or 0 for named cursors
a `GdkCursor`
Returns the vertical offset of the hotspot.
The hotspot indicates the pixel that will be directly above the cursor.
Note that named cursors may have a nonzero hotspot, but this function
will only return the hotspot position for cursors created with
[ctor@Gdk.Cursor.new_from_texture].
the vertical offset of the hotspot or 0 for named cursors
a `GdkCursor`
Returns the name of the cursor.
If the cursor is not a named cursor, %NULL will be returned.
the name of the cursor or %NULL
if it is not a named cursor
a `GdkCursor`
Returns the texture for the cursor.
If the cursor is a named cursor, %NULL will be returned.
the texture for cursor or %NULL
if it is a named cursor
a `GdkCursor`
Cursor to fall back to if this cursor cannot be displayed.
X position of the cursor hotspot in the cursor image.
Y position of the cursor hotspot in the cursor image.
Name of this this cursor.
The name will be %NULL if the cursor was created from a texture.
The texture displayed by this cursor.
The texture will be %NULL if the cursor was created from a name.
The type of callback used by a dynamic `GdkCursor` to generate
a texture for the cursor image at the given @cursor_size
and @scale.
The actual cursor size in application pixels may be different
from @cursor_size x @cursor_size, and will be returned in
@width, @height. The returned texture should have a size that
corresponds to the actual cursor size, in device pixels (i.e.
application pixels, multiplied by @scale).
This function may fail and return `NULL`, in which case
the fallback cursor will be used.
the cursor image, or
`NULL` if none could be produced.
the `GdkCursor`
the nominal cursor size, in application pixels
the device scale
return location for the actual cursor width,
in application pixels
return location for the actual cursor height,
in application pixels
return location for the hotspot X position,
in application pixels
return location for the hotspot Y position,
in application pixels
User data for the callback
An event related to drag and drop operations.
Gets the `GdkDrop` object from a DND event.
the drop
a DND event
An event related to closing a top-level surface.
The `GdkDevice` object represents an input device, such
as a keyboard, a mouse, or a touchpad.
See the [class@Gdk.Seat] documentation for more information
about the various kinds of devices, and their relationships.
Retrieves whether the Caps Lock modifier of the keyboard is locked.
This is only relevant for keyboard devices.
%TRUE if Caps Lock is on for @device
a `GdkDevice`
Retrieves the current tool for @device.
the `GdkDeviceTool`
a `GdkDevice`
Returns the direction of effective layout of the keyboard.
This is only relevant for keyboard devices.
The direction of a layout is the direction of the majority
of its symbols. See [func@Pango.unichar_direction].
%PANGO_DIRECTION_LTR or %PANGO_DIRECTION_RTL
if it can determine the direction. %PANGO_DIRECTION_NEUTRAL
otherwise
a `GdkDevice`
Returns the `GdkDisplay` to which @device pertains.
a `GdkDisplay`
a `GdkDevice`
Determines whether the pointer follows device motion.
This is not meaningful for keyboard devices, which
don't have a pointer.
%TRUE if the pointer follows device motion
a `GdkDevice`
Retrieves the current modifier state of the keyboard.
This is only relevant for keyboard devices.
the current modifier state
a `GdkDevice`
The name of the device, suitable for showing in a user interface.
a name
a GdkDevice`
Retrieves whether the Num Lock modifier of the keyboard is locked.
This is only relevant for keyboard devices.
%TRUE if Num Lock is on for @device
a ``GdkDevice`
Retrieves the number of touch points associated to @device.
the number of touch points
a `GdkDevice`
Returns the product ID of this device.
This ID is retrieved from the device, and does not change.
See [method@Gdk.Device.get_vendor_id] for more information.
the product ID
a physical `GdkDevice`
Retrieves whether the Scroll Lock modifier of the keyboard is locked.
This is only relevant for keyboard devices.
%TRUE if Scroll Lock is on for @device
a `GdkDevice`
Returns the `GdkSeat` the device belongs to.
a `GdkSeat`
A `GdkDevice`
Determines the type of the device.
a `GdkInputSource`
a `GdkDevice`
Obtains the surface underneath @device, returning the location of the
device in @win_x and @win_y.
Returns %NULL if the surface tree under @device is not known to GDK
(for example, belongs to another application).
the `GdkSurface` under the
device position
pointer `GdkDevice` to query info to
return location for the X coordinate
of the device location relative to the surface origin
return location for the Y coordinate
of the device location relative to the surface origin
Returns the timestamp of the last activity for this device.
In practice, this means the timestamp of the last event that was
received from the OS for this device. (GTK may occasionally produce
events for a device that are not received from the OS, and will not
update the timestamp).
the timestamp of the last activity for this device
a `GdkDevice`
Returns the vendor ID of this device.
This ID is retrieved from the device, and does not change.
This function, together with [method@Gdk.Device.get_product_id],
can be used to eg. compose `GSettings` paths to store settings
for this device.
```c
static GSettings *
get_device_settings (GdkDevice *device)
{
const char *vendor, *product;
GSettings *settings;
GdkDevice *device;
char *path;
vendor = gdk_device_get_vendor_id (device);
product = gdk_device_get_product_id (device);
path = g_strdup_printf ("/org/example/app/devices/%s:%s/", vendor, product);
settings = g_settings_new_with_path (DEVICE_SCHEMA, path);
g_free (path);
return settings;
}
```
the vendor ID
a physical `GdkDevice`
Determines if layouts for both right-to-left and
left-to-right languages are in use on the keyboard.
This is only relevant for keyboard devices.
%TRUE if there are layouts with both directions, %FALSE otherwise
a `GdkDevice`
Whether Caps Lock is on.
This is only relevant for keyboard devices.
The direction of the current layout.
This is only relevant for keyboard devices.
The `GdkDisplay` the `GdkDevice` pertains to.
Whether the device has both right-to-left and left-to-right layouts.
This is only relevant for keyboard devices.
Whether the device is represented by a cursor on the screen.
The current modifier state of the device.
This is only relevant for keyboard devices.
Number of axes in the device.
The device name.
Whether Num Lock is on.
This is only relevant for keyboard devices.
The maximal number of concurrent touches on a touch device.
Will be 0 if the device is not a touch device or if the number
of touches is unknown.
Product ID of this device.
See [method@Gdk.Device.get_product_id].
Whether Scroll Lock is on.
This is only relevant for keyboard devices.
`GdkSeat` of this device.
Source type for the device.
The `GdkDeviceTool` that is currently used with this device.
Vendor ID of this device.
See [method@Gdk.Device.get_vendor_id].
Emitted either when the number of either axes or keys changes.
On X11 this will normally happen when the physical device
routing events through the logical device changes (for
example, user switches from the USB mouse to a tablet); in
that case the logical device will change to reflect the axes
and keys on the new physical device.
Emitted on pen/eraser devices whenever tools enter or leave proximity.
The new current tool
`GdkDevicePad` is an interface implemented by devices of type
%GDK_SOURCE_TABLET_PAD
It allows querying the features provided by the pad device.
Tablet pads may contain one or more groups, each containing a subset
of the buttons/rings/strips available. [method@Gdk.DevicePad.get_n_groups]
can be used to obtain the number of groups, [method@Gdk.DevicePad.get_n_features]
and [method@Gdk.DevicePad.get_feature_group] can be combined to find out
the number of buttons/rings/strips the device has, and how are they grouped.
Each of those groups have different modes, which may be used to map each
individual pad feature to multiple actions. Only one mode is effective
(current) for each given group, different groups may have different
current modes. The number of available modes in a group can be found
out through [method@Gdk.DevicePad.get_group_n_modes], and the current mode
for a given group will be notified through events of type `GDK_PAD_GROUP_MODE`.
Returns the group the given @feature and @idx belong to.
f the feature or index do not exist in @pad, -1 is returned.
The group number of the queried pad feature.
a `GdkDevicePad`
the feature type to get the group from
the index of the feature to get the group from
Returns the number of modes that @group may have.
The number of modes available in @group.
a `GdkDevicePad`
group to get the number of available modes from
Returns the number of features a tablet pad has.
The amount of elements of type @feature that this pad has.
a `GdkDevicePad`
a pad feature
Returns the number of groups this pad device has.
Pads have at least one group. A pad group is a subcollection of
buttons/strip/rings that is affected collectively by a same
current mode.
The number of button/ring/strip groups in the pad.
a `GdkDevicePad`
A pad feature.
a button
a ring-shaped interactive area
a straight interactive area
A physical tool associated to a `GdkDevice`.
Gets the axes of the tool.
the axes of @tool
a `GdkDeviceTool`
Gets the hardware ID of this tool, or 0 if it's not known.
When non-zero, the identifier is unique for the given tool model,
meaning that two identical tools will share the same @hardware_id,
but will have different serial numbers (see
[method@Gdk.DeviceTool.get_serial]).
This is a more concrete (and device specific) method to identify
a `GdkDeviceTool` than [method@Gdk.DeviceTool.get_tool_type],
as a tablet may support multiple devices with the same
`GdkDeviceToolType`, but different hardware identifiers.
The hardware identifier of this tool.
a `GdkDeviceTool`
Gets the serial number of this tool.
This value can be used to identify a physical tool
(eg. a tablet pen) across program executions.
The serial ID for this tool
a `GdkDeviceTool`
Gets the `GdkDeviceToolType` of the tool.
The physical type for this tool. This can be used to
figure out what sort of pen is being used, such as an airbrush
or a pencil.
a `GdkDeviceTool`
The axes of the tool.
The hardware ID of the tool.
The serial number of the tool.
The type of the tool.
Indicates the specific type of tool being used being a tablet. Such as an
airbrush, pencil, etc.
Tool is of an unknown type.
Tool is a standard tablet stylus.
Tool is standard tablet eraser.
Tool is a brush stylus.
Tool is a pencil stylus.
Tool is an airbrush stylus.
Tool is a mouse.
Tool is a lens cursor.
`GdkDisplay` objects are the GDK representation of a workstation.
Their purpose are two-fold:
- To manage and provide information about input devices (pointers, keyboards, etc)
- To manage and provide information about output devices (monitors, projectors, etc)
Most of the input device handling has been factored out into separate
[class@Gdk.Seat] objects. Every display has a one or more seats, which
can be accessed with [method@Gdk.Display.get_default_seat] and
[method@Gdk.Display.list_seats].
Output devices are represented by [class@Gdk.Monitor] objects, which can
be accessed with [method@Gdk.Display.get_monitor_at_surface] and similar APIs.
Gets the default `GdkDisplay`.
This is a convenience function for:
gdk_display_manager_get_default_display (gdk_display_manager_get ())
a `GdkDisplay`, or %NULL if
there is no default display
Opens a display.
If opening the display fails, `NULL` is returned.
a `GdkDisplay`
the name of the display to open
Emits a short beep on @display
a `GdkDisplay`
Closes the connection to the windowing system for the given display.
This cleans up associated resources.
a `GdkDisplay`
Creates a new `GdkGLContext` for the `GdkDisplay`.
The context is disconnected from any particular surface or surface
and cannot be used to draw to any surface. It can only be used to
draw to non-surface framebuffers like textures.
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].
the newly created `GdkGLContext`
a `GdkDisplay`
Returns %TRUE if there is an ongoing grab on @device for @display.
%TRUE if there is a grab in effect for @device.
a `GdkDisplay`
a `GdkDevice`
Flushes any requests queued for the windowing system.
This happens automatically when the main loop blocks waiting for new events,
but if your application is drawing without returning control to the main loop,
you may need to call this function explicitly. A common case where this function
needs to be called is when an application is executing drawing commands
from a thread other than the thread where the main loop is running.
This is most useful for X11. On windowing systems where requests are
handled synchronously, this function will do nothing.
a `GdkDisplay`
Returns a `GdkAppLaunchContext` suitable for launching
applications on the given display.
a new `GdkAppLaunchContext` for @display
a `GdkDisplay`
Gets the clipboard used for copy/paste operations.
the display's clipboard
a `GdkDisplay`
Returns the default `GdkSeat` for this display.
Note that a display may not have a seat. In this case,
this function will return %NULL.
the default seat.
a `GdkDisplay`
Returns the dma-buf formats that are supported on this display.
GTK may use OpenGL or Vulkan to support some formats.
Calling this function will then initialize them if they aren't yet.
The formats returned by this function can be used for negotiating
buffer formats with producers such as v4l, pipewire or GStreamer.
To learn more about dma-bufs, see [class@Gdk.DmabufTextureBuilder].
a `GdkDmabufFormats` object
a `GdkDisplay`
Gets the monitor in which the largest area of @surface
resides.
the monitor with the largest
overlap with @surface
a `GdkDisplay`
a `GdkSurface`
Gets the list of monitors associated with this display.
Subsequent calls to this function will always return the
same list for the same display.
You can listen to the GListModel::items-changed signal on
this list to monitor changes to the monitor of this display.
a `GListModel` of `GdkMonitor`
a `GdkDisplay`
Gets the name of the display.
a string representing the display name. This string is owned
by GDK and should not be modified or freed.
a `GdkDisplay`
Gets the clipboard used for the primary selection.
On backends where the primary clipboard is not supported natively,
GDK emulates this clipboard locally.
the primary clipboard
a `GdkDisplay`
Retrieves a desktop-wide setting such as double-click time
for the @display.
%TRUE if the setting existed and a value was stored
in @value, %FALSE otherwise
a `GdkDisplay`
the name of the setting
location to store the value of the setting
Gets the startup notification ID for a Wayland display, or %NULL
if no ID has been defined.
the startup notification ID for @display
a `GdkDisplay`
Finds out if the display has been closed.
%TRUE if the display is closed.
a `GdkDisplay`
Returns whether surfaces can reasonably be expected to have
their alpha channel drawn correctly on the screen.
Check [method@Gdk.Display.is_rgba] for whether the display
supports an alpha channel.
On X11 this function returns whether a compositing manager is
compositing on @display.
On modern displays, this value is always %TRUE.
Whether surfaces with RGBA visuals can reasonably
be expected to have their alpha channels drawn correctly
on the screen.
a `GdkDisplay`
Returns whether surfaces on this @display are created with an
alpha channel.
Even if a %TRUE is returned, it is possible that the
surface’s alpha channel won’t be honored when displaying the
surface on the screen: in particular, for X an appropriate
windowing manager and compositing manager must be running to
provide appropriate display. Use [method@Gdk.Display.is_composited]
to check if that is the case.
On modern displays, this value is always %TRUE.
%TRUE if surfaces are created with an alpha channel or
%FALSE if the display does not support this functionality.
a `GdkDisplay`
Returns the list of seats known to @display.
the
list of seats known to the `GdkDisplay`
a `GdkDisplay`
Returns the keyvals bound to @keycode.
The Nth `GdkKeymapKey` in @keys is bound to the Nth keyval in @keyvals.
When a keycode is pressed by the user, the keyval from
this list of entries is selected by considering the effective
keyboard group and level.
Free the returned arrays with g_free().
%TRUE if there were any entries
a `GdkDisplay`
a keycode
return
location for array of `GdkKeymapKey`
return
location for array of keyvals
length of @keys and @keyvals
Obtains a list of keycode/group/level combinations that will
generate @keyval.
Groups and levels are two kinds of keyboard mode; in general, the level
determines whether the top or bottom symbol on a key is used, and the
group determines whether the left or right symbol is used.
On US keyboards, the shift key changes the keyboard level, and there
are no groups. A group switch key might convert a keyboard between
Hebrew to English modes, for example.
`GdkEventKey` contains a %group field that indicates the active
keyboard group. The level is computed from the modifier mask.
The returned array should be freed with g_free().
%TRUE if keys were found and returned
a `GdkDisplay`
a keyval, such as %GDK_KEY_a, %GDK_KEY_Up, %GDK_KEY_Return, etc.
return location
for an array of `GdkKeymapKey`
return location for number of elements in returned array
Indicates to the GUI environment that the application has
finished loading, using a given identifier.
GTK will call this function automatically for [GtkWindow](../gtk4/class.Window.html)
with custom startup-notification identifier unless
[gtk_window_set_auto_startup_notification()](../gtk4/method.Window.set_auto_startup_notification.html)
is called to disable that feature.
Using [method@Gdk.Toplevel.set_startup_id] is sufficient
a `GdkDisplay`
a startup-notification identifier, for which
notification process should be completed
Checks that OpenGL is available for @self and ensures that it is
properly initialized.
When this fails, an @error will be set describing the error and this
function returns %FALSE.
Note that even if this function succeeds, creating a `GdkGLContext`
may still fail.
This function is idempotent. Calling it multiple times will just
return the same value or error.
You never need to call this function, GDK will call it automatically
as needed. But you can use it as a check when setting up code that
might make use of OpenGL.
%TRUE if the display supports OpenGL
a `GdkDisplay`
Adds the given event to the event queue for @display.
This function is only useful in very
special situations and should not be used by applications.
a `GdkDisplay`
a `GdkEvent`
Returns %TRUE if the display supports input shapes.
This means that [method@Gdk.Surface.set_input_region] can
be used to modify the input shape of surfaces on @display.
On modern displays, this value is always %TRUE.
%TRUE if surfaces with modified input shape are supported
a `GdkDisplay`
Returns whether it's possible for a surface to draw outside of the window area.
If %TRUE is returned the application decides if it wants to draw shadows.
If %FALSE is returned, the compositor decides if it wants to draw shadows.
%TRUE if surfaces can draw shadows or
%FALSE if the display does not support this functionality.
a `GdkDisplay`
Flushes any requests queued for the windowing system and waits until all
requests have been handled.
This is often used for making sure that the display is synchronized
with the current state of the program. Calling [method@Gdk.Display.sync]
before [method@GdkX11.Display.error_trap_pop] makes sure that any errors
generated from earlier requests are handled before the error trap is removed.
This is most useful for X11. On windowing systems where requests are
handled synchronously, this function will do nothing.
a `GdkDisplay`
Translates the contents of a `GdkEventKey` into a keyval, effective group,
and level.
Modifiers that affected the translation and are thus unavailable for
application use are returned in @consumed_modifiers.
The @effective_group is the group that was actually used for the
translation; some keys such as Enter are not affected by the active
keyboard group. The @level is derived from @state.
@consumed_modifiers gives modifiers that should be masked out
from @state when comparing this key press to a keyboard shortcut.
For instance, on a US keyboard, the `plus` symbol is shifted, so
when comparing a key press to a `<Control>plus` accelerator `<Shift>`
should be masked out.
This function should rarely be needed, since `GdkEventKey` already
contains the translated keyval. It is exported for the benefit of
virtualized test environments.
%TRUE if there was a keyval bound to keycode/state/group.
a `GdkDisplay`
a keycode
a modifier state
active keyboard group
return location for keyval
return location for effective group
return location for level
return location for modifiers that were used
to determine the group or level
%TRUE if the display properly composites the alpha channel.
The dma-buf formats that are supported on this display
%TRUE if the display supports input shapes.
%TRUE if the display supports an alpha channel.
%TRUE if the display supports extensible frames.
Emitted when the connection to the windowing system for @display is closed.
%TRUE if the display was closed due to an error
Emitted when the connection to the windowing system for @display is opened.
Emitted whenever a new seat is made known to the windowing system.
the seat that was just added
Emitted whenever a seat is removed by the windowing system.
the seat that was just removed
Emitted whenever a setting changes its value.
the name of the setting that changed
A singleton object that offers notification when displays appear or
disappear.
You can use [func@Gdk.DisplayManager.get] to obtain the `GdkDisplayManager`
singleton, but that should be rarely necessary. Typically, initializing
GTK opens a display that you can work with without ever accessing the
`GdkDisplayManager`.
The GDK library can be built with support for multiple backends.
The `GdkDisplayManager` object determines which backend is used
at runtime.
In the rare case that you need to influence which of the backends
is being used, you can use [func@Gdk.set_allowed_backends]. Note
that you need to call this function before initializing GTK.
## Backend-specific code
When writing backend-specific code that is supposed to work with
multiple GDK backends, you have to consider both compile time and
runtime. At compile time, use the `GDK_WINDOWING_X11`, `GDK_WINDOWING_WIN32`
macros, etc. to find out which backends are present in the GDK library
you are building your application against. At runtime, use type-check
macros like GDK_IS_X11_DISPLAY() to find out which backend is in use:
```c
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (display))
{
// make X11-specific calls here
}
else
#endif
#ifdef GDK_WINDOWING_MACOS
if (GDK_IS_MACOS_DISPLAY (display))
{
// make Quartz-specific calls here
}
else
#endif
g_error ("Unsupported GDK backend");
```
Gets the singleton `GdkDisplayManager` object.
When called for the first time, this function consults the
`GDK_BACKEND` environment variable to find out which of the
supported GDK backends to use (in case GDK has been compiled
with multiple backends).
Applications can use [func@set_allowed_backends] to limit what
backends will be used.
The global `GdkDisplayManager` singleton
Gets the default `GdkDisplay`.
a `GdkDisplay`
a `GdkDisplayManager`
List all currently open displays.
a newly
allocated `GSList` of `GdkDisplay` objects
a `GdkDisplayManager`
Opens a display.
a `GdkDisplay`, or %NULL
if the display could not be opened
a `GdkDisplayManager`
the name of the display to open
Sets @display as the default display.
a `GdkDisplayManager`
a `GdkDisplay`
The default display.
Emitted when a display is opened.
the opened display
Error enumeration for `GdkDmabufTexture`.
Dmabuf support is not available, because the OS
is not Linux, or it was explicitly disabled at compile- or runtime
The requested format is not supported
GTK failed to create the resource for other
reasons
Registers an error quark for [class@Gdk.DmabufTexture] errors.
the error quark
The `GdkDmabufFormats` struct provides information about
supported DMA buffer formats.
You can query whether a given format is supported with
[method@Gdk.DmabufFormats.contains] and you can iterate
over the list of all supported formats with
[method@Gdk.DmabufFormats.get_n_formats] and
[method@Gdk.DmabufFormats.get_format].
The list of supported formats is sorted by preference,
with the best formats coming first.
The list may contains (format, modifier) pairs where the modifier
is `DMA_FORMAT_MOD_INVALID`, indicating that **_implicit modifiers_**
may be used with this format.
See [class@Gdk.DmabufTextureBuilder] for more information
about DMA buffers.
Note that DMA buffers only exist on Linux.
Returns whether a given format is contained in @formats.
`TRUE` if the format specified by the arguments
is part of @formats
a `GdkDmabufFormats`
a format code
a format modifier
Returns whether @formats1 and @formats2 contain the
same dmabuf formats, in the same order.
`TRUE` if @formats1 and @formats2 are equal
a `GdkDmabufFormats`
another `GdkDmabufFormats`
Gets the fourcc code and modifier for a format
that is contained in @formats.
a `GdkDmabufFormats`
the index of the format to return
return location for the format code
return location for the format modifier
Returns the number of formats that the @formats object
contains.
Note that DMA buffers are a Linux concept, so on other
platforms, [method@Gdk.DmabufFormats.get_n_formats] will
always return zero.
the number of formats
a `GdkDmabufFormats`
Increases the reference count of @formats.
the passed-in object
a `GdkDmabufFormats`
Decreases the reference count of @formats.
When the reference count reaches zero,
the object is freed.
a `GdkDmabufFormats`
A `GdkTexture` representing a DMA buffer.
To create a `GdkDmabufTexture`, use the auxiliary
[class@Gdk.DmabufTextureBuilder] object.
Dma-buf textures can only be created on Linux.
`GdkDmabufTextureBuilder` is a builder used to construct [class@Gdk.Texture]
objects from DMA buffers.
DMA buffers are commonly called **_dma-bufs_**.
DMA buffers are a feature of the Linux kernel to enable efficient buffer and
memory sharing between hardware such as codecs, GPUs, displays, cameras and the
kernel drivers controlling them. For example, a decoder may want its output to
be directly shared with the display server for rendering without a copy.
Any device driver which participates in DMA buffer sharing, can do so as either
the exporter or importer of buffers (or both).
The memory that is shared via DMA buffers is usually stored in non-system memory
(maybe in device's local memory or something else not directly accessible by the
CPU), and accessing this memory from the CPU may have higher-than-usual overhead.
In particular for graphics data, it is not uncommon that data consists of multiple
separate blocks of memory, for example one block for each of the red, green and
blue channels. These blocks are called **_planes_**. DMA buffers can have up to
four planes. Even if the memory is a single block, the data can be organized in
multiple planes, by specifying offsets from the beginning of the data.
DMA buffers are exposed to user-space as file descriptors allowing to pass them
between processes. If a DMA buffer has multiple planes, there is one file
descriptor per plane.
The format of the data (for graphics data, essentially its colorspace) is described
by a 32-bit integer. These format identifiers are defined in the header file `drm_fourcc.h`
and commonly referred to as **_fourcc_** values, since they are identified by 4 ASCII
characters. Additionally, each DMA buffer has a **_modifier_**, which is a 64-bit integer
that describes driver-specific details of the memory layout, such as tiling or compression.
For historical reasons, some producers of dma-bufs don't provide an explicit modifier, but
instead return `DMA_FORMAT_MOD_INVALID` to indicate that their modifier is **_implicit_**.
GTK tries to accommodate this situation by accepting `DMA_FORMAT_MOD_INVALID` as modifier.
The operation of `GdkDmabufTextureBuilder` is quite simple: Create a texture builder,
set all the necessary properties, and then call [method@Gdk.DmabufTextureBuilder.build]
to create the new texture.
The required properties for a dma-buf texture are
* The width and height in pixels
* The `fourcc` code and `modifier` which identify the format and memory layout of the dma-buf
* The file descriptor, offset and stride for each of the planes
`GdkDmabufTextureBuilder` can be used for quick one-shot construction of
textures as well as kept around and reused to construct multiple textures.
For further information, see
* The Linux kernel [documentation](https://docs.kernel.org/driver-api/dma-buf.html)
* The header file [drm_fourcc.h](https://gitlab.freedesktop.org/mesa/drm/-/blob/main/include/drm/drm_fourcc.h)
Creates a new texture builder.
the new `GdkTextureBuilder`
Builds a new `GdkTexture` with the values set up in the builder.
It is a programming error to call this function if any mandatory property has not been set.
Not all formats defined in the `drm_fourcc.h` header are supported. You can use
[method@Gdk.Display.get_dmabuf_formats] to get a list of supported formats. If the
format is not supported by GTK, %NULL will be returned and @error will be set.
The `destroy` function gets called when the returned texture gets released.
It is the responsibility of the caller to keep the file descriptors for the planes
open until the created texture is no longer used, and close them afterwards (possibly
using the @destroy notify).
It is possible to call this function multiple times to create multiple textures,
possibly with changing properties in between.
a newly built `GdkTexture` or `NULL`
if the format is not supported
a `GdkDmabufTextureBuilder`
destroy function to be called when the texture is
released
user data to pass to the destroy function
Returns the display that this texture builder is
associated with.
the display
a `GdkDmabufTextureBuilder
Gets the file descriptor for a plane.
the file descriptor
a `GdkDmabufTextureBuilder`
the plane to get the fd for
Gets the format previously set via gdk_dmabuf_texture_builder_set_fourcc()
or 0 if the format wasn't set.
The format is specified as a fourcc code.
The format
a `GdkDmabufTextureBuilder`
Gets the height previously set via gdk_dmabuf_texture_builder_set_height() or
0 if the height wasn't set.
The height
a `GdkDmabufTextureBuilder`
Gets the modifier value.
the modifier
a `GdkDmabufTextureBuilder`
Gets the number of planes.
The number of planes
a `GdkDmabufTextureBuilder`
Gets the offset value for a plane.
the offset
a `GdkDmabufTextureBuilder`
the plane to get the offset for
Whether the data is premultiplied.
whether the data is premultiplied
a `GdkDmabufTextureBuilder`
Gets the stride value for a plane.
the stride
a `GdkDmabufTextureBuilder`
the plane to get the stride for
Gets the region previously set via gdk_dmabuf_texture_builder_set_update_region() or
%NULL if none was set.
The region
a `GdkDmabufTextureBuilder`
Gets the texture previously set via gdk_dmabuf_texture_builder_set_update_texture() or
%NULL if none was set.
The texture
a `GdkDmabufTextureBuilder`
Gets the width previously set via gdk_dmabuf_texture_builder_set_width() or
0 if the width wasn't set.
The width
a `GdkDmabufTextureBuilder`
Sets the display that this texture builder is
associated with.
The display is used to determine the supported
dma-buf formats.
a `GdkDmabufTextureBuilder
the display
Sets the file descriptor for a plane.
a `GdkDmabufTextureBuilder`
the plane to set the fd for
the file descriptor
Sets the format of the texture.
The format is specified as a fourcc code.
The format must be set before calling [method@Gdk.GLTextureBuilder.build].
a `GdkDmabufTextureBuilder`
the texture's format or 0 to unset
Sets the height of the texture.
The height must be set before calling [method@Gdk.GLTextureBuilder.build].
a `GdkDmabufTextureBuilder`
the texture's height or 0 to unset
Sets the modifier.
a `GdkDmabufTextureBuilder`
the modifier value
Sets the number of planes of the texture.
a `GdkDmabufTextureBuilder`
the number of planes
Sets the offset for a plane.
a `GdkDmabufTextureBuilder`
the plane to set the offset for
the offset value
Sets whether the data is premultiplied.
Unless otherwise specified, all formats including alpha channels are assumed
to be premultiplied.
a `GdkDmabufTextureBuilder`
whether the data is premultiplied
Sets the stride for a plane.
The stride must be set for all planes before calling [method@Gdk.GLTextureBuilder.build].
a `GdkDmabufTextureBuilder`
the plane to set the stride for
the stride value
Sets the region to be updated by this texture. Together with
[property@Gdk.DmabufTextureBuilder:update-texture] this describes an
update of a previous texture.
When rendering animations of large textures, it is possible that
consecutive textures are only updating contents in parts of the texture.
It is then possible to describe this update via these two properties,
so that GTK can avoid rerendering parts that did not change.
An example would be a screen recording where only the mouse pointer moves.
a `GdkDmabufTextureBuilder`
the region to update
Sets the texture to be updated by this texture. See
[method@Gdk.DmabufTextureBuilder.set_update_region] for an explanation.
a `GdkDmabufTextureBuilder`
the texture to update
Sets the width of the texture.
The width must be set before calling [method@Gdk.GLTextureBuilder.build].
a `GdkDmabufTextureBuilder`
The texture's width or 0 to unset
The display that this texture will be used on.
The format of the texture, as a fourcc value.
The height of the texture.
The modifier.
The number of planes of the texture.
Note that you can set properties for other planes,
but they will be ignored when constructing the texture.
Whether the alpha channel is premultiplied into the others.
Only relevant if the format has alpha.
The update region for [property@Gdk.GLTextureBuilder:update-texture].
The texture [property@Gdk.DmabufTextureBuilder:update-region] is an update for.
The width of the texture.
The `GdkDrag` object represents the source of an ongoing DND operation.
A `GdkDrag` is created when a drag is started, and stays alive for duration of
the DND operation. After a drag has been started with [func@Gdk.Drag.begin],
the caller gets informed about the status of the ongoing drag operation
with signals on the `GdkDrag` object.
GTK provides a higher level abstraction based on top of these functions,
and so they are not normally needed in GTK applications. See the
"Drag and Drop" section of the GTK documentation for more information.
Starts a drag and creates a new drag context for it.
This function is called by the drag source. After this call, you
probably want to set up the drag icon using the surface returned
by [method@Gdk.Drag.get_drag_surface].
This function returns a reference to the [class@Gdk.Drag] object,
but GTK keeps its own reference as well, as long as the DND operation
is going on.
Note: if @actions include %GDK_ACTION_MOVE, you need to listen for
the [signal@Gdk.Drag::dnd-finished] signal and delete the data at
the source if [method@Gdk.Drag.get_selected_action] returns
%GDK_ACTION_MOVE.
a newly created `GdkDrag`
the source surface for this drag
the device that controls this drag
the offered content
the actions supported by this drag
the x offset to @device's position where the drag nominally started
the y offset to @device's position where the drag nominally started
Informs GDK that the drop ended.
Passing %FALSE for @success may trigger a drag cancellation
animation.
This function is called by the drag source, and should be the
last call before dropping the reference to the @drag.
The `GdkDrag` will only take the first [method@Gdk.Drag.drop_done]
call as effective, if this function is called multiple times,
all subsequent calls will be ignored.
a `GdkDrag`
whether the drag was ultimatively successful
Determines the bitmask of possible actions proposed by the source.
the `GdkDragAction` flags
a `GdkDrag`
Returns the `GdkContentProvider` associated to the `GdkDrag` object.
The `GdkContentProvider` associated to @drag.
a `GdkDrag`
Returns the `GdkDevice` associated to the `GdkDrag` object.
The `GdkDevice` associated to @drag.
a `GdkDrag`
Gets the `GdkDisplay` that the drag object was created for.
a `GdkDisplay`
a `GdkDrag`
Returns the surface on which the drag icon should be rendered
during the drag operation.
Note that the surface may not be available until the drag operation
has begun. GDK will move the surface in accordance with the ongoing
drag operation. The surface is owned by @drag and will be destroyed
when the drag operation is over.
the drag surface
a `GdkDrag`
Retrieves the formats supported by this `GdkDrag` object.
a `GdkContentFormats`
a `GdkDrag`
Determines the action chosen by the drag destination.
a `GdkDragAction` value
a `GdkDrag`
Returns the `GdkSurface` where the drag originates.
The `GdkSurface` where the drag originates
a `GdkDrag`
Sets the position of the drag surface that will be kept
under the cursor hotspot.
Initially, the hotspot is at the top left corner of the drag surface.
a `GdkDrag`
x coordinate of the drag surface hotspot
y coordinate of the drag surface hotspot
The possible actions of this drag.
The `GdkContentProvider`.
The `GdkDevice` that is performing the drag.
The `GdkDisplay` that the drag belongs to.
The possible formats that the drag can provide its data in.
The currently selected action of the drag.
The surface where the drag originates.
Emitted when the drag operation is cancelled.
The reason the drag was cancelled
Emitted when the destination side has finished reading all data.
The drag object can now free all miscellaneous data.
Emitted when the drop operation is performed on an accepting client.
Used in `GdkDrop` and `GdkDrag` to indicate the actions that the
destination can and should do with the dropped data.
Copy the data.
Move the data, i.e. first copy it, then delete
it from the source using the DELETE target of the X selection protocol.
Add a link to the data. Note that this is only
useful if source and destination agree on what it means, and is not
supported on all platforms.
Ask the user what to do with the data.
Checks if @action represents a single action or includes
multiple actions.
When @action is 0 - ie no action was given, %TRUE
is returned.
%TRUE if exactly one action was given
a `GdkDragAction`
Used in `GdkDrag` to the reason of a cancelled DND operation.
There is no suitable drop target.
Drag cancelled by the user
Unspecified error.
A `GdkDragSurface` is an interface for surfaces used during DND.
Present @drag_surface.
%FALSE if it failed to be presented, otherwise %TRUE.
the `GdkDragSurface` to show
the unconstrained drag_surface width to layout
the unconstrained drag_surface height to layout
Emitted when the size for the surface needs to be computed, when it is
present.
This signal will normally be emitted during the native surface layout
cycle when the surface size needs to be recomputed.
It is the responsibility of the drag surface user to handle this signal
and compute the desired size of the surface, storing the computed size
in the [struct@Gdk.DragSurfaceSize] object that is passed to the signal
handler, using [method@Gdk.DragSurfaceSize.set_size].
Failing to set a size so will result in an arbitrary size being used as
a result.
the size of the drag surface
The `GdkDragSurfaceInterface` implementation is private to GDK.
The `GdkDragSurfaceSize` struct contains information that is useful
to compute the size of a drag surface.
Sets the size the drag surface prefers to be resized to.
a `GdkDragSurfaceSize`
the width
the height
Base class for objects implementing different rendering methods.
`GdkDrawContext` is the base object used by contexts implementing different
rendering methods, such as [class@Gdk.CairoContext] or [class@Gdk.GLContext].
It provides shared functionality between those contexts.
You will always interact with one of those subclasses.
A `GdkDrawContext` is always associated with a single toplevel surface.
Indicates that you are beginning the process of redrawing @region
on the @context's surface.
Calling this function begins a drawing operation using @context on the
surface that @context was created from. The actual requirements and
guarantees for the drawing operation vary for different implementations
of drawing, so a [class@Gdk.CairoContext] and a [class@Gdk.GLContext]
need to be treated differently.
A call to this function is a requirement for drawing and must be
followed by a call to [method@Gdk.DrawContext.end_frame], which will
complete the drawing operation and ensure the contents become visible
on screen.
Note that the @region passed to this function is the minimum region that
needs to be drawn and depending on implementation, windowing system and
hardware in use, it might be necessary to draw a larger region. Drawing
implementation must use [method@Gdk.DrawContext.get_frame_region] to
query the region that must be drawn.
When using GTK, the widget system automatically places calls to
gdk_draw_context_begin_frame() and gdk_draw_context_end_frame() via the
use of [GskRenderer](../gsk4/class.Renderer.html)s, so application code
does not need to call these functions explicitly.
the `GdkDrawContext` used to draw the frame. The context must
have a surface.
minimum region that should be drawn
Ends a drawing operation started with gdk_draw_context_begin_frame().
This makes the drawing available on screen.
See [method@Gdk.DrawContext.begin_frame] for more details about drawing.
When using a [class@Gdk.GLContext], this function may call `glFlush()`
implicitly before returning; it is not recommended to call `glFlush()`
explicitly before calling this function.
a `GdkDrawContext`
Retrieves the `GdkDisplay` the @context is created for
the `GdkDisplay`
a `GdkDrawContext`
Retrieves the region that is currently being repainted.
After a call to [method@Gdk.DrawContext.begin_frame] this function will
return a union of the region passed to that function and the area of the
surface that the @context determined needs to be repainted.
If @context is not in between calls to [method@Gdk.DrawContext.begin_frame]
and [method@Gdk.DrawContext.end_frame], %NULL will be returned.
a Cairo region
a `GdkDrawContext`
Retrieves the surface that @context is bound to.
a `GdkSurface`
a `GdkDrawContext`
Returns %TRUE if @context is in the process of drawing to its surface.
This is the case between calls to [method@Gdk.DrawContext.begin_frame]
and [method@Gdk.DrawContext.end_frame]. In this situation, drawing commands
may be effecting the contents of the @context's surface.
%TRUE if the context is between [method@Gdk.DrawContext.begin_frame]
and [method@Gdk.DrawContext.end_frame] calls.
a `GdkDrawContext`
The `GdkDisplay` used to create the `GdkDrawContext`.
The `GdkSurface` the context is bound to.
The `GdkDrop` object represents the target of an ongoing DND operation.
Possible drop sites get informed about the status of the ongoing drag
operation with events of type %GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
%GDK_DRAG_MOTION and %GDK_DROP_START. The `GdkDrop` object can be obtained
from these [class@Gdk.Event] types using [method@Gdk.DNDEvent.get_drop].
The actual data transfer is initiated from the target side via an async
read, using one of the `GdkDrop` methods for this purpose:
[method@Gdk.Drop.read_async] or [method@Gdk.Drop.read_value_async].
GTK provides a higher level abstraction based on top of these functions,
and so they are not normally needed in GTK applications. See the
"Drag and Drop" section of the GTK documentation for more information.
Ends the drag operation after a drop.
The @action must be a single action selected from the actions
available via [method@Gdk.Drop.get_actions].
a `GdkDrop`
the action performed by the destination or 0 if the drop failed
Returns the possible actions for this `GdkDrop`.
If this value contains multiple actions - i.e.
[func@Gdk.DragAction.is_unique] returns %FALSE for the result -
[method@Gdk.Drop.finish] must choose the action to use when
accepting the drop. This will only happen if you passed
%GDK_ACTION_ASK as one of the possible actions in
[method@Gdk.Drop.status]. %GDK_ACTION_ASK itself will not
be included in the actions returned by this function.
This value may change over the lifetime of the [class@Gdk.Drop]
both as a response to source side actions as well as to calls to
[method@Gdk.Drop.status] or [method@Gdk.Drop.finish]. The source
side will not change this value anymore once a drop has started.
The possible `GdkDragActions`
a `GdkDrop`
Returns the `GdkDevice` performing the drop.
The `GdkDevice` performing the drop.
a `GdkDrop`
Gets the `GdkDisplay` that @self was created for.
a `GdkDisplay`
a `GdkDrop`
If this is an in-app drag-and-drop operation, returns the `GdkDrag`
that corresponds to this drop.
If it is not, %NULL is returned.
the corresponding `GdkDrag`
a `GdkDrop`
Returns the `GdkContentFormats` that the drop offers the data
to be read in.
The possible `GdkContentFormats`
a `GdkDrop`
Returns the `GdkSurface` performing the drop.
The `GdkSurface` performing the drop.
a `GdkDrop`
Asynchronously read the dropped data from a `GdkDrop`
in a format that complies with one of the mime types.
a `GdkDrop`
pointer to an array of mime types
the I/O priority for the read operation
optional `GCancellable` object
a `GAsyncReadyCallback` to call when
the request is satisfied
the data to pass to @callback
Finishes an async drop read operation.
Note that you must not use blocking read calls on the returned stream
in the GTK thread, since some platforms might require communication with
GTK to complete the data transfer. You can use async APIs such as
g_input_stream_read_bytes_async().
See [method@Gdk.Drop.read_async].
the `GInputStream`
a `GdkDrop`
a `GAsyncResult`
return location for the used mime type
Asynchronously request the drag operation's contents converted
to the given @type.
For local drag-and-drop operations that are available in the given
`GType`, the value will be copied directly. Otherwise, GDK will
try to use [func@Gdk.content_deserialize_async] to convert the data.
a `GdkDrop`
a `GType` to read
the I/O priority of the request.
optional `GCancellable` object, %NULL to ignore.
callback to call when the request is satisfied
the data to pass to callback function
Finishes an async drop read.
See [method@Gdk.Drop.read_value_async].
a `GValue` containing the result.
a `GdkDrop`
a `GAsyncResult`
Selects all actions that are potentially supported by the destination.
When calling this function, do not restrict the passed in actions to
the ones provided by [method@Gdk.Drop.get_actions]. Those actions may
change in the future, even depending on the actions you provide here.
The @preferred action is a hint to the drag-and-drop mechanism about which
action to use when multiple actions are possible.
This function should be called by drag destinations in response to
%GDK_DRAG_ENTER or %GDK_DRAG_MOTION events. If the destination does
not yet know the exact actions it supports, it should set any possible
actions first and then later call this function again.
a `GdkDrop`
Supported actions of the destination, or 0 to indicate
that a drop will not be accepted
A unique action that's a member of @actions indicating the
preferred action
The possible actions for this drop
The `GdkDevice` performing the drop
The `GdkDisplay` that the drop belongs to.
The `GdkDrag` that initiated this drop
The possible formats that the drop can provide its data in.
The `GdkSurface` the drop happens on
Use this macro as the return value for continuing the propagation of
an event handler.
Use this macro as the return value for stopping the propagation of
an event handler.
`GdkEvent`s are immutable data structures, created by GDK to
represent windowing system events.
In GTK applications the events are handled automatically by toplevel
widgets and passed on to the event controllers of appropriate widgets,
so using `GdkEvent` and its related API is rarely needed.
Returns the relative angle from @event1 to @event2.
The relative angle is the angle between the X axis and the line
through both events' positions. The rotation direction for positive
angles is from the positive X axis towards the positive Y axis.
This assumes that both events have X/Y information.
If not, this function returns %FALSE.
%TRUE if the angle could be calculated.
first `GdkEvent`
second `GdkEvent`
return location for the relative angle between both events
Returns the point halfway between the events' positions.
This assumes that both events have X/Y information.
If not, this function returns %FALSE.
%TRUE if the center could be calculated.
first `GdkEvent`
second `GdkEvent`
return location for the X coordinate of the center
return location for the Y coordinate of the center
Returns the distance between the event locations.
This assumes that both events have X/Y information.
If not, this function returns %FALSE.
%TRUE if the distance could be calculated.
first `GdkEvent`
second `GdkEvent`
return location for the distance
Extracts all axis values from an event.
To find out which axes are used, use [method@Gdk.DeviceTool.get_axes]
on the device tool returned by [method@Gdk.Event.get_device_tool].
%TRUE on success, otherwise %FALSE
a `GdkEvent`
the array of values for all axes
the length of array
Extract the axis value for a particular axis use from
an event structure.
To find out which axes are used, use [method@Gdk.DeviceTool.get_axes]
on the device tool returned by [method@Gdk.Event.get_device_tool].
%TRUE if the specified axis was found, otherwise %FALSE
a `GdkEvent`
the axis use to look for
location to store the value found
Returns the device of an event.
a `GdkDevice`
a `GdkEvent`.
Returns a `GdkDeviceTool` representing the tool that
caused the event.
If the was not generated by a device that supports
different tools (such as a tablet), this function will
return %NULL.
Note: the `GdkDeviceTool` will be constant during
the application lifetime, if settings must be stored
persistently across runs, see [method@Gdk.DeviceTool.get_serial].
The current device tool
a `GdkEvent`
Retrieves the display associated to the @event.
a `GdkDisplay`
a `GdkEvent`
Returns the event sequence to which the event belongs.
Related touch events are connected in a sequence. Other
events typically don't have event sequence information.
the event sequence that the event belongs to
a `GdkEvent`
Retrieves the type of the event.
a `GdkEvent`Type
a `GdkEvent`
Retrieves the history of the device that @event is for, as a list of
time and coordinates.
The history includes positions that are not delivered as separate events
to the application because they occurred in the same frame as @event.
Note that only motion and scroll events record history, and motion
events do it only if one of the mouse buttons is down, or the device
has a tool.
an
array of time and coordinates
a motion or scroll event
Return location for the length of the returned array
Returns the modifier state field of an event.
the modifier state of @event
a `GdkEvent`
Returns whether this event is an 'emulated' pointer event.
Emulated pointer events typically originate from a touch events.
%TRUE if this event is emulated
a `GdkEvent`
Extract the event surface relative x/y coordinates from an event.
This position is in [surface coordinates](coordinates.html).
whether the positions were set
a `GdkEvent`
location to put event surface x coordinate
location to put event surface y coordinate
Returns the seat that originated the event.
a `GdkSeat`.
a `GdkEvent`
Extracts the surface associated with an event.
The `GdkSurface` associated with the event
a `GdkEvent`
Returns the timestamp of @event.
Not all events have timestamps. In that case, this function
returns %GDK_CURRENT_TIME.
timestamp field from @event
a `GdkEvent`
Increase the ref count of @event.
@event
a `GdkEvent`
Returns whether a `GdkEvent` should trigger a context menu,
according to platform conventions.
The right mouse button typically triggers context menus.
This function should always be used instead of simply checking for
event->button == %GDK_BUTTON_SECONDARY.
%TRUE if the event should trigger a context menu.
a `GdkEvent`, currently only button events are meaningful values
Decrease the ref count of @event.
If the last reference is dropped, the structure is freed.
a `GdkEvent`
`GdkEventSequence` is an opaque type representing a sequence
of related touch events.
Specifies the type of the event.
the window manager has requested that the toplevel surface be
hidden or destroyed, usually when the user clicks on a special icon in the
title bar.
the pointer (usually a mouse) has moved.
a mouse button has been pressed.
a mouse button has been released.
a key has been pressed.
a key has been released.
the pointer has entered the surface.
the pointer has left the surface.
the keyboard focus has entered or left the surface.
an input device has moved into contact with a sensing
surface (e.g. a touchscreen or graphics tablet).
an input device has moved out of contact with a sensing
surface.
the mouse has entered the surface while a drag is in progress.
the mouse has left the surface while a drag is in progress.
the mouse has moved in the surface while a drag is in
progress.
a drop operation onto the surface has started.
the scroll wheel was turned
a pointer or keyboard grab was broken.
A new touch event sequence has just started.
A touch event sequence has been updated.
A touch event sequence has finished.
A touch event sequence has been canceled.
A touchpad swipe gesture event, the current state
is determined by its phase field.
A touchpad pinch gesture event, the current state
is determined by its phase field.
A tablet pad button press event.
A tablet pad button release event.
A tablet pad axis event from a "ring".
A tablet pad axis event from a "strip".
A tablet pad group mode change.
A touchpad hold gesture event, the current state is determined by its phase
field.
marks the end of the GdkEventType enumeration.
An opaque type representing a list of files.
Creates a new `GdkFileList` for the given array of files.
This function is meant to be used by language bindings.
the newly create files list
the files to add to the list
the number of files in the array
Creates a new files list container from a singly linked list of
`GFile` instances.
This function is meant to be used by language bindings
the newly created files list
a list of files
Retrieves the list of files inside a `GdkFileList`.
This function is meant for language bindings.
the files inside the list
the file list
An event related to a keyboard focus change.
Extracts whether this event is about focus entering or
leaving the surface.
%TRUE of the focus is entering
a focus change event
A `GdkFrameClock` tells the application when to update and repaint
a surface.
This may be synced to the vertical refresh rate of the monitor, for example.
Even when the frame clock uses a simple timer rather than a hardware-based
vertical sync, the frame clock helps because it ensures everything paints at
the same time (reducing the total number of frames).
The frame clock can also automatically stop painting when it knows the frames
will not be visible, or scale back animation framerates.
`GdkFrameClock` is designed to be compatible with an OpenGL-based implementation
or with mozRequestAnimationFrame in Firefox, for example.
A frame clock is idle until someone requests a frame with
[method@Gdk.FrameClock.request_phase]. At some later point that makes sense
for the synchronization being implemented, the clock will process a frame and
emit signals for each phase that has been requested. (See the signals of the
`GdkFrameClock` class for documentation of the phases.
%GDK_FRAME_CLOCK_PHASE_UPDATE and the [signal@Gdk.FrameClock::update] signal
are most interesting for application writers, and are used to update the
animations, using the frame time given by [method@Gdk.FrameClock.get_frame_time].
The frame time is reported in microseconds and generally in the same
timescale as g_get_monotonic_time(), however, it is not the same
as g_get_monotonic_time(). The frame time does not advance during
the time a frame is being painted, and outside of a frame, an attempt
is made so that all calls to [method@Gdk.FrameClock.get_frame_time] that
are called at a “similar” time get the same value. This means that
if different animations are timed by looking at the difference in
time between an initial value from [method@Gdk.FrameClock.get_frame_time]
and the value inside the [signal@Gdk.FrameClock::update] signal of the clock,
they will stay exactly synchronized.
Starts updates for an animation.
Until a matching call to [method@Gdk.FrameClock.end_updating] is made,
the frame clock will continually request a new frame with the
%GDK_FRAME_CLOCK_PHASE_UPDATE phase. This function may be called multiple
times and frames will be requested until gdk_frame_clock_end_updating()
is called the same number of times.
a `GdkFrameClock`
Stops updates for an animation.
See the documentation for [method@Gdk.FrameClock.begin_updating].
a `GdkFrameClock`
Gets the frame timings for the current frame.
the `GdkFrameTimings` for the
frame currently being processed, or even no frame is being
processed, for the previous frame. Before any frames have been
processed, returns %NULL.
a `GdkFrameClock`
Calculates the current frames-per-second, based on the
frame timings of @frame_clock.
the current fps, as a `double`
a `GdkFrameClock`
`GdkFrameClock` maintains a 64-bit counter that increments for
each frame drawn.
inside frame processing, the value of the frame counter
for the current frame. Outside of frame processing, the frame
counter for the last frame.
a `GdkFrameClock`
Gets the time that should currently be used for animations.
Inside the processing of a frame, it’s the time used to compute the
animation position of everything in a frame. Outside of a frame, it's
the time of the conceptual “previous frame,” which may be either
the actual previous frame time, or if that’s too old, an updated
time.
a timestamp in microseconds, in the timescale of
of g_get_monotonic_time().
a `GdkFrameClock`
Returns the frame counter for the oldest frame available in history.
`GdkFrameClock` internally keeps a history of `GdkFrameTimings`
objects for recent frames that can be retrieved with
[method@Gdk.FrameClock.get_timings]. The set of stored frames
is the set from the counter values given by
[method@Gdk.FrameClock.get_history_start] and
[method@Gdk.FrameClock.get_frame_counter], inclusive.
the frame counter value for the oldest frame
that is available in the internal frame history of the
`GdkFrameClock`
a `GdkFrameClock`
Predicts a presentation time, based on history.
Using the frame history stored in the frame clock, finds the last
known presentation time and refresh interval, and assuming that
presentation times are separated by the refresh interval,
predicts a presentation time that is a multiple of the refresh
interval after the last presentation time, and later than @base_time.
a `GdkFrameClock`
base time for determining a presentaton time
a location to store the
determined refresh interval, or %NULL. A default refresh interval of
1/60th of a second will be stored if no history is present.
a location to store the next
candidate presentation time after the given base time.
0 will be will be stored if no history is present.
Retrieves a `GdkFrameTimings` object holding timing information
for the current frame or a recent frame.
The `GdkFrameTimings` object may not yet be complete: see
[method@Gdk.FrameTimings.get_complete] and
[method@Gdk.FrameClock.get_history_start].
the `GdkFrameTimings` object
for the specified frame, or %NULL if it is not available
a `GdkFrameClock`
the frame counter value identifying the frame to
be received
Asks the frame clock to run a particular phase.
The signal corresponding the requested phase will be emitted the next
time the frame clock processes. Multiple calls to
gdk_frame_clock_request_phase() will be combined together
and only one frame processed. If you are displaying animated
content and want to continually request the
%GDK_FRAME_CLOCK_PHASE_UPDATE phase for a period of time,
you should use [method@Gdk.FrameClock.begin_updating] instead,
since this allows GTK to adjust system parameters to get maximally
smooth animations.
a `GdkFrameClock`
the phase that is requested
This signal ends processing of the frame.
Applications should generally not handle this signal.
Begins processing of the frame.
Applications should generally not handle this signal.
Used to flush pending motion events that are being batched up and
compressed together.
Applications should not handle this signal.
Emitted as the second step of toolkit and application processing
of the frame.
Any work to update sizes and positions of application elements
should be performed. GTK normally handles this internally.
Emitted as the third step of toolkit and application processing
of the frame.
The frame is repainted. GDK normally handles this internally and
emits [signal@Gdk.Surface::render] signals which are turned into
[GtkWidget::snapshot](../gtk4/signal.Widget.snapshot.html) signals
by GTK.
Emitted after processing of the frame is finished.
This signal is handled internally by GTK to resume normal
event processing. Applications should not handle this signal.
Emitted as the first step of toolkit and application processing
of the frame.
Animations should be updated using [method@Gdk.FrameClock.get_frame_time].
Applications can connect directly to this signal, or use
[gtk_widget_add_tick_callback()](../gtk4/method.Widget.add_tick_callback.html)
as a more convenient interface.
Used to represent the different paint clock phases that can be requested.
The elements of the enumeration correspond to the signals of `GdkFrameClock`.
no phase
corresponds to GdkFrameClock::flush-events. Should not be handled by applications.
corresponds to GdkFrameClock::before-paint. Should not be handled by applications.
corresponds to GdkFrameClock::update.
corresponds to GdkFrameClock::layout. Should not be handled by applications.
corresponds to GdkFrameClock::paint.
corresponds to GdkFrameClock::resume-events. Should not be handled by applications.
corresponds to GdkFrameClock::after-paint. Should not be handled by applications.
A `GdkFrameTimings` object holds timing information for a single frame
of the application’s displays.
To retrieve `GdkFrameTimings` objects, use [method@Gdk.FrameClock.get_timings]
or [method@Gdk.FrameClock.get_current_timings]. The information in
`GdkFrameTimings` is useful for precise synchronization of video with
the event or audio streams, and for measuring quality metrics for the
application’s display, such as latency and jitter.
Returns whether @timings are complete.
The timing information in a `GdkFrameTimings` is filled in
incrementally as the frame as drawn and passed off to the
window system for processing and display to the user. The
accessor functions for `GdkFrameTimings` can return 0 to
indicate an unavailable value for two reasons: either because
the information is not yet available, or because it isn't
available at all.
Once this function returns %TRUE for a frame, you can be
certain that no further values will become available and be
stored in the `GdkFrameTimings`.
%TRUE if all information that will be available
for the frame has been filled in.
a `GdkFrameTimings`
Gets the frame counter value of the `GdkFrameClock` when
this frame was drawn.
the frame counter value for this frame
a `GdkFrameTimings`
Returns the frame time for the frame.
This is the time value that is typically used to time
animations for the frame. See [method@Gdk.FrameClock.get_frame_time].
the frame time for the frame, in the timescale
of g_get_monotonic_time()
A `GdkFrameTimings`
Gets the predicted time at which this frame will be displayed.
Although no predicted time may be available, if one is available,
it will be available while the frame is being generated, in contrast
to [method@Gdk.FrameTimings.get_presentation_time], which is only
available after the frame has been presented.
In general, if you are simply animating, you should use
[method@Gdk.FrameClock.get_frame_time] rather than this function,
but this function is useful for applications that want exact control
over latency. For example, a movie player may want this information
for Audio/Video synchronization.
The predicted time at which the frame will be presented,
in the timescale of g_get_monotonic_time(), or 0 if no predicted
presentation time is available.
a `GdkFrameTimings`
Reurns the presentation time.
This is the time at which the frame became visible to the user.
the time the frame was displayed to the user, in the
timescale of g_get_monotonic_time(), or 0 if no presentation
time is available. See [method@Gdk.FrameTimings.get_complete]
a `GdkFrameTimings`
Gets the natural interval between presentation times for
the display that this frame was displayed on.
Frame presentation usually happens during the “vertical
blanking interval”.
the refresh interval of the display, in microseconds,
or 0 if the refresh interval is not available.
See [method@Gdk.FrameTimings.get_complete].
a `GdkFrameTimings`
Increases the reference count of @timings.
@timings
a `GdkFrameTimings`
Decreases the reference count of @timings.
If @timings is no longer referenced, it will be freed.
a `GdkFrameTimings`
Indicates which monitor a surface should span over when in fullscreen mode.
Fullscreen on current monitor only.
Span across all monitors when fullscreen.
The list of the different APIs that GdkGLContext can potentially support.
The OpenGL API
The OpenGL ES API
`GdkGLContext` is an object representing a platform-specific
OpenGL draw context.
`GdkGLContext`s are created for a surface using
[method@Gdk.Surface.create_gl_context], and the context will match
the characteristics of the surface.
A `GdkGLContext` is not tied to any particular normal framebuffer.
For instance, it cannot draw to the surface back buffer. The GDK
repaint system is in full control of the painting to that. Instead,
you can create render buffers or textures and use [func@cairo_draw_from_gl]
in the draw function of your widget to draw them. Then GDK will handle
the integration of your rendering with that of other widgets.
Support for `GdkGLContext` is platform-specific and context creation
can fail, returning %NULL context.
A `GdkGLContext` has to be made "current" in order to start using
it, otherwise any OpenGL call will be ignored.
## Creating a new OpenGL context
In order to create a new `GdkGLContext` instance you need a `GdkSurface`,
which you typically get during the realize call of a widget.
A `GdkGLContext` is not realized until either [method@Gdk.GLContext.make_current]
or [method@Gdk.GLContext.realize] is called. It is possible to specify
details of the GL context like the OpenGL version to be used, or whether
the GL context should have extra state validation enabled after calling
[method@Gdk.Surface.create_gl_context] by calling [method@Gdk.GLContext.realize].
If the realization fails you have the option to change the settings of
the `GdkGLContext` and try again.
## Using a GdkGLContext
You will need to make the `GdkGLContext` the current context before issuing
OpenGL calls; the system sends OpenGL commands to whichever context is current.
It is possible to have multiple contexts, so you always need to ensure that
the one which you want to draw with is the current one before issuing commands:
```c
gdk_gl_context_make_current (context);
```
You can now perform your drawing using OpenGL commands.
You can check which `GdkGLContext` is the current one by using
[func@Gdk.GLContext.get_current]; you can also unset any `GdkGLContext`
that is currently set by calling [func@Gdk.GLContext.clear_current].
Clears the current `GdkGLContext`.
Any OpenGL call after this function returns will be ignored
until [method@Gdk.GLContext.make_current] is called.
Retrieves the current `GdkGLContext`.
the current `GdkGLContext`
Gets the allowed APIs set via gdk_gl_context_set_allowed_apis().
the allowed APIs
a GL context
Gets the API currently in use.
If the renderer has not been realized yet, 0 is returned.
the currently used API
a GL context
Retrieves whether the context is doing extra validations and runtime checking.
See [method@Gdk.GLContext.set_debug_enabled].
%TRUE if debugging is enabled
a `GdkGLContext`
Retrieves the display the @context is created for
a `GdkDisplay`
a `GdkGLContext`
Retrieves whether the context is forward-compatible.
See [method@Gdk.GLContext.set_forward_compatible].
%TRUE if the context should be forward-compatible
a `GdkGLContext`
Retrieves required OpenGL version set as a requirement for the @context
realization. It will not change even if a greater OpenGL version is supported
and used after the @context is realized. See
[method@Gdk.GLContext.get_version] for the real version in use.
See [method@Gdk.GLContext.set_required_version].
a `GdkGLContext`
return location for the major version to request
return location for the minor version to request
Used to retrieves the `GdkGLContext` that this @context share data with.
As many contexts can share data now and no single shared context exists
anymore, this function has been deprecated and now always returns %NULL.
Use [method@Gdk.GLContext.is_shared] to check if contexts
can be shared.
%NULL
a `GdkGLContext`
Retrieves the surface used by the @context.
a `GdkSurface`
a `GdkGLContext`
Checks whether the @context is using an OpenGL or OpenGL ES profile.
%TRUE if the `GdkGLContext` is using an OpenGL ES profile;
%FALSE if other profile is in use of if the @context has not yet
been realized.
a `GdkGLContext`
Retrieves the OpenGL version of the @context.
The @context must be realized prior to calling this function.
a `GdkGLContext`
return location for the major version
return location for the minor version
Whether the `GdkGLContext` is in legacy mode or not.
The `GdkGLContext` must be realized before calling this function.
When realizing a GL context, GDK will try to use the OpenGL 3.2 core
profile; this profile removes all the OpenGL API that was deprecated
prior to the 3.2 version of the specification. If the realization is
successful, this function will return %FALSE.
If the underlying OpenGL implementation does not support core profiles,
GDK will fall back to a pre-3.2 compatibility profile, and this function
will return %TRUE.
You can use the value returned by this function to decide which kind
of OpenGL API to use, or whether to do extension discovery, or what
kind of shader programs to load.
%TRUE if the GL context is in legacy mode
a `GdkGLContext`
Checks if the two GL contexts can share resources.
When they can, the texture IDs from @other can be used in @self. This
is particularly useful when passing `GdkGLTexture` objects between
different contexts.
Contexts created for the same display with the same properties will
always be compatible, even if they are created for different surfaces.
For other contexts it depends on the GL backend.
Both contexts must be realized for this check to succeed. If either one
is not, this function will return %FALSE.
%TRUE if the two GL contexts are compatible.
a `GdkGLContext`
the `GdkGLContext` that should be compatible with @self
Makes the @context the current one.
a `GdkGLContext`
Realizes the given `GdkGLContext`.
It is safe to call this function on a realized `GdkGLContext`.
%TRUE if the context is realized
a `GdkGLContext`
Sets the allowed APIs. When gdk_gl_context_realize() is called, only the
allowed APIs will be tried. If you set this to 0, realizing will always fail.
If you set it on a realized context, the property will not have any effect.
It is only relevant during gdk_gl_context_realize().
By default, all APIs are allowed.
a GL context
the allowed APIs
Sets whether the `GdkGLContext` should perform extra validations and
runtime checking.
This is useful during development, but has additional overhead.
The `GdkGLContext` must not be realized or made current prior to
calling this function.
a `GdkGLContext`
whether to enable debugging in the context
Sets whether the `GdkGLContext` should be forward-compatible.
Forward-compatible contexts must not support OpenGL functionality that
has been marked as deprecated in the requested version; non-forward
compatible contexts, on the other hand, must support both deprecated and
non deprecated functionality.
The `GdkGLContext` must not be realized or made current prior to calling
this function.
a `GdkGLContext`
whether the context should be forward-compatible
Sets the major and minor version of OpenGL to request.
Setting @major and @minor to zero will use the default values.
Setting @major and @minor lower than the minimum versions required
by GTK will result in the context choosing the minimum version.
The @context must not be realized or made current prior to calling
this function.
a `GdkGLContext`
the major version to request
the minor version to request
Requests that GDK create an OpenGL ES context instead of an OpenGL one.
Not all platforms support OpenGL ES.
The @context must not have been realized.
By default, GDK will attempt to automatically detect whether the
underlying GL implementation is OpenGL or OpenGL ES once the @context
is realized.
You should check the return value of [method@Gdk.GLContext.get_use_es]
after calling [method@Gdk.GLContext.realize] to decide whether to use
the OpenGL or OpenGL ES API, extensions, or shaders.
a `GdkGLContext`
whether the context should use OpenGL ES instead of OpenGL,
or -1 to allow auto-detection
The allowed APIs.
The API currently in use.
Always %NULL
As many contexts can share data now and no single shared context exists
anymore, this function has been deprecated and now always returns %NULL.
Use [method@Gdk.GLContext.is_shared] to check if contexts
can be shared.
Error enumeration for `GdkGLContext`.
OpenGL support is not available
The requested visual format is not supported
The requested profile is not supported
The shader compilation failed
The shader linking failed
Registers an error quark for [class@Gdk.GLContext] errors.
the error quark
A GdkTexture representing a GL texture object.
Creates a new texture for an existing GL texture.
Note that the GL texture must not be modified until @destroy is called,
which will happen when the GdkTexture object is finalized, or due to
an explicit call of [method@Gdk.GLTexture.release].
[class@Gdk.GLTextureBuilder] supersedes this function
and provides extended functionality for creating GL textures.
A newly-created
`GdkTexture`
a `GdkGLContext`
the ID of a texture that was created with @context
the nominal width of the texture
the nominal height of the texture
a destroy notify that will be called when the GL resources
are released
data that gets passed to @destroy
Releases the GL resources held by a `GdkGLTexture`.
The texture contents are still available via the
[method@Gdk.Texture.download] function, after this
function has been called.
a `GdkTexture` wrapping a GL texture
`GdkGLTextureBuilder` is a builder used to construct [class@Gdk.Texture] objects from
GL textures.
The operation is quite simple: Create a texture builder, set all the necessary
properties - keep in mind that the properties [property@Gdk.GLTextureBuilder:context],
[property@Gdk.GLTextureBuilder:id], [property@Gdk.GLTextureBuilder:width], and
[property@Gdk.GLTextureBuilder:height] are mandatory - and then call
[method@Gdk.GLTextureBuilder.build] to create the new texture.
`GdkGLTextureBuilder` can be used for quick one-shot construction of
textures as well as kept around and reused to construct multiple textures.
Creates a new texture builder.
the new `GdkTextureBuilder`
Builds a new `GdkTexture` with the values set up in the builder.
The `destroy` function gets called when the returned texture gets released;
either when the texture is finalized or by an explicit call to
[method@Gdk.GLTexture.release]. It should release all GL resources associated
with the texture, such as the [property@Gdk.GLTextureBuilder:id] and the
[property@Gdk.GLTextureBuilder:sync].
Note that it is a programming error to call this function if any mandatory
property has not been set.
It is possible to call this function multiple times to create multiple textures,
possibly with changing properties in between.
a newly built `GdkTexture`
a `GdkGLTextureBuilder`
destroy function to be called when the texture is
released
user data to pass to the destroy function
Gets the context previously set via gdk_gl_texture_builder_set_context() or
%NULL if none was set.
The context
a `GdkGLTextureBuilder`
Gets the format previously set via gdk_gl_texture_builder_set_format().
The format
a `GdkGLTextureBuilder`
Gets whether the texture has a mipmap.
Whether the texture has a mipmap
a `GdkGLTextureBuilder`
Gets the height previously set via gdk_gl_texture_builder_set_height() or
0 if the height wasn't set.
The height
a `GdkGLTextureBuilder`
Gets the texture id previously set via gdk_gl_texture_builder_set_id() or
0 if the id wasn't set.
The id
a `GdkGLTextureBuilder`
Gets the `GLsync` previously set via gdk_gl_texture_builder_set_sync().
the `GLSync`
a `GdkGLTextureBuilder`
Gets the region previously set via gdk_gl_texture_builder_set_update_region() or
%NULL if none was set.
The region
a `GdkGLTextureBuilder`
Gets the texture previously set via gdk_gl_texture_builder_set_update_texture() or
%NULL if none was set.
The texture
a `GdkGLTextureBuilder`
Gets the width previously set via gdk_gl_texture_builder_set_width() or
0 if the width wasn't set.
The width
a `GdkGLTextureBuilder`
Sets the context to be used for the texture. This is the context that owns
the texture.
The context must be set before calling [method@Gdk.GLTextureBuilder.build].
a `GdkGLTextureBuilder`
The context the texture beongs to or %NULL to unset
Sets the format of the texture. The default is `GDK_MEMORY_R8G8B8A8_PREMULTIPLIED`.
The format is the preferred format the texture data should be downloaded to. The
format must be supported by the GL version of [property@Gdk.GLTextureBuilder:context].
GDK's texture download code assumes that the format corresponds to the storage
parameters of the GL texture in an obvious way. For example, a format of
`GDK_MEMORY_R16G16B16A16_PREMULTIPLIED` is expected to be stored as `GL_RGBA16`
texture, and `GDK_MEMORY_G8A8` is expected to be stored as `GL_RG8` texture.
Setting the right format is particularly useful when using high bit depth textures
to preserve the bit depth, to set the correct value for unpremultiplied textures
and to make sure opaque textures are treated as such.
Non-RGBA textures need to have swizzling parameters set up properly to be usable
in GSK's shaders.
a `GdkGLTextureBuilder`
The texture's format
Sets whether the texture has a mipmap. This allows the renderer and other users of the
generated texture to use a higher quality downscaling.
Typically, the `glGenerateMipmap` function is used to generate a mimap.
a `GdkGLTextureBuilder`
Whether the texture has a mipmap
Sets the height of the texture.
The height must be set before calling [method@Gdk.GLTextureBuilder.build].
a `GdkGLTextureBuilder`
The texture's height or 0 to unset
Sets the texture id of the texture. The texture id must remain unmodified
until the texture was finalized. See [method@Gdk.GLTextureBuilder.build]
for a longer discussion.
The id must be set before calling [method@Gdk.GLTextureBuilder.build].
a `GdkGLTextureBuilder`
The texture id to be used for creating the texture
Sets the GLSync object to use for the texture.
GTK will wait on this object before using the created `GdkTexture`.
The `destroy` function that is passed to [method@Gdk.GLTextureBuilder.build]
is responsible for freeing the sync object when it is no longer needed.
The texture builder does not destroy it and it is the callers
responsibility to make sure it doesn't leak.
a `GdkGLTextureBuilder`
the GLSync object
Sets the region to be updated by this texture. Together with
[property@Gdk.GLTextureBuilder:update-texture] this describes an
update of a previous texture.
When rendering animations of large textures, it is possible that
consecutive textures are only updating contents in parts of the texture.
It is then possible to describe this update via these two properties,
so that GTK can avoid rerendering parts that did not change.
An example would be a screen recording where only the mouse pointer moves.
a `GdkGLTextureBuilder`
the region to update
Sets the texture to be updated by this texture. See
[method@Gdk.GLTextureBuilder.set_update_region] for an explanation.
a `GdkGLTextureBuilder`
the texture to update
Sets the width of the texture.
The width must be set before calling [method@Gdk.GLTextureBuilder.build].
a `GdkGLTextureBuilder`
The texture's width or 0 to unset
The context owning the texture.
The format when downloading the texture.
If the texture has a mipmap.
The height of the texture.
The texture ID to use.
An optional `GLSync` object.
If this is set, GTK will wait on it before using the texture.
The update region for [property@Gdk.GLTextureBuilder:update-texture].
The texture [property@Gdk.GLTextureBuilder:update-region] is an update for.
The width of the texture.
An event related to a broken windowing system grab.
Extracts the grab surface from a grab broken event.
the grab surface of @event
a grab broken event
Checks whether the grab broken event is for an implicit grab.
%TRUE if the an implicit grab was broken
a grab broken event
Defines the reference point of a surface and is used in `GdkPopupLayout`.
the reference point is at the top left corner.
the reference point is in the middle of the top edge.
the reference point is at the top right corner.
the reference point is at the middle of the left edge.
the reference point is at the center of the surface.
the reference point is at the middle of the right edge.
the reference point is at the lower left corner.
the reference point is at the middle of the lower edge.
the reference point is at the lower right corner.
the reference point is at the top left corner of the
surface itself, ignoring window manager decorations.
An enumeration describing the type of an input device in general terms.
the device is a mouse. (This will be reported for the core
pointer, even if it is something else, such as a trackball.)
the device is a stylus of a graphics tablet or similar device.
the device is a keyboard.
the device is a direct-input touch device, such
as a touchscreen or tablet
the device is an indirect touch device, such
as a touchpad
the device is a trackpoint
the device is a "pad", a collection of buttons,
rings and strips found in drawing tablets
An event related to a key-based device.
Extracts the consumed modifiers from a key event.
the consumed modifiers or @event
a key event
Extracts the keycode from a key event.
the keycode of @event
a key event
Extracts the keyval from a key event.
the keyval of @event
a key event
Extracts the layout from a key event.
the layout of @event
a key event
Extracts the shift level from a key event.
the shift level of @event
a key event
Gets a keyval and modifier combination that will match
the event.
See [method@Gdk.KeyEvent.matches].
%TRUE on success
a key `GdkEvent`
return location for a keyval
return location for modifiers
Extracts whether the key event is for a modifier key.
%TRUE if the @event is for a modifier key
a key event
Matches a key event against a keyval and modifiers.
This is typically used to trigger keyboard shortcuts such as Ctrl-C.
Partial matches are possible where the combination matches
if the currently active group is ignored.
Note that we ignore Caps Lock for matching.
a `GdkKeyMatch` value describing whether @event matches
a key `GdkEvent`
the keyval to match
the modifiers to match
Describes how well an event matches a given keyval and modifiers.
`GdkKeyMatch` values are returned by [method@Gdk.KeyEvent.matches].
The key event does not match
The key event matches if keyboard state
(specifically, the currently active group) is ignored
The key event matches
A `GdkKeymapKey` is a hardware key that can be mapped to a keyval.
the hardware keycode. This is an identifying number for a
physical key.
indicates movement in a horizontal direction. Usually groups are used
for two different languages. In group 0, a key might have two English
characters, and in group 1 it might have two Hebrew characters. The Hebrew
characters will be printed on the key next to the English characters.
indicates which symbol on the key will be used, in a vertical direction.
So on a standard US keyboard, the key with the number “1” on it also has the
exclamation point ("!") character on it. The level indicates whether to use
the “1” or the “!” symbol. The letter keys are considered to have a lowercase
letter at level 0, and an uppercase letter at level 1, though only the
uppercase letter is printed.
A mask covering all entries in `GdkModifierType`.
`GdkMemoryFormat` describes formats that image data can have in memory.
It describes formats by listing the contents of the memory passed to it.
So `GDK_MEMORY_A8R8G8B8` will be 1 byte (8 bits) of alpha, followed by a
byte each of red, green and blue. It is not endian-dependent, so
`CAIRO_FORMAT_ARGB32` is represented by different `GdkMemoryFormats`
on architectures with different endiannesses.
Its naming is modelled after
[VkFormat](https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkFormat)
for details).
4 bytes; for blue, green, red, alpha.
The color values are premultiplied with the alpha value.
4 bytes; for alpha, red, green, blue.
The color values are premultiplied with the alpha value.
4 bytes; for red, green, blue, alpha
The color values are premultiplied with the alpha value.
4 bytes; for blue, green, red, alpha.
4 bytes; for alpha, red, green, blue.
4 bytes; for red, green, blue, alpha.
4 bytes; for alpha, blue, green, red.
3 bytes; for red, green, blue. The data is opaque.
3 bytes; for blue, green, red. The data is opaque.
3 guint16 values; for red, green, blue.
4 guint16 values; for red, green, blue, alpha. The color values are
premultiplied with the alpha value.
4 guint16 values; for red, green, blue, alpha.
3 half-float values; for red, green, blue. The data is opaque.
4 half-float values; for red, green, blue and alpha. The color values are
premultiplied with the alpha value.
4 half-float values; for red, green, blue and alpha.
3 float values; for red, green, blue.
4 float values; for red, green, blue and alpha. The color values are
premultiplied with the alpha value.
4 float values; for red, green, blue and alpha.
2 bytes; for grayscale, alpha. The color values are premultiplied with the
alpha value.
2 bytes; for grayscale, alpha.
One byte; for grayscale. The data is opaque.
2 guint16 values; for grayscale, alpha. The color values are premultiplied
with the alpha value.
2 guint16 values; for grayscale, alpha.
One guint16 value; for grayscale. The data is opaque.
One byte; for alpha.
One guint16 value; for alpha.
One half-float value; for alpha.
One float value; for alpha.
4 bytes; for alpha, blue, green, red, The color values are premultiplied with
the alpha value.
4 bytes; for blue, green, red, unused.
4 bytes; for unused, red, green, blue.
4 bytes; for red, green, blue, unused.
4 bytes; for unused, blue, green, red.
The number of formats. This value will change as
more formats get added, so do not rely on its concrete integer.
A `GdkTexture` representing image data in memory.
Creates a new texture for a blob of image data.
The `GBytes` must contain @stride × @height pixels
in the given format.
A newly-created `GdkTexture`
the width of the texture
the height of the texture
the format of the data
the `GBytes` containing the pixel data
rowstride for the data
Flags to indicate the state of modifier keys and mouse buttons
in events.
Typical modifier keys are Shift, Control, Meta, Super, Hyper, Alt, Compose,
Apple, CapsLock or ShiftLock.
Note that GDK may add internal values to events which include values outside
of this enumeration. Your code should preserve and ignore them. You can use
%GDK_MODIFIER_MASK to remove all private values.
No modifier.
the Shift key.
a Lock key (depending on the modifier mapping of the
X server this may either be CapsLock or ShiftLock).
the Control key.
the fourth modifier key (it depends on the modifier
mapping of the X server which key is interpreted as this modifier, but
normally it is the Alt key).
the first mouse button.
the second mouse button.
the third mouse button.
the fourth mouse button.
the fifth mouse button.
the Super modifier.
the Hyper modifier.
the Meta modifier. Maps to Command on macOS.
`GdkMonitor` objects represent the individual outputs that are
associated with a `GdkDisplay`.
`GdkDisplay` keeps a `GListModel` to enumerate and monitor
monitors with [method@Gdk.Display.get_monitors]. You can use
[method@Gdk.Display.get_monitor_at_surface] to find a particular
monitor.
Gets the name of the monitor's connector, if available.
These are strings such as "eDP-1", or "HDMI-2". They depend
on software and hardware configuration, and should not be
relied on as stable identifiers of a specific monitor.
the name of the connector
a `GdkMonitor`
Gets a string describing the monitor, if available.
This can be used to identify a monitor in the UI.
the monitor description
a `GdkMonitor`
Gets the display that this monitor belongs to.
the display
a `GdkMonitor`
Retrieves the size and position of the monitor within the
display coordinate space.
The returned geometry is in ”application pixels”, not in
”device pixels” (see [method@Gdk.Monitor.get_scale]).
a `GdkMonitor`
a `GdkRectangle` to be filled with the monitor geometry
Gets the height in millimeters of the monitor.
the physical height of the monitor
a `GdkMonitor`
Gets the name or PNP ID of the monitor's manufacturer.
Note that this value might also vary depending on actual
display backend.
The PNP ID registry is located at
[https://uefi.org/pnp_id_list](https://uefi.org/pnp_id_list).
the name of the manufacturer
a `GdkMonitor`
Gets the string identifying the monitor model, if available.
the monitor model
a `GdkMonitor`
Gets the refresh rate of the monitor, if available.
The value is in milli-Hertz, so a refresh rate of 60Hz
is returned as 60000.
the refresh rate in milli-Hertz, or 0
a `GdkMonitor`
Gets the internal scale factor that maps from monitor coordinates
to device pixels.
This can be used if you want to create pixel based data for a
particular monitor, but most of the time you’re drawing to a surface
where it is better to use [method@Gdk.Surface.get_scale] instead.
the scale
a `GdkMonitor`
Gets the internal scale factor that maps from monitor coordinates
to device pixels.
On traditional systems this is 1, but on very high density outputs
it can be a higher value (often 2).
This can be used if you want to create pixel based data for a
particular monitor, but most of the time you’re drawing to a surface
where it is better to use [method@Gdk.Surface.get_scale_factor] instead.
the scale factor
a `GdkMonitor`
Gets information about the layout of red, green and blue
primaries for pixels.
the subpixel layout
a `GdkMonitor`
Gets the width in millimeters of the monitor.
the physical width of the monitor
a `GdkMonitor`
Returns %TRUE if the @monitor object corresponds to a
physical monitor.
The @monitor becomes invalid when the physical monitor
is unplugged or removed.
%TRUE if the object corresponds to a physical monitor
a `GdkMonitor`
The connector name.
A short description of the monitor, meant for display to the user.
The `GdkDisplay` of the monitor.
The geometry of the monitor.
The height of the monitor, in millimeters.
The manufacturer name.
The model name.
The refresh rate, in milli-Hertz.
The scale of the monitor.
The scale factor.
The scale factor is the next larger integer,
compared to [property@Gdk.Surface:scale].
The subpixel layout.
Whether the object is still valid.
The width of the monitor, in millimeters.
Emitted when the output represented by @monitor gets disconnected.
An event related to a pointer or touch device motion.
Specifies the kind of crossing for enter and leave events.
See the X11 protocol specification of LeaveNotify for
full details of crossing event generation.
the surface is entered from an ancestor or
left towards an ancestor.
the pointer moves between an ancestor and an
inferior of the surface.
the surface is entered from an inferior or
left towards an inferior.
the surface is entered from or left towards
a surface which is neither an ancestor nor an inferior.
the pointer moves between two surfaces
which are not ancestors of each other and the surface is part of
the ancestor chain between one of these surfaces and their least
common ancestor.
an unknown type of enter/leave event occurred.
This is the priority that the idle handler processing surface updates
is given in the main loop.
An event related to a pad-based device.
Extracts the information from a pad strip or ring event.
a pad strip or ring event
Return location for the axis index
Return location for the axis value
Extracts information about the pressed button from
a pad event.
the button of @event
a pad button event
Extracts group and mode information from a pad event.
a pad event
return location for the group
return location for the mode
`GdkPaintable` is a simple interface used by GTK to represent content that
can be painted.
The content of a `GdkPaintable` can be painted anywhere at any size
without requiring any sort of layout. The interface is inspired by
similar concepts elsewhere, such as
[ClutterContent](https://developer.gnome.org/clutter/stable/ClutterContent.html),
[HTML/CSS Paint Sources](https://www.w3.org/TR/css-images-4/#paint-source),
or [SVG Paint Servers](https://www.w3.org/TR/SVG2/pservers.html).
A `GdkPaintable` can be snapshot at any time and size using
[method@Gdk.Paintable.snapshot]. How the paintable interprets that size and
if it scales or centers itself into the given rectangle is implementation
defined, though if you are implementing a `GdkPaintable` and don't know what
to do, it is suggested that you scale your paintable ignoring any potential
aspect ratio.
The contents that a `GdkPaintable` produces may depend on the [class@Gdk.Snapshot]
passed to it. For example, paintables may decide to use more detailed images
on higher resolution screens or when OpenGL is available. A `GdkPaintable`
will however always produce the same output for the same snapshot.
A `GdkPaintable` may change its contents, meaning that it will now produce
a different output with the same snapshot. Once that happens, it will call
[method@Gdk.Paintable.invalidate_contents] which will emit the
[signal@Gdk.Paintable::invalidate-contents] signal. If a paintable is known
to never change its contents, it will set the %GDK_PAINTABLE_STATIC_CONTENTS
flag. If a consumer cannot deal with changing contents, it may call
[method@Gdk.Paintable.get_current_image] which will return a static
paintable and use that.
A paintable can report an intrinsic (or preferred) size or aspect ratio it
wishes to be rendered at, though it doesn't have to. Consumers of the interface
can use this information to layout thepaintable appropriately. Just like the
contents, the size of a paintable can change. A paintable will indicate this
by calling [method@Gdk.Paintable.invalidate_size] which will emit the
[signal@Gdk.Paintable::invalidate-size] signal. And just like for contents,
if a paintable is known to never change its size, it will set the
%GDK_PAINTABLE_STATIC_SIZE flag.
Besides API for applications, there are some functions that are only
useful for implementing subclasses and should not be used by applications:
[method@Gdk.Paintable.invalidate_contents],
[method@Gdk.Paintable.invalidate_size],
[func@Gdk.Paintable.new_empty].
Returns a paintable that has the given intrinsic size and draws nothing.
This is often useful for implementing the
[vfunc@Gdk.Paintable.get_current_image] virtual function
when the paintable is in an incomplete state (like a
[GtkMediaStream](../gtk4/class.MediaStream.html) before receiving
the first frame).
a `GdkPaintable`
The intrinsic width to report. Can be 0 for no width.
The intrinsic height to report. Can be 0 for no height.
Gets an immutable paintable for the current contents displayed by @paintable.
This is useful when you want to retain the current state of an animation,
for example to take a screenshot of a running animation.
If the @paintable is already immutable, it will return itself.
An immutable paintable for the current
contents of @paintable
a `GdkPaintable`
Get flags for the paintable.
This is oftentimes useful for optimizations.
See [flags@Gdk.PaintableFlags] for the flags and what they mean.
The `GdkPaintableFlags` for this paintable
a `GdkPaintable`
Gets the preferred aspect ratio the @paintable would like to be displayed at.
The aspect ratio is the width divided by the height, so a value of 0.5
means that the @paintable prefers to be displayed twice as high as it
is wide. Consumers of this interface can use this to preserve aspect
ratio when displaying the paintable.
This is a purely informational value and does not in any way limit the
values that may be passed to [method@Gdk.Paintable.snapshot].
Usually when a @paintable returns nonzero values from
[method@Gdk.Paintable.get_intrinsic_width] and
[method@Gdk.Paintable.get_intrinsic_height] the aspect ratio
should conform to those values, though that is not required.
If the @paintable does not have a preferred aspect ratio,
it returns 0. Negative values are never returned.
the intrinsic aspect ratio of @paintable or 0 if none.
a `GdkPaintable`
Gets the preferred height the @paintable would like to be displayed at.
Consumers of this interface can use this to reserve enough space to draw
the paintable.
This is a purely informational value and does not in any way limit the
values that may be passed to [method@Gdk.Paintable.snapshot].
If the @paintable does not have a preferred height, it returns 0.
Negative values are never returned.
the intrinsic height of @paintable or 0 if none.
a `GdkPaintable`
Gets the preferred width the @paintable would like to be displayed at.
Consumers of this interface can use this to reserve enough space to draw
the paintable.
This is a purely informational value and does not in any way limit the
values that may be passed to [method@Gdk.Paintable.snapshot].
If the @paintable does not have a preferred width, it returns 0.
Negative values are never returned.
the intrinsic width of @paintable or 0 if none.
a `GdkPaintable`
Snapshots the given paintable with the given @width and @height.
The paintable is drawn at the current (0,0) offset of the @snapshot.
If @width and @height are not larger than zero, this function will
do nothing.
a `GdkPaintable`
a `GdkSnapshot` to snapshot to
width to snapshot in
height to snapshot in
Compute a concrete size for the `GdkPaintable`.
Applies the sizing algorithm outlined in the
[CSS Image spec](https://drafts.csswg.org/css-images-3/#default-sizing)
to the given @paintable. See that link for more details.
It is not necessary to call this function when both @specified_width
and @specified_height are known, but it is useful to call this
function in GtkWidget:measure implementations to compute the
other dimension when only one dimension is given.
a `GdkPaintable`
the width @paintable could be drawn into or
0.0 if unknown
the height @paintable could be drawn into or
0.0 if unknown
the width @paintable would be drawn into if
no other constraints were given
the height @paintable would be drawn into if
no other constraints were given
will be set to the concrete width computed
will be set to the concrete height computed
Gets an immutable paintable for the current contents displayed by @paintable.
This is useful when you want to retain the current state of an animation,
for example to take a screenshot of a running animation.
If the @paintable is already immutable, it will return itself.
An immutable paintable for the current
contents of @paintable
a `GdkPaintable`
Get flags for the paintable.
This is oftentimes useful for optimizations.
See [flags@Gdk.PaintableFlags] for the flags and what they mean.
The `GdkPaintableFlags` for this paintable
a `GdkPaintable`
Gets the preferred aspect ratio the @paintable would like to be displayed at.
The aspect ratio is the width divided by the height, so a value of 0.5
means that the @paintable prefers to be displayed twice as high as it
is wide. Consumers of this interface can use this to preserve aspect
ratio when displaying the paintable.
This is a purely informational value and does not in any way limit the
values that may be passed to [method@Gdk.Paintable.snapshot].
Usually when a @paintable returns nonzero values from
[method@Gdk.Paintable.get_intrinsic_width] and
[method@Gdk.Paintable.get_intrinsic_height] the aspect ratio
should conform to those values, though that is not required.
If the @paintable does not have a preferred aspect ratio,
it returns 0. Negative values are never returned.
the intrinsic aspect ratio of @paintable or 0 if none.
a `GdkPaintable`
Gets the preferred height the @paintable would like to be displayed at.
Consumers of this interface can use this to reserve enough space to draw
the paintable.
This is a purely informational value and does not in any way limit the
values that may be passed to [method@Gdk.Paintable.snapshot].
If the @paintable does not have a preferred height, it returns 0.
Negative values are never returned.
the intrinsic height of @paintable or 0 if none.
a `GdkPaintable`
Gets the preferred width the @paintable would like to be displayed at.
Consumers of this interface can use this to reserve enough space to draw
the paintable.
This is a purely informational value and does not in any way limit the
values that may be passed to [method@Gdk.Paintable.snapshot].
If the @paintable does not have a preferred width, it returns 0.
Negative values are never returned.
the intrinsic width of @paintable or 0 if none.
a `GdkPaintable`
Called by implementations of `GdkPaintable` to invalidate their contents.
Unless the contents are invalidated, implementations must guarantee that
multiple calls of [method@Gdk.Paintable.snapshot] produce the same output.
This function will emit the [signal@Gdk.Paintable::invalidate-contents]
signal.
If a @paintable reports the %GDK_PAINTABLE_STATIC_CONTENTS flag,
it must not call this function.
a `GdkPaintable`
Called by implementations of `GdkPaintable` to invalidate their size.
As long as the size is not invalidated, @paintable must return the same
values for its intrinsic width, height and aspect ratio.
This function will emit the [signal@Gdk.Paintable::invalidate-size]
signal.
If a @paintable reports the %GDK_PAINTABLE_STATIC_SIZE flag,
it must not call this function.
a `GdkPaintable`
Snapshots the given paintable with the given @width and @height.
The paintable is drawn at the current (0,0) offset of the @snapshot.
If @width and @height are not larger than zero, this function will
do nothing.
a `GdkPaintable`
a `GdkSnapshot` to snapshot to
width to snapshot in
height to snapshot in
Emitted when the contents of the @paintable change.
Examples for such an event would be videos changing to the next frame or
the icon theme for an icon changing.
Emitted when the intrinsic size of the @paintable changes.
This means the values reported by at least one of
[method@Gdk.Paintable.get_intrinsic_width],
[method@Gdk.Paintable.get_intrinsic_height] or
[method@Gdk.Paintable.get_intrinsic_aspect_ratio]
has changed.
Examples for such an event would be a paintable displaying
the contents of a toplevel surface being resized.
Flags about a paintable object.
Implementations use these for optimizations such as caching.
The size is immutable.
The [signal@Gdk.Paintable::invalidate-size] signal will never be
emitted.
The content is immutable.
The [signal@Gdk.Paintable::invalidate-contents] signal will never be
emitted.
The list of functions that can be implemented for the `GdkPaintable`
interface.
Note that apart from the [vfunc@Gdk.Paintable.snapshot] function,
no virtual function of this interface is mandatory to implement, though it
is a good idea to implement [vfunc@Gdk.Paintable.get_current_image]
for non-static paintables and [vfunc@Gdk.Paintable.get_flags] if the
image is not dynamic as the default implementation returns no flags and
that will make the implementation likely quite slow.
Snapshot the paintable. The given @width and @height are
guaranteed to be larger than 0.0. The resulting snapshot must modify
only the area in the rectangle from (0,0) to (width, height).
This is the only function that must be implemented for this interface.
a `GdkPaintable`
a `GdkSnapshot` to snapshot to
width to snapshot in
height to snapshot in
return a `GdkPaintable` that does not change over
time. This means the `GDK_PAINTABLE_STATIC_SIZE` and
`GDK_PAINTABLE_STATIC_CONTENTS` flag are set.
An immutable paintable for the current
contents of @paintable
a `GdkPaintable`
Get the flags for this instance. See [flags@Gdk.PaintableFlags]
for details.
The `GdkPaintableFlags` for this paintable
a `GdkPaintable`
The preferred width for this object to be
snapshot at or 0 if none. This is purely a hint. The object must still
be able to render at any size.
the intrinsic width of @paintable or 0 if none.
a `GdkPaintable`
The preferred height for this object to be
snapshot at or 0 if none. This is purely a hint. The object must still
be able to render at any size.
the intrinsic height of @paintable or 0 if none.
a `GdkPaintable`
The preferred aspect ratio for this object
or 0 if none. If both [vfunc@Gdk.Paintable.get_intrinsic_width]
and [vfunc@Gdk.Paintable.get_intrinsic_height] return non-zero
values, this function should return the aspect ratio computed from those.
the intrinsic aspect ratio of @paintable or 0 if none.
a `GdkPaintable`
A `GdkPopup` is a surface that is attached to another surface.
The `GdkPopup` is positioned relative to its parent surface.
`GdkPopup`s are typically used to implement menus and similar popups.
They can be modal, which is indicated by the [property@Gdk.Popup:autohide]
property.
Returns whether this popup is set to hide on outside clicks.
%TRUE if @popup will autohide
a `GdkPopup`
Returns the parent surface of a popup.
the parent surface
a `GdkPopup`
Obtains the position of the popup relative to its parent.
the X coordinate of @popup position
a `GdkPopup`
Obtains the position of the popup relative to its parent.
the Y coordinate of @popup position
a `GdkPopup`
Gets the current popup rectangle anchor.
The value returned may change after calling [method@Gdk.Popup.present],
or after the [signal@Gdk.Surface::layout] signal is emitted.
the current rectangle anchor value of @popup
a `GdkPopup`
Gets the current popup surface anchor.
The value returned may change after calling [method@Gdk.Popup.present],
or after the [signal@Gdk.Surface::layout] signal is emitted.
the current surface anchor value of @popup
a `GdkPopup`
Present @popup after having processed the `GdkPopupLayout` rules.
If the popup was previously not showing, it will be shown,
otherwise it will change position according to @layout.
After calling this function, the result should be handled in response
to the [signal@Gdk.Surface::layout] signal being emitted. The resulting
popup position can be queried using [method@Gdk.Popup.get_position_x],
[method@Gdk.Popup.get_position_y], and the resulting size will be sent as
parameters in the layout signal. Use [method@Gdk.Popup.get_rect_anchor]
and [method@Gdk.Popup.get_surface_anchor] to get the resulting anchors.
Presenting may fail, for example if the @popup is set to autohide
and is immediately hidden upon being presented. If presenting failed,
the [signal@Gdk.Surface::layout] signal will not me emitted.
%FALSE if it failed to be presented, otherwise %TRUE.
the `GdkPopup` to show
the unconstrained popup width to layout
the unconstrained popup height to layout
the `GdkPopupLayout` object used to layout
Whether to hide on outside clicks.
The parent surface.
The `GdkPopupLayout` struct contains information that is
necessary position a [iface@Gdk.Popup] relative to its parent.
The positioning requires a negotiation with the windowing system,
since it depends on external constraints, such as the position of
the parent surface, and the screen dimensions.
The basic ingredients are a rectangle on the parent surface,
and the anchor on both that rectangle and the popup. The anchors
specify a side or corner to place next to each other.
![Popup anchors](popup-anchors.png)
For cases where placing the anchors next to each other would make
the popup extend offscreen, the layout includes some hints for how
to resolve this problem. The hints may suggest to flip the anchor
position to the other side, or to 'slide' the popup along a side,
or to resize it.
![Flipping popups](popup-flip.png)
![Sliding popups](popup-slide.png)
These hints may be combined.
Ultimatively, it is up to the windowing system to determine the position
and size of the popup. You can learn about the result by calling
[method@Gdk.Popup.get_position_x], [method@Gdk.Popup.get_position_y],
[method@Gdk.Popup.get_rect_anchor] and [method@Gdk.Popup.get_surface_anchor]
after the popup has been presented. This can be used to adjust the rendering.
For example, [GtkPopover](../gtk4/class.Popover.html) changes its arrow position
accordingly. But you have to be careful avoid changing the size of the popover,
or it has to be presented again.
Create a popup layout description.
Used together with [method@Gdk.Popup.present] to describe how a popup
surface should be placed and behave on-screen.
@anchor_rect is relative to the top-left corner of the surface's parent.
@rect_anchor and @surface_anchor determine anchor points on @anchor_rect
and surface to pin together.
The position of @anchor_rect's anchor point can optionally be offset using
[method@Gdk.PopupLayout.set_offset], which is equivalent to offsetting the
position of surface.
newly created instance of `GdkPopupLayout`
the anchor `GdkRectangle` to align @surface with
the point on @anchor_rect to align with @surface's anchor point
the point on @surface to align with @rect's anchor point
Makes a copy of @layout.
a copy of @layout.
a `GdkPopupLayout`
Check whether @layout and @other has identical layout properties.
%TRUE if @layout and @other have identical layout properties,
otherwise %FALSE.
a `GdkPopupLayout`
another `GdkPopupLayout`
Get the `GdkAnchorHints`.
the `GdkAnchorHints`
a `GdkPopupLayout`
Get the anchor rectangle.
The anchor rectangle
a `GdkPopupLayout`
Retrieves the offset for the anchor rectangle.
a `GdkPopupLayout`
return location for the delta X coordinate
return location for the delta Y coordinate
Returns the anchor position on the anchor rectangle.
the anchor on the anchor rectangle.
a `GdkPopupLayout`
Obtains the shadow widths of this layout.
a `GdkPopupLayout`
return location for the left shadow width
return location for the right shadow width
return location for the top shadow width
return location for the bottom shadow width
Returns the anchor position on the popup surface.
the anchor on the popup surface.
a `GdkPopupLayout`
Increases the reference count of @value.
the same @layout
a `GdkPopupLayout`
Set new anchor hints.
The set @anchor_hints determines how @surface will be moved
if the anchor points cause it to move off-screen. For example,
%GDK_ANCHOR_FLIP_X will replace %GDK_GRAVITY_NORTH_WEST with
%GDK_GRAVITY_NORTH_EAST and vice versa if @surface extends
beyond the left or right edges of the monitor.
a `GdkPopupLayout`
the new `GdkAnchorHints`
Set the anchor rectangle.
a `GdkPopupLayout`
the new anchor rectangle
Offset the position of the anchor rectangle with the given delta.
a `GdkPopupLayout`
x delta to offset the anchor rectangle with
y delta to offset the anchor rectangle with
Set the anchor on the anchor rectangle.
a `GdkPopupLayout`
the new rect anchor
Sets the shadow width of the popup.
The shadow width corresponds to the part of the computed
surface size that would consist of the shadow margin
surrounding the window, would there be any.
a `GdkPopupLayout`
width of the left part of the shadow
width of the right part of the shadow
height of the top part of the shadow
height of the bottom part of the shadow
Set the anchor on the popup surface.
a `GdkPopupLayout`
the new popup surface anchor
Decreases the reference count of @value.
a `GdkPopupLayout`
An event related to the proximity of a tool to a device.
A `GdkRGBA` is used to represent a color, in a way that is compatible
with cairo’s notion of color.
`GdkRGBA` is a convenient way to pass colors around. It’s based on
cairo’s way to deal with colors and mirrors its behavior. All values
are in the range from 0.0 to 1.0 inclusive. So the color
(0.0, 0.0, 0.0, 0.0) represents transparent black and
(1.0, 1.0, 1.0, 1.0) is opaque white. Other values will
be clamped to this range when drawing.
The intensity of the red channel from 0.0 to 1.0 inclusive
The intensity of the green channel from 0.0 to 1.0 inclusive
The intensity of the blue channel from 0.0 to 1.0 inclusive
The opacity of the color from 0.0 for completely translucent to
1.0 for opaque
Makes a copy of a `GdkRGBA`.
The result must be freed through [method@Gdk.RGBA.free].
A newly allocated `GdkRGBA`, with the same contents as @rgba
a `GdkRGBA`
Compares two `GdkRGBA` colors.
%TRUE if the two colors compare equal
a `GdkRGBA`
another `GdkRGBA`
Frees a `GdkRGBA`.
a `GdkRGBA`
A hash function suitable for using for a hash
table that stores `GdkRGBA`s.
The hash value for @p
a `GdkRGBA`
Checks if an @rgba value is transparent.
That is, drawing with the value would not produce any change.
%TRUE if the @rgba is clear
a `GdkRGBA`
Checks if an @rgba value is opaque.
That is, drawing with the value will not retain any results
from previous contents.
%TRUE if the @rgba is opaque
a `GdkRGBA`
Parses a textual representation of a color.
The string can be either one of:
- A standard name (Taken from the CSS specification).
- A hexadecimal value in the form “\#rgb”, “\#rrggbb”,
“\#rrrgggbbb” or ”\#rrrrggggbbbb”
- A hexadecimal value in the form “\#rgba”, “\#rrggbbaa”,
or ”\#rrrrggggbbbbaaaa”
- A RGB color in the form “rgb(r,g,b)” (In this case the color
will have full opacity)
- A RGBA color in the form “rgba(r,g,b,a)”
- A HSL color in the form "hsl(hue, saturation, lightness)"
- A HSLA color in the form "hsla(hue, saturation, lightness, alpha)"
Where “r”, “g”, “b” and “a” are respectively the red, green,
blue and alpha color values. In the last two cases, “r”, “g”,
and “b” are either integers in the range 0 to 255 or percentage
values in the range 0% to 100%, and a is a floating point value
in the range 0 to 1.
%TRUE if the parsing succeeded
the `GdkRGBA` to fill in
the string specifying the color
Returns a textual specification of @rgba in the form
`rgb(r,g,b)` or `rgba(r,g,b,a)`, where “r”, “g”, “b” and
“a” represent the red, green, blue and alpha values
respectively. “r”, “g”, and “b” are represented as integers
in the range 0 to 255, and “a” is represented as a floating
point value in the range 0 to 1.
These string forms are string forms that are supported by
the CSS3 colors module, and can be parsed by [method@Gdk.RGBA.parse].
Note that this string representation may lose some precision,
since “r”, “g” and “b” are represented as 8-bit integers. If
this is a concern, you should use a different representation.
A newly allocated text string
a `GdkRGBA`
A `GdkRectangle` data type for representing rectangles.
`GdkRectangle` is identical to `cairo_rectangle_t`. Together with Cairo’s
`cairo_region_t` data type, these are the central types for representing
sets of pixels.
The intersection of two rectangles can be computed with
[method@Gdk.Rectangle.intersect]; to find the union of two rectangles use
[method@Gdk.Rectangle.union].
The `cairo_region_t` type provided by Cairo is usually used for managing
non-rectangular clipping of graphical operations.
The Graphene library has a number of other data types for regions and
volumes in 2D and 3D.
the x coordinate of the top left corner
the y coordinate of the top left corner
the width of the rectangle
the height of the rectangle
Returns %TRUE if @rect contains the point described by @x and @y.
%TRUE if @rect contains the point
a `GdkRectangle`
X coordinate
Y coordinate
Checks if the two given rectangles are equal.
%TRUE if the rectangles are equal.
a `GdkRectangle`
a `GdkRectangle`
Calculates the intersection of two rectangles.
It is allowed for @dest to be the same as either @src1 or @src2.
If the rectangles do not intersect, @dest’s width and height is set
to 0 and its x and y values are undefined. If you are only interested
in whether the rectangles intersect, but not in the intersecting area
itself, pass %NULL for @dest.
%TRUE if the rectangles intersect.
a `GdkRectangle`
a `GdkRectangle`
return location for the
intersection of @src1 and @src2
Calculates the union of two rectangles.
The union of rectangles @src1 and @src2 is the smallest rectangle which
includes both @src1 and @src2 within it. It is allowed for @dest to be
the same as either @src1 or @src2.
Note that this function does not ignore 'empty' rectangles (ie. with
zero width or height).
a `GdkRectangle`
a `GdkRectangle`
return location for the union of @src1 and @src2
Specifies the direction for scroll events.
the surface is scrolled up.
the surface is scrolled down.
the surface is scrolled to the left.
the surface is scrolled to the right.
the scrolling is determined by the delta values
in scroll events. See gdk_scroll_event_get_deltas()
An event related to a scrolling motion.
Extracts the scroll deltas of a scroll event.
The deltas will be zero unless the scroll direction
is %GDK_SCROLL_SMOOTH.
For the representation unit of these deltas, see
[method@Gdk.ScrollEvent.get_unit].
a scroll event
return location for x scroll delta
return location for y scroll delta
Extracts the direction of a scroll event.
the scroll direction of @event
a scroll event
Extracts the scroll delta unit of a scroll event.
The unit will always be %GDK_SCROLL_UNIT_WHEEL if the scroll direction is not
%GDK_SCROLL_SMOOTH.
the scroll unit.
a scroll event.
Check whether a scroll event is a stop scroll event.
Scroll sequences with smooth scroll information may provide
a stop scroll event once the interaction with the device finishes,
e.g. by lifting a finger. This stop scroll event is the signal
that a widget may trigger kinetic scrolling based on the current
velocity.
Stop scroll events always have a delta of 0/0.
%TRUE if the event is a scroll stop event
a scroll event
Specifies the unit of scroll deltas.
When you get %GDK_SCROLL_UNIT_WHEEL, a delta of 1.0 means 1 wheel detent
click in the south direction, 2.0 means 2 wheel detent clicks in the south
direction... This is the same logic for negative values but in the north
direction.
If you get %GDK_SCROLL_UNIT_SURFACE, are managing a scrollable view and get a
value of 123, you have to scroll 123 surface logical pixels right if it's
@delta_x or down if it's @delta_y. This is the same logic for negative values
but you have to scroll left instead of right if it's @delta_x and up instead
of down if it's @delta_y.
1 surface logical pixel is equal to 1 real screen pixel multiplied by the
final scale factor of your graphical interface (the product of the desktop
scale factor and eventually a custom scale factor in your app).
The delta is in number of wheel clicks.
The delta is in surface pixels to scroll directly
on screen.
The `GdkSeat` object represents a collection of input devices
that belong to a user.
Returns the capabilities this `GdkSeat` currently has.
the seat capabilities
a `GdkSeat`
Returns the devices that match the given capabilities.
A list
of `GdkDevices`. The list must be freed with g_list_free(),
the elements are owned by GTK and must not be freed.
a `GdkSeat`
capabilities to get devices for
Returns the `GdkDisplay` this seat belongs to.
a `GdkDisplay`. This object
is owned by GTK and must not be freed.
a `GdkSeat`
Returns the device that routes keyboard events.
a `GdkDevice` with keyboard
capabilities. This object is owned by GTK and must not be freed.
a `GdkSeat`
Returns the device that routes pointer events.
a `GdkDevice` with pointer
capabilities. This object is owned by GTK and must not be freed.
a `GdkSeat`
Returns all `GdkDeviceTools` that are known to the application.
A list of tools. Free with g_list_free().
a `GdkSeat`
`GdkDisplay` of this seat.
Emitted when a new input device is related to this seat.
the newly added `GdkDevice`.
Emitted when an input device is removed (e.g. unplugged).
the just removed `GdkDevice`.
Emitted whenever a new tool is made known to the seat.
The tool may later be assigned to a device (i.e. on
proximity with a tablet). The device will emit the
[signal@Gdk.Device::tool-changed] signal accordingly.
A same tool may be used by several devices.
the new `GdkDeviceTool` known to the seat
Emitted whenever a tool is no longer known to this @seat.
the just removed `GdkDeviceTool`
Flags describing the seat capabilities.
No input capabilities
The seat has a pointer (e.g. mouse)
The seat has touchscreen(s) attached
The seat has drawing tablet(s) attached
The seat has keyboard(s) attached
The seat has drawing tablet pad(s) attached
The union of all pointing capabilities
The union of all capabilities
Base type for snapshot operations.
The subclass of `GdkSnapshot` used by GTK is [GtkSnapshot](../gtk4/class.Snapshot.html).
This enumeration describes how the red, green and blue components
of physical pixels on an output device are laid out.
The layout is not known
Not organized in this way
The layout is horizontal, the order is RGB
The layout is horizontal, the order is BGR
The layout is vertical, the order is RGB
The layout is vertical, the order is BGR
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.
Create a new popup surface.
The surface will be attached to @parent and can be positioned
relative to it using [method@Gdk.Popup.present].
a new `GdkSurface`
the parent surface to attach the surface to
whether to hide the surface on outside clicks
Creates a new toplevel surface.
the new `GdkSurface`
the display to create the surface on
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].
a toplevel `GdkSurface`
Creates a new `GdkCairoContext` for rendering on @surface.
the newly created `GdkCairoContext`
a `GdkSurface`
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].
the newly created `GdkGLContext`
a `GdkSurface`
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.
Create a suitable cairo image surface yourself
a pointer to the newly allocated surface. The caller
owns the surface and should call cairo_surface_destroy() when done
with it.
surface to make new surface similar to
the content for the new surface
width of the new surface
height of the new surface
Sets an error and returns %NULL.
GTK does not expose any Vulkan internals. This
function is a leftover that was accidentally exposed.
%NULL
a `GdkSurface`
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.
a `GdkSurface`
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.
a `GdkCursor`
a `GdkSurface`
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.
a `GdkCursor`
a `GdkSurface`
a pointer `GdkDevice`
Obtains the current device position and modifier state.
The position is given in coordinates relative to the upper
left corner of @surface.
%TRUE if the device is over the surface
a `GdkSurface`
pointer `GdkDevice` to query to
return location for the X coordinate of @device
return location for the Y coordinate of @device
return location for the modifier mask
Gets the `GdkDisplay` associated with a `GdkSurface`.
the `GdkDisplay` associated with @surface
a `GdkSurface`
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.
the frame clock
surface to get frame clock for
Returns the height of the given @surface.
Surface size is reported in ”application pixels”, not
”device pixels” (see [method@Gdk.Surface.get_scale_factor]).
The height of @surface
a `GdkSurface`
Checks whether the surface has been mapped.
A surface is mapped with [method@Gdk.Toplevel.present]
or [method@Gdk.Popup.present].
%TRUE if the surface is mapped
a `GdkSurface`
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.
the scale
surface to get scale for
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.
the scale factor
surface to get scale factor for
Returns the width of the given @surface.
Surface size is reported in ”application pixels”, not
”device pixels” (see [method@Gdk.Surface.get_scale_factor]).
The width of @surface
a `GdkSurface`
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()](../gtk4/method.Widget.hide.html).
a `GdkSurface`
Check to see if a surface is destroyed.
%TRUE if the surface is destroyed
a `GdkSurface`
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.
a `GdkSurface`
Request a layout phase from the surface's frame clock.
See [method@Gdk.FrameClock.request_phase].
a `GdkSurface`
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.
a `GdkSurface`
a `GdkCursor`
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.
a `GdkSurface`
a pointer `GdkDevice`
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
@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.
a `GdkSurface`
region of surface to be 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 @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](../gtk4/vfunc.Widget.css_changed.html) handler.
a top-level `GdkSurface`
a region, or %NULL to make the entire
surface opaque
Translates coordinates between two surfaces.
Note that this only works if @to and @from are popups or
transient-for to the same toplevel (directly or indirectly).
%TRUE if the coordinates were successfully translated
the origin surface
the target surface
coordinates to translate
coordinates to translate
The mouse pointer for the `GdkSurface`.
The `GdkDisplay` connection of the surface.
The `GdkFrameClock` of the surface.
The height of the surface, in pixels.
Whether the surface is mapped.
The scale of the surface.
The scale factor of the surface.
The scale factor is the next larger integer,
compared to [property@Gdk.Surface:scale].
The width of the surface in pixels.
Emitted when @surface starts being present on the monitor.
the monitor
Emitted when GDK receives an input event for @surface.
%TRUE to indicate that the event has been handled
an input event
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()).
the current width
the current height
Emitted when @surface stops being present on the monitor.
the monitor
Emitted when part of the surface needs to be redrawn.
%TRUE to indicate that the signal has been handled
the region that needs to be redrawn
Determines a surface edge or corner.
the top left corner.
the top edge.
the top right corner.
the left edge.
the right edge.
the lower left corner.
the lower edge.
the lower right corner.
`GdkTexture` is the basic element used to refer to pixel data.
It is primarily meant for pixel data that will not change over
multiple frames, and will be used for a long time.
There are various ways to create `GdkTexture` objects from a
[class@GdkPixbuf.Pixbuf], or from bytes stored in memory, a file, or a
[struct@Gio.Resource].
The ownership of the pixel data is transferred to the `GdkTexture`
instance; you can only make a copy of it, via [method@Gdk.Texture.download].
`GdkTexture` is an immutable object: That means you cannot change
anything about it other than increasing the reference count via
[method@GObject.Object.ref], and consequently, it is a thread-safe object.
Creates a new texture object representing the `GdkPixbuf`.
This function is threadsafe, so that you can e.g. use GTask
and [method@Gio.Task.run_in_thread] to avoid blocking the main thread
while loading a big image.
a new `GdkTexture`
a `GdkPixbuf`
Creates a new texture by loading an image from memory,
The file format is detected automatically. The supported formats
are PNG, JPEG and TIFF, though more formats might be available.
If %NULL is returned, then @error will be set.
This function is threadsafe, so that you can e.g. use GTask
and [method@Gio.Task.run_in_thread] to avoid blocking the main thread
while loading a big image.
A newly-created `GdkTexture`
a `GBytes` containing the data to load
Creates a new texture by loading an image from a file.
The file format is detected automatically. The supported formats
are PNG, JPEG and TIFF, though more formats might be available.
If %NULL is returned, then @error will be set.
This function is threadsafe, so that you can e.g. use GTask
and [method@Gio.Task.run_in_thread] to avoid blocking the main thread
while loading a big image.
A newly-created `GdkTexture`
`GFile` to load
Creates a new texture by loading an image from a file.
The file format is detected automatically. The supported formats
are PNG, JPEG and TIFF, though more formats might be available.
If %NULL is returned, then @error will be set.
This function is threadsafe, so that you can e.g. use GTask
and [method@Gio.Task.run_in_thread] to avoid blocking the main thread
while loading a big image.
A newly-created `GdkTexture`
the filename to load
Creates a new texture by loading an image from a resource.
The file format is detected automatically. The supported formats
are PNG and JPEG, though more formats might be available.
It is a fatal error if @resource_path does not specify a valid
image resource and the program will abort if that happens.
If you are unsure about the validity of a resource, use
[ctor@Gdk.Texture.new_from_file] to load it.
This function is threadsafe, so that you can e.g. use GTask
and [method@Gio.Task.run_in_thread] to avoid blocking the main thread
while loading a big image.
A newly-created `GdkTexture`
the path of the resource file
Downloads the @texture into local memory.
This may be an expensive operation, as the actual texture data
may reside on a GPU or on a remote display server.
The data format of the downloaded data is equivalent to
%CAIRO_FORMAT_ARGB32, so every downloaded pixel requires
4 bytes of memory.
Downloading a texture into a Cairo image surface:
```c
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
gdk_texture_get_width (texture),
gdk_texture_get_height (texture));
gdk_texture_download (texture,
cairo_image_surface_get_data (surface),
cairo_image_surface_get_stride (surface));
cairo_surface_mark_dirty (surface);
```
For more flexible download capabilities, see
[struct@Gdk.TextureDownloader].
a `GdkTexture`
pointer to enough memory to be filled with the
downloaded data of @texture
rowstride in bytes
Returns the color state associated with the texture.
the color state of the `GdkTexture`
a `GdkTexture`
Gets the memory format most closely associated with the data of
the texture.
Note that it may not be an exact match for texture data
stored on the GPU or with compression.
The format can give an indication about the bit depth and opacity
of the texture and is useful to determine the best format for
downloading the texture.
the preferred format for the texture's data
a GdkTexture
Returns the height of the @texture, in pixels.
the height of the `GdkTexture`
a `GdkTexture`
Returns the width of @texture, in pixels.
the width of the `GdkTexture`
a `GdkTexture`
Store the given @texture to the @filename as a PNG file.
This is a utility function intended for debugging and testing.
If you want more control over formats, proper error handling or
want to store to a [iface@Gio.File] or other location, you might want to
use [method@Gdk.Texture.save_to_png_bytes] or look into the
gdk-pixbuf library.
%TRUE if saving succeeded, %FALSE on failure.
a `GdkTexture`
the filename to store to
Store the given @texture in memory as a PNG file.
Use [ctor@Gdk.Texture.new_from_bytes] to read it back.
If you want to serialize a texture, this is a convenient and
portable way to do that.
If you need more control over the generated image, such as
attaching metadata, you should look into an image handling
library such as the gdk-pixbuf library.
If you are dealing with high dynamic range float data, you
might also want to consider [method@Gdk.Texture.save_to_tiff_bytes]
instead.
a newly allocated `GBytes` containing PNG data
a `GdkTexture`
Store the given @texture to the @filename as a TIFF file.
GTK will attempt to store data without loss.
%TRUE if saving succeeded, %FALSE on failure.
a `GdkTexture`
the filename to store to
Store the given @texture in memory as a TIFF file.
Use [ctor@Gdk.Texture.new_from_bytes] to read it back.
This function is intended to store a representation of the
texture's data that is as accurate as possible. This is
particularly relevant when working with high dynamic range
images and floating-point texture data.
If that is not your concern and you are interested in a
smaller size and a more portable format, you might want to
use [method@Gdk.Texture.save_to_png_bytes].
a newly allocated `GBytes` containing TIFF data
a `GdkTexture`
The color state of the texture.
The height of the texture, in pixels.
The width of the texture, in pixels.
The `GdkTextureDownloader` is used to download the contents of a
[class@Gdk.Texture].
It is intended to be created as a short-term object for a single download,
but can be used for multiple downloads of different textures or with different
settings.
`GdkTextureDownloader` can be used to convert data between different formats.
Create a `GdkTexture` for the existing format and then download it in a
different format.
Creates a new texture downloader for @texture.
A new texture downloader
texture to download
Creates a copy of the downloader.
This function is meant for language bindings.
A copy of the downloader
the downloader to copy
Downloads the given texture pixels into a `GBytes`. The rowstride will
be stored in the stride value.
This function will abort if it tries to download a large texture and
fails to allocate memory. If you think that may happen, you should handle
memory allocation yourself and use [method@Gdk.TextureDownloader.download_into]
once allocation succeeded.
The downloaded pixels
the downloader
The stride of the resulting data in bytes
Downloads the @texture into local memory.
a texture downloader
pointer to enough memory to be filled with the
downloaded data of the texture
rowstride in bytes
Frees the given downloader and all its associated resources.
texture downloader to free
Gets the format that the data will be downloaded in.
The format of the download
a texture downloader
Gets the texture that the downloader will download.
The texture to download
a texture downloader
Sets the format the downloader will download.
By default, GDK_MEMORY_DEFAULT is set.
a texture downloader
the format to use
Changes the texture the downloader will download.
a texture downloader
the new texture to download
Possible errors that can be returned by `GdkTexture` constructors.
Not enough memory to handle this image
The image data appears corrupted
The image contains features
that cannot be loaded
The image format is not supported
Registers an error quark for [class@Gdk.Texture] errors.
the error quark
A `GdkTimeCoord` stores a single event in a motion history.
To check whether an axis is present, check whether the corresponding
flag from the [flags@Gdk.AxisFlags] enumeration is set in the @flags
To access individual axis values, use the values of the values of
the [enum@Gdk.AxisUse] enumerations as indices.
The timestamp for this event
Flags indicating what axes are present, see [flags@Gdk.AxisFlags]
axis values, indexed by [enum@Gdk.AxisUse]
The kind of title bar gesture to emit with
[method@Gdk.Toplevel.titlebar_gesture].
double click gesture
right click gesture
middle click gesture
A `GdkToplevel` is a freestanding toplevel surface.
The `GdkToplevel` interface provides useful APIs for interacting with
the windowing system, such as controlling maximization and size of the
surface, setting icons and transient parents for dialogs.
Begins an interactive move operation.
You might use this function to implement draggable titlebars.
a `GdkToplevel`
the device used for the operation
the button being used to drag, or 0 for a keyboard-initiated drag
surface X coordinate of mouse click that began the drag
surface Y coordinate of mouse click that began the drag
timestamp of mouse click that began the drag (use
[method@Gdk.Event.get_time])
Begins an interactive resize operation.
You might use this function to implement a “window resize grip.”
a `GdkToplevel`
the edge or corner from which the drag is started
the device used for the operation
the button being used to drag, or 0 for a keyboard-initiated drag
surface X coordinate of mouse click that began the drag
surface Y coordinate of mouse click that began the drag
timestamp of mouse click that began the drag (use
[method@Gdk.Event.get_time])
Sets keyboard focus to @surface.
In most cases, [gtk_window_present_with_time()](../gtk4/method.Window.present_with_time.html)
should be used on a [GtkWindow](../gtk4/class.Window.html), rather than
calling this function.
a `GdkToplevel`
timestamp of the event triggering the surface focus
Gets the bitwise or of the currently active surface state flags,
from the `GdkToplevelState` enumeration.
surface state bitfield
a `GdkToplevel`
Requests that the @toplevel inhibit the system shortcuts.
This is asking the desktop environment/windowing system to let all
keyboard events reach the surface, as long as it is focused, instead
of triggering system actions.
If granted, the rerouting remains active until the default shortcuts
processing is restored with [method@Gdk.Toplevel.restore_system_shortcuts],
or the request is revoked by the desktop environment, windowing system
or the user.
A typical use case for this API is remote desktop or virtual machine
viewers which need to inhibit the default system keyboard shortcuts
so that the remote session or virtual host gets those instead of the
local environment.
The windowing system or desktop environment may ask the user to grant
or deny the request or even choose to ignore the request entirely.
The caller can be notified whenever the request is granted or revoked
by listening to the [property@Gdk.Toplevel:shortcuts-inhibited] property.
a `GdkToplevel`
the `GdkEvent` that is triggering the inhibit
request, or %NULL if none is available
Asks to lower the @toplevel below other windows.
The windowing system may choose to ignore the request.
%TRUE if the surface was lowered
a `GdkToplevel`
Asks to minimize the @toplevel.
The windowing system may choose to ignore the request.
%TRUE if the surface was minimized
a `GdkToplevel`
Present @toplevel after having processed the `GdkToplevelLayout` rules.
If the toplevel was previously not showing, it will be showed,
otherwise it will change layout according to @layout.
GDK may emit the [signal@Gdk.Toplevel::compute-size] signal to let
the user of this toplevel compute the preferred size of the toplevel
surface.
Presenting is asynchronous and the specified layout parameters are not
guaranteed to be respected.
the `GdkToplevel` to show
the `GdkToplevelLayout` object used to layout
Restore default system keyboard shortcuts which were previously
inhibited.
This undoes the effect of [method@Gdk.Toplevel.inhibit_system_shortcuts].
a `GdkToplevel`
Sets the toplevel to be decorated.
Setting @decorated to %FALSE hints the desktop environment
that the surface has its own, client-side decorations and
does not need to have window decorations added.
a `GdkToplevel`
%TRUE to request decorations
Sets the toplevel to be deletable.
Setting @deletable to %TRUE hints the desktop environment
that it should offer the user a way to close the surface.
a `GdkToplevel`
%TRUE to request a delete button
Sets a list of icons for the surface.
One of these will be used to represent the surface in iconic form.
The icon may be shown in window lists or task bars. Which icon
size is shown depends on the window manager. The window manager
can scale the icon but setting several size icons can give better
image quality.
Note that some platforms don't support surface icons.
a `GdkToplevel`
A list of textures to use as icon, of different sizes
Sets the toplevel to be modal.
The application can use this hint to tell the
window manager that a certain surface has modal
behaviour. The window manager can use this information
to handle modal surfaces in a special way.
You should only use this on surfaces for which you have
previously called [method@Gdk.Toplevel.set_transient_for].
a `GdkToplevel`
%TRUE if the surface is modal, %FALSE otherwise.
Sets the startup notification ID.
When using GTK, typically you should use
[gtk_window_set_startup_id()](../gtk4/method.Window.set_startup_id.html)
instead of this low-level function.
a `GdkToplevel`
a string with startup-notification identifier
Sets the title of a toplevel surface.
The title maybe be displayed in the titlebar,
in lists of windows, etc.
a `GdkToplevel`
title of @surface
Sets a transient-for parent.
Indicates to the window manager that @surface is a transient
dialog associated with the application surface @parent. This
allows the window manager to do things like center @surface
on @parent and keep @surface above @parent.
See [gtk_window_set_transient_for()](../gtk4/method.Window.set_transient_for.html)
if you’re using [GtkWindow](../gtk4/class.Window.html).
a `GdkToplevel`
another toplevel `GdkSurface`
Asks the windowing system to show the window menu.
The window menu is the menu shown when right-clicking the titlebar
on traditional windows managed by the window manager. This is useful
for windows using client-side decorations, activating it with a
right-click on the window decorations.
%TRUE if the window menu was shown and %FALSE otherwise.
a `GdkToplevel`
a `GdkEvent` to show the menu for
Returns whether the desktop environment supports
tiled window states.
%TRUE if the desktop environment supports tiled window states
a `GdkToplevel`
Performs a title bar gesture.
whether the gesture was performed
a `GdkToplevel`
a `GdkTitlebarGesture`
Whether the window manager should add decorations.
Whether the window manager should allow to close the surface.
The fullscreen mode of the surface.
A list of textures to use as icon.
Whether the surface is modal.
Whether the surface should inhibit keyboard shortcuts.
The startup ID of the surface.
See [class@Gdk.AppLaunchContext] for more information about
startup feedback.
The state of the toplevel.
The title of the surface.
The transient parent of the surface.
Emitted when the size for the surface needs to be computed, when
it is present.
This signal will normally be emitted during or after a call to
[method@Gdk.Toplevel.present], depending on the configuration
received by the windowing system. It may also be emitted at any
other point in time, in response to the windowing system
spontaneously changing the configuration of the toplevel surface.
It is the responsibility of the toplevel user to handle this signal
and compute the desired size of the toplevel, given the information
passed via the [struct@Gdk.ToplevelSize] object. Failing to do so
will result in an arbitrary size being used as a result.
a `GdkToplevelSize`
The `GdkToplevelLayout` struct contains information that
is necessary to present a sovereign window on screen.
The `GdkToplevelLayout` struct is necessary for using
[method@Gdk.Toplevel.present].
Toplevel surfaces are sovereign windows that can be presented
to the user in various states (maximized, on all workspaces,
etc).
Create a toplevel layout description.
Used together with gdk_toplevel_present() to describe
how a toplevel surface should be placed and behave on-screen.
The size is in ”application pixels”, not
”device pixels” (see gdk_surface_get_scale_factor()).
newly created instance of `GdkToplevelLayout`
Create a new `GdkToplevelLayout` and copy the contents of @layout into it.
a copy of @layout.
a `GdkToplevelLayout`
Check whether @layout and @other has identical layout properties.
%TRUE if @layout and @other have identical layout properties,
otherwise %FALSE.
a `GdkToplevelLayout`
another `GdkToplevelLayout`
If the layout specifies whether to the toplevel should go fullscreen,
the value pointed to by @fullscreen is set to %TRUE if it should go
fullscreen, or %FALSE, if it should go unfullscreen.
whether the @layout specifies the fullscreen state for the toplevel
a ``GdkToplevelLayout`
location to store whether the toplevel should be fullscreen
Returns the monitor that the layout is fullscreening
the surface on.
the monitor on which @layout fullscreens
a `GdkToplevelLayout`
If the layout specifies whether to the toplevel should go maximized,
the value pointed to by @maximized is set to %TRUE if it should go
fullscreen, or %FALSE, if it should go unmaximized.
whether the @layout specifies the maximized state for the toplevel
a `GdkToplevelLayout`
set to %TRUE if the toplevel should be maximized
Returns whether the layout should allow the user
to resize the surface.
%TRUE if the layout is resizable
a `GdkToplevelLayout`
Increases the reference count of @layout.
the same @layout
a `GdkToplevelLayout`
Sets whether the layout should cause the surface
to be fullscreen when presented.
a `GdkToplevelLayout`
%TRUE to fullscreen the surface
the monitor to fullscreen on
Sets whether the layout should cause the surface
to be maximized when presented.
a `GdkToplevelLayout`
%TRUE to maximize
Sets whether the layout should allow the user
to resize the surface after it has been presented.
a `GdkToplevelLayout`
%TRUE to allow resizing
Decreases the reference count of @layout.
a `GdkToplevelLayout`
The `GdkToplevelSize` struct contains information that is useful
to compute the size of a toplevel.
Retrieves the bounds the toplevel is placed within.
The bounds represent the largest size a toplevel may have while still being
able to fit within some type of boundary. Depending on the backend, this may
be equivalent to the dimensions of the work area or the monitor on which the
window is being presented on, or something else that limits the way a
toplevel can be presented.
a `GdkToplevelSize`
return location for width
return location for height
Sets the minimum size of the toplevel.
The minimum size corresponds to the limitations the toplevel can be shrunk
to, without resulting in incorrect painting. A user of a `GdkToplevel` should
calculate these given both the existing size, and the bounds retrieved from
the `GdkToplevelSize` object.
The minimum size should be within the bounds (see
[method@Gdk.ToplevelSize.get_bounds]).
a `GdkToplevelSize`
the minimum width
the minimum height
Sets the shadows size of the toplevel.
The shadow width corresponds to the part of the computed surface size
that would consist of the shadow margin surrounding the window, would
there be any.
Shadow width should only be set if
[method@Gtk.Display.supports_shadow_width] is %TRUE.
a `GdkToplevelSize`
width of the left part of the shadow
width of the right part of the shadow
height of the top part of the shadow
height of the bottom part of the shadow
Sets the size the toplevel prefers to be resized to.
The size should be within the bounds (see
[method@Gdk.ToplevelSize.get_bounds]). The set size should
be considered as a hint, and should not be assumed to be
respected by the windowing system, or backend.
a `GdkToplevelSize`
the width
the height
Specifies the state of a toplevel surface.
On platforms that support information about individual edges, the
%GDK_TOPLEVEL_STATE_TILED state will be set whenever any of the individual
tiled states is set. On platforms that lack that support, the tiled state
will give an indication of tiledness without any of the per-edge states
being set.
the surface is minimized
the surface is maximized
the surface is sticky
the surface is maximized without decorations
the surface is kept above other surfaces
the surface is kept below other surfaces
the surface is presented as focused (with active decorations)
the surface is in a tiled state
whether the top edge is tiled
whether the top edge is resizable
whether the right edge is tiled
whether the right edge is resizable
whether the bottom edge is tiled
whether the bottom edge is resizable
whether the left edge is tiled
whether the left edge is resizable
the surface is not visible to the user
An event related to a touch-based device.
Extracts whether a touch event is emulating a pointer event.
%TRUE if @event is emulating
a touch event
An event related to a gesture on a touchpad device.
Unlike touchscreens, where the windowing system sends basic
sequences of begin, update, end events, and leaves gesture
recognition to the clients, touchpad gestures are typically
processed by the system, resulting in these events.
Extracts delta information from a touchpad event.
a touchpad event
return location for x
return location for y
Extracts the touchpad gesture phase from a touchpad event.
the gesture phase of @event
a touchpad event
Extracts the number of fingers from a touchpad event.
the number of fingers for @event
a touchpad event
Extracts the angle delta from a touchpad pinch event.
the angle delta of @event
a touchpad pinch event
Extracts the scale from a touchpad pinch event.
the scale of @event
a touchpad pinch event
Specifies the current state of a touchpad gesture.
All gestures are guaranteed to begin with an event with phase
%GDK_TOUCHPAD_GESTURE_PHASE_BEGIN, followed by 0 or several events
with phase %GDK_TOUCHPAD_GESTURE_PHASE_UPDATE.
A finished gesture may have 2 possible outcomes, an event with phase
%GDK_TOUCHPAD_GESTURE_PHASE_END will be emitted when the gesture is
considered successful, this should be used as the hint to perform any
permanent changes.
Cancelled gestures may be so for a variety of reasons, due to hardware
or the compositor, or due to the gesture recognition layers hinting the
gesture did not finish resolutely (eg. a 3rd finger being added during
a pinch gesture). In these cases, the last event will report the phase
%GDK_TOUCHPAD_GESTURE_PHASE_CANCEL, this should be used as a hint
to undo any visible/permanent changes that were done throughout the
progress of the gesture.
The gesture has begun.
The gesture has been updated.
The gesture was finished, changes
should be permanently applied.
The gesture was cancelled, all
changes should be undone.
`GdkVulkanContext` is an object representing the platform-specific
Vulkan draw context.
`GdkVulkanContext`s are created for a surface using
[method@Gdk.Surface.create_vulkan_context], and the context will match
the characteristics of the surface.
Support for `GdkVulkanContext` is platform-specific and context creation
can fail, returning %NULL context.
GTK does not expose any Vulkan internals. This
struct is a leftover that was accidentally exposed.
Emitted when the images managed by this context have changed.
Usually this means that the swapchain had to be recreated,
for example in response to a change of the surface size.
Error enumeration for `GdkVulkanContext`.
Vulkan is not supported on this backend or has not been
compiled in.
Vulkan support is not available on this Surface
Registers an error quark for [class@Gdk.VulkanContext] errors.
the error quark
The main way to not 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 onto @cr with an OVER operation,
respecting the current clip. The top left corner of the rectangle specified
by @x, @y, @width and @height will be drawn at the current (0,0) position of
the `cairo_t`.
This will work for *all* `cairo_t`, as long as @surface 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 to @cr 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 use GL_TEXTURE if using alpha.
Calling this may change the current GL context.
The function is overly complex and produces broken output
in various combinations of arguments. If you want to draw with GL textures
in GTK, use [ctor@Gdk.GLTexture.new]; if you want to use that texture in
Cairo, use [method@Gdk.Texture.download] to download the data into a Cairo
image surface.
a cairo context
The surface we're rendering for (not necessarily into)
The GL ID of the source buffer
The type of the @source
The scale-factor that the @source buffer is allocated for
The source x position in @source to start copying from in GL coordinates
The source y position in @source to start copying from in GL coordinates
The width of the region to draw
The height of the region to draw
Adds the given rectangle to the current path of @cr.
a cairo context
a `GdkRectangle`
Adds the given region to the current path of @cr.
a cairo context
a `cairo_region_t`
Creates region that covers the area where the given
@surface is more than 50% opaque.
This function takes into account device offsets that might be
set with cairo_surface_set_device_offset().
A `cairo_region_t`
a cairo surface
Sets the given pixbuf as the source pattern for @cr.
The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
so that the origin of @pixbuf is @pixbuf_x, @pixbuf_y.
a cairo context
a `GdkPixbuf`
X coordinate of location to place upper left corner of @pixbuf
Y coordinate of location to place upper left corner of @pixbuf
Sets the specified `GdkRGBA` as the source color of @cr.
a cairo context
a `GdkRGBA`
Returns the color state object representing the sRGB color space.
the color state object for sRGB
Returns the color state object representing the linearized sRGB color space.
the color state object for linearized sRGB
Read content from the given input stream and deserialize it, asynchronously.
The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
indicate a higher priority.
a `GInputStream` to read the serialized content from
the mime type to deserialize from
the GType to deserialize from
the I/O priority of the operation
optional `GCancellable` object
callback to call when the operation is done
data to pass to the callback function
Finishes a content deserialization operation.
%TRUE if the operation was successful. In this case,
@value is set. %FALSE if an error occurred. In this case,
@error is set
the `GAsyncResult`
return location for the result of the operation
Parses the given @string into `GdkContentFormats` and
returns the formats.
Strings printed via [method@Gdk.ContentFormats.to_string]
can be read in again successfully using this function.
If @string does not describe valid content formats, %NULL
is returned.
the content formats if @string is valid
the string to parse
Registers a function to deserialize object of a given type.
the mime type which the function can deserialize from
the type of objects that the function creates
the callback
data that @deserialize can access
destroy notify for @data
Registers a function to serialize objects of a given type.
the type of objects that the function can serialize
the mime type to serialize to
the callback
data that @serialize can access
destroy notify for @data
Serialize content and write it to the given output stream, asynchronously.
The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
indicate a higher priority.
a `GOutputStream` to write the serialized content to
the mime type to serialize to
the content to serialize
the I/O priority of the operation
optional `GCancellable` object
callback to call when the operation is done
data to pass to the callback function
Finishes a content serialization operation.
%TRUE if the operation was successful, %FALSE if an
error occurred. In this case, @error is set
the `GAsyncResult`
Registers an error quark for [class@Gdk.DmabufTexture] errors.
the error quark
Checks if @action represents a single action or includes
multiple actions.
When @action is 0 - ie no action was given, %TRUE
is returned.
%TRUE if exactly one action was given
a `GdkDragAction`
Returns the relative angle from @event1 to @event2.
The relative angle is the angle between the X axis and the line
through both events' positions. The rotation direction for positive
angles is from the positive X axis towards the positive Y axis.
This assumes that both events have X/Y information.
If not, this function returns %FALSE.
%TRUE if the angle could be calculated.
first `GdkEvent`
second `GdkEvent`
return location for the relative angle between both events
Returns the point halfway between the events' positions.
This assumes that both events have X/Y information.
If not, this function returns %FALSE.
%TRUE if the center could be calculated.
first `GdkEvent`
second `GdkEvent`
return location for the X coordinate of the center
return location for the Y coordinate of the center
Returns the distance between the event locations.
This assumes that both events have X/Y information.
If not, this function returns %FALSE.
%TRUE if the distance could be calculated.
first `GdkEvent`
second `GdkEvent`
return location for the distance
Registers an error quark for [class@Gdk.GLContext] errors.
the error quark
Canonicalizes the given mime type and interns the result.
If @string is not a valid mime type, %NULL is returned instead.
See RFC 2048 for the syntax if mime types.
An interned string for the canonicalized
mime type or %NULL if the string wasn't a valid mime type
string of a potential mime type
Obtains the upper- and lower-case versions of the keyval @symbol.
Examples of keyvals are `GDK_KEY_a`, `GDK_KEY_Enter`, `GDK_KEY_F1`, etc.
a keyval
return location for lowercase version of @symbol
return location for uppercase version of @symbol
Converts a key name to a key value.
The names are the same as those in the
`gdk/gdkkeysyms.h` header file
but without the leading “GDK_KEY_”.
the corresponding key value, or %GDK_KEY_VoidSymbol
if the key name is not a valid key
a key name
Returns %TRUE if the given key value is in lower case.
%TRUE if @keyval is in lower case, or if @keyval is not
subject to case conversion.
a key value.
Returns %TRUE if the given key value is in upper case.
%TRUE if @keyval is in upper case, or if @keyval is not subject to
case conversion.
a key value.
Converts a key value into a symbolic name.
The names are the same as those in the
`gdk/gdkkeysyms.h` header file
but without the leading “GDK_KEY_”.
a string containing the name
of the key
a key value
Converts a key value to lower case, if applicable.
the lower case form of @keyval, or @keyval itself if it is already
in lower case or it is not subject to case conversion.
a key value.
Convert from a GDK key symbol to the corresponding Unicode
character.
Note that the conversion does not take the current locale
into consideration, which might be expected for particular
keyvals, such as %GDK_KEY_KP_Decimal.
the corresponding unicode character, or 0 if there
is no corresponding character.
a GDK key symbol
Converts a key value to upper case, if applicable.
the upper case form of @keyval, or @keyval itself if it is already
in upper case or it is not subject to case conversion.
a key value.
Returns a paintable that has the given intrinsic size and draws nothing.
This is often useful for implementing the
[vfunc@Gdk.Paintable.get_current_image] virtual function
when the paintable is in an incomplete state (like a
[GtkMediaStream](../gtk4/class.MediaStream.html) before receiving
the first frame).
a `GdkPaintable`
The intrinsic width to report. Can be 0 for no width.
The intrinsic height to report. Can be 0 for no height.
Obtains a clip region which contains the areas where the given ranges
of text would be drawn.
@x_origin and @y_origin are the top left point to center the layout.
@index_ranges should contain ranges of bytes in the layout’s text.
Note that the regions returned correspond to logical extents of the text
ranges, not ink extents. So the drawn layout may in fact touch areas out of
the clip region. The clip region is mainly useful for highlightling parts
of text, such as when text is selected.
a clip region containing the given ranges
a `PangoLayout`
X pixel where you intend to draw the layout with this clip
Y pixel where you intend to draw the layout with this clip
array of byte indexes into the layout, where even members of array are start indexes and odd elements are end indexes
number of ranges in @index_ranges, i.e. half the size of @index_ranges
Obtains a clip region which contains the areas where the given
ranges of text would be drawn.
@x_origin and @y_origin are the top left position of the layout.
@index_ranges should contain ranges of bytes in the layout’s text.
The clip region will include space to the left or right of the line
(to the layout bounding box) if you have indexes above or below the
indexes contained inside the line. This is to draw the selection all
the way to the side of the layout. However, the clip region is in line
coordinates, not layout coordinates.
Note that the regions returned correspond to logical extents of the text
ranges, not ink extents. So the drawn line may in fact touch areas out of
the clip region. The clip region is mainly useful for highlightling parts
of text, such as when text is selected.
a clip region containing the given ranges
a `PangoLayoutLine`
X pixel where you intend to draw the layout line with this clip
baseline pixel where you intend to draw the layout line with this clip
array of byte indexes into the layout, where even
members of array are start indexes and odd elements are end indexes
number of ranges in @index_ranges, i.e. half the size of @index_ranges
Transfers image data from a `cairo_surface_t` and converts it
to a `GdkPixbuf`.
This allows you to efficiently read individual pixels from cairo surfaces.
This function will create an RGB pixbuf with 8 bits per channel.
The pixbuf will contain an alpha channel if the @surface contains one.
Use [class@Gdk.Texture] and subclasses instead
cairo surfaces and pixbufs
A newly-created pixbuf with a
reference count of 1
surface to copy from
Source X coordinate within @surface
Source Y coordinate within @surface
Width in pixels of region to get
Height in pixels of region to get
Creates a new pixbuf from @texture.
This should generally not be used in newly written code as later
stages will almost certainly convert the pixbuf back into a texture
to draw it on screen.
Use [class@Gdk.Texture] and subclasses instead
cairo surfaces and pixbufs
a new `GdkPixbuf`
a `GdkTexture`
Sets a list of backends that GDK should try to use.
This can be useful if your application does not
work with certain GDK backends.
By default, GDK tries all included backends.
For example:
```c
gdk_set_allowed_backends ("wayland,macos,*");
```
instructs GDK to try the Wayland backend first, followed by the
MacOs backend, and then all others.
If the `GDK_BACKEND` environment variable is set, it determines
what backends are tried in what order, while still respecting the
set of allowed backends that are specified by this function.
The possible backend names are:
- `broadway`
- `macos`
- `wayland`.
- `win32`
- `x11`
You can also include a `*` in the list to try all remaining backends.
This call must happen prior to functions that open a display, such
as [func@Gdk.Display.open], `gtk_init()`, or `gtk_init_check()`
in order to take effect.
a comma-separated list of backends
Registers an error quark for [class@Gdk.Texture] errors.
the error quark
Convert from a Unicode character to a key symbol.
the corresponding GDK key symbol, if one exists.
or, if there is no corresponding symbol, wc | 0x01000000
a Unicode character
Registers an error quark for [class@Gdk.VulkanContext] errors.
the error quark