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