Crate gdk4

Source
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.80.

§Documentation

§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

FeatureDescription
v4_18Enable the new APIs part of GTK 4.18
v4_16Enable the new APIs part of GTK 4.16
v4_14Enable the new APIs part of GTK 4.14
v4_12Enable the new APIs part of GTK 4.12
v4_10Enable the new APIs part of GTK 4.10
v4_8Enable the new APIs part of GTK 4.8
v4_6Enable the new APIs part of GTK 4.6
v4_4Enable the new APIs part of GTK 4.4
v4_2Enable the new APIs part of GTK 4.2
glIntegration 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§

builders
Builder pattern types.
prelude
Traits intended for blanket imports.
subclass
Traits intended for creating custom types.

Structs§

AnchorHints
Positioning hints for aligning a surface relative to a rectangle.
AppLaunchContext
Handles launching an application in a graphical context.
AxisFlags
Flags describing the current capabilities of a device/tool.
ButtonEvent
An event related to a button on a pointer device.
CairoContext
Represents the platform-specific draw context.
CicpParamsv4_16
Contains the parameters that define a colorstate with cicp parameters.
Clipboard
Represents data shared between applications or inside an application.
ColorStatev4_16
Provides information to interpret colors and pixels in a variety of ways.
ContentDeserializer
Deserializes content received via inter-application data transfers.
ContentFormats
Used to advertise and negotiate the format of content.
ContentFormatsBuilder
Creates ContentFormats objects.
ContentProvider
Provides content for the clipboard or for drag-and-drop operations in a number of formats.
ContentSerializer
Serializes content for inter-application data transfers.
CrossingEvent
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.
DeleteEvent
An event related to closing a top-level surface.
Device
Represents an input device, such as a keyboard, mouse or touchpad.
DevicePad
An interface for tablet pad devices.
DeviceTool
A physical tool associated to a Device.
Display
A representation of a workstation.
DisplayManager
Offers notification when displays appear or disappear.
DmabufFormatsv4_14
Provides information about supported DMA buffer formats.
DmabufTexturev4_14
A Texture representing a DMA buffer.
DmabufTextureBuilderv4_14
Constructs Texture objects from DMA buffers.
Drag
Represents the source of an ongoing DND operation.
DragAction
Used in Drop and Drag to indicate the actions that the destination can and should do with the dropped data.
DragSurface
A surface that is used during DND.
DragSurfaceSizev4_12
Contains information that is useful to compute the size of a drag surface.
DrawContext
Base class for objects implementing different rendering methods.
Drop
Represents the target of an ongoing DND operation.
Event
Represents windowing system events.
EventSequence
An opaque type representing a sequence of related events.
FileListv4_6
An opaque type representing a list of files.
FocusEvent
An event related to a keyboard focus change.
FrameClock
Tells the application when to update and repaint a surface.
FrameClockPhase
Used to represent the different paint clock phases that can be requested.
FrameTimings
Holds timing information for a single frame of the application’s displays.
GLAPIv4_6
The list of the different APIs that GdkGLContext can potentially support.
GLContext
Represents a platform-specific OpenGL draw context.
GLTexture
A Texture representing a GL texture object.
GLTextureBuilderv4_12
Constructs Texture objects from GL textures.
GRange
GrabBrokenEvent
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.
KeymapKey
Represents a hardware key that can be mapped to a keyval.
MemoryTexture
A Texture representing image data in memory.
MemoryTextureBuilderv4_16
Constructs Texture objects from system memory provided via glib::Bytes.
ModifierType
Flags to indicate the state of modifier keys and mouse buttons in events.
Monitor
Represents the individual outputs that are associated with a Display.
MotionEvent
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.
PaintableFlags
Flags about a paintable object.
Popup
A surface that is attached to another surface.
PopupLayout
Contains information that is necessary position a Popup relative to its parent.
ProximityEvent
An event related to the proximity of a tool to a device.
RGBA
Represents a color, in a way that is compatible with cairo’s notion of color.
Rectangle
Represents a rectangle.
ScrollEvent
An event related to a scrolling motion.
Seat
Represents a collection of input devices that belong to a user.
SeatCapabilities
Flags describing the seat capabilities.
Snapshot
Base type for snapshot operations.
Surface
Represents a rectangular region on the screen.
Texture
Refers to pixel data in various forms.
TextureDownloaderv4_10
Used to download the contents of a Texture.
TimeCoord
Stores a single event in a motion history.
Toplevel
A freestanding toplevel surface.
ToplevelLayout
Contains information that is necessary to present a sovereign window on screen.
ToplevelSize
Contains information that is useful to compute the size of a toplevel.
ToplevelState
Specifies the state of a toplevel surface.
TouchEvent
An event related to a touch-based device.
TouchpadEvent
An event related to a gesture on a touchpad device.
VulkanContextDeprecated
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
CicpRangev4_16
The values of this enumeration describe whether image data uses the full range of 8-bit values.
CrossingMode
Specifies the crossing mode for enter and leave events.
DevicePadFeature
A pad feature.
DeviceToolType
Indicates the specific type of tool being used being a tablet. Such as an airbrush, pencil, etc.
DmabufErrorv4_14
Error enumeration for DmabufTexture.
DragCancelReason
Used in Drag to the reason of a cancelled DND operation.
EventType
Specifies the type of the event.
FullscreenMode
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.
InputSource
An enumeration describing the type of an input device in general terms.
KeyMatch
Describes how well an event matches a given keyval and modifiers.
MemoryFormat
Describes formats that image data can have in memory.
NotifyType
Specifies the kind of crossing for enter and leave events.
ScrollDirection
Specifies the direction for scroll events.
ScrollUnitv4_8
Specifies the unit of scroll deltas.
SubpixelLayout
This enumeration describes how the red, green and blue components of physical pixels on an output device are laid out.
SurfaceEdge
Determines a surface edge or corner.
TextureErrorv4_6
Possible errors that can be returned by Texture constructors.
TitlebarGesturev4_4
The kind of title bar gesture to emit with ToplevelExt::titlebar_gesture().
TouchpadGesturePhase
Specifies the current state of a touchpad gesture.
VulkanError
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
Obtains a clip region which contains the areas where the given ranges of text would be drawn.
pango_layout_line_get_clip_region
Obtains a clip region which contains the areas where the given ranges of text would be drawn.
pixbuf_get_from_surfaceDeprecated
Transfers image data from a cairo::Surface and converts it to a gdk_pixbuf::Pixbuf.
pixbuf_get_from_textureDeprecated
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.