wl_pointer_listener Struct Reference
The wl_pointer interface

`#include <wayland-client-protocol.h>`

## Data Fields

void(* | enter )(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t surface_x, wl_fixed_t surface_y)
void(* | leave )(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface)
void(* | motion )(void *data, struct wl_pointer *wl_pointer, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y)
void(* | button )(void *data, struct wl_pointer *wl_pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
void(* | axis )(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis, wl_fixed_t value)
void(* | frame )(void *data, struct wl_pointer *wl_pointer)
void(* | axis_source )(void *data, struct wl_pointer *wl_pointer, uint32_t axis_source)
void(* | axis_stop )(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis)
void(* | axis_discrete )(void *data, struct wl_pointer *wl_pointer, uint32_t axis, int32_t discrete)

## Detailed Description

Definition at line 4072 of file wayland-client-protocol.h.

## Field Documentation

## axis

void(* wl_pointer_listener::axis) (void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis, wl_fixed_t value)

axis event

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.

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.

Parameters

  time | timestamp with millisecond granularity
  axis | axis type
  value | length of vector in surface-local coordinate space

Definition at line 4173 of file wayland-client-protocol.h.

## axis_discrete

void(* wl_pointer_listener::axis_discrete) (void *data, struct wl_pointer *wl_pointer, uint32_t axis, int32_t discrete)

axis click event

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).

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.

Parameters

  axis | axis type
  discrete | number of steps

Since
  5

Definition at line 4312 of file wayland-client-protocol.h.

## axis_source

void(* wl_pointer_listener::axis_source) (void *data, struct wl_pointer *wl_pointer, uint32_t axis_source)

axis source 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.

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.

Parameters

  axis_source | source of the axis event

Since
  5

Definition at line 4250 of file wayland-client-protocol.h.

## axis_stop

void(* wl_pointer_listener::axis_stop) (void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis)

axis stop 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.

Parameters

  time | timestamp with millisecond granularity
  axis | the axis stopped with this event

Since
  5

Definition at line 4274 of file wayland-client-protocol.h.

## button

void(* wl_pointer_listener::button) (void *data, struct wl_pointer *wl_pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state)

pointer button event

Mouse button click and release notifications.

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. All other button codes above 0xFFFF are currently undefined but may be used in future versions of this protocol.

Parameters

  serial | serial number of the button event
  time | timestamp with millisecond granularity
  button | button that produced the event
  state | physical state of the button

Definition at line 4144 of file wayland-client-protocol.h.

## enter

void(* wl_pointer_listener::enter) (void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t surface_x, wl_fixed_t surface_y)

enter event

Notification that this seat's pointer is focused on a certain surface.

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.

Parameters

  serial | serial number of the enter event
  surface | surface entered by the pointer
  surface_x | surface-local x coordinate
  surface_y | surface-local y coordinate

Definition at line 4087 of file wayland-client-protocol.h.

## frame

void(* wl_pointer_listener::frame) (void *data, struct wl_pointer *wl_pointer)

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.

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.

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.

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.

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.

Since
  5

Definition at line 4217 of file wayland-client-protocol.h.

## leave

void(* wl_pointer_listener::leave) (void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface)

leave event

Notification that this seat's pointer is no longer focused on a certain surface.

The leave notification is sent before the enter notification for the new focus.

Parameters

  serial | serial number of the leave event
  surface | surface left by the pointer

Definition at line 4104 of file wayland-client-protocol.h.

## motion

void(* wl_pointer_listener::motion) (void *data, struct wl_pointer *wl_pointer, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y)

pointer motion event

Notification of pointer location change. The arguments surface_x and surface_y are the location relative to the focused surface.

Parameters

  time | timestamp with millisecond granularity
  surface_x | surface-local x coordinate
  surface_y | surface-local y coordinate

Definition at line 4118 of file wayland-client-protocol.h.

The documentation for this struct was generated from the following file:

- gen/wayland-client-protocol.h