Louvre
v2.13.0-1
C++ library for Wayland compositors
|
Scene. More...
Public Types | |
enum | EventOptions : UInt8 |
Custom options for input event handlers. More... | |
enum | InputFilter : UInt8 |
Input filter flags used by viewAt(). More... | |
Public Member Functions | |
LScene () | |
Constructor for LScene. More... | |
~LScene () | |
Destructor for LScene. More... | |
void | enableAutoRepaint (bool enabled) noexcept |
Enables or disables automatic repainting of child views. More... | |
bool | autoRepaintEnabled () const noexcept |
Checks if automatic repainting of child views is currently enabled. More... | |
const std::vector< LView * > & | pointerFocus () const |
Vector of views with pointer focus. More... | |
const std::vector< LView * > & | keyboardFocus () const |
Vector of views with keyboard focus. More... | |
const std::vector< LSceneTouchPoint * > & | touchPoints () const |
Vector of active touch points managed within the scene. More... | |
LSceneTouchPoint * | findTouchPoint (Int32 id) const |
Searches for a touch point within the scene by its ID. More... | |
void | handleInitializeGL (LOutput *output) |
Handle the OpenGL initialization for an LOutput. More... | |
void | handlePaintGL (LOutput *output) |
Handle the OpenGL painting for an LOutput. More... | |
void | handleMoveGL (LOutput *output) |
Handle the OpenGL movement for an LOutput. More... | |
void | handleResizeGL (LOutput *output) |
Handle the OpenGL resizing for an LOutput. More... | |
void | handleUninitializeGL (LOutput *output) |
Handle the OpenGL uninitialization for an LOutput. More... | |
void | handlePointerMoveEvent (const LPointerMoveEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle pointer movement event. More... | |
void | handlePointerButtonEvent (const LPointerButtonEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle pointer button event. More... | |
void | handlePointerScrollEvent (const LPointerScrollEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle pointer scroll event. More... | |
void | handlePointerSwipeBeginEvent (const LPointerSwipeBeginEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle pointer swipe begin event. More... | |
void | handlePointerSwipeUpdateEvent (const LPointerSwipeUpdateEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle pointer swipe update event. More... | |
void | handlePointerSwipeEndEvent (const LPointerSwipeEndEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle pointer swipe end event. More... | |
void | handlePointerPinchBeginEvent (const LPointerPinchBeginEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle pointer pinch begin event. More... | |
void | handlePointerPinchUpdateEvent (const LPointerPinchUpdateEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle pointer pinch update event. More... | |
void | handlePointerPinchEndEvent (const LPointerPinchEndEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle pointer pinch end event. More... | |
void | handlePointerHoldBeginEvent (const LPointerHoldBeginEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle pointer hold begin event. More... | |
void | handlePointerHoldEndEvent (const LPointerHoldEndEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle pointer hold end event. More... | |
void | handleKeyboardKeyEvent (const LKeyboardKeyEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle keyboard key event. More... | |
void | handleTouchDownEvent (const LTouchDownEvent &event, const LPointF &globalPos, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle touch down event. More... | |
void | handleTouchMoveEvent (const LTouchMoveEvent &event, const LPointF &globalPos, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle touch move event. More... | |
void | handleTouchUpEvent (const LTouchUpEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle touch up event. More... | |
void | handleTouchFrameEvent (const LTouchFrameEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle touch frame event. More... | |
void | handleTouchCancelEvent (const LTouchCancelEvent &event, LBitset< EventOptions > options=WaylandEvents|PointerConstraints|AuxFunc) |
Handle touch cancel event. More... | |
LSceneView * | mainView () const |
Retrieve the main (root) view of the scene. More... | |
LView * | viewAt (const LPoint &pos, LView::Type type=LView::UndefinedType, LBitset< InputFilter > filter=FilterDisabled) |
Retrieve the view located at the specified position. 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... | |
Additional Inherited Members | |
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... | |
Scene.
The LScene class is an optional utility that significantly simplifies rendering.
It encompasses a primary LSceneView which can host multiple children and even nested scenes.
A single LScene can drive multiple outputs and also manage Wayland input events, while also providing per-view input events.
You might opt to leverage LScene for rendering instead of relying solely on the basic rendering functions from the LPainter class or your custom OpenGL shaders.
LScene achieves high efficiency by rendering only damaged regions and avoiding rendering content obscured by opaque areas.
Alternatively, you can still use your own OpenGL shaders or LPainter functions for rendering, either in conjunction with LScene or independently.
These approaches can be applied before or after handlePaintGL() is called, or by creating custom LViews that override the LView::paintEvent() virtual method.
For proper rendering with LScene, you need to "plug" the following methods into each LOutput you intend to manage:
For example, like this:
Similar to rendering, you can integrate LScene into LPointer, LKeyboard and LTouch for managing input events.
enum EventOptions : UInt8 |
Custom options for input event handlers.
Enumerator | |
---|---|
OptionsDisabled | All options disabled, input events will only be dispatched to views acordingly. |
WaylandEvents | Input events will be dispatched to client surfaces acordingly. |
PointerConstraints | The scene will constraint the cursor within surfaces when allowed clients require it. |
AuxFunc | Auxiliary functionality of the default Louvre implementation, such as exiting the compositor when Ctrl + Shift + Esc is pressed, will be handled. |
enum InputFilter : UInt8 |
|
noexcept |
Enables or disables automatic repainting of child views.
When disabled, LOutput::repaint() requests from child views will be ignored.
This can be useful when modifying views during an LOutput::paintGL() event to prevent the output from immediately scheduling a new repaint.
Enabled by default.
|
noexcept |
Checks if automatic repainting of child views is currently enabled.
const std::vector< LView * > & pointerFocus | ( | ) | const |
Vector of views with pointer focus.
This vector contains views that have pointer events enabled and whose input region intersects with the current pointer position.
The vector is ordered with the topmost views first and the bottommost views last.
Views with the property LView::blockInputEnabled() disabled allow views behind them to also receive pointer events, which is why multiple views can be in focus at the same time.
const std::vector< LView * > & keyboardFocus | ( | ) | const |
Vector of views with keyboard focus.
Views with keyboard focus are simply those whose LView::keyboardEventsEnabled() property is enabled.
const std::vector< LSceneTouchPoint * > & touchPoints | ( | ) | const |
Vector of active touch points managed within the scene.
LSceneTouchPoint * findTouchPoint | ( | Int32 | id | ) | const |
Searches for a touch point within the scene by its ID.
id | The ID of the touch point to search for. |
nullptr
otherwise. void handleInitializeGL | ( | LOutput * | output | ) |
Handle the OpenGL initialization for an LOutput.
This method should be integrated into LOutput::initializeGL() to properly handle OpenGL initialization for the associated output.
output | The LOutput instance to handle OpenGL initialization for. |
void handlePaintGL | ( | LOutput * | output | ) |
Handle the OpenGL painting for an LOutput.
This method should be integrated into LOutput::paintGL() to properly handle OpenGL painting for the associated output.
output | The LOutput instance to handle OpenGL painting for. |
void handleMoveGL | ( | LOutput * | output | ) |
Handle the OpenGL movement for an LOutput.
This method should be integrated into LOutput::moveGL() to properly handle OpenGL movement for the associated output.
output | The LOutput instance to handle OpenGL movement for. |
void handleResizeGL | ( | LOutput * | output | ) |
Handle the OpenGL resizing for an LOutput.
This method should be integrated into LOutput::resizeGL() to properly handle OpenGL resizing for the associated output.
output | The LOutput instance to handle OpenGL resizing for. |
void handleUninitializeGL | ( | LOutput * | output | ) |
Handle the OpenGL uninitialization for an LOutput.
This method should be integrated into LOutput::uninitializeGL() to properly handle OpenGL uninitialization for the associated output.
output | The LOutput instance to handle OpenGL uninitialization for. |
void handlePointerMoveEvent | ( | const LPointerMoveEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle pointer movement event.
This method should be integrated into LPointer::pointerMoveEvent() to effectively manage pointer movement events.
event | The pointer move event to handle. |
options | Custom event options. |
void handlePointerButtonEvent | ( | const LPointerButtonEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle pointer button event.
This method should be integrated into LPointer::pointerButtonEvent() to handle pointer button events.
event | The pointer button event to handle. |
void handlePointerScrollEvent | ( | const LPointerScrollEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle pointer scroll event.
This method should be integrated into LPointer::pointerScrollEvent() to manage pointer scroll events.
event | The pointer scroll event to handle. |
void handlePointerSwipeBeginEvent | ( | const LPointerSwipeBeginEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle pointer swipe begin event.
This method should be integrated into LPointer::pointerSwipeBeginEvent() to manage pointer swipe begin events.
event | The pointer swipe begin event to handle. |
void handlePointerSwipeUpdateEvent | ( | const LPointerSwipeUpdateEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle pointer swipe update event.
This method should be integrated into LPointer::pointerSwipeUpdateEvent() to manage pointer swipe update events.
event | The pointer swipe update event to handle. |
void handlePointerSwipeEndEvent | ( | const LPointerSwipeEndEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle pointer swipe end event.
This method should be integrated into LPointer::pointerSwipeEndEvent() to manage pointer swipe end events.
event | The pointer swipe end event to handle. |
void handlePointerPinchBeginEvent | ( | const LPointerPinchBeginEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle pointer pinch begin event.
This method should be integrated into LPointer::pointerPinchBeginEvent() to manage pointer pinch begin events.
event | The pointer pinch begin event to handle. |
void handlePointerPinchUpdateEvent | ( | const LPointerPinchUpdateEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle pointer pinch update event.
This method should be integrated into LPointer::pointerPinchUpdateEvent() to manage pointer pinch update events.
event | The pointer pinch update event to handle. |
void handlePointerPinchEndEvent | ( | const LPointerPinchEndEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle pointer pinch end event.
This method should be integrated into LPointer::pointerPinchEndEvent() to manage pointer pinch end events.
event | The pointer pinch end event to handle. |
void handlePointerHoldBeginEvent | ( | const LPointerHoldBeginEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle pointer hold begin event.
This method should be integrated into LPointer::pointerHoldBeginEvent() to manage pointer hold begin events.
event | The pointer hold begin event to handle. |
void handlePointerHoldEndEvent | ( | const LPointerHoldEndEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle pointer hold end event.
This method should be integrated into LPointer::pointerHoldEndEvent() to manage pointer hold end events.
event | The pointer hold end event to handle. |
void handleKeyboardKeyEvent | ( | const LKeyboardKeyEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle keyboard key event.
This method should be integrated into LKeyboard::keyEvent() to handle key events.
void handleTouchDownEvent | ( | const LTouchDownEvent & | event, |
const LPointF & | globalPos, | ||
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle touch down event.
This method should be integrated into LTouch::touchDownEvent() to manage touch down events.
event | The touch down event to handle. |
globalPos | The event position transformed to global coordinates. |
void handleTouchMoveEvent | ( | const LTouchMoveEvent & | event, |
const LPointF & | globalPos, | ||
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle touch move event.
This method should be integrated into LTouch::touchMoveEvent() to manage touch move events.
event | The touch move event to handle. |
globalPos | The event position transformed to global coordinates. |
void handleTouchUpEvent | ( | const LTouchUpEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle touch up event.
This method should be integrated into LTouch::touchUpEvent() to manage touch up events.
event | The touch up event to handle. |
void handleTouchFrameEvent | ( | const LTouchFrameEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle touch frame event.
This method should be integrated into LTouch::touchFrameEvent() to manage touch frame events.
event | The touch frame event to handle. |
void handleTouchCancelEvent | ( | const LTouchCancelEvent & | event, |
LBitset< EventOptions > | options = WaylandEvents | PointerConstraints | AuxFunc |
||
) |
Handle touch cancel event.
This method should be integrated into LTouch::touchCancelEvent() to manage touch cancel events.
event | The touch cancel event to handle. |
LSceneView * mainView | ( | ) | const |
Retrieve the main (root) view of the scene.
This method returns the main LSceneView associated with the LScene.
LView * viewAt | ( | const LPoint & | pos, |
LView::Type | type = LView::UndefinedType , |
||
LBitset< InputFilter > | filter = FilterDisabled |
||
) |
Retrieve the view located at the specified position.
This method returns the first LView whose input region intersects the given position.
pos | The position to query. |
type | The type of view to search for. Passing LView::Type::Undefined disables the type filter. |
filter | Additional flags for searching only views with pointer, keyboard and/or touch events enabled. |
nullptr
if no view is found.