Compare commits

..

15 Commits

Author SHA1 Message Date
826c3e3ce0 Port to QtWaylandClient's shell surface api 2021-11-13 12:32:53 +02:00
3214fb588f Set dummy project version 2021-11-13 12:32:53 +02:00
8c39cad0ba Bump to Qt6 2021-11-13 12:11:48 +02:00
80f6a629bb GIT_SILENT: add missing override 2021-10-27 13:43:28 +02:00
662afeba22 Update kf5 version requirement to 5.86
GIT_SILENT
2021-10-11 20:48:40 +01:00
3dac2dd012 Add FreeBSD CI 2021-10-07 01:27:09 +02:00
5b280a4602 Add Linux CI 2021-10-05 15:14:20 +02:00
eb6fb8ab13 Add .kde-ci.yml 2021-10-05 15:14:05 +02:00
06815f2817 Update version number for 5.23.80
GIT_SILENT
2021-09-16 10:34:01 +01:00
dc07e14630 Update version number for 5.22.90
GIT_SILENT
2021-09-16 09:21:32 +01:00
4a439143ba Fix a crash when creating views on the placeholder screen
When a compositor has no outputs listed Qt creates a dummy placeholder
QScreen object that does not represent a wl_output.

This should still be fixed in the clients to not create a view, it's
wasteful and probably will still have plenty of other bugs, hence the
giant warning, but it's still worth guarding.

CCBUG: 439096
2021-09-15 22:55:35 +00:00
331505a4d2 Explicitly set KDE_COMPILERSETTINGS_LEVEL 2021-08-24 22:41:46 +02:00
f6084b2c43 Fix compile with last ecm.
("we have disabled the C and C++ specific compiler extensions.")
2021-06-28 07:51:57 +02:00
9af3c35020 Mark .gitignore file as non-copyrightable 2021-05-21 15:35:56 +02:00
525fa9b819 Update version number for 5.22.80
GIT_SILENT
2021-05-13 15:09:54 +01:00
11 changed files with 59 additions and 35 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: none
# Ignore the following files # Ignore the following files
.vscode .vscode
*~ *~

6
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: None
# SPDX-License-Identifier: CC0-1.0
include:
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd.yml

7
.kde-ci.yml Normal file
View File

@ -0,0 +1,7 @@
# SPDX-FileCopyrightText: None
# SPDX-License-Identifier: CC0-1.0
Dependencies:
- 'on': ['@all']
'require':
'frameworks/extra-cmake-modules': '@latest'

View File

@ -4,17 +4,19 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(layershellqt) project(layershellqt)
set(PROJECT_VERSION "5.22.4") set(PROJECT_VERSION "6.0.0")
set(PROJECT_VERSION_MAJOR 5) set(PROJECT_VERSION_MAJOR 6)
set(QT_MIN_VERSION "5.15.0") set(CMAKE_C_STANDARD 99)
set(KF5_MIN_VERSION "5.82")
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 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml) find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml)
find_package(Qt5XkbCommonSupport REQUIRED PRIVATE)
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${ECM_MODULE_PATH}) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${ECM_MODULE_PATH})
@ -35,8 +37,6 @@ find_package(Wayland 1.3 COMPONENTS Client Server)
find_package(WaylandProtocols) find_package(WaylandProtocols)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(XKBCOMMON xkbcommon REQUIRED IMPORTED_TARGET)
set_package_properties(Wayland PROPERTIES set_package_properties(Wayland PROPERTIES
TYPE REQUIRED) TYPE REQUIRED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90")

View File

@ -4,6 +4,6 @@
@PACKAGE_INIT@ @PACKAGE_INIT@
include(CMakeFindDependencyMacro) include(CMakeFindDependencyMacro)
find_dependency(Qt5Gui "@QT_MIN_VERSION@") find_dependency(Qt6Gui "@QT_MIN_VERSION@")
include("${CMAKE_CURRENT_LIST_DIR}/LayerShellQtTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/LayerShellQtTargets.cmake")

View File

@ -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}) 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>" target_include_directories(LayerShellQtInterface PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/LayerShellQt>"
INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR}/>" INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR}/>"
) )
@ -27,7 +27,7 @@ set_target_properties(LayerShellQtInterface PROPERTIES VERSION ${LAYERSHELLQT_
) )
add_library(layer-shell SHARED qwaylandlayershellintegrationplugin.cpp) 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 ecm_generate_headers(LayerShellQt_HEADERS
HEADER_NAMES HEADER_NAMES

View File

@ -21,7 +21,7 @@ class LAYERSHELLQT_EXPORT QWaylandLayerShell : public QtWayland::zwlr_layer_shel
{ {
public: public:
QWaylandLayerShell(::wl_registry *registry, uint32_t id, uint32_t version); QWaylandLayerShell(::wl_registry *registry, uint32_t id, uint32_t version);
virtual ~QWaylandLayerShell(); ~QWaylandLayerShell() override;
QWaylandLayerSurface *createLayerSurface(QtWaylandClient::QWaylandWindow *window); QWaylandLayerSurface *createLayerSurface(QtWaylandClient::QWaylandWindow *window);
// TODO: Popups // TODO: Popups

View File

@ -22,26 +22,30 @@ QWaylandLayerShellIntegration::~QWaylandLayerShellIntegration()
{ {
} }
bool QWaylandLayerShellIntegration::initialize(QtWaylandClient::QWaylandDisplay *display) bool QWaylandLayerShellIntegration::initialize()
{ {
QWaylandShellIntegration::initialize(display); if (m_layerShell) {
display->addRegistryListener(registryLayer, this); return true;
return m_layerShell != nullptr; }
wl_registry *registry;
uint32_t id;
uint32_t version;
const bool found = findGlobal(QLatin1String("zwlr_layer_shell_v1"), &registry, &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) QtWaylandClient::QWaylandShellSurface *QWaylandLayerShellIntegration::createShellSurface(QtWaylandClient::QWaylandWindow *window)
{ {
if (m_layerShell) {
return m_layerShell->createLayerSurface(window); return m_layerShell->createLayerSurface(window);
} }
return nullptr;
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)));
} }
} }
//#include "qwaylandlayershellintegration.moc"

View File

@ -8,10 +8,9 @@
#ifndef _LAYERSHELLINTEGRATION_P_H #ifndef _LAYERSHELLINTEGRATION_P_H
#define _LAYERSHELLINTEGRATION_P_H #define _LAYERSHELLINTEGRATION_P_H
#include <wayland-client.h>
#include "layershellqt_export.h" #include "layershellqt_export.h"
#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
#include <QtWaylandClient/private/qwaylandclientshellapi_p.h>
namespace LayerShellQt namespace LayerShellQt
{ {
@ -23,12 +22,10 @@ public:
QWaylandLayerShellIntegration(); QWaylandLayerShellIntegration();
~QWaylandLayerShellIntegration() override; ~QWaylandLayerShellIntegration() override;
bool initialize(QtWaylandClient::QWaylandDisplay *display) override; bool initialize() override;
QtWaylandClient::QWaylandShellSurface *createShellSurface(QtWaylandClient::QWaylandWindow *window) override; QtWaylandClient::QWaylandShellSurface *createShellSurface(QtWaylandClient::QWaylandWindow *window) override;
private: private:
static void registryLayer(void *data, struct wl_registry *registry, uint32_t id, const QString &interface, uint32_t version);
QScopedPointer<QWaylandLayerShell> m_layerShell; QScopedPointer<QWaylandLayerShell> m_layerShell;
}; };

View File

@ -8,6 +8,7 @@
#include "interfaces/shell.h" #include "interfaces/shell.h"
#include "qwaylandlayershell_p.h" #include "qwaylandlayershell_p.h"
#include "qwaylandlayersurface_p.h" #include "qwaylandlayersurface_p.h"
#include "layershellqt_logging.h"
#include <QtWaylandClient/private/qwaylandscreen_p.h> #include <QtWaylandClient/private/qwaylandscreen_p.h>
#include <QtWaylandClient/private/qwaylandsurface_p.h> #include <QtWaylandClient/private/qwaylandsurface_p.h>
@ -22,7 +23,14 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShell *shell, QtWaylandC
LayerShellQt::Window *interface = Window::get(window->window()); LayerShellQt::Window *interface = Window::get(window->window());
Q_ASSERT(interface); Q_ASSERT(interface);
init(shell->get_layer_surface(window->waylandSurface()->object(), window->waylandScreen()->output(), interface->layer(), interface->scope())); // Qt will always assign a screen to a window, but if the compositor has no screens available a dummy QScreen object is created
// this will not cast to a QWaylandScreen
QtWaylandClient::QWaylandScreen *screen = window->waylandScreen();
if (screen->isPlaceholder()) {
qCWarning(LAYERSHELLQT) << "Creating a layer shell for placeholder screen. This will be positioned incorrectly";
}
init(shell->get_layer_surface(window->waylandSurface()->object(), screen->isPlaceholder() ? nullptr : screen->output(), interface->layer(), interface->scope()));
Window::Anchors anchors = interface->anchors(); Window::Anchors anchors = interface->anchors();

View File

@ -23,7 +23,7 @@ class LAYERSHELLQT_EXPORT QWaylandLayerSurface : public QtWaylandClient::QWaylan
Q_OBJECT Q_OBJECT
public: public:
QWaylandLayerSurface(QWaylandLayerShell *shell, QtWaylandClient::QWaylandWindow *window); QWaylandLayerSurface(QWaylandLayerShell *shell, QtWaylandClient::QWaylandWindow *window);
virtual ~QWaylandLayerSurface(); ~QWaylandLayerSurface() override;
bool isExposed() const override bool isExposed() const override
{ {