mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Another attempt to implement shadows on Wayland
Works only with patched Qt
This commit is contained in:
parent
c13d0e96ef
commit
160cd975ce
2 changed files with 33 additions and 8 deletions
|
@ -65,6 +65,8 @@ using namespace Platform;
|
||||||
using Platform::internal::WaylandIntegration;
|
using Platform::internal::WaylandIntegration;
|
||||||
using Platform::internal::GtkIntegration;
|
using Platform::internal::GtkIntegration;
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(QMargins);
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -796,24 +798,45 @@ bool ShowWindowMenu(QWindow *window) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetWindowExtents(QWindow *window, const QMargins &extents) {
|
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 SetXCBFrameExtents(window, extents);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UnsetWindowExtents(QWindow *window) {
|
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 UnsetXCBFrameExtents(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WindowsNeedShadow() {
|
bool WindowsNeedShadow() {
|
||||||
return !IsWayland()
|
#ifdef DESKTOP_APP_QT_PATCHED
|
||||||
&& base::Platform::XCB::IsSupportedByWM(kXCBFrameExtentsAtomName.utf16());
|
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() {
|
Window::ControlsLayout WindowControlsLayout() {
|
||||||
|
|
|
@ -479,6 +479,8 @@ RUN git submodule update qtbase qtwayland qtimageformats qtsvg
|
||||||
|
|
||||||
WORKDIR qtbase
|
WORKDIR qtbase
|
||||||
RUN find ../../patches/qtbase_${QT} -type f -print0 | sort -z | xargs -r0 git apply
|
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 ..
|
WORKDIR ..
|
||||||
|
|
||||||
# I couldn't make it work with direct ./configure call :(
|
# I couldn't make it work with direct ./configure call :(
|
||||||
|
|
Loading…
Add table
Reference in a new issue