Louvre
v2.13.0-1
C++ library for Wayland compositors
|
Class for handling events generated by pointing devices. More...
Public Member Functions | |
LPointer (const void *params) noexcept | |
LPointer class constructor. More... | |
~LPointer () | |
LPointer class destructor. More... | |
LSurface * | focus () const noexcept |
Gets the focused surface. More... | |
void | setFocus (LSurface *surface, const LPoint &localPos) noexcept |
Sets the pointer focus. More... | |
void | setFocus (LSurface *surface) noexcept |
Sets the pointer focus. More... | |
void | setDraggingSurface (LSurface *surface) noexcept |
Keep track of the surface pressed by the main pointer button. More... | |
LSurface * | draggingSurface () const noexcept |
Surface being actively pressed by the main pointer button. More... | |
LSurface * | surfaceAt (const LPoint &point) |
Looks for a surface at the given position. More... | |
const std::vector< LPointerButtonEvent::Button > & | pressedKeys () const noexcept |
Vector of all currently pressed buttons. More... | |
bool | isButtonPressed (LPointerButtonEvent::Button button) const noexcept |
Checks if a button is pressed. More... | |
void | enableNaturalScrollingX (bool enabled) noexcept |
Toggles natural scrolling for the X axis. More... | |
void | enableNaturalScrollingY (bool enabled) noexcept |
Toggles natural scrolling for the Y axis. More... | |
bool | naturalScrollingXEnabled () const noexcept |
Checks if natural scrolling is enabled for the X axis. More... | |
bool | naturalScrollingYEnabled () const noexcept |
Checks if natural scrolling is enabled for the Y axis. More... | |
Public Member Functions inherited from LFactoryObject | |
Type | factoryObjectType () const noexcept |
Gets the base factory object type. More... | |
Public Member Functions inherited from LObject | |
LObject (const LObject &) noexcept | |
Copy constructor. More... | |
LObject & | operator= (const LObject &) noexcept |
Assignment operator (each object has its own individual LWeak reference count). More... | |
void | setUserData (UIntPtr data) const noexcept |
Store an unsigned integer value/pointer. More... | |
UIntPtr | userData () const noexcept |
Retrieves the stored unsigned integer value/pointer. More... | |
Client Events | |
These methods allow you to send pointer events to clients.
| |
void | sendMoveEvent (const LPointerMoveEvent &event) |
Sends a pointer move event to the currently focused surface. More... | |
void | sendButtonEvent (const LPointerButtonEvent &event) |
Sends a pointer button event to the currently focused surface. More... | |
void | sendScrollEvent (const LPointerScrollEvent &event) |
Sends a scroll event to the currently focused surface. More... | |
void | sendSwipeBeginEvent (const LPointerSwipeBeginEvent &event) |
Sends a swipe begin gesture event to the currently focused surface. More... | |
void | sendSwipeUpdateEvent (const LPointerSwipeUpdateEvent &event) |
Sends a swipe update gesture event to the currently focused surface. More... | |
void | sendSwipeEndEvent (const LPointerSwipeEndEvent &event) |
Sends a swipe end gesture event to the currently focused surface. More... | |
void | sendPinchBeginEvent (const LPointerPinchBeginEvent &event) |
Sends a pinch begin gesture event to the currently focused surface. More... | |
void | sendPinchUpdateEvent (const LPointerPinchUpdateEvent &event) |
Sends a pinch update gesture event to the currently focused surface. More... | |
void | sendPinchEndEvent (const LPointerPinchEndEvent &event) |
Sends a pinch end gesture event to the currently focused surface. More... | |
void | sendHoldBeginEvent (const LPointerHoldBeginEvent &event) |
Sends a hold begin gesture event to the currently focused surface. More... | |
void | sendHoldEndEvent (const LPointerHoldEndEvent &event) |
Sends a hold end gesture event to the currently focused surface. More... | |
Virtual Methods | |
virtual void | pointerMoveEvent (const LPointerMoveEvent &event) |
Pointer move event generated by the input backend. More... | |
virtual void | pointerButtonEvent (const LPointerButtonEvent &event) |
Pointer button event generated by the input backend. More... | |
virtual void | pointerScrollEvent (const LPointerScrollEvent &event) |
Pointer scroll event generated by the input backend. More... | |
virtual void | pointerSwipeBeginEvent (const LPointerSwipeBeginEvent &event) |
Pointer swipe begin gesture event generated by the input backend. More... | |
virtual void | pointerSwipeUpdateEvent (const LPointerSwipeUpdateEvent &event) |
Pointer swipe update gesture event generated by the input backend. More... | |
virtual void | pointerSwipeEndEvent (const LPointerSwipeEndEvent &event) |
Pointer swipe end gesture event generated by the input backend. More... | |
virtual void | pointerPinchBeginEvent (const LPointerPinchBeginEvent &event) |
Pointer pinch begin gesture event generated by the input backend. More... | |
virtual void | pointerPinchUpdateEvent (const LPointerPinchUpdateEvent &event) |
Pointer pinch update gesture event generated by the input backend. More... | |
virtual void | pointerPinchEndEvent (const LPointerPinchEndEvent &event) |
Pointer pinch end gesture event generated by the input backend. More... | |
virtual void | pointerHoldBeginEvent (const LPointerHoldBeginEvent &event) |
Pointer hold begin gesture event generated by the input backend. More... | |
virtual void | pointerHoldEndEvent (const LPointerHoldEndEvent &event) |
Pointer hold end gesture event generated by the input backend. More... | |
virtual void | setCursorRequest (const LClientCursor &clientCursor) |
Set cursor request. More... | |
Additional Inherited Members | |
Public Types inherited from LFactoryObject | |
enum class | Type : Int32 |
Base factory object types. More... | |
Protected Member Functions inherited from LObject | |
LObject () noexcept=default | |
Constructor of the LObject class. More... | |
virtual | ~LObject () noexcept |
Destructor of the LObject class. More... | |
void | notifyDestruction () noexcept |
Notifies the object destruction. More... | |
Class for handling events generated by pointing devices.
The LPointer class allows you to listen to input events generated by devices such as a mouse or touchpad and redirect them to client surfaces. There is a single instance of LPointer, which can be accessed through LSeat::pointer().
To send pointer events to clients, you must first assign focus to a surface using one of the setFocus() variants.
Subsequently, all pointer events sent with any of the sendXXXEvent() methods are directed to the currently focused surface.
|
noexcept |
LPointer class constructor.
There is a single instance of LPointer, which can be accessed from LSeat::pointer().
params | Internal library parameters provided in the LCompositor::createObjectRequest() virtual constructor. |
~LPointer | ( | ) |
LPointer class destructor.
Invoked after LCompositor::onAnticipatedObjectDestruction().
|
noexcept |
Gets the focused surface.
This method returns the surface that has been assigned pointer focus using setFocus().
nullptr
if no surface has pointer focus. Sets the pointer focus.
This method assigns the pointer focus to the specified surface at the given local surface position within the surface.
If another surface already has pointer focus, it will lose it.
surface | Surface to which the pointer focus will be assigned, or nullptr to remove focus from all surfaces. |
localPos | Local position within the surface where the pointer enters. |
|
noexcept |
Sets the pointer focus.
Sets the pointer focus to the provided surface based on the current LCursor position.
surface | The surface to which you want to assign the pointer focus or nullptr to remove focus from all surfaces. |
|
noexcept |
Keep track of the surface pressed by the main pointer button.
This is just a utility used by the default LPointer implementation to ensure that pointer focus remains on a surface while it's being actively pressed by the left pointer button, for example, during text selection, even if the pointer moves outside the surface boundaries.
surface | The surface being pressed or nullptr to unset. |
|
noexcept |
Surface being actively pressed by the main pointer button.
This method returns the surface that is currently being actively pressed by the main pointer button.
nullptr
.Looks for a surface at the given position.
This method looks for the first mapped surface that contains the point given point.
It takes into account the surfaces rolePos(), size(), inputRegion() and the reverse order given by the LCompositor::surfaces() list.
point | Point in compositor-global coordinates. |
nullptr
if no surface is found.
|
noexcept |
Vector of all currently pressed buttons.
|
noexcept |
Checks if a button is pressed.
|
noexcept |
Toggles natural scrolling for the X axis.
Disabled by default. See naturalScrollingXEnabled().
enabled | Set to true to enable natural scrolling, or false to disable it. |
|
noexcept |
Toggles natural scrolling for the Y axis.
Disabled by default. See naturalScrollingYEnabled().
enabled | Set to true to enable natural scrolling, or false to disable it. |
|
noexcept |
Checks if natural scrolling is enabled for the X axis.
|
noexcept |
Checks if natural scrolling is enabled for the Y axis.
void sendMoveEvent | ( | const LPointerMoveEvent & | event | ) |
Sends a pointer move event to the currently focused surface.
void sendButtonEvent | ( | const LPointerButtonEvent & | event | ) |
Sends a pointer button event to the currently focused surface.
void sendScrollEvent | ( | const LPointerScrollEvent & | event | ) |
Sends a scroll event to the currently focused surface.
void sendSwipeBeginEvent | ( | const LPointerSwipeBeginEvent & | event | ) |
Sends a swipe begin gesture event to the currently focused surface.
void sendSwipeUpdateEvent | ( | const LPointerSwipeUpdateEvent & | event | ) |
Sends a swipe update gesture event to the currently focused surface.
void sendSwipeEndEvent | ( | const LPointerSwipeEndEvent & | event | ) |
Sends a swipe end gesture event to the currently focused surface.
void sendPinchBeginEvent | ( | const LPointerPinchBeginEvent & | event | ) |
Sends a pinch begin gesture event to the currently focused surface.
void sendPinchUpdateEvent | ( | const LPointerPinchUpdateEvent & | event | ) |
Sends a pinch update gesture event to the currently focused surface.
void sendPinchEndEvent | ( | const LPointerPinchEndEvent & | event | ) |
Sends a pinch end gesture event to the currently focused surface.
void sendHoldBeginEvent | ( | const LPointerHoldBeginEvent & | event | ) |
Sends a hold begin gesture event to the currently focused surface.
void sendHoldEndEvent | ( | const LPointerHoldEndEvent & | event | ) |
Sends a hold end gesture event to the currently focused surface.
|
virtual |
Pointer move event generated by the input backend.
|
virtual |
Pointer button event generated by the input backend.
|
virtual |
Pointer scroll event generated by the input backend.
|
virtual |
Pointer swipe begin gesture event generated by the input backend.
|
virtual |
Pointer swipe update gesture event generated by the input backend.
|
virtual |
Pointer swipe end gesture event generated by the input backend.
|
virtual |
Pointer pinch begin gesture event generated by the input backend.
|
virtual |
Pointer pinch update gesture event generated by the input backend.
|
virtual |
Pointer pinch end gesture event generated by the input backend.
|
virtual |
Pointer hold begin gesture event generated by the input backend.
|
virtual |
Pointer hold end gesture event generated by the input backend.
|
virtual |
Set cursor request.
Triggered when a client requests to set the cursor texture, hotspot or hide it.