diff options
author | Ilya Fedin <fedin-ilja2010@ya.ru> | 2022-04-12 08:48:34 +0400 |
---|---|---|
committer | Ilya Fedin <fedin-ilja2010@ya.ru> | 2022-07-19 19:15:01 +0400 |
commit | c9f355ebe8d8171c2de265c00780d7f39b580409 (patch) | |
tree | 65f30943b16f176154561d5457d8388b7e271398 /src/client/qwaylandnativeinterface.cpp | |
parent | 5a288c87e00cdd7224a673eb7ae35b0995d881ba (diff) | |
download | qtwayland-c9f355ebe8d8171c2de265c00780d7f39b580409.tar.gz |
Client: Expose a way to set window margins via native interface
The lack of such API is a big hassle to me since a long time.
All that time I was forced to have my own fork of the
xdg-shell plugin in the application code in order to have
shadows on Wayland with custom client-side decorations.
I hope I won't have to maintain the fork anymore.
Pick-to: 6.4
Change-Id: Iaf498469843b5cac5c458049164065c4ef15877d
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Diffstat (limited to 'src/client/qwaylandnativeinterface.cpp')
-rw-r--r-- | src/client/qwaylandnativeinterface.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp index 6d858348..f2620fc4 100644 --- a/src/client/qwaylandnativeinterface.cpp +++ b/src/client/qwaylandnativeinterface.cpp @@ -129,6 +129,17 @@ void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resour } #endif // opengl +QPlatformNativeInterface::NativeResourceForWindowFunction QWaylandNativeInterface::nativeResourceFunctionForWindow(const QByteArray &resource) +{ + QByteArray lowerCaseResource = resource.toLower(); + + if (lowerCaseResource == "setmargins") { + return NativeResourceForWindowFunction(reinterpret_cast<void *>(setWindowMargins)); + } + + return nullptr; +} + QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const { QWaylandWindow *waylandWindow = static_cast<QWaylandWindow *>(window); @@ -158,6 +169,12 @@ void QWaylandNativeInterface::emitWindowPropertyChanged(QPlatformWindow *window, emit windowPropertyChanged(window,name); } +void QWaylandNativeInterface::setWindowMargins(QWindow *window, const QMargins &margins) +{ + QWaylandWindow *wlWindow = static_cast<QWaylandWindow*>(window->handle()); + wlWindow->setCustomMargins(margins); +} + } QT_END_NAMESPACE |