Skip to content

Commit

Permalink
Allow querying manual rounding radius of RpWindow.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Feb 17, 2023
1 parent eb4d44e commit 3b69ec4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ui/platform/ui_platform_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ void BasicWindowHelper::close() {
_window->close();
}

int BasicWindowHelper::manualRoundingRadius() const {
return 0;
}

void BasicWindowHelper::setBodyTitleArea(
Fn<WindowTitleHitTestFlags(QPoint)> testMethod) {
Expects(!_bodyTitleAreaTestMethod || testMethod);
Expand Down Expand Up @@ -524,6 +528,10 @@ void DefaultWindowHelper::setGeometry(QRect rect) {
window()->setGeometry(rect.marginsAdded(bodyPadding()));
}

int DefaultWindowHelper::manualRoundingRadius() const {
return _roundingOverlay ? Radius() : 0;
}

void DefaultWindowHelper::paintBorders(QPainter &p) {
const auto titleBackground = window()->isActiveWindow()
? _title->st()->bgActive
Expand Down
2 changes: 2 additions & 0 deletions ui/platform/ui_platform_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class BasicWindowHelper {
virtual void showNormal();
virtual void close();

virtual int manualRoundingRadius() const;
void setBodyTitleArea(Fn<WindowTitleHitTestFlags(QPoint)> testMethod);

protected:
Expand Down Expand Up @@ -91,6 +92,7 @@ class DefaultWindowHelper final : public QObject, public BasicWindowHelper {
void setMinimumSize(QSize size) override;
void setFixedSize(QSize size) override;
void setGeometry(QRect rect) override;
int manualRoundingRadius() const override;

protected:
bool eventFilter(QObject *obj, QEvent *e) override;
Expand Down
4 changes: 4 additions & 0 deletions ui/widgets/rp_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,8 @@ void RpWindow::setBodyTitleArea(
_helper->setBodyTitleArea(std::move(testMethod));
}

int RpWindow::manualRoundingRadius() const {
return _helper->manualRoundingRadius();
}

} // namespace Ui
1 change: 1 addition & 0 deletions ui/widgets/rp_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class RpWindow : public RpWidget {
void showFullScreen();
void showNormal();
void close();
[[nodiscard]] int manualRoundingRadius() const;
void setBodyTitleArea(Fn<WindowTitleHitTestFlags(QPoint)> testMethod);

private:
Expand Down

0 comments on commit 3b69ec4

Please sign in to comment.