Don't add shadow on Wayland

It was implemented like a hack and worked like a hack... Looks like it is better to wait until Qt give a way to create shadows.
This commit is contained in:
Ilya Fedin 2020-10-01 16:40:20 +04:00 committed by John Preston
parent c6ef2b057e
commit 7fef7e6315
2 changed files with 2 additions and 40 deletions

View File

@ -770,22 +770,6 @@ bool UnsetXCBFrameExtents(QWindow *window) {
return true;
}
bool SetWaylandWindowGeometry(QWindow *window, const QRect &geometry) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) || defined DESKTOP_APP_QT_PATCHED
if (const auto waylandWindow = static_cast<QWaylandWindow*>(
window->handle())) {
if (const auto seat = waylandWindow->display()->lastInputDevice()) {
if (const auto shellSurface = waylandWindow->shellSurface()) {
shellSurface->setWindowGeometry(geometry);
return true;
}
}
}
#endif // Qt >= 5.13 || DESKTOP_APP_QT_PATCHED
return false;
}
Window::Control GtkKeywordToWindowControl(const QString &keyword) {
if (keyword == qstr("minimize")) {
return Window::Control::Minimize;
@ -1107,32 +1091,18 @@ bool ShowWindowMenu(QWindow *window) {
}
bool SetWindowExtents(QWindow *window, const QMargins &extents) {
if (IsWayland()) {
const auto geometry = QRect(QPoint(), window->size())
.marginsRemoved(extents);
return SetWaylandWindowGeometry(window, geometry);
} else {
if (!IsWayland()) {
return SetXCBFrameExtents(window, extents);
}
}
bool UnsetWindowExtents(QWindow *window) {
if (IsWayland()) {
const auto geometry = QRect(QPoint(), window->size());
return SetWaylandWindowGeometry(window, geometry);
} else {
if (!IsWayland()) {
return UnsetXCBFrameExtents(window);
}
}
bool WindowsNeedShadow() {
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) || defined DESKTOP_APP_QT_PATCHED
if (IsWayland()) {
return true;
}
#endif // Qt >= 5.13 || DESKTOP_APP_QT_PATCHED
if (!IsWayland() && XCBFrameExtentsSupported()) {
return true;
}

View File

@ -252,14 +252,6 @@ void TitleWidgetQt::mouseDoubleClickEvent(QMouseEvent *e) {
}
bool TitleWidgetQt::eventFilter(QObject *obj, QEvent *e) {
// I tried to listen only QEvent::Move and QEvent::Resize
// but that doesn't work on Wayland
if (obj->isWidgetType()
&& window() == static_cast<QWidget*>(obj)
&& Platform::IsWayland()) {
updateWindowExtents();
}
if (e->type() == QEvent::MouseMove
|| e->type() == QEvent::MouseButtonPress) {
if (window()->isAncestorOf(static_cast<QWidget*>(obj))) {