.TH "wayland::pointer_t" 3 "Wed May 3 2023" "Version 1.0.0" "Wayland++" \" -*- nroff -*- .ad l .nh .SH NAME wayland::pointer_t \- pointer input device .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBwayland::proxy_t\fP\&. .SS "Public Types" .in +1c .ti -1c .RI "enum class \fBwrapper_type\fP { \fBstandard\fP, \fBdisplay\fP, \fBforeign\fP, \fBproxy_wrapper\fP }" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "void \fBset_cursor\fP (uint32_t serial, \fBsurface_t\fP const &surface, int32_t hotspot_x, int32_t hotspot_y)" .br .RI "set the pointer surface " .ti -1c .RI "void \fBrelease\fP ()" .br .RI "release the pointer object " .ti -1c .RI "bool \fBcan_release\fP () const" .br .RI "Check whether the \fBrelease\fP function is available with the currently bound version of the protocol\&. " .ti -1c .RI "std::function< void(uint32_t, \fBsurface_t\fP, double, double)> & \fBon_enter\fP ()" .br .RI "enter event " .ti -1c .RI "std::function< void(uint32_t, \fBsurface_t\fP)> & \fBon_leave\fP ()" .br .RI "leave event " .ti -1c .RI "std::function< void(uint32_t, double, double)> & \fBon_motion\fP ()" .br .RI "pointer motion event " .ti -1c .RI "std::function< void(uint32_t, uint32_t, uint32_t, pointer_button_state)> & \fBon_button\fP ()" .br .RI "pointer button event " .ti -1c .RI "std::function< void(uint32_t, pointer_axis, double)> & \fBon_axis\fP ()" .br .RI "axis event " .ti -1c .RI "std::function< void()> & \fBon_frame\fP ()" .br .RI "end of a pointer event sequence " .ti -1c .RI "std::function< void(pointer_axis_source)> & \fBon_axis_source\fP ()" .br .RI "axis source event " .ti -1c .RI "std::function< void(uint32_t, pointer_axis)> & \fBon_axis_stop\fP ()" .br .RI "axis stop event " .ti -1c .RI "std::function< void(pointer_axis, int32_t)> & \fBon_axis_discrete\fP ()" .br .RI "axis click event " .ti -1c .RI "std::function< void(pointer_axis, int32_t)> & \fBon_axis_value120\fP ()" .br .RI "axis high-resolution scroll event " .ti -1c .RI "uint32_t \fBget_id\fP () const" .br .RI "Get the id of a proxy object\&. " .ti -1c .RI "std::string \fBget_class\fP () const" .br .RI "Get the interface name (class) of a proxy object\&. " .ti -1c .RI "uint32_t \fBget_version\fP () const" .br .RI "Get the protocol object version of a proxy object\&. " .ti -1c .RI "\fBwrapper_type\fP \fBget_wrapper_type\fP () const" .br .RI "Get the type of a proxy object\&. " .ti -1c .RI "void \fBset_queue\fP (\fBevent_queue_t\fP queue)" .br .RI "Assign a proxy to an event queue\&. " .ti -1c .RI "wl_proxy * \fBc_ptr\fP () const" .br .RI "Get a pointer to the underlying C struct\&. " .ti -1c .RI "bool \fBproxy_has_object\fP () const" .br .RI "Check whether this wrapper actually wraps an object\&. " .ti -1c .RI "\fBoperator bool\fP () const" .br .RI "Check whether this wrapper actually wraps an object\&. " .ti -1c .RI "bool \fBoperator==\fP (const \fBproxy_t\fP &right) const" .br .RI "Check whether two wrappers refer to the same object\&. " .ti -1c .RI "bool \fBoperator!=\fP (const \fBproxy_t\fP &right) const" .br .RI "Check whether two wrappers refer to different objects\&. " .ti -1c .RI "void \fBproxy_release\fP ()" .br .RI "Release the wrapped object (if any), making this an empty wrapper\&. " .in -1c .SS "Static Public Attributes" .in +1c .ti -1c .RI "static constexpr std::uint32_t \fBset_cursor_since_version\fP = 1" .br .RI "Minimum protocol version required for the \fBset_cursor\fP function\&. " .ti -1c .RI "static constexpr std::uint32_t \fBrelease_since_version\fP = 3" .br .RI "Minimum protocol version required for the \fBrelease\fP function\&. " .in -1c .SH "Detailed Description" .PP pointer input device The wl_pointer interface represents one or more input devices, such as mice, which control the pointer location and pointer_focus of a seat\&. .PP 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\&. .PP \fBExamples\fP .in +1c \fBegl\&.cpp\fP, and \fBshm\&.cpp\fP\&. .PP Definition at line \fB2688\fP of file \fBwayland\-client\-protocol\&.hpp\fP\&. .SH "Member Enumeration Documentation" .PP .SS "enum class \fBwayland::proxy_t::wrapper_type\fP\fC [strong]\fP, \fC [inherited]\fP" Underlying wl_proxy type and properties of a \fBproxy_t\fP that affect construction, destruction, and event handling .PP \fBEnumerator\fP .in +1c .TP \fB\fIstandard \fP\fP C pointer is a standard type compatible with wl_proxy*\&. Events are dispatched and it is destructed when the \fBproxy_t\fP is destructed\&. User data is set\&. .TP \fB\fIdisplay \fP\fP C pointer is a wl_display*\&. No events are dispatched, wl_display_disconnect is called when the \fBproxy_t\fP is destructed\&. User data is set\&. .TP \fB\fIforeign \fP\fP C pointer is a standard type compatible with wl_proxy*, but another library owns it and it should not be touched in a way that could affect the operation of the other library\&. No events are dispatched, wl_proxy_destroy is not called when the \fBproxy_t\fP is destructed, user data is not touched\&. Consequently, there is no reference counting for the \fBproxy_t\fP\&. Lifetime of such wrappers should preferably be short to minimize the chance that the owning library decides to destroy the wl_proxy\&. .TP \fB\fIproxy_wrapper \fP\fP C pointer is a wl_proxy* that was constructed with wl_proxy_create_wrapper\&. No events are dispatched, wl_proxy_wrapper_destroy is called when the \fBproxy_t\fP is destroyed\&. Reference counting is active\&. A reference to the \fBproxy_t\fP creating this proxy wrapper is held to extend its lifetime until after the proxy wrapper is destroyed\&. .PP Definition at line \fB115\fP of file \fBwayland\-client\&.hpp\fP\&. .SH "Member Function Documentation" .PP .SS "wl_proxy * wayland::proxy_t::c_ptr () const\fC [inherited]\fP" .PP Get a pointer to the underlying C struct\&. .PP \fBReturns\fP .RS 4 The underlying wl_proxy wrapped by this \fBproxy_t\fP if it exists, otherwise an exception is thrown .RE .PP .SS "bool pointer_t::can_release () const" .PP Check whether the \fBrelease\fP function is available with the currently bound version of the protocol\&. .PP Definition at line \fB2971\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::string wayland::proxy_t::get_class () const\fC [inherited]\fP" .PP Get the interface name (class) of a proxy object\&. .PP \fBReturns\fP .RS 4 The interface name of the object associated with the proxy .RE .PP .SS "uint32_t wayland::proxy_t::get_id () const\fC [inherited]\fP" .PP Get the id of a proxy object\&. .PP \fBReturns\fP .RS 4 The id the object associated with the proxy .RE .PP .SS "uint32_t wayland::proxy_t::get_version () const\fC [inherited]\fP" .PP Get the protocol object version of a proxy object\&. Gets the protocol object version of a proxy object, or 0 if the proxy was created with unversioned API\&. .PP A returned value of 0 means that no version information is available, so the caller must make safe assumptions about the object's real version\&. .PP \fBdisplay_t\fP will always return version 0\&. .PP \fBReturns\fP .RS 4 The protocol object version of the proxy or 0 .RE .PP .SS "\fBwrapper_type\fP wayland::proxy_t::get_wrapper_type () const\fC [inline]\fP, \fC [inherited]\fP" .PP Get the type of a proxy object\&. .PP Definition at line \fB301\fP of file \fBwayland\-client\&.hpp\fP\&. .SS "std::function< void(uint32_t, pointer_axis, double)> & pointer_t::on_axis ()" .PP axis event .PP \fBParameters\fP .RS 4 \fItime\fP timestamp with millisecond granularity .br \fIaxis\fP axis type .br \fIvalue\fP length of vector in surface-local coordinate space .RE .PP Scroll and other axis notifications\&. .PP 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\&. .PP For devices that support movements non-parallel to axes multiple axis events will be emitted\&. .PP 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\&. .PP When applicable, a client can transform its content relative to the scroll distance\&. .PP Definition at line \fB2997\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void(pointer_axis, int32_t)> & pointer_t::on_axis_discrete ()" .PP axis click event .PP \fBParameters\fP .RS 4 \fIaxis\fP axis type .br \fIdiscrete\fP number of steps .RE .PP Discrete step information for scroll and other axes\&. .PP This event carries the axis value of the wl_pointer\&.axis event in discrete steps (e\&.g\&. mouse wheel clicks)\&. .PP This event is deprecated with wl_pointer version 8 - this event is not sent to clients supporting version 8 or later\&. .PP 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\&. .PP This event is optional; continuous scrolling devices like two-finger scrolling on touchpads do not have discrete steps and do not generate this event\&. .PP The discrete value carries the directional information\&. e\&.g\&. a value of -2 is two steps towards the negative direction of this axis\&. .PP The axis number is identical to the axis number in the associated axis event\&. .PP The order of wl_pointer\&.axis_discrete and wl_pointer\&.axis_source is not guaranteed\&. .PP Definition at line \fB3017\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void(pointer_axis_source)> & pointer_t::on_axis_source ()" .PP axis source event .PP \fBParameters\fP .RS 4 \fIaxis_source\fP source of the axis event .RE .PP Source information for scroll and other axes\&. .PP 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\&. .PP 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\&. .PP 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\&. .PP 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\&. .PP The order of wl_pointer\&.axis_discrete and wl_pointer\&.axis_source is not guaranteed\&. .PP Definition at line \fB3007\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void(uint32_t, pointer_axis)> & pointer_t::on_axis_stop ()" .PP axis stop event .PP \fBParameters\fP .RS 4 \fItime\fP timestamp with millisecond granularity .br \fIaxis\fP the axis stopped with this event .RE .PP Stop notification for scroll and other axes\&. .PP 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\&. .PP Any wl_pointer\&.axis events with the same axis_source after this event should be considered as the start of a new axis motion\&. .PP 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\&. .PP Definition at line \fB3012\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void(pointer_axis, int32_t)> & pointer_t::on_axis_value120 ()" .PP axis high-resolution scroll event .PP \fBParameters\fP .RS 4 \fIaxis\fP axis type .br \fIvalue120\fP scroll distance as fraction of 120 .RE .PP Discrete high-resolution scroll information\&. .PP 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\&. .PP The value120 must not be zero\&. .PP This event replaces the wl_pointer\&.axis_discrete event in clients supporting wl_pointer version 8 or later\&. .PP Where a wl_pointer\&.axis_source event occurs in the same wl_pointer\&.frame, the axis source applies to this event\&. .PP The order of wl_pointer\&.axis_value120 and wl_pointer\&.axis_source is not guaranteed\&. .PP Definition at line \fB3022\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void(uint32_t, uint32_t, uint32_t, pointer_button_state)> & pointer_t::on_button ()" .PP pointer button event .PP \fBParameters\fP .RS 4 \fIserial\fP serial number of the button event .br \fItime\fP timestamp with millisecond granularity .br \fIbutton\fP button that produced the event .br \fIstate\fP physical state of the button .RE .PP Mouse button click and release notifications\&. .PP 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\&. .PP The button is a button code as defined in the Linux kernel's linux/input-event-codes\&.h header file, e\&.g\&. BTN_LEFT\&. .PP Any 16-bit button code value is reserved for future additions to the kernel's event code list\&. All other button codes above 0xFFFF are currently undefined but may be used in future versions of this protocol\&. .PP \fBExamples\fP .in +1c \fBegl\&.cpp\fP, and \fBshm\&.cpp\fP\&. .PP Definition at line \fB2992\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void(uint32_t, \fBsurface_t\fP, double, double)> & pointer_t::on_enter ()" .PP enter event .PP \fBParameters\fP .RS 4 \fIserial\fP serial number of the enter event .br \fIsurface\fP surface entered by the pointer .br \fIsurface_x\fP surface-local x coordinate .br \fIsurface_y\fP surface-local y coordinate .RE .PP Notification that this seat's pointer is focused on a certain surface\&. .PP When a seat's focus enters a surface, the pointer image is undefined and a client should respond to this event by setting an appropriate pointer image with the set_cursor request\&. .PP \fBExamples\fP .in +1c \fBegl\&.cpp\fP, and \fBshm\&.cpp\fP\&. .PP Definition at line \fB2977\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void()> & pointer_t::on_frame ()" .PP end of a pointer event sequence 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\&. .PP All wl_pointer events before a wl_pointer\&.frame event belong logically together\&. For example, 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\&. .PP When multiple wl_pointer\&.axis events occur within the same frame, the motion vector is the combined motion of all events\&. When a wl_pointer\&.axis and a wl_pointer\&.axis_stop event 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_stop events occur within the same frame, this indicates that these axes stopped in the same instance\&. .PP 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\&. .PP The wl_pointer\&.enter and wl_pointer\&.leave events are logical events generated by the compositor and not the hardware\&. These events are 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, 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\&. .PP Definition at line \fB3002\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void(uint32_t, \fBsurface_t\fP)> & pointer_t::on_leave ()" .PP leave event .PP \fBParameters\fP .RS 4 \fIserial\fP serial number of the leave event .br \fIsurface\fP surface left by the pointer .RE .PP Notification that this seat's pointer is no longer focused on a certain surface\&. .PP The leave notification is sent before the enter notification for the new focus\&. .PP Definition at line \fB2982\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "std::function< void(uint32_t, double, double)> & pointer_t::on_motion ()" .PP pointer motion event .PP \fBParameters\fP .RS 4 \fItime\fP timestamp with millisecond granularity .br \fIsurface_x\fP surface-local x coordinate .br \fIsurface_y\fP surface-local y coordinate .RE .PP Notification of pointer location change\&. The arguments surface_x and surface_y are the location relative to the focused surface\&. .PP Definition at line \fB2987\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "wayland::proxy_t::operator bool () const\fC [inherited]\fP" .PP Check whether this wrapper actually wraps an object\&. .PP \fBReturns\fP .RS 4 true if there is an underlying object, false if this wrapper is empty .RE .PP .SS "bool wayland::proxy_t::operator!= (const \fBproxy_t\fP & right) const\fC [inherited]\fP" .PP Check whether two wrappers refer to different objects\&. .SS "bool wayland::proxy_t::operator== (const \fBproxy_t\fP & right) const\fC [inherited]\fP" .PP Check whether two wrappers refer to the same object\&. .SS "bool wayland::proxy_t::proxy_has_object () const\fC [inherited]\fP" .PP Check whether this wrapper actually wraps an object\&. .PP \fBReturns\fP .RS 4 true if there is an underlying object, false if this wrapper is empty .RE .PP .SS "void wayland::proxy_t::proxy_release ()\fC [inherited]\fP" .PP Release the wrapped object (if any), making this an empty wrapper\&. Note that \fBdisplay_t\fP instances cannot be released this way\&. Attempts to do so are ignored\&. .PP \fBExamples\fP .in +1c \fBforeign_display\&.cpp\fP\&. .SS "void pointer_t::release ()" .PP release the pointer object Using this request a client can tell the server that it is not going to use the pointer object anymore\&. .PP This request destroys the pointer proxy object, so clients must not call wl_pointer_destroy() after using this request\&. .PP Definition at line \fB2966\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "void pointer_t::set_cursor (uint32_t serial, \fBsurface_t\fP const & surface, int32_t hotspot_x, int32_t hotspot_y)" .PP set the pointer surface .PP \fBParameters\fP .RS 4 \fIserial\fP serial number of the enter event .br \fIsurface\fP pointer surface .br \fIhotspot_x\fP surface-local x coordinate .br \fIhotspot_y\fP surface-local y coordinate .RE .PP Set the pointer surface, i\&.e\&., the surface that contains the pointer image (cursor)\&. This request gives the surface the role of a cursor\&. If the surface already has another role, it raises a protocol error\&. .PP 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\&. .PP 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\&. .PP 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\&. .PP 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\&. .PP 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\&. .PP The serial parameter must match the latest wl_pointer\&.enter serial number sent to the client\&. Otherwise the request will be ignored\&. .PP \fBExamples\fP .in +1c \fBegl\&.cpp\fP, and \fBshm\&.cpp\fP\&. .PP Definition at line \fB2960\fP of file \fBwayland\-client\-protocol\&.cpp\fP\&. .SS "void wayland::proxy_t::set_queue (\fBevent_queue_t\fP queue)\fC [inherited]\fP" .PP Assign a proxy to an event queue\&. .PP \fBParameters\fP .RS 4 \fIqueue\fP The event queue that will handle this proxy .RE .PP Assign proxy to event queue\&. Events coming from proxy will be queued in queue instead of the display's main queue\&. .PP See also: \fBdisplay_t::dispatch_queue()\fP\&. .PP \fBExamples\fP .in +1c \fBproxy_wrapper\&.cpp\fP\&. .SH "Member Data Documentation" .PP .SS "constexpr std::uint32_t wayland::pointer_t::release_since_version = 3\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBrelease\fP function\&. .PP Definition at line \fB2782\fP of file \fBwayland\-client\-protocol\&.hpp\fP\&. .SS "constexpr std::uint32_t wayland::pointer_t::set_cursor_since_version = 1\fC [static]\fP, \fC [constexpr]\fP" .PP Minimum protocol version required for the \fBset_cursor\fP function\&. .PP Definition at line \fB2767\fP of file \fBwayland\-client\-protocol\&.hpp\fP\&. .SH "Author" .PP Generated automatically by Doxygen for Wayland++ from the source code\&.