![]() |
Louvre
v1.0.1-1
C++ library for Wayland compositors
|
#include <LScene.h>
The LScene class is an optional utility that significantly simplifies rendering. More...
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 pointer and keyboard Wayland 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 invoked, or by creating your custom LView that overrides the LView::paintRect() virtual method.
For proper rendering with LScene, you need to "plug" the following methods into each LOutput you intend to manage with LScene:
For example, like this:
Similar to rendering, you can integrate the handlePointerXXX methods into the LPointer class.
This enables LScene to dispatch pointer events to each LView, invoking methods such as LView::pointerEnterEvent(), LView::pointerMoveEvent(), and more. Additionally, the scene can manage pointer focus for LSurfaces and transmit pointer events accordingly to clients. You also have the option to disable this behavior if you prefer to handle this logic independently. To deactivate the handling of Wayland events, use the enableHandleWaylandPointerEvents() method.
Similar to rendering, you can integrate the handleKeyXXX methods into the LKeyboard class.
This empowers LScene to dispatch keyboard events to each LView, triggering methods like LView::keyEvent(), LView::keyModifiersEvent(), and more. Furthermore, the scene can manage keyboard focus for LSurfaces and transmit keyboard events correspondingly to clients. If desired, you can also opt to disable this behavior and manage the logic independently. To deactivate the handling of Wayland events, utilize the enableHandleWaylandKeyboardEvents() method.
Public Member Functions | |
LScene () | |
Default constructor for LScene. More... | |
~LScene () | |
Destructor for LScene. 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... | |
LView * | handlePointerMoveEvent (Float32 x, Float32 y, bool absolute, LPoint *localPos=nullptr) |
Handle pointer movement event. More... | |
void | handlePointerButtonEvent (LPointer::Button button, LPointer::ButtonState state) |
Handle pointer button event. More... | |
void | handlePointerAxisEvent (Float64 axisX, Float64 axisY, Int32 discreteX, Int32 discreteY, LPointer::AxisSource source) |
Handle pointer axis event. More... | |
bool | handleWaylandPointerEventsEnabled () const |
Check if handling of Wayland pointer events is enabled. More... | |
void | enableHandleWaylandPointerEvents (bool enabled) |
Enable or disable handling of Wayland pointer events. More... | |
void | handleKeyModifiersEvent (UInt32 depressed, UInt32 latched, UInt32 locked, UInt32 group) |
Handle key modifiers event. More... | |
void | handleKeyEvent (UInt32 keyCode, LKeyboard::KeyState keyState) |
Handle key event. More... | |
bool | handleWaylandKeyboardEventsEnabled () const |
Check if handling of Wayland keyboard events is enabled. More... | |
void | enableHandleWaylandKeyboardEvents (bool enabled) |
Enable or disable handling of Wayland keyboard events. More... | |
bool | auxKeyboardImplementationEnabled () const |
Check if auxiliary keyboard implementation is enabled. More... | |
void | enableAuxKeyboardImplementation (bool enabled) |
Enable or disable auxiliary keyboard implementation. More... | |
LSceneView * | mainView () const |
Retrieve the main view of the scene. More... | |
LView * | viewAt (const LPoint &pos) |
Retrieve the view located at the specified position. More... | |
![]() | |
LObject () | |
Constructor of the LObject class. More... | |
Additional Inherited Members | |
![]() | |
static LCompositor * | compositor () |
Quick access to the global compositor instance. More... | |
static LSeat * | seat () |
Quick access to the global seat instance. More... | |
static LCursor * | cursor () |
Quick access to the global cursor instance. More... | |
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. |
Handle pointer movement event.
This method should be integrated into LPointer::pointerMoveEvent() to effectively manage pointer movement events.
x | The x-component of the new pointer position or delta from its previous position. |
y | The y-component of the new pointer position or delta from its previous position. |
absolute | If true , the (x, y) values represent absolute coordinates; if false , they are deltas from the previous position. |
localPos | Local pos of the first view found under the cursor. |
void handlePointerButtonEvent | ( | LPointer::Button | button, |
LPointer::ButtonState | state | ||
) |
Handle pointer button event.
This method should be integrated into LPointer::pointerButtonEvent() to handle pointer button events.
button | The button involved in the event. |
state | The state of the button (pressed or released). |
void handlePointerAxisEvent | ( | Float64 | axisX, |
Float64 | axisY, | ||
Int32 | discreteX, | ||
Int32 | discreteY, | ||
LPointer::AxisSource | source | ||
) |
Handle pointer axis event.
This method should be integrated into LPointer::pointerAxisEvent() to manage pointer axis events.
axisX | The x-axis value of the event. |
axisY | The y-axis value of the event. |
discreteX | The discrete value on the x-axis. |
discreteY | The discrete value on the y-axis. |
source | The source of the event. |
bool handleWaylandPointerEventsEnabled | ( | ) | const |
Check if handling of Wayland pointer events is enabled.
This method allows you to check whether the handling of Wayland pointer events is currently enabled.
void enableHandleWaylandPointerEvents | ( | bool | enabled | ) |
Enable or disable handling of Wayland pointer events.
This method enables or disables the handling of Wayland pointer events by LScene.
enabled | True to enable handling of Wayland pointer events, false to disable. |
Handle key modifiers event.
This method should be integrated into LKeyboard::keyModifiersEvent() to manage key modifiers events.
depressed | The bitfield representing depressed modifiers. |
latched | The bitfield representing latched modifiers. |
locked | The bitfield representing locked modifiers. |
group | The keyboard group. |
void handleKeyEvent | ( | UInt32 | keyCode, |
LKeyboard::KeyState | keyState | ||
) |
Handle key event.
This method should be integrated into LKeyboard::keyEvent() to handle key events.
keyCode | The code of the key involved in the event. |
keyState | The state of the key (pressed or released). |
bool handleWaylandKeyboardEventsEnabled | ( | ) | const |
Check if handling of Wayland keyboard events is enabled.
This method allows you to check whether the handling of Wayland keyboard events is currently enabled.
void enableHandleWaylandKeyboardEvents | ( | bool | enabled | ) |
Enable or disable handling of Wayland keyboard events.
This method enables or disables the handling of Wayland keyboard events by LScene.
enabled | True to enable handling of Wayland keyboard events, false to disable. |
bool auxKeyboardImplementationEnabled | ( | ) | const |
Check if auxiliary keyboard implementation is enabled.
This method allows you to check whether auxiliary keyboard functions, such as closing the compositor with Ctrl + Alt + Esc, executing weston-terminal
with F1, or modifying the drag-and-drop action with Shift, Alt, or Ctrl keys, are currently enabled.
void enableAuxKeyboardImplementation | ( | bool | enabled | ) |
Enable or disable auxiliary keyboard implementation.
This method enables or disables auxiliary keyboard functions, such as custom key actions.
enabled | True to enable auxiliary keyboard implementation, false to disable. |
LSceneView * mainView | ( | ) | const |
Retrieve the main view of the scene.
This method returns the main LSceneView associated with the LScene.