Another attempt to implement shadows on Wayland

Works only with patched Qt
This commit is contained in:
Ilya Fedin 2021-01-28 04:22:56 +04:00 committed by John Preston
parent c13d0e96ef
commit 160cd975ce
2 changed files with 33 additions and 8 deletions

View File

@ -65,6 +65,8 @@ using namespace Platform;
using Platform::internal::WaylandIntegration;
using Platform::internal::GtkIntegration;
Q_DECLARE_METATYPE(QMargins);
namespace Platform {
namespace {
@ -796,24 +798,45 @@ bool ShowWindowMenu(QWindow *window) {
}
bool SetWindowExtents(QWindow *window, const QMargins &extents) {
if (!IsWayland()) {
if (IsWayland()) {
#ifdef DESKTOP_APP_QT_PATCHED
window->setProperty("WaylandCustomMargins", QVariant::fromValue<QMargins>(extents));
return true;
#else // DESKTOP_APP_QT_PATCHED
return false;
#endif // !DESKTOP_APP_QT_PATCHED
} else {
return SetXCBFrameExtents(window, extents);
}
return false;
}
bool UnsetWindowExtents(QWindow *window) {
if (!IsWayland()) {
if (IsWayland()) {
#ifdef DESKTOP_APP_QT_PATCHED
window->setProperty("WaylandCustomMargins", QVariant());
return true;
#else // DESKTOP_APP_QT_PATCHED
return false;
#endif // !DESKTOP_APP_QT_PATCHED
} else {
return UnsetXCBFrameExtents(window);
}
return false;
}
bool WindowsNeedShadow() {
return !IsWayland()
&& base::Platform::XCB::IsSupportedByWM(kXCBFrameExtentsAtomName.utf16());
#ifdef DESKTOP_APP_QT_PATCHED
if (IsWayland()) {
return true;
}
#endif // DESKTOP_APP_QT_PATCHED
namespace XCB = base::Platform::XCB;
if (!IsWayland()
&& XCB::IsSupportedByWM(kXCBFrameExtentsAtomName.utf16())) {
return true;
}
return false;
}
Window::ControlsLayout WindowControlsLayout() {

View File

@ -479,6 +479,8 @@ RUN git submodule update qtbase qtwayland qtimageformats qtsvg
WORKDIR qtbase
RUN find ../../patches/qtbase_${QT} -type f -print0 | sort -z | xargs -r0 git apply
WORKDIR ../qtwayland
RUN find ../../patches/qtwayland_${QT} -type f -print0 | sort -z | xargs -r0 git apply
WORKDIR ..
# I couldn't make it work with direct ./configure call :(