Expand description
§Rust GDK 4 bindings
The project website is here.
Rust bindings of GDK 4, part of gtk4-rs.
§Minimum supported Rust version
Currently, the minimum supported Rust version is 1.83.
§Documentation
- The Rust API Stable/Development
- The C API
- GTK Installation instructions
§Using
We recommend using crates from crates.io, as demonstrated here.
If you want to track the bleeding edge, use the git dependency instead:
[dependencies]
gdk = { git = "https://github.com/gtk-rs/gtk4-rs.git", package = "gdk4" }Avoid mixing versioned and git crates like this:
# This will not compile
[dependencies]
gtk = {version = "0.1", package = "gtk4"}
gdk = { git = "https://github.com/gtk-rs/gtk4-rs.git", package = "gdk4" }§Features
| Feature | Description |
|---|---|
v4_22 | Enable the new APIs part of GTK 4.22 |
v4_20 | Enable the new APIs part of GTK 4.20 |
v4_18 | Enable the new APIs part of GTK 4.18 |
v4_16 | Enable the new APIs part of GTK 4.16 |
v4_14 | Enable the new APIs part of GTK 4.14 |
v4_12 | Enable the new APIs part of GTK 4.12 |
v4_10 | Enable the new APIs part of GTK 4.10 |
v4_8 | Enable the new APIs part of GTK 4.8 |
v4_6 | Enable the new APIs part of GTK 4.6 |
v4_4 | Enable the new APIs part of GTK 4.4 |
v4_2 | Enable the new APIs part of GTK 4.2 |
gl | Integration with the gl crate |
§See Also
§License
The Rust bindings of gdk4 are available under the MIT License, please refer to it.
Re-exports§
Modules§
- builders
- Builder pattern types.
- prelude
- Traits intended for blanket imports.
- subclass
- Traits intended for creating custom types.
Structs§
- Anchor
Hints - Positioning hints for aligning a surface relative to a rectangle.
- AppLaunch
Context - message);
- Axis
Flags - Flags describing the current capabilities of a device/tool.
- Button
Event - An event related to a button on a pointer device.
- Cairo
Context - Represents the platform-specific draw context.
- Cicp
Params v4_16 - Contains the parameters that define a colorstate with cicp parameters.
- Clipboard
- Represents data shared between applications or inside an application.
- Color
State v4_16 - Provides information to interpret colors and pixels in a variety of ways.
- Content
Deserializer - Deserializes content received via inter-application data transfers.
- Content
Formats - Used to advertise and negotiate the format of content.
- Content
Formats Builder - Creates
ContentFormatsobjects. - Content
Provider - Provides content for the clipboard or for drag-and-drop operations in a number of formats.
- Content
Serializer - Serializes content for inter-application data transfers.
- Crossing
Event - An event caused by a pointing device moving between surfaces.
- Cursor
- Used to create and destroy cursors.
- DNDEvent
- An event related to drag and drop operations.
- Delete
Event - An event related to closing a top-level surface.
- Device
- Represents an input device, such as a keyboard, mouse or touchpad.
- Device
Pad - An interface for tablet pad devices.
- Device
Tool - A physical tool associated to a
Device. - Display
- A representation of a workstation.
- Display
Manager - Offers notification when displays appear or disappear.
- Dmabuf
Formats Linux and v4_14 - Provides information about supported DMA buffer formats.
- Dmabuf
Texture Linux and v4_14 - A
Texturerepresenting a DMA buffer. - Dmabuf
Texture Builder Linux and v4_14 - Constructs
Textureobjects from DMA buffers. - Drag
- Represents the source of an ongoing DND operation.
- Drag
Action - Used in
DropandDragto indicate the actions that the destination can and should do with the dropped data. - Drag
Surface - A surface that is used during DND.
- Drag
Surface Size v4_12 - Contains information that is useful to compute the size of a drag surface.
- Draw
Context - Base class for objects implementing different rendering methods.
- Drop
- Represents the target of an ongoing DND operation.
- Event
- Represents windowing system events.
- Event
Sequence - An opaque type representing a sequence of related events.
- File
List v4_6 - An opaque type representing a list of files.
- Focus
Event - An event related to a keyboard focus change.
- Frame
Clock - 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
frame_time()and the value inside theupdatesignal of the clock, they will stay exactly synchronized. - Frame
Clock Phase - Used to represent the different paint clock phases that can be requested.
- Frame
Timings - s display, such as latency and jitter.
- GLAPI
v4_6 - The list of the different APIs that GdkGLContext can potentially support.
- GLContext
- Represents a platform-specific OpenGL draw context.
- GLTexture
- A
Texturerepresenting a GL texture object. - GLTexture
Builder v4_12 - Constructs
Textureobjects from GL textures. - GRange
- Grab
Broken Event - An event related to a broken windowing system grab.
- Key
- A wrapper around
GDK_KEY_constants and keyval methods. - KeyEvent
- An event related to a key-based device.
- Keymap
Key - Represents a hardware key that can be mapped to a keyval.
- Memory
Texture - A
Texturerepresenting image data in memory. - Memory
Texture Builder v4_16 - Constructs
Textureobjects from system memory provided viaglib::Bytes. - Modifier
Type - Flags to indicate the state of modifier keys and mouse buttons in events.
- Monitor
- Represents the individual outputs that are associated with a
Display. - Motion
Event - An event related to a pointer or touch device motion.
- PadEvent
- An event related to a pad-based device.
- Paintable
- An interface for content that can be painted.
- Paintable
Flags - Flags about a paintable object.
- Popup
- A surface that is attached to another surface.
- Popup
Layout - Contains information that is necessary position a
Popuprelative to its parent. - Proximity
Event - An event related to the proximity of a tool to a device.
- RGBA
- 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.
- Rectangle
- s
cairo::Regiondata type, these are the central types for representing sets of pixels. - Scroll
Event - An event related to a scrolling motion.
- Seat
- Represents a collection of input devices that belong to a user.
- Seat
Capabilities - Flags describing the seat capabilities.
- Snapshot
- Base type for snapshot operations.
- Surface
- s a low-level object, used to implement high-level objects such as GtkWindow.
- Texture
- Refers to pixel data in various forms.
- Texture
Downloader v4_10 - Used to download the contents of a
Texture. - Time
Coord - Stores a single event in a motion history.
- Toplevel
- A freestanding toplevel surface.
- Toplevel
Capabilities v4_20 - Reflects what features a
Toplevelsupports. - Toplevel
Layout - Contains information that is necessary to present a sovereign window on screen.
- Toplevel
Size - Contains information that is useful to compute the size of a toplevel.
- Toplevel
State - Specifies the state of a toplevel surface.
- Touch
Event - An event related to a touch-based device.
- Touchpad
Event - An event related to a gesture on a touchpad device.
- Vulkan
Context Deprecated - GTK does not expose any Vulkan internals. This struct is a leftover that was accidentally exposed. Represents the platform-specific Vulkan draw context.
Enums§
- AxisUse
- Defines how device axes are interpreted by GTK.
- Backend
- Cicp
Range v4_16 - The values of this enumeration describe whether image data uses the full range of 8-bit values.
- Color
Channel v4_22 - Enumerates the color channels of RGBA values as used in
GdkColorand OpenGL/Vulkan shaders. - Crossing
Mode - Specifies the crossing mode for enter and leave events.
- Device
PadFeature - A pad feature.
- Device
Tool Type - Indicates the specific type of tool being used being a tablet. Such as an airbrush, pencil, etc.
- Dmabuf
Error Linux and v4_14 - Error enumeration for
DmabufTexture. - Drag
Cancel Reason - Used in
Dragto the reason of a cancelled DND operation. - Event
Type - Specifies the type of the event.
- Fullscreen
Mode - Indicates which monitor a surface should span over when in fullscreen mode.
- GLError
- Error enumeration for
GLContext. - Gravity
- Defines the reference point of a surface and is used in
PopupLayout. - Input
Source - An enumeration describing the type of an input device in general terms.
- KeyMatch
- Describes how well an event matches a given keyval and modifiers.
- Memory
Format - ` where CHANNELS describe how the RGBA channels are layed out in memory, with an X denoting padding. DATA_TYPE is unsigned normalized integer if not present, or otherwise FLOAT. The optional SUBSAMPLING defines the subsampling method used. The optional ENDIAN term describes the endianness if it is not host-endian. Finally, an optional PREMULTIPLIED term indicates that the color channels are premultiplied with the alpha value, if it is omitted, the data is not premultiplied or there is no alpha channel.
- Notify
Type - Specifies the kind of crossing for enter and leave events.
- Scroll
Direction - Specifies the direction for scroll events.
- Scroll
Relative Direction v4_20 - Used in scroll events, to announce the direction relative to physical motion.
- Scroll
Unit v4_8 - Specifies the unit of scroll deltas.
- Subpixel
Layout - This enumeration describes how the red, green and blue components of physical pixels on an output device are laid out.
- Surface
Edge - Determines a surface edge or corner.
- Texture
Error v4_6 - Possible errors that can be returned by
Textureconstructors. - Titlebar
Gesture v4_4 - The kind of title bar gesture to emit with
ToplevelExt::titlebar_gesture(). - Touchpad
Gesture Phase - Specifies the current state of a touchpad gesture.
- Vulkan
Error - Error enumeration for
VulkanContext.
Constants§
- ACTION_
ALL - Defines all possible DND actions.
- BUTTON_
MIDDLE - The middle button.
- BUTTON_
PRIMARY - The primary button. This is typically the left mouse button, or the right button in a left-handed setup.
- BUTTON_
SECONDARY - The secondary button. This is typically the right mouse button, or the left button in a left-handed setup.
- CURRENT_
TIME - Represents the current time, and can be used anywhere a time is expected.
- EVENT_
PROPAGATE - Use this macro as the return value for continuing the propagation of an event handler.
- EVENT_
STOP - Use this macro as the return value for stopping the propagation of an event handler.
- MODIFIER_
MASK - A mask covering all entries in
ModifierType. - PRIORITY_
REDRAW - This is the priority that the idle handler processing surface updates is given in the main loop.
Functions§
- content_
deserialize_ async - Reads content from the given input stream and deserialize it, asynchronously.
- content_
deserialize_ future - content_
register_ deserializer - Registers a function to deserialize object of a given type.
- content_
register_ serializer - Registers a function to serialize objects of a given type.
- content_
serialize_ async - Serialize content and write it to the given output stream, asynchronously.
- content_
serialize_ future - intern_
mime_ type - Canonicalizes the given mime type and interns the result.
- pango_
layout_ get_ clip_ region - s text.
- pango_
layout_ line_ get_ clip_ region - 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.
- pixbuf_
get_ from_ surface Deprecated - Transfers image data from a
cairo::Surfaceand converts it to agdk_pixbuf::Pixbuf. - pixbuf_
get_ from_ texture Deprecated - Creates a new pixbuf from @texture.
- set_
allowed_ backends - Sets a list of backends that GDK should try to use.
- unicode_
to_ keyval - Converts from a Unicode character to a key symbol.