mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2025-11-04 19:04:56 +11:00
core/menu: add QsMenuAnchor for more control of platform menus
This commit is contained in:
parent
54350277be
commit
6b9b1fcb53
10 changed files with 245 additions and 21 deletions
|
|
@ -184,9 +184,9 @@ void PopupPositioner::reposition(PopupAnchor* anchor, QWindow* window, bool only
|
|||
auto effectiveY = calcEffectiveY();
|
||||
|
||||
if (adjustment.testFlag(PopupAdjustment::FlipX)) {
|
||||
bool flip = (anchorGravity.testFlag(Edges::Left) && effectiveX < screenGeometry.left())
|
||||
|| (anchorGravity.testFlag(Edges::Right)
|
||||
&& effectiveX + windowGeometry.width() > screenGeometry.right());
|
||||
const bool flip = (anchorGravity.testFlag(Edges::Left) && effectiveX < screenGeometry.left())
|
||||
|| (anchorGravity.testFlag(Edges::Right)
|
||||
&& effectiveX + windowGeometry.width() > screenGeometry.right());
|
||||
|
||||
if (flip) {
|
||||
anchorGravity ^= Edges::Left | Edges::Right;
|
||||
|
|
@ -200,9 +200,9 @@ void PopupPositioner::reposition(PopupAnchor* anchor, QWindow* window, bool only
|
|||
}
|
||||
|
||||
if (adjustment.testFlag(PopupAdjustment::FlipY)) {
|
||||
bool flip = (anchorGravity.testFlag(Edges::Top) && effectiveY < screenGeometry.top())
|
||||
|| (anchorGravity.testFlag(Edges::Bottom)
|
||||
&& effectiveY + windowGeometry.height() > screenGeometry.bottom());
|
||||
const bool flip = (anchorGravity.testFlag(Edges::Top) && effectiveY < screenGeometry.top())
|
||||
|| (anchorGravity.testFlag(Edges::Bottom)
|
||||
&& effectiveY + windowGeometry.height() > screenGeometry.bottom());
|
||||
|
||||
if (flip) {
|
||||
anchorGravity ^= Edges::Top | Edges::Bottom;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue