1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-18 08:22:33 +02:00

Fix linking and setting window position

This commit is contained in:
Elias Steurer 2023-08-04 15:55:49 +02:00
parent b36b340762
commit 9fb9ab4391
2 changed files with 13 additions and 17 deletions

View File

@ -89,6 +89,9 @@ if(UNIX AND NOT APPLE)
find_package(ECM CONFIG REQUIRED NO_MODULE)
set(LayerShellQt "/usr/local/lib/x86_64-linux-gnu/cmake/LayerShellQt/")
find_package(LayerShellQt REQUIRED)
target_link_libraries(
${PROJECT_NAME}
PRIVATE /usr/local/lib/x86_64-linux-gnu/libLayerShellQtInterface.so)
include(CopyRecursive)
copy_recursive(${CMAKE_CURRENT_SOURCE_DIR}/kde/ScreenPlay ${CMAKE_BINARY_DIR}/bin/kde/ScreenPlay "*")

View File

@ -23,26 +23,19 @@ ScreenPlay::WallpaperExitCode LinuxWaylandWindow::start()
// Get the Wayland display
if (QGuiApplication::platformName() == "wayland") {
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
void *display = native->nativeResourceForWindow("display", nullptr);
// Create the layer shell
LayerShellQt::QWaylandLayerShellIntegration layerShell(display);
auto *layerShell = LayerShellQt::Window::get(&m_window);
layerShell->setLayer(LayerShellQt::Window::LayerBackground);
layerShell->setAnchors(static_cast<QFlags<LayerShellQt::Window::Anchor>>(
LayerShellQt::Window::Anchor::AnchorTop |
LayerShellQt::Window::Anchor::AnchorBottom |
LayerShellQt::Window::Anchor::AnchorLeft |
LayerShellQt::Window::Anchor::AnchorRight
));
// Create the layer surface
LayerShellQt::QWaylandLayerSurface layerSurface(&layerShell, window.windowHandle());
// Set the layer to background
layerSurface.setLayer(LayerShellQt::zwlr_layer_shell_v1::layer::background);
// Set the size of the layer surface to match the screen size
QScreen *screen = QGuiApplication::primaryScreen();
layerSurface.setSize(screen->size().width(), screen->size().height());
// Set the anchor to all edges
layerSurface.setAnchor(LayerShellQt::zwlr_layer_surface_v1::anchor::top |
LayerShellQt::zwlr_layer_surface_v1::anchor::bottom |
LayerShellQt::zwlr_layer_surface_v1::anchor::left |
LayerShellQt::zwlr_layer_surface_v1::anchor::right);
}
m_window.show();