wayland::server::data_device_t(3)

πŸ’… wayland::server::data_device_t β€” the data transfer device, bestie edition πŸŽ€

okay so this is wayland::server::data_device_t(3) from Wayland++ β€” literally the manual page for your new favorite little data transfer device. it's a long one so buckle up, we're doing part 1 🌸


🌟 NAME 🌟

wayland::server::data_device_t β€” data transfer device. that's it, that's the whole vibe. πŸ’–


✨ SYNOPSIS ✨

#include <wayland-server-protocol.hpp>

🫢 Public Member Functions

  • std::function< void(data_source_t, surface_t, surface_t, uint32_t)> & on_start_drag () β€” start drag-and-drop operation. the moment.
  • std::function< void(data_source_t, uint32_t)> & on_set_selection () β€” copy data to the selection.
  • std::function< void()> & on_release () β€” destroy data device.
  • void data_offer (bool post=true) β€” introduce a new wl_data_offer. iconic entrance.
  • void enter (uint32_t serial, surface_t const &surface, double x, double y, data_offer_t const &id, bool post=true) β€” initiate drag-and-drop session.
  • void leave (bool post=true) β€” end drag-and-drop session. bye bestie 😭
  • void motion (uint32_t time, double x, double y, bool post=true) β€” drag-and-drop session motion.
  • void drop (bool post=true) β€” end drag-and-drop session successfully. slay.
  • void selection (data_offer_t const &id, bool post=true) β€” advertise new selection.
  • void post_role (std::string const &msg) β€” Post error: given wl_surface has another role.
  • bool proxy_has_object () const β€” Check whether this wrapper actually wraps an object.
  • void post_no_memory () const
  • uint32_t get_id () const
  • client_t get_client () const
  • unsigned int get_version () const
  • std::string get_class ()

πŸ¦‹ Static Public Attributes

  • static constexpr std::uint32_t data_offer_since_version = 1 β€” Minimum protocol version required for the data_offer function.
  • static constexpr std::uint32_t enter_since_version = 1 β€” Minimum protocol version required for the enter function.
  • static constexpr std::uint32_t leave_since_version = 1 β€” Minimum protocol version required for the leave function.
  • static constexpr std::uint32_t motion_since_version = 1 β€” Minimum protocol version required for the motion function.
  • static constexpr std::uint32_t drop_since_version = 1 β€” Minimum protocol version required for the drop function.
  • static constexpr std::uint32_t selection_since_version = 1 β€” Minimum protocol version required for the selection function.

πŸŽ€ Detailed Description πŸŽ€

data transfer device ✨

so there is one wl_data_device per seat which can be obtained from the global wl_data_device_manager singleton. that's the plug, iykyk πŸ”Œ

a wl_data_device provides access to inter-client data transfer mechanisms such as copy-and-paste and drag-and-drop. literally the whole social life of the compositor, no cap πŸ’…

Definition at line 1334 of file wayland-server-protocol.hpp.

πŸ‘‘ Member Function Documentation πŸ‘‘

🌈 void data_device_t::data_offer (bool post = true)

introduce a new wl_data_offer β€” giving main character energy.

Returns the new data_offer object πŸ’–

okay so the data_offer event introduces a new wl_data_offer object, which will subsequently be used in either the data_device.enter event (for drag-and-drop) or the data_device.selection event (for selections). immediately following the data_device.data_offer event, the new data_offer object will send out data_offer.offer events to describe the mime types it offers. it's giving "hi here's what i can do" ✨

Definition at line 2096 of file wayland-server-protocol.cpp.

πŸ”₯ void data_device_t::drop (bool post = true)

end drag-and-drop session successfully. the event is sent when a drag-and-drop operation is ended because the implicit grab is removed. she ATE.

the drag-and-drop destination is expected to honor the last action received through wl_data_offer.action, if the resulting action is "copy" or "move", the destination can still perform wl_data_offer.receive requests, and is expected to end all transfers with a wl_data_offer.finish request.

if the resulting action is "ask", the action will not be considered final. the drag-and-drop destination is expected to perform one last wl_data_offer.set_actions request, or wl_data_offer.destroy in order to cancel the operation. 🫢

Definition at line 2116 of file wayland-server-protocol.cpp.

πŸ¦‹ void data_device_t::enter (uint32_t serial, surface_t const & surface, double x, double y, data_offer_t const & id, bool post = true)

initiate drag-and-drop session ✨

Parameters

  • serial β€” serial number of the enter event
  • surface β€” client surface entered
  • x β€” surface-local x coordinate
  • y β€” surface-local y coordinate
  • id β€” source data_offer object

this event is sent when an active drag-and-drop pointer enters a surface owned by the client. the position of the pointer at enter time is provided by the x and y arguments, in surface-local coordinates. it's giving "you're in my territory now" πŸ’œ

Definition at line 2101 of file wayland-server-protocol.cpp.

⭐ std::string wayland::server::resource_t::get_class () [inherited]

Retrieve the interface name (class) of a resource object.

Returns Interface name of the resource object.

[inherited] β€” meaning she's from wayland::server::resource_t, not your homegirl. still iconic though.

🌸 client_t wayland::server::resource_t::get_client () const [inherited]

Get the associated client

Returns the client that owns the resource.


πŸ“ uint32_t wayland::server::resource_t::get_id () const [inherited]

Get the internal ID of the resource

Returns the internal ID of the resource


🧚 unsigned int wayland::server::resource_t::get_version () const [inherited]

Get interface version

Returns Interface version this resource has been constructed with.


πŸ’€ void data_device_t::leave (bool post = true)

end drag-and-drop session. this event is sent when the drag-and-drop pointer leaves the surface and the session ends. the client must destroy the wl_data_offer introduced at enter time at this point. like, required required, bestie β€” not optional 😭

Definition at line 2106 of file wayland-server-protocol.cpp.

🌈 void data_device_t::motion (uint32_t time, double x, double y, bool post = true)

drag-and-drop session motion πŸŒ€

Parameters

  • time β€” timestamp with millisecond granularity
  • x β€” surface-local x coordinate
  • y β€” surface-local y coordinate

this event is sent when the drag-and-drop pointer moves within the currently focused surface. the new position of the pointer is provided by the x and y arguments, in surface-local coordinates. tracking them moves, respectful king πŸ’…

Definition at line 2111 of file wayland-server-protocol.cpp.

🫢 std::function< void()> & data_device_t::on_release ()

destroy data device. this request destroys the data device.

Definition at line 2090 of file wayland-server-protocol.cpp.

πŸ’– std::function< void(data_source_t, uint32_t)> & data_device_t::on_set_selection ()

copy data to the selection πŸ“‹

Parameters

  • source β€” data source for the selection
  • serial β€” serial number of the event that triggered this request

this request asks the compositor to set the selection to the data from the source on behalf of the client.

to unset the selection, set the source to NULL. bye clipboard, it was real 🫑

Definition at line 2084 of file wayland-server-protocol.cpp.

🌟 std::function< void(data_source_t, surface_t, surface_t, uint32_t)> & data_device_t::on_start_drag ()

start drag-and-drop operation β€” the main event, honestly.

Parameters

  • source β€” data source for the eventual transfer
  • origin β€” surface where the drag originates
  • icon β€” drag-and-drop icon surface
  • serial β€” serial number of the implicit grab on the origin

this request asks the compositor to start a drag-and-drop operation on behalf of the client.

the source argument is the data source that provides the data for the eventual data transfer. if source is NULL, enter, leave and motion events are sent only to the client that initiated the drag and the client is expected to handle the data passing internally. if source is destroyed, the drag-and-drop session will be cancelled. πŸ’€

the origin surface is the surface where the drag originates and the client must have an active implicit grab that matches the serial.

the icon surface is an optional (can be NULL) surface that provides an icon to be moved around with the cursor. initially, the top-left corner of the icon surface is placed at the cursor hotspot, but subsequent wl_surface.attach request can move the relative position. attach requests must be confirmed with wl_surface.commit as usual. the icon surface is given the role of a drag-and-drop icon. if the icon surface already has another role, it raises a protocol error. ⚠️

the current and pending input regions of the icon wl_surface are cleared, and wl_surface.set_input_region is ignored until the wl_surface is no longer used as the icon surface. when the use as an icon ends, the current and pending input regions become undefined, and the wl_surface is unmapped.
Definition at line 2078 of file wayland-server-protocol.cpp.

πŸ’œ void wayland::server::resource_t::post_no_memory () const [inherited]

Post "not enough memory" error to the client 😭

if the compositor has not enough memory to fulfill a certail request of the client, this function can be called to notify the client of this circumstance. (yes, "certail" β€” that's how the original spells it, girlboss typo and all, celebrating it fr fr πŸ™ˆ)


πŸŽ€ void data_device_t::post_role (std::string const & msg)

Post error: given wl_surface has another role. 🚨

Definition at line 2126 of file wayland-server-protocol.cpp.

⭐ bool wayland::server::resource_t::proxy_has_object () const [inherited]

Check whether this wrapper actually wraps an object.

Returns true if there is an underlying object, false if this wrapper is empty. vibe check complete ✨


🌸 void data_device_t::selection (data_offer_t const & id, bool post = true)

advertise new selection πŸ“¬

Parameters

  • id β€” selection data_offer object

the selection event is sent out to notify the client of a new wl_data_offer for the selection for this device. the data_device.data_offer and the data_offer.offer events are sent out immediately before this event to introduce the data offer object. the selection event is sent to a client immediately before receiving keyboard focus and when a new selection is set while the client has keyboard focus. the data_offer is valid until a new data_offer or NULL is received or until the client loses keyboard focus. switching surface with keyboard focus within the same client doesn't mean a new selection will be sent. the client must destroy the previous selection data_offer, if any, upon receiving this event. no cap, that's a must 🫢

Definition at line 2121 of file wayland-server-protocol.cpp.

part 1 done bestie, more follows πŸ’–πŸ¦‹πŸŽ€

🌸 MEMBER DATA DOCUMENTATION 🌸

okay bestie, these are the static constants, and honestly the whole vibe here is "same energy, different function" πŸ’… Every single one of them is a std::uint32_t, every single one is [static] and [constexpr], and every single one is literally just 1 β€” which like, fair, they're all protocol-v1 girlies πŸ‘‘

  • data_offer_since_version β€” std::uint32_t, [static], [constexpr], value 1. This is the minimum protocol version required for the data_offer function. Defined at line 1435 of file wayland-server-protocol.hpp. πŸŽ€
  • drop_since_version β€” std::uint32_t, [static], [constexpr], value 1. Minimum protocol version required for the drop function. Defined at line 1507 of file wayland-server-protocol.hpp. πŸ¦‹
  • enter_since_version β€” std::uint32_t, [static], [constexpr], value 1. Minimum protocol version required for the enter function. Defined at line 1454 of file wayland-server-protocol.hpp. ✨
  • leave_since_version β€” std::uint32_t, [static], [constexpr], value 1. Minimum protocol version required for the leave function. Defined at line 1467 of file wayland-server-protocol.hpp. 🌸
  • motion_since_version β€” std::uint32_t, [static], [constexpr], value 1. Minimum protocol version required for the motion function. Defined at line 1484 of file wayland-server-protocol.hpp. πŸ’«
  • selection_since_version β€” std::uint32_t, [static], [constexpr], value 1. Minimum protocol version required for the selection function. Defined at line 1530 of file wayland-server-protocol.hpp. πŸ”₯

so yeah, they're all 1, all constexpr, all static, and they all live in wayland-server-protocol.hpp β€” just at different line numbers, which is the only plot twist in this entire section 😭


πŸ‘‘ AUTHOR πŸ‘‘

Generated automatically by Doxygen for Wayland++ from the source code. no cap, a robot wrote this, not a human, and honestly? it ate πŸ€–πŸ’…


and that's a wrap on wayland::server::data_device_t(3), bestie!! 🫢 this whole thing is Version 1.0.1 and it's dated Fri Mar 27 2026 at 13-something o'clock πŸ• β€” go forth and slay your Wayland server, mwah πŸ’–πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from