Louvre v2.18.1-1
C++ library for Wayland compositors
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
LPointerScrollEvent Class Referencefinal

Pointer scroll event. More...

#include <LPointerScrollEvent.h>

+ Inheritance diagram for LPointerScrollEvent:

Public Types

enum  Source : UInt32
 Source of a scroll event. More...
 
- Public Types inherited from LEvent
enum class  Type : UInt8
 Defines the type of event. More...
 
enum class  Subtype : UInt8
 Defines the subtype of event. More...
 

Public Member Functions

 LPointerScrollEvent (const LPointF &axes=LPointF(0.f, 0.f), const LPointF &axesDiscrete=LPoint(0, 0), bool hasX=true, bool hasY=true, Source source=Continuous, UInt32 serial=LTime::nextSerial(), UInt32 ms=LTime::ms(), UInt64 us=LTime::us(), LInputDevice *device=nullptr) noexcept
 Constructs an LPointerScrollEvent object.
 
bool hasX () const noexcept
 Indicates whether the event includes a value for the X axis.
 
void setHasX (bool hasX) noexcept
 Sets whether the event includes a value for the X axis.
 
bool hasY () const noexcept
 Indicates whether the event includes a value for the Y axis.
 
void setHasY (bool hasY) noexcept
 Sets whether the event includes a value for the Y axis.
 
void setAxes (const LPointF &axes) noexcept
 Sets the scroll axes values.
 
void setAxes (Float32 x, Float32 y) noexcept
 Sets the scroll axes values.
 
void setX (Float32 x) noexcept
 Sets the scroll value along the x-axis.
 
void setY (Float32 y) noexcept
 Sets the scroll value along the y-axis.
 
const LPointFaxes () const noexcept
 Gets the scroll axes values.
 
void setDiscreteAxes (const LPoint &axes) noexcept
 Sets the discrete scroll axes values.
 
void setDiscreteAxes (Int32 x, Int32 y) noexcept
 Sets the discrete scroll axes values using individual x and y components.
 
void setDiscreteX (Int32 x) noexcept
 Sets the discrete scroll value along the x-axis.
 
void setDiscreteY (Int32 y) noexcept
 Sets the discrete scroll value along the y-axis.
 
const LPointdiscreteAxes () const noexcept
 Retrieves the discrete scroll axes values.
 
void setSource (Source source) noexcept
 Sets the source of the scroll event.
 
Source source () const noexcept
 Gets the source of the scroll event.
 
- Public Member Functions inherited from LInputEvent
void setDevice (LInputDevice *device) noexcept
 Sets the input device that originated the event.
 
LInputDevicedevice () const noexcept
 Gets the input device that originated this event.
 
- Public Member Functions inherited from LEvent
 ~LEvent () noexcept=default
 Destructor.
 
Type type () const noexcept
 Retrieves the type of the event.
 
Subtype subtype () const noexcept
 Retrieves the subtype of the event.
 
void setSerial (UInt32 serial) noexcept
 Sets the serial of the event.
 
UInt32 serial () const noexcept
 Retrieves the serial of the event.
 
void setMs (UInt32 ms) noexcept
 Sets the time the event was generated in milliseconds.
 
UInt32 ms () const noexcept
 Retrieves the time the event was generated in milliseconds.
 
void setUs (UInt32 us) noexcept
 Sets the time the event was generated in microseconds.
 
UInt64 us () const noexcept
 Retrieves the time the event was generated in microseconds.
 
LEventcopy () const noexcept
 Creates a deep copy of the event.
 

Detailed Description

Pointer scroll event.

When handling mouse wheel events on the server, its recommended to choose either Wheel or WheelLegacy and avoid handling both due to their semantic differences.

However, all events should still be dispatched to clients through LPointer::sendScrollEvent(). Louvre internally filters them appropriately based on the wl_pointer version used by the client.

Member Enumeration Documentation

◆ Source

enum Source : UInt32

Source of a scroll event.

Possible sources of a scroll event.

Enumerator
Wheel 

Mouse wheel (120 value)

Finger 

Finger (continuous)

Continuous 

Continuous movement (with unspecified source)

WheelTilt 

Side movement of a mouse wheel

WheelLegacy 

Legacy mouse wheel (discrete)

Constructor & Destructor Documentation

◆ LPointerScrollEvent()

LPointerScrollEvent ( const LPointF axes = LPointF(0.f, 0.f),
const LPointF axesDiscrete = LPoint(0, 0),
bool  hasX = true,
bool  hasY = true,
Source  source = Continuous,
UInt32  serial = LTime::nextSerial(),
UInt32  ms = LTime::ms(),
UInt64  us = LTime::us(),
LInputDevice device = nullptr 
)
inlinenoexcept

Constructs an LPointerScrollEvent object.

Parameters
axesThe scroll axes values (included in all sources).
axesDiscreteThe scroll axes values for high-resolution scrolling (Wheel source) or th physical mouse wheel clicks (WheelLegacy source).
hasXIndicates whether the event includes a value for the X axis.
hasYIndicates whether the event includes a value for the Y axis.
sourceThe source of the scroll event.
serialThe serial number of the event.
msThe millisecond timestamp of the event.
usThe microsecond timestamp of the event.
deviceThe input device that originated the event.

Member Function Documentation

◆ hasX()

bool hasX ( ) const
inlinenoexcept

Indicates whether the event includes a value for the X axis.

Note
Applicable to all sources.

◆ setHasX()

void setHasX ( bool  hasX)
inlinenoexcept

Sets whether the event includes a value for the X axis.

Note
Applicable to all sources.

◆ hasY()

bool hasY ( ) const
inlinenoexcept

Indicates whether the event includes a value for the Y axis.

Note
Applicable to all sources.

◆ setHasY()

void setHasY ( bool  hasY)
inlinenoexcept

Sets whether the event includes a value for the Y axis.

Note
Applicable to all sources.

◆ setAxes() [1/2]

void setAxes ( const LPointF axes)
inlinenoexcept

Sets the scroll axes values.

Note
Applicable to all sources.

◆ setAxes() [2/2]

void setAxes ( Float32  x,
Float32  y 
)
inlinenoexcept

Sets the scroll axes values.

Note
Applicable to all sources.

◆ setX()

void setX ( Float32  x)
inlinenoexcept

Sets the scroll value along the x-axis.

Note
Applicable to all sources.

◆ setY()

void setY ( Float32  y)
inlinenoexcept

Sets the scroll value along the y-axis.

Note
Applicable to all sources.

◆ axes()

const LPointF & axes ( ) const
inlinenoexcept

Gets the scroll axes values.

Note
Applicable to all sources.

◆ setDiscreteAxes() [1/2]

void setDiscreteAxes ( const LPoint axes)
inlinenoexcept

Sets the discrete scroll axes values.

See also
discreteAxes()

◆ setDiscreteAxes() [2/2]

void setDiscreteAxes ( Int32  x,
Int32  y 
)
inlinenoexcept

Sets the discrete scroll axes values using individual x and y components.

See also
discreteAxes()

◆ setDiscreteX()

void setDiscreteX ( Int32  x)
inlinenoexcept

Sets the discrete scroll value along the x-axis.

See also
discreteAxes()

◆ setDiscreteY()

void setDiscreteY ( Int32  y)
inlinenoexcept

Sets the discrete scroll value along the y-axis.

See also
discreteAxes()

◆ discreteAxes()

const LPoint & discreteAxes ( ) const
inlinenoexcept

Retrieves the discrete scroll axes values.

  • If the source is WheelLegacy, the values represent physical mouse wheel clicks.
  • If the source is Wheel, the property contains high-resolution scroll axis values: A value that is a fraction of ±120 indicates a wheel movement smaller than one logical click. The caller should either scroll by the respective fraction of the normal scroll distance or accumulate the value until it reaches a multiple of 120.

Ignore this value for other source types.

◆ setSource()

void setSource ( Source  source)
inlinenoexcept

Sets the source of the scroll event.

◆ source()

Source source ( ) const
inlinenoexcept

Gets the source of the scroll event.