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.70
.
§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_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§
pub use cairo;
pub use gdk4_sys as ffi;
pub use gdk_pixbuf;
pub use gio;
pub use gl;
gl
pub use glib;
pub use pango;
Modules§
- Builder pattern types.
- Traits intended for blanket imports.
- Traits intended for creating custom types.
Structs§
- Positioning hints for aligning a surface relative to a rectangle.
AppLaunchContext
handles launching an application in a graphical context.- Flags describing the current capabilities of a device/tool.
- An event related to a button on a pointer device.
CairoContext
is an object representing the platform-specific draw context.- Cicp
Params v4_16
TheCicpParams
struct contains the parameters that define a colorstate according to the ITU-T H.273 specification. - The
Clipboard
object represents data shared between applications or inside an application. - Color
State v4_16
AColorState
object provides the information to interpret colors and pixels in a variety of ways. - A
ContentDeserializer
is used to deserialize content received via inter-application data transfers. - The
ContentFormats
structure is used to advertise and negotiate the format of content. - A
ContentFormatsBuilder
is an auxiliary struct used to create newContentFormats
, and should not be kept around. - A
ContentProvider
is used to provide content for the clipboard or for drag-and-drop operations in a number of formats. - A
ContentSerializer
is used to serialize content for inter-application data transfers. - An event caused by a pointing device moving between surfaces.
Cursor
is used to create and destroy cursors.- An event related to drag and drop operations.
- An event related to closing a top-level surface.
- The
Device
object represents an input device, such as a keyboard, a mouse, or a touchpad. DevicePad
is an interface implemented by devices of typeInputSource::TabletPad
- A physical tool associated to a
Device
. Display
objects are the GDK representation of a workstation.- A singleton object that offers notification when displays appear or disappear.
- Dmabuf
Formats v4_14
TheDmabufFormats
struct provides information about supported DMA buffer formats. - Dmabuf
Texture v4_14
ATexture
representing a DMA buffer. - Dmabuf
Texture Builder v4_14
DmabufTextureBuilder
is a builder used to constructTexture
objects from DMA buffers. - The
Drag
object represents the source of an ongoing DND operation. - A
DragSurface
is an interface for surfaces used during DND. - Drag
Surface Size v4_12
TheDragSurfaceSize
struct contains information that is useful to compute the size of a drag surface. - Base class for objects implementing different rendering methods.
- The
Drop
object represents the target of an ongoing DND operation. Event
s are immutable data structures, created by GDK to represent windowing system events.EventSequence
is an opaque type representing a sequence of related touch events.- File
List v4_6
An opaque type representing a list of files. - An event related to a keyboard focus change.
- A
FrameClock
tells the application when to update and repaint a surface. - Used to represent the different paint clock phases that can be requested.
- A
FrameTimings
object holds timing information for a single frame of the application’s displays. - GLAPI
v4_6
The list of the different APIs that GdkGLContext can potentially support. GLContext
is an object representing a platform-specific OpenGL draw context.- A GdkTexture representing a GL texture object.
- GLTexture
Builder v4_12
GLTextureBuilder
is a builder used to constructTexture
objects from GL textures. - An event related to a broken windowing system grab.
- A wrapper around
GDK_KEY_
constants and keyval methods. - An event related to a key-based device.
- A
KeymapKey
is a hardware key that can be mapped to a keyval. - A
Texture
representing image data in memory. - Flags to indicate the state of modifier keys and mouse buttons in events.
- An event related to a pointer or touch device motion.
- An event related to a pad-based device.
Paintable
is a simple interface used by GTK to represent content that can be painted.- Flags about a paintable object.
- A
Popup
is a surface that is attached to another surface. - The
PopupLayout
struct contains information that is necessary position aPopup
relative to its parent. - An event related to the proximity of a tool to a device.
- A
RGBA
is used to represent a color, in a way that is compatible with cairo’s notion of color. - A
Rectangle
data type for representing rectangles. - An event related to a scrolling motion.
- The
Seat
object represents a collection of input devices that belong to a user. - Flags describing the seat capabilities.
- Base type for snapshot operations.
- A
Surface
is a rectangular region on the screen. Texture
is the basic element used to refer to pixel data.- Texture
Downloader v4_10
TheTextureDownloader
is used to download the contents of aTexture
. - A
TimeCoord
stores a single event in a motion history. - A
Toplevel
is a freestanding toplevel surface. - The
ToplevelLayout
struct contains information that is necessary to present a sovereign window on screen. - The
ToplevelSize
struct contains information that is useful to compute the size of a toplevel. - Specifies the state of a toplevel surface.
- An event related to a touch-based device.
- 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.VulkanContext
is an object representing the platform-specific Vulkan draw context.
Enums§
- Defines how device axes are interpreted by GTK.
- Cicp
Range v4_16
The values of this enumeration describe whether image data uses the full range of 8-bit values. - Specifies the crossing mode for enter and leave events.
- A pad feature.
- Indicates the specific type of tool being used being a tablet. Such as an airbrush, pencil, etc.
- Dmabuf
Error v4_14
Error enumeration forDmabufTexture
. - Used in
Drag
to the reason of a cancelled DND operation. - Specifies the type of the event.
- Indicates which monitor a surface should span over when in fullscreen mode.
- Error enumeration for
GLContext
. - Defines the reference point of a surface and is used in
PopupLayout
. - An enumeration describing the type of an input device in general terms.
- Describes how well an event matches a given keyval and modifiers.
MemoryFormat
describes formats that image data can have in memory.- Specifies the kind of crossing for enter and leave events.
- Specifies the direction for scroll events.
- Scroll
Unit v4_8
Specifies the unit of scroll deltas. - This enumeration describes how the red, green and blue components of physical pixels on an output device are laid out.
- Determines a surface edge or corner.
- Texture
Error v4_6
Possible errors that can be returned byTexture
constructors. - Titlebar
Gesture v4_4
The kind of title bar gesture to emit withToplevelExt::titlebar_gesture()
. - Specifies the current state of a touchpad gesture.
- Error enumeration for
VulkanContext
.
Constants§
- Defines all possible DND actions.
- 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.
- Represents the current time, and can be used anywhere a time is expected.
- 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.
- A mask covering all entries in
ModifierType
. - This is the priority that the idle handler processing surface updates is given in the main loop.
Functions§
- Read content from the given input stream and deserialize it, asynchronously.
- Registers a function to deserialize object of a given type.
- Registers a function to serialize objects of a given type.
- Serialize content and write it to the given output stream, asynchronously.
- Canonicalizes the given mime type and interns the result.
- Obtains a clip region which contains the areas where the given ranges of text would be drawn.
- Obtains a clip region which contains the areas where the given ranges of text would be drawn.
- pixbuf_
get_ from_ surface Deprecated Transfers image data from acairo::Surface
and converts it to agdk_pixbuf::Pixbuf
. - pixbuf_
get_ from_ texture Deprecated Creates a new pixbuf from @texture. - Sets a list of backends that GDK should try to use.
- Convert from a Unicode character to a key symbol.