Remove 'osx' special target code.

This commit is contained in:
John Preston 2021-07-23 18:52:15 +03:00
parent 1ed242718e
commit 8de7b873f9
2 changed files with 0 additions and 31 deletions

View file

@ -41,14 +41,6 @@ private:
const not_null<RpWidget*> _body;
bool _titleVisible = true;
#ifdef OS_OSX
struct WindowDrag {
QPoint windowStartPosition;
QPoint dragStartPosition;
};
std::optional<WindowDrag> _drag;
#endif // OS_OSX
};
} // namespace Platform

View file

@ -367,7 +367,6 @@ void WindowHelper::setGeometry(QRect rect) {
}
void WindowHelper::setupBodyTitleAreaEvents() {
#ifndef OS_OSX
const auto controls = _private->controlsRect();
qApp->installNativeEventFilter(new EventFilter(window(), [=](void *nswindow) {
const auto point = body()->mapFromGlobal(QCursor::pos());
@ -380,28 +379,6 @@ void WindowHelper::setupBodyTitleAreaEvents() {
}
return false;
}));
#else // OS_OSX
// OS X 10.10 doesn't have performWindowDragWithEvent yet.
body()->events() | rpl::start_with_next([=](not_null<QEvent*> e) {
const auto hitTest = [&] {
return bodyTitleAreaHit(
static_cast<QMouseEvent*>(e.get())->pos());
};
if (e->type() == QEvent::MouseButtonRelease
&& (static_cast<QMouseEvent*>(e.get())->button()
== Qt::LeftButton)) {
_drag = std::nullopt;
} else if (e->type() == QEvent::MouseButtonPress
&& hitTest()
&& (static_cast<QMouseEvent*>(e.get())->button()
== Qt::LeftButton)) {
_drag = { window()->pos(), static_cast<QMouseEvent*>(e.get())->globalPos() };
} else if (e->type() == QEvent::MouseMove && _drag && !window()->isFullScreen()) {
const auto delta = static_cast<QMouseEvent*>(e.get())->globalPos() - _drag->dragStartPosition;
window()->move(_drag->windowStartPosition + delta);
}
}, body()->lifetime());
#endif // OS_OSX
}
void WindowHelper::close() {