![]() |
Louvre
v2.9.0-1
C++ library for Wayland compositors
|
Positioning rules for LPopupRole surfaces. More...
Public Types | |
enum | Anchor : UInt32 |
Anchor point. More... | |
enum | Gravity : UInt32 |
Gravity. More... | |
enum | ConstraintAdjustments : UInt32 |
Constraint adjustments. More... | |
Public Member Functions | |
const LSize & | size () const |
Size in surface coordinates. More... | |
const LRect & | anchorRect () const |
Anchor rect in surface coordinates. More... | |
const LPoint & | offset () const noexcept |
Additional offset in surface coordinates. More... | |
Anchor | anchor () const noexcept |
Anchor point. More... | |
Gravity | gravity () const noexcept |
Popup gravity. More... | |
LBitset< ConstraintAdjustments > | constraintAdjustments () const noexcept |
Constraint adjustment rules. More... | |
bool | reactive () const noexcept |
Determines if the popup should be reconfigured, for example, when the parent surface moves. More... | |
bool | hasParentSize () const noexcept |
Checks if the popup is being repositioned according to a future parent size. More... | |
const LSize & | parentSize () const noexcept |
Parent size. More... | |
bool | hasParentConfigureSerial () const noexcept |
Checks if the popup is being repositioned according to a future parent configuration. More... | |
UInt32 | parentConfigureSerial () const noexcept |
Parent configuration serial. More... | |
Positioning rules for LPopupRole surfaces.
The LPositioner class defines the rules by which a popup should be positioned relative to the anchor point of its parent.
Each LPopupRole has its own LPositioner accessible through LPopupRole::positioner().
The anchorRect() defines a sub-rectangle within the parent surface's window geometry. Within this sub-rectangle, an anchor point is specified, which the popup uses as a reference for positioning itself.
The anchor point can be located at the center, the corners, or the midpoints of the edges of the anchor rectangle (indicated by gray and blue points).
For example, in the following image, a popup is positioned using the anchor points AnchorRight and AnchorBottomLeft.
The gravity() of the popup indicates the direction in which it tries to move.
You can visualize the anchor point as a "nail" and the popup as a frame composed only of edges. If the gravity is down, the top edge of the popup will collide with the nail, preventing it from moving further.
In the following image, a popup is shown with gravity set to GravityBottomRight and GravityTopLeft .
You might be wondering why such complex rules are used to position popups. The answer is that these rules simplify repositioning popups when their initial position causes constraints (e.g., when they appear outside the visible area of the screen).
The specific rules for adjusting the position of popups when they are constrained are defined by the client in constraintAdjustments(). Typically, the process involves the following steps:
For more information on LPositioner rules, consult the documentation of the xdg_shell::positioner interface.
Anchor point.
Gravity.
The direction in which the popup tries to move.
enum ConstraintAdjustments : UInt32 |
Constraint adjustments.
Rules for handling a constrained popup.
|
inline |
Size in surface coordinates.
Size of the popup to be positioned (window geometry size) in surface coordinates.
|
inline |
Anchor rect in surface coordinates.
Anchor rect relative to the parent window geometry in surface coordinates.
|
inlinenoexcept |
Additional offset in surface coordinates.
Additional offset in surface coordinates added to the final calculated position.
|
inlinenoexcept |
Anchor point.
Edge or corner within the anchorRect() the popup is positioned relative to.
|
inlinenoexcept |
Popup gravity.
Direction in which the popup is trying to move, defined in LPositioner::Gravity.
|
inlinenoexcept |
Constraint adjustment rules.
Flags with rules used to unconstrain the popup.
|
inlinenoexcept |
Determines if the popup should be reconfigured, for example, when the parent surface moves.
This method checks whether the popup needs to be reconfigured in response to changes in the parent surface, such as movement or other configuration changes.
true
if the popup should be reconfigured, false
otherwise.
|
inlinenoexcept |
Checks if the popup is being repositioned according to a future parent size.
The compositor may use parentConfigureSerial() together with parentSize() to determine what future state the popup should be constrained using during an LPopupRole::configureRequest().
true
if the popup is being repositioned due to a parent configure change, false
otherwise.
|
inlinenoexcept |
Parent size.
|
inlinenoexcept |
Checks if the popup is being repositioned according to a future parent configuration.
The compositor may use parentConfigureSerial() together with parentSize() to determine what future state the popup should be constrained using during an LPopupRole::configureRequest().
true
if the popup is being repositioned according to a future parent configuration, false
otherwise.
|
inlinenoexcept |
Parent configuration serial.