Fix closing Ui::Window from FullScreen on macOS.
This commit is contained in:
parent
f2f592be81
commit
a1dbca8578
6 changed files with 29 additions and 4 deletions
|
|
@ -24,6 +24,7 @@ public:
|
|||
void setMinimumSize(QSize size) override;
|
||||
void setFixedSize(QSize size) override;
|
||||
void setGeometry(QRect rect) override;
|
||||
void close() override;
|
||||
|
||||
private:
|
||||
class Private;
|
||||
|
|
|
|||
|
|
@ -110,11 +110,13 @@ private:
|
|||
class WindowHelper::Private final {
|
||||
public:
|
||||
explicit Private(not_null<WindowHelper*> owner);
|
||||
~Private();
|
||||
|
||||
[[nodiscard]] int customTitleHeight() const;
|
||||
[[nodiscard]] QRect controlsRect() const;
|
||||
[[nodiscard]] bool checkNativeMove(void *nswindow) const;
|
||||
void activateBeforeNativeMove();
|
||||
void close();
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
|
@ -143,6 +145,10 @@ WindowHelper::Private::Private(not_null<WindowHelper*> owner)
|
|||
init();
|
||||
}
|
||||
|
||||
WindowHelper::Private::~Private() {
|
||||
[_observer release];
|
||||
}
|
||||
|
||||
int WindowHelper::Private::customTitleHeight() const {
|
||||
return _customTitleHeight;
|
||||
}
|
||||
|
|
@ -192,18 +198,22 @@ void WindowHelper::Private::activateBeforeNativeMove() {
|
|||
[_nativeWindow makeKeyAndOrderFront:_nativeWindow];
|
||||
}
|
||||
|
||||
void WindowHelper::Private::close() {
|
||||
[_nativeWindow close];
|
||||
}
|
||||
|
||||
Fn<void(bool)> WindowHelper::Private::toggleCustomTitleCallback() {
|
||||
return [=](bool visible) {
|
||||
return crl::guard(_owner->window(), [=](bool visible) {
|
||||
_owner->toggleCustomTitle(visible);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Fn<void()> WindowHelper::Private::enforceStyleCallback() {
|
||||
return [=] {
|
||||
return crl::guard(_owner->window(), [=] {
|
||||
if (_nativeWindow && _customTitleHeight > 0) {
|
||||
[_nativeWindow setStyleMask:[_nativeWindow styleMask] | NSFullSizeContentViewWindowMask];
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
void WindowHelper::Private::initOpenGL() {
|
||||
|
|
@ -345,6 +355,10 @@ void WindowHelper::setupBodyTitleAreaEvents() {
|
|||
}));
|
||||
}
|
||||
|
||||
void WindowHelper::close() {
|
||||
_private->close();
|
||||
}
|
||||
|
||||
void WindowHelper::init() {
|
||||
rpl::combine(
|
||||
window()->sizeValue(),
|
||||
|
|
|
|||
|
|
@ -49,6 +49,10 @@ void BasicWindowHelper::showNormal() {
|
|||
_window->showNormal();
|
||||
}
|
||||
|
||||
void BasicWindowHelper::close() {
|
||||
_window->close();
|
||||
}
|
||||
|
||||
void BasicWindowHelper::setBodyTitleArea(
|
||||
Fn<WindowTitleHitTestFlags(QPoint)> testMethod) {
|
||||
Expects(!_bodyTitleAreaTestMethod);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public:
|
|||
virtual void setGeometry(QRect rect);
|
||||
virtual void showFullScreen();
|
||||
virtual void showNormal();
|
||||
virtual void close();
|
||||
|
||||
void setBodyTitleArea(Fn<WindowTitleHitTestFlags(QPoint)> testMethod);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,10 @@ void Window::showNormal() {
|
|||
_helper->showNormal();
|
||||
}
|
||||
|
||||
void Window::close() {
|
||||
_helper->close();
|
||||
}
|
||||
|
||||
void Window::setBodyTitleArea(
|
||||
Fn<WindowTitleHitTestFlags(QPoint)> testMethod) {
|
||||
_helper->setBodyTitleArea(std::move(testMethod));
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public:
|
|||
void setGeometry(QRect rect);
|
||||
void showFullScreen();
|
||||
void showNormal();
|
||||
void close();
|
||||
void setBodyTitleArea(Fn<WindowTitleHitTestFlags(QPoint)> testMethod);
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue