Skip to content

Commit adcef7f

Browse files
committed
core/popupwindow: wait for polish to reposition
1 parent b67f92b commit adcef7f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/window/popupwindow.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,20 @@ qint32 ProxyPopupWindow::relativeY() const {
126126
PopupAnchor* ProxyPopupWindow::anchor() { return &this->mAnchor; }
127127

128128
void ProxyPopupWindow::reposition() {
129-
if (this->window != nullptr) {
130-
PopupPositioner::instance()->reposition(&this->mAnchor, this->window);
129+
// not gated on pendingReposition as a polish might not be triggered in edge cases
130+
if (this->window) {
131+
this->pendingReposition = true;
132+
this->schedulePolish();
133+
}
134+
}
135+
136+
void ProxyPopupWindow::onPolished() {
137+
this->ProxyWindowBase::onPolished();
138+
if (this->pendingReposition) {
139+
this->pendingReposition = false;
140+
141+
if (this->window) {
142+
PopupPositioner::instance()->reposition(&this->mAnchor, this->window);
143+
}
131144
}
132145
}

src/window/popupwindow.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class ProxyPopupWindow: public ProxyWindowBase {
8787

8888
void completeWindow() override;
8989
void postCompleteWindow() override;
90+
void onPolished() override;
9091

9192
void setScreen(QuickshellScreenInfo* screen) override;
9293
void setVisible(bool visible) override;
@@ -119,4 +120,5 @@ private slots:
119120

120121
PopupAnchor mAnchor {this};
121122
bool wantsVisible = false;
123+
bool pendingReposition = false;
122124
};

0 commit comments

Comments
 (0)