Louvre
v2.13.0-1
C++ library for Wayland compositors
|
Exclusive zone within an LOutput. More...
Public Types | |
using | OnRectChangeCallback = std::function< void(LExclusiveZone *)> |
Public Member Functions | |
LExclusiveZone (LEdge edge, Int32 size, LOutput *output=nullptr) noexcept | |
Constructor for LExclusiveZone. More... | |
~LExclusiveZone () | |
Destructor for LExclusiveZone. More... | |
void | setEdgeAndSize (LEdge edge, Int32 size) noexcept |
Sets the edge and size simultaneously. More... | |
void | setEdge (LEdge edge) noexcept |
Sets the edge of the output to which the exclusive zone is anchored. More... | |
void | setSize (Int32 size) noexcept |
Sets the size of the exclusive zone. More... | |
void | setOutput (LOutput *output) noexcept |
Sets the current output. More... | |
LOutput * | output () const noexcept |
Gets the current output. More... | |
LEdge | edge () const noexcept |
Gets the current edge. More... | |
Int32 | size () const noexcept |
Gets the exclusive zone size. More... | |
bool | insertAfter (LExclusiveZone *zone) const |
Inserts this zone after the given zone in the LOutput::exclusiveZones() list. More... | |
LExclusiveZone * | nextZone () const noexcept |
Next exclusive zone in the LOutput::exclusiveZones() list. More... | |
LExclusiveZone * | prevZone () const noexcept |
Previous exclusive zone in the LOutput::exclusiveZones() list. More... | |
const LRect & | rect () const noexcept |
Gets the calculated position and size of the exclusive zone in output-local surface coordinates. More... | |
void | setOnRectChangeCallback (const OnRectChangeCallback &callback) noexcept |
Sets the rect change listener. More... | |
const OnRectChangeCallback & | onRectChangeCallback () const noexcept |
Gets the callback set for rect changes. 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... | |
Exclusive zone within an LOutput.
The LExclusiveZone class allows you to define a specific region relative to an LOutput edge to be considered exclusive.
It is primarily used by LLayerRole surfaces to prevent other elements from occupying their space, but it can also be utilized by custom compositor UI elements, such as a built-in panel.
When assigned to an output, exclusive zones affect LOutput::availableGeometry() and LOutput::exclusiveEdges(). These properties are used, for example, to properly position and resize LToplevelRole surfaces.
To define an exclusive zone, you need to specify the output(), the edge() it is anchored to, and the distance (size()) from that edge.
The rect() property will be updated to indicate the position and size of the exclusive zone within the output.
Multiple exclusive zones can be assigned to the same output. In such cases, the zones located at the beginning of the LOutput::exclusiveZones() list have preference, causing other zones to be moved/resized to prevent occlusion of the predominant ones.
The list order also determines the arrangement of multiple exclusive zones attached to the same edge. For example, if two exclusive zones are anchored to the top edge, the first one will be on top, and the second one will be closer to the center of the output.
You can also specify a callback function to be notified when an exclusive zone's rect() changes using the setOnRectChangeCallback() method.
using OnRectChangeCallback = std::function<void(LExclusiveZone*)> |
Callback function type used to handle the onRectChange()
event.
|
noexcept |
Constructor for LExclusiveZone.
Initializes an exclusive zone with the specified edge, size, and output.
edge | The edge of the output to anchor the exclusive zone to. |
size | The distance from the edge to define the exclusive zone. |
output | The output to assign the exclusive zone to. |
~LExclusiveZone | ( | ) |
Destructor for LExclusiveZone.
Sets the edge and size simultaneously.
Each time the edge and/or size change, the rect() of all zones within the same output are recalculated.
This method allows you to change both parameters at once with a single update, which is more efficient.
edge | The edge of the output to anchor the exclusive zone to. |
size | The distance from the edge to define the exclusive zone. |
|
noexcept |
Sets the edge of the output to which the exclusive zone is anchored.
Accepts a single LEdge or LEdgeNone .
If set to LEdgeNone, the zone will not affect others, regardless of the value of size().
edge | The edge of the output to anchor the exclusive zone to. |
|
noexcept |
Sets the size of the exclusive zone.
size | The distance from the edge to define the exclusive zone. |
|
noexcept |
Sets the current output.
The zone is added at the end of the LOutput::exclusiveZones() list.
output | The output to assign the exclusive zone to, or nullptr to remove it from all outputs. |
|
inlinenoexcept |
Gets the current output.
nullptr
if not assigned.
|
inlinenoexcept |
Gets the current edge.
The edge the exclusive zone is anchored to, set with setEdge().
|
inlinenoexcept |
Gets the exclusive zone size.
The size of the exclusive zone, set with setSize().
bool insertAfter | ( | LExclusiveZone * | zone | ) | const |
Inserts this zone after the given zone in the LOutput::exclusiveZones() list.
This operation is only successful if both exclusive zones belong to the same output.
zone | The zone after which this zone should be inserted. |
true
if successful, false
on failure.
|
noexcept |
Next exclusive zone in the LOutput::exclusiveZones() list.
nullptr
if no output is assigned or it is the last exclusive zone.
|
noexcept |
Previous exclusive zone in the LOutput::exclusiveZones() list.
nullptr
if no output is assigned or it is the first exclusive zone.
|
inlinenoexcept |
Gets the calculated position and size of the exclusive zone in output-local surface coordinates.
nullptr
, the rect is (0, 0, 0, 0).
|
inlinenoexcept |
Sets the rect change listener.
This callback is triggered each time the exclusive zone rect() changes, for example, after modifying its parameters or when other zones change.
callback | The callback function to be called on rect changes. |
|
inlinenoexcept |
Gets the callback set for rect changes.