mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2025-07-14 11:04:20 -04:00
Compare commits
3 Commits
v5.26.3
...
work/zzag/
Author | SHA1 | Date | |
---|---|---|---|
826c3e3ce0 | |||
3214fb588f | |||
8c39cad0ba |
@ -4,20 +4,19 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(layershellqt)
|
||||
set(PROJECT_VERSION "5.23.80")
|
||||
set(PROJECT_VERSION_MAJOR 5)
|
||||
set(PROJECT_VERSION "6.0.0")
|
||||
set(PROJECT_VERSION_MAJOR 6)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
|
||||
set(QT_MIN_VERSION "5.15.0")
|
||||
set(QT_MIN_VERSION "6.2.0")
|
||||
set(KF5_MIN_VERSION "5.86")
|
||||
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml)
|
||||
find_package(Qt5XkbCommonSupport REQUIRED PRIVATE)
|
||||
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml)
|
||||
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${ECM_MODULE_PATH})
|
||||
|
||||
@ -38,8 +37,6 @@ find_package(Wayland 1.3 COMPONENTS Client Server)
|
||||
find_package(WaylandProtocols)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_check_modules(XKBCOMMON xkbcommon REQUIRED IMPORTED_TARGET)
|
||||
|
||||
set_package_properties(Wayland PROPERTIES
|
||||
TYPE REQUIRED)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90")
|
||||
|
@ -4,6 +4,6 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(Qt5Gui "@QT_MIN_VERSION@")
|
||||
find_dependency(Qt6Gui "@QT_MIN_VERSION@")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/LayerShellQtTargets.cmake")
|
||||
|
@ -16,7 +16,7 @@ ecm_qt_declare_logging_category(LAYER_SHELL_SOURCES
|
||||
)
|
||||
|
||||
add_library(LayerShellQtInterface SHARED qwaylandlayersurface.cpp interfaces/window.cpp interfaces/shell.cpp qwaylandlayershellintegration.cpp qwaylandlayershell.cpp ${LAYER_SHELL_SOURCES})
|
||||
target_link_libraries(LayerShellQtInterface PRIVATE Qt::Gui Qt::WaylandClientPrivate Qt::XkbCommonSupportPrivate Wayland::Client PkgConfig::XKBCOMMON)
|
||||
target_link_libraries(LayerShellQtInterface PRIVATE Qt::Gui Qt::WaylandClientPrivate Wayland::Client)
|
||||
target_include_directories(LayerShellQtInterface PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/LayerShellQt>"
|
||||
INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR}/>"
|
||||
)
|
||||
@ -27,7 +27,7 @@ set_target_properties(LayerShellQtInterface PROPERTIES VERSION ${LAYERSHELLQT_
|
||||
)
|
||||
|
||||
add_library(layer-shell SHARED qwaylandlayershellintegrationplugin.cpp)
|
||||
target_link_libraries(layer-shell LayerShellQtInterface Qt::WaylandClient Qt::WaylandClientPrivate Qt::XkbCommonSupportPrivate Wayland::Client PkgConfig::XKBCOMMON)
|
||||
target_link_libraries(layer-shell LayerShellQtInterface Qt::WaylandClient Qt::WaylandClientPrivate Wayland::Client)
|
||||
|
||||
ecm_generate_headers(LayerShellQt_HEADERS
|
||||
HEADER_NAMES
|
||||
|
@ -22,26 +22,30 @@ QWaylandLayerShellIntegration::~QWaylandLayerShellIntegration()
|
||||
{
|
||||
}
|
||||
|
||||
bool QWaylandLayerShellIntegration::initialize(QtWaylandClient::QWaylandDisplay *display)
|
||||
bool QWaylandLayerShellIntegration::initialize()
|
||||
{
|
||||
QWaylandShellIntegration::initialize(display);
|
||||
display->addRegistryListener(registryLayer, this);
|
||||
return m_layerShell != nullptr;
|
||||
if (m_layerShell) {
|
||||
return true;
|
||||
}
|
||||
wl_registry *registry;
|
||||
uint32_t id;
|
||||
uint32_t version;
|
||||
const bool found = findGlobal(QLatin1String("zwlr_layer_shell_v1"), ®istry, &id, &version);
|
||||
if (!found) {
|
||||
qWarning() << "Could not find the zwlr_layer_shell_v1 global. Compositor does not support the layer shell protocol?";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_layerShell.reset(new QWaylandLayerShell(registry, id, std::min(version, 4u)));
|
||||
return true;
|
||||
}
|
||||
|
||||
QtWaylandClient::QWaylandShellSurface *QWaylandLayerShellIntegration::createShellSurface(QtWaylandClient::QWaylandWindow *window)
|
||||
{
|
||||
return m_layerShell->createLayerSurface(window);
|
||||
}
|
||||
|
||||
void QWaylandLayerShellIntegration::registryLayer(void *data, struct wl_registry *registry, uint32_t id, const QString &interface, uint32_t version)
|
||||
{
|
||||
QWaylandLayerShellIntegration *shell = static_cast<QWaylandLayerShellIntegration *>(data);
|
||||
|
||||
if (interface == zwlr_layer_shell_v1_interface.name)
|
||||
shell->m_layerShell.reset(new QWaylandLayerShell(registry, id, std::min(version, 4u)));
|
||||
if (m_layerShell) {
|
||||
return m_layerShell->createLayerSurface(window);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//#include "qwaylandlayershellintegration.moc"
|
||||
|
@ -8,10 +8,9 @@
|
||||
#ifndef _LAYERSHELLINTEGRATION_P_H
|
||||
#define _LAYERSHELLINTEGRATION_P_H
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include "layershellqt_export.h"
|
||||
#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwaylandclientshellapi_p.h>
|
||||
|
||||
namespace LayerShellQt
|
||||
{
|
||||
@ -23,12 +22,10 @@ public:
|
||||
QWaylandLayerShellIntegration();
|
||||
~QWaylandLayerShellIntegration() override;
|
||||
|
||||
bool initialize(QtWaylandClient::QWaylandDisplay *display) override;
|
||||
bool initialize() override;
|
||||
QtWaylandClient::QWaylandShellSurface *createShellSurface(QtWaylandClient::QWaylandWindow *window) override;
|
||||
|
||||
private:
|
||||
static void registryLayer(void *data, struct wl_registry *registry, uint32_t id, const QString &interface, uint32_t version);
|
||||
|
||||
QScopedPointer<QWaylandLayerShell> m_layerShell;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user