7 Functions

Procedure: cairo-rectangle cr rectangle

Adds the given rectangle to the current path of cr.

cr

Passed: a <CairoContext>.

a cairo context

rectangle

Passed: a <GdkRectangle>.

a <GdkRectangle>

Procedure: cairo-region cr region

Adds the given region to the current path of cr.

cr

Passed: a <CairoContext>.

a cairo context

region

Passed: a <CairoRegion>.

a <CairoRegion>

Procedure: cairo-region-create-from-surface surface ⇒ %return

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().

surface

Passed: a <CairoSurface>.

a cairo surface

%return

Returned: a <CairoRegion>.

A <CairoRegion>

Procedure: cairo-set-source-rgba cr rgba

Sets the specified <GdkRGBA> as the source color of cr.

cr

Passed: a <CairoContext>.

a cairo context

rgba

Passed: a <GdkRGBA>.

a <GdkRGBA>

Procedure: color-state-get-oklab ⇒ %return

Returns the color state object representing the oklab color space.

This is a perceptually uniform color state.

%return

Returned: a <GdkColorState>.

the color state object for oklab

Procedure: color-state-get-oklch ⇒ %return

Returns the color state object representing the oklch color space.

This is the polar variant of oklab, in which the hue is encoded as a polar coordinate.

%return

Returned: a <GdkColorState>.

the color state object for oklch

Procedure: color-state-get-rec2100-linear ⇒ %return

Returns the color state object representing the linear rec2100 color space.

This color state uses the primaries defined by BT.2020-2 and BT.2100-0 and a linear transfer function.

It is equivalent to the Cicp tuple 9/8/0/1.

See e.g. the CSS HDR Module for details about this colorstate.

%return

Returned: a <GdkColorState>.

the color state object for linearized rec2100

Procedure: color-state-get-rec2100-pq ⇒ %return

Returns the color state object representing the rec2100-pq color space.

This color state uses the primaries defined by BT.2020-2 and BT.2100-0 and the transfer function defined by SMPTE ST 2084 and BT.2100-2.

It is equivalent to the Cicp tuple 9/16/0/1.

See e.g. the CSS HDR Module for details about this colorstate.

%return

Returned: a <GdkColorState>.

the color state object for rec2100-pq

Procedure: color-state-get-srgb ⇒ %return

Returns the color state object representing the sRGB color space.

This color state uses the primaries defined by BT.709-6 and the transfer function defined by IEC 61966-2-1.

It is equivalent to the Cicp tuple 1/13/0/1.

See e.g. the CSS Color Module for details about this colorstate.

%return

Returned: a <GdkColorState>.

the color state object for sRGB

Procedure: color-state-get-srgb-linear ⇒ %return

Returns the color state object representing the linearized sRGB color space.

This color state uses the primaries defined by BT.709-6 and a linear transfer function.

It is equivalent to the Cicp tuple 1/8/0/1.

See e.g. the CSS Color Module for details about this colorstate.

%return

Returned: a <GdkColorState>.

the color state object for linearized sRGB

Procedure: content-deserialize-async stream mime-type type io-priority [cancellable] [callback]

Reads 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.

stream

Passed: a <GInputStream>.

a <GInputStream> to read the serialized content from

mime-type

Passed: a string.

the mime type to deserialize from

type

Passed: a class, or a GType number.

the GType to deserialize from

io-priority

Passed: a 32-bit integer.

the I/O priority of the operation

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object

callback

Passed, or left out: a procedure, or #f.

callback to call when the operation is done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to the callback function

Procedure: content-deserialize-finish! result value ⇒ %return value

Finishes a content deserialization operation.

result

Passed: a <GAsyncResult>.

the <GAsyncResult>

value

Passed, filled in, and returned: a <GValue>.

return location for the result of the operation

%return

Returned: a boolean.

#t if the operation was successful. In this case, value is set. #f if an error occurred. In this case, error is set

Procedure: content-formats-parse string ⇒ %return

Parses the given string into <GdkContentFormats> and returns the formats.

Strings printed via content-formats:to-string can be read in again successfully using this function.

If string does not describe valid content formats, #f is returned.

string

Passed: a string.

the string to parse

%return

Returned: a <GdkContentFormats>, or #f.

the content formats if string is valid

Procedure: content-register-deserializer mime-type type deserialize

Registers a function to deserialize object of a given type.

Since 4.20, when looking up a deserializer to use, GTK will use the last registered deserializer for a given mime type, so applications can override the built-in deserializers.

mime-type

Passed: a string.

the mime type which the function can deserialize from

type

Passed: a class, or a GType number.

the type of objects that the function creates

deserialize

Passed: a procedure.

the callback

See GdkContentDeserializeFunc for how it is called.

data

Not passed: guile-gi supplies it.

data that deserialize can access

notify

Not passed: guile-gi supplies it.

destroy notify for data

See GDestroyNotify for how it is called.

Procedure: content-register-serializer type mime-type serialize

Registers a function to serialize objects of a given type.

Since 4.20, when looking up a serializer to use, GTK will use the last registered serializer for a given mime type, so applications can override the built-in serializers.

type

Passed: a class, or a GType number.

the type of objects that the function can serialize

mime-type

Passed: a string.

the mime type to serialize to

serialize

Passed: a procedure.

the callback

See GdkContentSerializeFunc for how it is called.

data

Not passed: guile-gi supplies it.

data that serialize can access

notify

Not passed: guile-gi supplies it.

destroy notify for data

See GDestroyNotify for how it is called.

Procedure: content-serialize-async stream mime-type value io-priority [cancellable] [callback]

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.

stream

Passed: a <GOutputStream>.

a <GOutputStream> to write the serialized content to

mime-type

Passed: a string.

the mime type to serialize to

value

Passed: a <GValue>.

the content to serialize

io-priority

Passed: a 32-bit integer.

the I/O priority of the operation

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object

callback

Passed, or left out: a procedure, or #f.

callback to call when the operation is done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to the callback function

Procedure: content-serialize-finish? result ⇒ %return

Finishes a content serialization operation.

result

Passed: a <GAsyncResult>.

the <GAsyncResult>

%return

Returned: a boolean.

#t if the operation was successful, #f if an error occurred. In this case, error is set

Procedure: dmabuf-error-quark ⇒ %return

Registers an error quark for <GdkDmabufTexture> errors.

%return

Returned: an unsigned 32-bit integer.

the error quark

Procedure: drag-action-is-unique? action ⇒ %return

Checks if action represents a single action or includes multiple actions.

When action is none - ie no action was given, TRUE is returned.

action

Passed: a <GdkDragAction>, or a list of its symbols, or one of them.

a <GdkDragAction>

%return

Returned: a boolean.

#t if exactly one action was given

Procedure: events-get-angle event1 event2 ⇒ %return angle

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 #f.

event1

Passed: a <GdkEvent>.

first <GdkEvent>

event2

Passed: a <GdkEvent>.

second <GdkEvent>

%return

Returned: a boolean.

#t if the angle could be calculated.

angle

Returned: a real number.

return location for the relative angle between both events

Procedure: events-get-center event1 event2 ⇒ %return x y

Returns the point halfway between the events’ positions.

This assumes that both events have X/Y information. If not, this function returns #f.

event1

Passed: a <GdkEvent>.

first <GdkEvent>

event2

Passed: a <GdkEvent>.

second <GdkEvent>

%return

Returned: a boolean.

#t if the center could be calculated.

x

Returned: a real number.

return location for the X coordinate of the center

y

Returned: a real number.

return location for the Y coordinate of the center

Procedure: events-get-distance event1 event2 ⇒ %return distance

Returns the distance between the event locations.

This assumes that both events have X/Y information. If not, this function returns #f.

event1

Passed: a <GdkEvent>.

first <GdkEvent>

event2

Passed: a <GdkEvent>.

second <GdkEvent>

%return

Returned: a boolean.

#t if the distance could be calculated.

distance

Returned: a real number.

return location for the distance

Procedure: gl-error-quark ⇒ %return

Registers an error quark for <GdkGLContext> errors.

%return

Returned: an unsigned 32-bit integer.

the error quark

Procedure: intern-mime-type string ⇒ %return

Canonicalizes the given mime type and interns the result.

If string is not a valid mime type, #f is returned instead. See RFC 2048 for the syntax if mime types.

string

Passed: a string.

string of a potential mime type

%return

Returned: a string, or #f.

An interned string for the canonicalized mime type or #f if the string wasn’t a valid mime type

Procedure: keyval-convert-case symbol ⇒ lower upper

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.

symbol

Passed: an unsigned 32-bit integer.

a keyval

lower

Returned: an unsigned 32-bit integer.

return location for lowercase version of symbol

upper

Returned: an unsigned 32-bit integer.

return location for uppercase version of symbol

Procedure: keyval-from-name keyval-name ⇒ %return

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_”.

keyval-name

Passed: a string.

a key name

%return

Returned: an unsigned 32-bit integer.

the corresponding key value, or GDK_KEY_VoidSymbol if the key name is not a valid key

Procedure: keyval-is-lower? keyval ⇒ %return

Returns true if the given key value is in lower case.

keyval

Passed: an unsigned 32-bit integer.

a key value.

%return

Returned: a boolean.

true if keyval is in lower case, or if keyval is not subject to case conversion.

Procedure: keyval-is-upper? keyval ⇒ %return

Returns true if the given key value is in upper case.

keyval

Passed: an unsigned 32-bit integer.

a key value.

%return

Returned: a boolean.

true if keyval is in upper case, or if keyval is not subject to case conversion.

Procedure: keyval-name keyval ⇒ %return

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_”.

keyval

Passed: an unsigned 32-bit integer.

a key value

%return

Returned: a string, or #f.

a string containing the name of the key

Procedure: keyval-to-lower keyval ⇒ %return

Converts a key value to lower case, if applicable.

keyval

Passed: an unsigned 32-bit integer.

a key value.

%return

Returned: an unsigned 32-bit integer.

the lower case form of keyval, or keyval itself if it is already in lower case or it is not subject to case conversion.

Procedure: keyval-to-unicode keyval ⇒ %return

Converts 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.

keyval

Passed: an unsigned 32-bit integer.

a GDK key symbol

%return

Returned: an unsigned 32-bit integer.

the corresponding unicode character, or 0 if there is no corresponding character.

Procedure: keyval-to-upper keyval ⇒ %return

Converts a key value to upper case, if applicable.

keyval

Passed: an unsigned 32-bit integer.

a key value.

%return

Returned: an unsigned 32-bit integer.

the upper case form of keyval, or keyval itself if it is already in upper case or it is not subject to case conversion.

Procedure: paintable-new-empty intrinsic-width intrinsic-height ⇒ %return

Returns a paintable that has the given intrinsic size and draws nothing.

This is often useful for implementing the paintable:do-get-current-image virtual function when the paintable is in an incomplete state (like a GtkMediaStream before receiving the first frame).

intrinsic-width

Passed: a 32-bit integer.

The intrinsic width to report. Can be 0 for no width.

intrinsic-height

Passed: a 32-bit integer.

The intrinsic height to report. Can be 0 for no height.

%return

Returned: a <GdkPaintable>.

a <GdkPaintable>

Procedure: set-allowed-backends backends

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:

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 display:open, init, or init-check? in order to take effect.

backends

Passed: a string.

a comma-separated list of backends

Procedure: texture-error-quark ⇒ %return

Registers an error quark for <GdkTexture> errors.

%return

Returned: an unsigned 32-bit integer.

the error quark

Procedure: unicode-to-keyval wc ⇒ %return

Converts from a Unicode character to a key symbol.

wc

Passed: an unsigned 32-bit integer.

a Unicode character

%return

Returned: an unsigned 32-bit integer.

the corresponding GDK key symbol, if one exists, or, if there is no corresponding symbol, wc | 0x01000000

Procedure: vulkan-error-quark ⇒ %return

Registers an error quark for <GdkVulkanContext> errors.

%return

Returned: an unsigned 32-bit integer.

the error quark