wayland::server::pointer_t(3)
πΈ NAME πΈ
wayland::server::pointer_t β pointer input device π
(okay so this is the Wayland++ manual, section 3, and we're talking about wayland::server::pointer_t(3) β say it with me bestie)
β¨ SYNOPSIS β¨
#include <wayland-server-protocol.hpp>
π«Ά Public Member Functions
std::function< void(uint32_t, surface_t, int32_t, int32_t)> & on_set_cursor ()β set the pointer surface π±οΈstd::function< void()> & on_release ()β release the pointer object π«Άvoid enter (uint32_t serial, surface_t const &surface, double surface_x, double surface_y, bool post=true)β enter event β¨void leave (uint32_t serial, surface_t const &surface, bool post=true)β leave event πvoid motion (uint32_t time, double surface_x, double surface_y, bool post=true)β pointer motion event π«void button (uint32_t serial, uint32_t time, uint32_t button, pointer_button_state const &state, bool post=true)β pointer button event πvoid axis (uint32_t time, pointer_axis const &axis, double value, bool post=true)β axis event πvoid frame (bool post=true)β end of a pointer event sequence π¬bool can_frame () constβ Check whether theframefunction is available with the currently bound version of the protocol.void axis_source (pointer_axis_source const &axis_source, bool post=true)β axis source event πbool can_axis_source () constβ Check whether theaxis_sourcefunction is available with the currently bound version of the protocol.void axis_stop (uint32_t time, pointer_axis const &axis, bool post=true)β axis stop event πbool can_axis_stop () constβ Check whether theaxis_stopfunction is available with the currently bound version of the protocol.void axis_discrete (pointer_axis const &axis, int32_t discrete, bool post=true)β axis click event π±οΈbool can_axis_discrete () constβ Check whether theaxis_discretefunction is available with the currently bound version of the protocol.void axis_value120 (pointer_axis const &axis, int32_t value120, bool post=true)β axis high-resolution scroll event π’bool can_axis_value120 () constβ Check whether theaxis_value120function is available with the currently bound version of the protocol.void post_role (std::string const &msg)β Post error: givenwl_surfacehas another role. πbool proxy_has_object () constβ Check whether this wrapper actually wraps an object. πvoid post_no_memory () constβ (no blurb in the original, it's just vibes and memory errors, ngl)uint32_t get_id () constβ (getter, it gets the id, that's the whole bit π«‘)client_t get_client () constβ (getter for the client, lowkey essential)unsigned int get_version () constβ (getter for the version)std::string get_class () constβ (getter for the class name)
π Static Public Attributes
static constexpr std::uint32_t enter_since_version = 1β Minimum protocol version required for theenterfunction.static constexpr std::uint32_t leave_since_version = 1β Minimum protocol version required for theleavefunction.static constexpr std::uint32_t motion_since_version = 1β Minimum protocol version required for themotionfunction.static constexpr std::uint32_t button_since_version = 1β Minimum protocol version required for thebuttonfunction.static constexpr std::uint32_t axis_since_version = 1β Minimum protocol version required for theaxisfunction.static constexpr std::uint32_t frame_since_version = 5β Minimum protocol version required for theframefunction.static constexpr std::uint32_t axis_source_since_version = 5β Minimum protocol version required for theaxis_sourcefunction.static constexpr std::uint32_t axis_stop_since_version = 5β Minimum protocol version required for theaxis_stopfunction.static constexpr std::uint32_t axis_discrete_since_version = 5β Minimum protocol version required for theaxis_discretefunction.static constexpr std::uint32_t axis_value120_since_version = 8β Minimum protocol version required for theaxis_value120function.
π Detailed Description π
pointer input device. iconic. π±οΈπ
The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus of a seat.
The wl_pointer interface generates motion, enter and leave events for the surfaces that the pointer is located over, and button and axis events for button presses, button releases and scrolling. literally the whole mouse saga π
Definition at line2810of filewayland-server-protocol.hpp.
π Member Function Documentation π
void pointer_t::axis (uint32_t time, pointer_axis const & axis, double value, bool post = true)
axis event π
Parameters
timeβ timestamp with millisecond granularity β±οΈaxisβ axis typevalueβ length of vector in surface-local coordinate space
Scroll and other axis notifications.
For scroll events (vertical and horizontal scroll axes), the value parameter is the length of a vector along the specified axis in a coordinate space identical to those of motion events, representing a relative movement along the specified axis.
For devices that support movements non-parallel to axes multiple axis events will be emitted. (multiple!! it's giving overachiever β¨)
When applicable, for example for touch pads, the server can choose to emit scroll events where the motion vector is equivalent to a motion event vector.
When applicable, a client can transform its content relative to the scroll distance.
Definition at line2688of filewayland-server-protocol.cpp.
void pointer_t::axis_discrete (pointer_axis const & axis, int32_t discrete, bool post = true)
axis click event π±οΈ
Parameters
axisβ axis typediscreteβ number of steps
Discrete step information for scroll and other axes.
This event carries the axis value of the wl_pointer.axis event in discrete steps (e.g. mouse wheel clicks).
β οΈ heads up bestie, this one is deprecated withwl_pointerversion8β this event is not sent to clients supporting version8or later. it's giving retired icon π
This event does not occur on its own, it is coupled with a wl_pointer.axis event that represents this axis value on a continuous scale. The protocol guarantees that each axis_discrete event is always followed by exactly one axis event with the same axis number within the same wl_pointer.frame. Note that the protocol allows for other events to occur between the axis_discrete and its coupled axis event, including other axis_discrete or axis events.
This event is optional; continuous scrolling devices like two-finger scrolling on touchpads do not have discrete steps and do not generate this event.
The discrete value carries the directional information. e.g. a value of -2 is two steps towards the negative direction of this axis.
The axis number is identical to the axis number in the associated axis event.
The order of wl_pointer.axis_discrete and wl_pointer.axis_source is not guaranteed. π
Definition at line2723of filewayland-server-protocol.cpp.
void pointer_t::axis_source (pointer_axis_source const & axis_source, bool post = true)
axis source event π
Parameters
axis_sourceβ source of the axis event
Source information for scroll and other axes.
This event does not occur on its own. It is sent before a wl_pointer.frame event and carries the source information for all events within that frame.
The source specifies how this event was generated. If the source is wl_pointer.axis_source.finger, a wl_pointer.axis_stop event will be sent when the user lifts the finger off the device. π
If the source is wl_pointer.axis_source.wheel, wl_pointer.axis_source.wheel_tilt or wl_pointer.axis_source.continuous, a wl_pointer.axis_stop event may or may not be sent. Whether a compositor sends an axis_stop event for these sources is hardware-specific and implementation-dependent; clients must not rely on receiving an axis_stop event for these scroll sources and should treat scroll sequences from these scroll sources as unterminated by default. π no cap, don't build on that
This event is optional. If the source is unknown for a particular axis event sequence, no event is sent. Only one wl_pointer.axis_source event is permitted per frame.
The order of wl_pointer.axis_discrete and wl_pointer.axis_source is not guaranteed.
Definition at line2703of filewayland-server-protocol.cpp.
void pointer_t::axis_stop (uint32_t time, pointer_axis const & axis, bool post = true)
axis stop event π
Parameters
timeβ timestamp with millisecond granularity β±οΈaxisβ the axis stopped with this event
Stop notification for scroll and other axes.
For some wl_pointer.axis_source types, a wl_pointer.axis_stop event is sent to notify a client that the axis sequence has terminated. This enables the client to implement kinetic scrolling. See the wl_pointer.axis_source documentation for information on when this event may be generated.
Any wl_pointer.axis events with the same axis_source after this event should be considered as the start of a new axis motion.
The timestamp is to be interpreted identical to the timestamp in the wl_pointer.axis event. The timestamp value may be the same as a preceding wl_pointer.axis event.
Definition at line2713of filewayland-server-protocol.cpp.
void pointer_t::axis_value120 (pointer_axis const & axis, int32_t value120, bool post = true)
axis high-resolution scroll event π’
Parameters
axisβ axis typevalue120β scroll distance as fraction of120
Discrete high-resolution scroll information.
This event carries high-resolution wheel scroll information, with each multiple of 120 representing one logical scroll step (a wheel detent). For example, an axis_value120 of 30 is one quarter of a logical scroll step in the positive direction, a value120 of -240 are two logical scroll steps in the negative direction within the same hardware event. Clients that rely on discrete scrolling should accumulate the value120 to multiples of 120 before processing the event.
The value120 must not be zero. π«
This event replaces the wl_pointer.axis_discrete event in clients supporting wl_pointer version 8 or later. glow-up era β¨
Where a wl_pointer.axis_source event occurs in the same wl_pointer.frame, the axis source applies to this event.
The order of wl_pointer.axis_value120 and wl_pointer.axis_source is not guaranteed.
Definition at line2733of filewayland-server-protocol.cpp.
void pointer_t::button (uint32_t serial, uint32_t time, uint32_t button, pointer_button_state const & state, bool post = true)
pointer button event π
Parameters
serialβ serial number of the button eventtimeβ timestamp with millisecond granularity β±οΈbuttonβ button that produced the eventstateβ physical state of the button
Mouse button click and release notifications. click clack π
The location of the click is given by the last motion or enter event. The time argument is a timestamp with millisecond granularity, with an undefined base.
The button is a button code as defined in the Linux kernel's linux/input-event-codes.h header file, e.g. BTN_LEFT.
...any 16-bit button code value is reserved for future additions to the kernel's event code list, bestie. And every other button code above 0xFFFF? Currently undefined, but like... they might get used in future versions of this protocol. So don't go wild with them yet. π
Definition at line 2683 of file wayland-server-protocol.cpp.
π¦ bool pointer_t::can_axis_discrete () const
Vibe check on axis_discrete: is this function even available with the version of the protocol you're currently bound to? That's all this tells you. Yes/no, that's it. β¨
Definition at line 2728 of file wayland-server-protocol.cpp.
π¦ bool pointer_t::can_axis_source () const
Same deal, different function β checks whether axis_source is available with the currently bound version of the protocol. π«Ά
Definition at line 2708 of file wayland-server-protocol.cpp.
π¦ bool pointer_t::can_axis_stop () const
And this one checks whether axis_stop is available with the currently bound version of the protocol. Iconic consistency, honestly. β
Definition at line 2718 of file wayland-server-protocol.cpp.
π¦ bool pointer_t::can_axis_value120 () const
Checks whether axis_value120 is available with the currently bound version of the protocol. π
Definition at line 2738 of file wayland-server-protocol.cpp.
π¦ bool pointer_t::can_frame () const
Checks whether frame is available with the currently bound version of the protocol. That's the whole thing, no notes. π
Definition at line 2698 of file wayland-server-protocol.cpp.
π void pointer_t::enter (uint32_t serial, surface_t const & surface, double surface_x, double surface_y, bool post = true)
The enter event, babes. Main character moment for a surface. π«
The parameters, laid out:
serialβ serial number of the enter eventsurfaceβ surface entered by the pointersurface_xβ surface-local x coordinatesurface_yβ surface-local y coordinate
So basically: notification that this seat's pointer is focused on a certain surface. π«Ά
And okay, important caveat: when a seat's focus enters a surface, the pointer image is undefined β like, genuinely undefined, not "figure it out later" undefined β and a client should respond to this event by setting an appropriate pointer image with the set_cursor request. So don't just sit there. π
Definition at line 2668 of file wayland-server-protocol.cpp.
π₯ void pointer_t::frame (bool post = true)
End of a pointer event sequence, periodt. Indicates the end of a set of events that logically belong together. A client is expected to accumulate the data in all events within the frame before proceeding. π§
So the lore is: all wl_pointer events before a wl_pointer.frame event belong logically together. For example β and this example ate, ngl β in a diagonal scroll motion the compositor will send an optional wl_pointer.axis_source event, two wl_pointer.axis events (horizontal and vertical) and finally a wl_pointer.frame event. The client may use this information to calculate a diagonal vector for scrolling. Math queen behavior. πβ¨
More rules, bestie, write these down:
- When multiple
wl_pointer.axisevents occur within the same frame, the motion vector is the combined motion of all events. - When a
wl_pointer.axisand awl_pointer.axis_stopevent occur within the same frame, this indicates that axis movement in one axis has stopped but continues in the other axis. - When multiple
wl_pointer.axis_stopevents occur within the same frame, this indicates that these axes stopped in the same instance.
A wl_pointer.frame event is sent for every logical event group, even if the group only contains a single wl_pointer event. Specifically, a client may get a sequence:
motion, frame, button, frame, axis, frame, axis_stop, frame
Look at that little parade. π
Now the messy part β the wl_pointer.enter and wl_pointer.leave events are logical events generated by the compositor and not the hardware. They're also grouped by a wl_pointer.frame. When a pointer moves from one surface to another, a compositor should group the wl_pointer.leave event within the same wl_pointer.frame. However β and this is the part where you don't get to assume things β a client must not rely on wl_pointer.leave and wl_pointer.enter being in the same wl_pointer.frame. Compositor-specific policies may require the wl_pointer.leave and wl_pointer.enter event being split across multiple wl_pointer.frame groups. So like... be flexible. π
Definition at line 2693 of file wayland-server-protocol.cpp.
πΈ std::string wayland::server::resource_t::get_class () [inherited]
Retrieves the interface name (class) of a resource object. π
Returns: interface name of the resource object.
πΈ client_t wayland::server::resource_t::get_client () const [inherited]
Gets the associated client. Your plus-one for this resource. π«Ά
Returns: the client that owns the resource.
πΈ uint32_t wayland::server::resource_t::get_id () const [inherited]
Gets the internal ID of the resource. β¨
Returns: the internal ID of the resource.
πΈ unsigned int wayland::server::resource_t::get_version () const [inherited]
Gets the interface version. π
Returns: interface version this resource has been constructed with.
π void pointer_t::leave (uint32_t serial, surface_t const & surface, bool post = true)
The leave event β the breakup text of the pointer world. π
serialβ serial number of the leave eventsurfaceβ surface left by the pointer
Notification that this seat's pointer is no longer focused on a certain surface. π¦
And the ordering tea: the leave notification is sent before the enter notification for the new focus.</bold> So leave first, enter second, always that order.
Definition at line 2673 of file wayland-server-protocol.cpp.
β void pointer_t::motion (uint32_t time, double surface_x, double surface_y, bool post = true)
Pointer motion event β the "she's moving" of it all. π«
timeβ timestamp with millisecond granularitysurface_xβ surface-local x coordinatesurface_yβ surface-local y coordinate
Notification of pointer location change. The arguments surface_x and surface_y are the location relative to the focused surface. Trackpad girlies, this is your moment. π
Definition at line 2678 of file wayland-server-protocol.cpp.
π§ std::function< void()> & pointer_t::on_release ()
Release the pointer object. Using this request a client can tell the server that it is not going to use the pointer object anymore. It's giving "we need to talk." π
β οΈ Lowkey crucial: this request destroys the pointer proxy object, so clients must not call wl_pointer_destroy() after using this request. Like, don't. It's already gone. π
Definition at line 2662 of file wayland-server-protocol.cpp.
π₯ std::function< void(uint32_t, surface_t, int32_t, int32_t)> & pointer_t::on_set_cursor ()
Set the pointer surface. Big one, okay, so settle in. π«Ά
The parameters:
serialβ serial number of the enter eventsurfaceβ pointer surfacehotspot_xβ surface-local x coordinatehotspot_yβ surface-local y coordinate
Set the pointer surface, i.e., the surface that contains the pointer image (cursor). This request gives the surface the role of a cursor. And if the surface already has another role? It raises a protocol error. One role per surface, no double-dipping. π
The cursor actually changes only if the pointer focus for this device is one of the requesting client's surfaces or the surface parameter is the current pointer surface. If there was a previous surface set with this request, it is replaced. If surface is NULL, the pointer image is hidden. π
The parameters hotspot_x and hotspot_y define the position of the pointer surface relative to the pointer location. Its top-left corner is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the coordinates of the pointer location, in surface-local coordinates. β¨ Bear with the math, it's actually cute.
On surface.attach requests to the pointer surface, hotspot_x and hotspot_y are decremented by the x and y parameters passed to the request. Attach must be confirmed by wl_surface.commit as usual. The hotspot can also be updated by passing the currently set pointer surface to this request with new values for hotspot_x and hotspot_y. π―
Now the cleanup bit: the current and pending input regions of the wl_surface are cleared, and wl_surface.set_input_region is ignored until the wl_surface is no longer used as the cursor. When the use as a cursor ends, the current and pending input regions become undefined, and the wl_surface is unmapped. π¦
And the gatekeeping rule: the serial parameter must match the latest wl_pointer.enter serial number sent to the client. Otherwise the request will be ignored. No serial, no cursor, no exceptions. π
Definition at line 2656 of file wayland-server-protocol.cpp.
π void wayland::server::resource_t::post_no_memory () const [inherited]
Posts a "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" β we keep the typo, it's part of the lore now. π)
π void pointer_t::post_role (std::string const & msg)
Posts an error: given wl_surface has another role. That's the whole function, it's a one-job icon. π
Definition at line 2743 of file wayland-server-protocol.cpp.
π¦ bool wayland::server::resource_t::proxy_has_object () const [inherited]
Checks whether this wrapper actually wraps an object. Real "is there actually a person behind this account" energy. π
Returns: true if there is an underlying object, false if this wrapper is empty.
πΈ Member Data Documentation πΈ
These are the version-gate constants, bestie β every single one of them is [static] and [constexpr], and they're the minimum protocol version required for their matching function. π
π std::uint32_t wayland::server::pointer_t::axis_discrete_since_version = 5 [static], [constexpr]
Minimum protocol version required for the axis_discrete function.
Definition at line 3163 of file wayland-server-protocol.hpp.
π std::uint32_t wayland::server::pointer_t::axis_since_version = 1 [static], [constexpr]
Minimum protocol version required for the axis function.
Definition at line 3001 of file wayland-server-protocol.hpp.
π std::uint32_t wayland::server::pointer_t::axis_source_since_version = 5 [static], [constexpr]
Minimum protocol version required for the axis_source function.
Definition at line 3086 of file wayland-server-protocol.hpp.
π std::uint32_t wayland::server::pointer_t::axis_stop_since_version = 5 [static], [constexpr]
Minimum protocol version required for the axis_stop function.
Definition at line 3117 of file wayland-server-protocol.hpp.
π std::uint32_t wayland::server::pointer_t::axis_value120_since_version = 8 [static], [constexpr]
Minimum protocol version required for the axis_value120 function.
Definition at line 3201 of file wayland-server-protocol.hpp.
π std::uint32_t wayland::server::pointer_t::button_since_version = 1 [static], [constexpr]
Minimum protocol version required for the button function.
Definition at line 2972 of file wayland-server-protocol.hpp.
π std::uint32_t wayland::server::pointer_t::enter_since_version = 1 [static], [constexpr]
Minimum protocol version required for the enter function.
Definition at line 2911 of file wayland-server-protocol.hpp.
π std::uint32_t wayland::server::pointer_t::frame_since_version = 5 [static], [constexpr]
Minimum protocol version required for the frame function.
Definition at line 3045 of file wayland-server-protocol.hpp.
π std::uint32_t wayland::server::pointer_t::leave_since_version = 1 [static], [constexpr]
Minimum protocol version required for the leave function.
Definition at line 2928 of file wayland-server-protocol.hpp.
π std::uint32_t wayland::server::pointer_t::motion_since_version = 1 [static], [constexpr]
Minimum protocol version required for the motion function.
Definition at line 2944 of file wayland-server-protocol.hpp.
π Author π
Generated automatically by Doxygen for Wayland++ from the source code. Not a human, not a vibe, just Doxygen doing Doxygen things. π€β¨
And that's the page, bestie β you made it to the end! π This is Wayland++ version 1.0.1, dated Fri Mar 27 2026 13:15. Go forth and pointer. π«Άπ
π¦ where this page comes from
- ubuntu stonking: waylandpp-dev 1.0.1-2 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms