From 93cb056ec5c2efde772c6a8f4db8c0bcf4270d69 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Wed, 14 Feb 2024 22:12:48 +0100 Subject: [PATCH 01/25] fix: remove unused lambda captures These are not needed and produce warnings. --- como/render/backend/wlroots/egl_backend.h | 3 +-- como/render/effect/setup_handler.h | 2 +- como/render/effect/setup_window.h | 2 +- como/render/wayland/platform.h | 2 +- como/script/space.h | 2 +- como/win/tabbox/tabbox.h | 2 +- como/win/wayland/xdg_shell.h | 4 ++-- como/xwl/xwayland.h | 2 +- 8 files changed, 9 insertions(+), 10 deletions(-) diff --git a/como/render/backend/wlroots/egl_backend.h b/como/render/backend/wlroots/egl_backend.h index 89e53f3e8..00ad67da5 100644 --- a/como/render/backend/wlroots/egl_backend.h +++ b/como/render/backend/wlroots/egl_backend.h @@ -76,8 +76,7 @@ class egl_backend : public gl::backend( backend.frontend->base.server->display.get(), - [this]( - auto const& planes, auto format, auto modifier, auto const& size, auto flags) { + [](auto const& planes, auto format, auto modifier, auto const& size, auto flags) { return std::make_unique( planes, format, modifier, size, flags); }); diff --git a/como/render/effect/setup_handler.h b/como/render/effect/setup_handler.h index 6c7650518..996b45d92 100644 --- a/como/render/effect/setup_handler.h +++ b/como/render/effect/setup_handler.h @@ -227,7 +227,7 @@ void setup_handler(Handler& handler) if constexpr (requires { typename Handler::space_t::internal_window_t; }) { for (auto& win : ws->windows) { - std::visit(overload{[&handler](typename Handler::space_t::internal_window_t* win) { + std::visit(overload{[](typename Handler::space_t::internal_window_t* win) { setup_window_connections(*win); }, [](auto&&) {}}, diff --git a/como/render/effect/setup_window.h b/como/render/effect/setup_window.h index 301011ba0..047b2583a 100644 --- a/como/render/effect/setup_window.h +++ b/como/render/effect/setup_window.h @@ -22,7 +22,7 @@ void setup_window_connections(Win& window) Q_EMIT eff_win->windowDesktopsChanged(eff_win); }); QObject::connect( - qtwin, &win::window_qobject::maximize_mode_changed, eff_win, [&window, eff_win](auto mode) { + qtwin, &win::window_qobject::maximize_mode_changed, eff_win, [eff_win](auto mode) { Q_EMIT eff_win->windowMaximizedStateChanged( eff_win, flags(mode & win::maximize_mode::horizontal), diff --git a/como/render/wayland/platform.h b/como/render/wayland/platform.h index 7347cda91..895760594 100644 --- a/como/render/wayland/platform.h +++ b/como/render/wayland/platform.h @@ -45,7 +45,7 @@ class platform platform(Base& base) : base{base} - , qobject{std::make_unique([this](auto /*te*/) { return false; })} + , qobject{std::make_unique([](auto /*te*/) { return false; })} , options{std::make_unique(base.operation_mode, base.config.main)} , backend{*this} , night_color{std::make_unique>(base)} diff --git a/como/script/space.h b/como/script/space.h index 5b785ef4c..78e6a7da9 100644 --- a/como/script/space.h +++ b/como/script/space.h @@ -499,7 +499,7 @@ class template_space : public Space QObject::connect( ref_space->qobject.get(), &space_qobject::clientAdded, this, [this](auto win_id) { auto ref_win = this->ref_space->windows_map.at(win_id); - std::visit(overload{[&, this](auto&& win) { handle_client_added(win); }}, ref_win); + std::visit(overload{[this](auto&& win) { handle_client_added(win); }}, ref_win); }); QObject::connect(ref_space->qobject.get(), &space_qobject::clientRemoved, diff --git a/como/win/tabbox/tabbox.h b/como/win/tabbox/tabbox.h index 6161ee8fc..18d2133b9 100644 --- a/como/win/tabbox/tabbox.h +++ b/como/win/tabbox/tabbox.h @@ -818,7 +818,7 @@ class tabbox options_traverse_all = group.readEntry("TraverseAll", false); } - auto accept = [&, this](auto&& win) { + auto accept = [&](auto&& win) { if (!win || win == old_top_win) { // No candidate anymore, looped around. Abort looping. return true; diff --git a/como/win/wayland/xdg_shell.h b/como/win/wayland/xdg_shell.h index 57c41508c..c35c32db8 100644 --- a/como/win/wayland/xdg_shell.h +++ b/como/win/wayland/xdg_shell.h @@ -278,7 +278,7 @@ Win& create_toplevel_window(Space* space, Wrapland::Server::XdgShellToplevel* to QObject::connect(toplevel, &WS::XdgShellToplevel::transientForChanged, win.qobject.get(), - [space, &win] { handle_parent_changed(win); }); + [&win] { handle_parent_changed(win); }); auto configure = [&win, toplevel] { if (win.closing) { @@ -649,7 +649,7 @@ void handle_new_toplevel(Space* space, Wrapland::Server::XdgShellToplevel* tople QObject::connect(space->xdg_foreign.get(), &Wrapland::Server::XdgForeign::parentChanged, win.qobject.get(), - [space, &win](auto /*parent*/, auto child) { + [&win](auto /*parent*/, auto child) { if (child == win.surface) { handle_parent_changed(win); } diff --git a/como/xwl/xwayland.h b/como/xwl/xwayland.h index 47aa3c780..8c0523f41 100644 --- a/como/xwl/xwayland.h +++ b/como/xwl/xwayland.h @@ -152,7 +152,7 @@ class xwayland : public QObject xwayland_process->setArguments(arguments); xwayland_fail_notifier = QObject::connect( - xwayland_process, &QProcess::errorOccurred, this, [this](QProcess::ProcessError error) { + xwayland_process, &QProcess::errorOccurred, this, [](QProcess::ProcessError error) { if (error == QProcess::FailedToStart) { std::cerr << "FATAL ERROR: failed to start Xwayland" << std::endl; } else { From 2b376f56937af46841d629bad9eb39ac07c058b2 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Thu, 15 Feb 2024 00:18:24 +0100 Subject: [PATCH 02/25] build: disable cast-align warnings With wlroots and libwayland this warning is triggered at too many places. Still it might make sense instead to enable the warning in general and disable it in a more targetted manner with pragmas. For now we opt for the general removal and add a todo comment to revisit later. --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c86e82c2..3d56c818d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,11 @@ include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) +# TODO(romangg): The KDECompilerSettings include adds cast-align warnings. But with wlroots and +# libwayland we have too many C casts like this. For now disable the cast-align warning again. +# Should we instead wrap the calls and disable the warnings with pragma more targeted? +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-cast-align") + include(ECMInstallIcons) include(ECMOptionalAddSubdirectory) include(ECMConfiguredInstall) From 3d99c78dfc06a8d4dadb246a21eff8590849d4c5 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 18:27:05 +0100 Subject: [PATCH 03/25] build: disable missing-field-initializers warning Produces a lot of warnings with gcc and potentially clang on structs where we default-initialize some fields. --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d56c818d..2a0a5bacd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,9 @@ include(KDECompilerSettings NO_POLICY_SCOPE) # Should we instead wrap the calls and disable the warnings with pragma more targeted? set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-cast-align") +# Produces a lot of warnings with gcc on structs where we default-initialize some fields. +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-field-initializers") + include(ECMInstallIcons) include(ECMOptionalAddSubdirectory) include(ECMConfiguredInstall) From cfe3793fef9dba33845026f6072e0727d42bb074 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Sun, 18 Feb 2024 22:36:35 +0100 Subject: [PATCH 04/25] fix: remove unused symbols Produced compile warnings. --- autotests/integration/keyboard_keymap.cpp | 24 ------------------- autotests/integration/plasma_window.cpp | 2 ++ .../effect/interface/offscreen_effect.cpp | 5 ---- como/script/quick_scene_effect.cpp | 2 +- plugins/effects/cube/cube.cpp | 2 +- plugins/effects/overview/overvieweffect.cpp | 4 ++-- plugins/qpa/backingstore.cpp | 7 ------ plugins/qpa/offscreensurface.h | 5 ---- plugins/windowsystem/windowsystem.cpp | 2 +- 9 files changed, 7 insertions(+), 46 deletions(-) diff --git a/autotests/integration/keyboard_keymap.cpp b/autotests/integration/keyboard_keymap.cpp index d2a9a6ec4..b2361bb18 100644 --- a/autotests/integration/keyboard_keymap.cpp +++ b/autotests/integration/keyboard_keymap.cpp @@ -62,30 +62,6 @@ TEST_CASE("keyboard keymap", "[input]") auto create_focus_client = []() { return client(global_selection::seat); }; - auto create_keymap = []() -> std::string { - auto context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); - - auto const model = "pc104"; - auto const layout = "de"; - auto const variant = "nodeadkeys"; - auto const options = ""; - - auto const rule_names = xkb_rule_names{.rules = nullptr, - .model = model, - .layout = layout, - .variant = variant, - .options = options}; - - auto keymap = xkb_keymap_new_from_names(context, &rule_names, XKB_KEYMAP_COMPILE_NO_FLAGS); - auto keymap_c_string = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1); - auto keymap_string = std::string(keymap_c_string); - - free(keymap_c_string); - xkb_keymap_unref(keymap); - xkb_context_unref(context); - return keymap_string; - }; - SECTION("focus") { /** diff --git a/autotests/integration/plasma_window.cpp b/autotests/integration/plasma_window.cpp index 8f08b1378..93e598d23 100644 --- a/autotests/integration/plasma_window.cpp +++ b/autotests/integration/plasma_window.cpp @@ -374,7 +374,9 @@ TEST_CASE("plasma window", "[win]") ScreenLocker::KSldApp::self()->lock(ScreenLocker::EstablishLock::Immediate); // The lock screen creates one client per screen. +#if 0 auto outputs_count = setup.base->outputs.size(); +#endif // TODO(romangg): Fails for unknown reason REQUIRE_FALSE(clientAddedSpy.wait()); diff --git a/como/render/effect/interface/offscreen_effect.cpp b/como/render/effect/interface/offscreen_effect.cpp index 60b318c11..38b9a35b3 100644 --- a/como/render/effect/interface/offscreen_effect.cpp +++ b/como/render/effect/interface/offscreen_effect.cpp @@ -191,11 +191,6 @@ void OffscreenEffectPrivate::paint(GLTexture* texture, const GLenum primitiveType = indexedQuads ? GL_QUADS : GL_TRIANGLES; const int verticesPerQuad = indexedQuads ? 4 : 6; - const GLVertexAttrib attribs[] = { - {VA_Position, 2, GL_FLOAT, offsetof(GLVertex2D, position)}, - {VA_TexCoord, 2, GL_FLOAT, offsetof(GLVertex2D, texcoord)}, - }; - GLVertexBuffer* vbo = GLVertexBuffer::streamingBuffer(); vbo->reset(); vbo->setAttribLayout(std::span(GLVertexBuffer::GLVertex2DLayout), sizeof(GLVertex2D)); diff --git a/como/script/quick_scene_effect.cpp b/como/script/quick_scene_effect.cpp index 1e9a94f7b..ef02b7026 100644 --- a/como/script/quick_scene_effect.cpp +++ b/como/script/quick_scene_effect.cpp @@ -22,7 +22,7 @@ ScriptedQuickSceneEffect::~ScriptedQuickSceneEffect() { } -void ScriptedQuickSceneEffect::reconfigure(ReconfigureFlags flags) +void ScriptedQuickSceneEffect::reconfigure(ReconfigureFlags /*flags*/) { m_configLoader->load(); Q_EMIT m_configLoader->configChanged(); diff --git a/plugins/effects/cube/cube.cpp b/plugins/effects/cube/cube.cpp index 8201bcf42..e500fac8f 100644 --- a/plugins/effects/cube/cube.cpp +++ b/plugins/effects/cube/cube.cpp @@ -1913,7 +1913,7 @@ enum class tabbox_mode { // windows of current application }; -void CubeEffect::slotTabBoxAdded(int mode) +void CubeEffect::slotTabBoxAdded(int /*mode*/) { if (activated) return; diff --git a/plugins/effects/overview/overvieweffect.cpp b/plugins/effects/overview/overvieweffect.cpp index 92f8c28f1..649630329 100644 --- a/plugins/effects/overview/overvieweffect.cpp +++ b/plugins/effects/overview/overvieweffect.cpp @@ -137,14 +137,14 @@ OverviewEffect::OverviewEffect() connect(effects, &EffectsHandler::desktopChanging, this, - [this](auto old, QPointF desktopOffset, EffectWindow* with) { + [this](auto /*old*/, QPointF desktopOffset, EffectWindow* /*with*/) { m_desktopOffset = desktopOffset; Q_EMIT desktopOffsetChanged(); }); connect(effects, &EffectsHandler::desktopChanged, this, - [this](auto old, auto current, EffectWindow* with) { + [this](auto /*old*/, auto /*current*/, EffectWindow* /*with*/) { m_desktopOffset = QPointF(0, 0); Q_EMIT desktopOffsetChanged(); }); diff --git a/plugins/qpa/backingstore.cpp b/plugins/qpa/backingstore.cpp index 8d8aa8cc9..1b03626b7 100644 --- a/plugins/qpa/backingstore.cpp +++ b/plugins/qpa/backingstore.cpp @@ -41,13 +41,6 @@ void BackingStore::resize(const QSize& size, const QRegion& staticContents) m_buffer.setDevicePixelRatio(devicePixelRatio); } -static void blitImage(const QImage& source, QImage& target, const QRegion& region) -{ - for (const QRect& rect : region) { - blitImage(source, target, rect); - } -} - void BackingStore::flush(QWindow* window, const QRegion& region, const QPoint& offset) { Q_UNUSED(offset) diff --git a/plugins/qpa/offscreensurface.h b/plugins/qpa/offscreensurface.h index c8cc3f431..e389526ff 100644 --- a/plugins/qpa/offscreensurface.h +++ b/plugins/qpa/offscreensurface.h @@ -6,8 +6,6 @@ SPDX-License-Identifier: GPL-2.0-or-later #pragma once -#include - #include namespace como @@ -25,9 +23,6 @@ class OffscreenSurface : public QPlatformOffscreenSurface private: QSurfaceFormat m_format; - - EGLDisplay m_eglDisplay = EGL_NO_DISPLAY; - EGLSurface m_surface = EGL_NO_SURFACE; }; } // namespace QPA diff --git a/plugins/windowsystem/windowsystem.cpp b/plugins/windowsystem/windowsystem.cpp index 9c689fbf1..813e69eab 100644 --- a/plugins/windowsystem/windowsystem.cpp +++ b/plugins/windowsystem/windowsystem.cpp @@ -40,7 +40,7 @@ bool WindowSystem::showingDesktop() return false; } -void WindowSystem::requestToken(QWindow* win, uint32_t serial, const QString& appId) +void WindowSystem::requestToken(QWindow* /*win*/, uint32_t serial, const QString& appId) { // It's coming from within kwin, it doesn't matter the window. From d8028748fb43adc23888c02ae600bfa660e50659 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Sun, 18 Feb 2024 22:38:01 +0100 Subject: [PATCH 05/25] fix: compare numbers without implicit casts Produced compile warnings. --- autotests/gestures.cpp | 8 +++---- autotests/integration/gestures.cpp | 34 +++++++++++++++--------------- autotests/integration/screens.cpp | 2 +- autotests/integration/subspace.cpp | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/autotests/gestures.cpp b/autotests/gestures.cpp index 1b11ce5d2..bac1ec89a 100644 --- a/autotests/gestures.cpp +++ b/autotests/gestures.cpp @@ -18,7 +18,7 @@ TEST_CASE("gestures unit", "[input],[unit]") { SECTION("swipe min finger") { - auto count = GENERATE(0, 1, 10); + auto count = GENERATE(0u, 1u, 10u); win::swipe_gesture swipeGesture; QCOMPARE(swipeGesture.minimumFingerCountIsRelevant(), false); @@ -35,7 +35,7 @@ TEST_CASE("gestures unit", "[input],[unit]") SECTION("pinch min finger") { - auto count = GENERATE(0, 1, 10); + auto count = GENERATE(0u, 1u, 10u); win::pinch_gesture pinchGesture; QCOMPARE(pinchGesture.minimumFingerCountIsRelevant(), false); @@ -52,7 +52,7 @@ TEST_CASE("gestures unit", "[input],[unit]") SECTION("swipe max finger") { - auto count = GENERATE(0, 1, 10); + auto count = GENERATE(0u, 1u, 10u); win::swipe_gesture gesture; QCOMPARE(gesture.maximumFingerCountIsRelevant(), false); @@ -69,7 +69,7 @@ TEST_CASE("gestures unit", "[input],[unit]") SECTION("pinch max finger") { - auto count = GENERATE(0, 1, 10); + auto count = GENERATE(0u, 1u, 10u); win::pinch_gesture gesture; QCOMPARE(gesture.maximumFingerCountIsRelevant(), false); diff --git a/autotests/integration/gestures.cpp b/autotests/integration/gestures.cpp index 26258eed7..8e187adf5 100644 --- a/autotests/integration/gestures.cpp +++ b/autotests/integration/gestures.cpp @@ -39,7 +39,7 @@ TEST_CASE("gestures", "[input]") &Wrapland::Client::PointerSwipeGesture::cancelled); // Arbitrary test values. - auto fingers = 3; + auto fingers = 3u; auto dx = 1; auto dy = 2; uint32_t time{0}; @@ -65,31 +65,31 @@ TEST_CASE("gestures", "[input]") cursor()->set_pos(QPoint(10, 10)); swipe_begin(fingers, ++time); QVERIFY(begin_spy.wait()); - QCOMPARE(begin_spy.back().back().toInt(), time); + QCOMPARE(begin_spy.back().back().toUInt(), time); QCOMPARE(client_gesture->fingerCount(), fingers); QCOMPARE(begin_spy.size(), 1); swipe_update(fingers, ++dx, ++dy, ++time); QVERIFY(update_spy.wait()); QCOMPARE(update_spy.back().front().toSizeF(), QSizeF(dx, dy)); - QCOMPARE(update_spy.back().back().toInt(), time); + QCOMPARE(update_spy.back().back().toUInt(), time); QCOMPARE(client_gesture->fingerCount(), fingers); QCOMPARE(update_spy.size(), 1); swipe_end(++time); QVERIFY(end_spy.wait()); - QCOMPARE(end_spy.back().back().toInt(), time); + QCOMPARE(end_spy.back().back().toUInt(), time); QCOMPARE(end_spy.size(), 1); swipe_begin(++fingers, ++time); QVERIFY(begin_spy.wait()); - QCOMPARE(begin_spy.back().back().toInt(), time); + QCOMPARE(begin_spy.back().back().toUInt(), time); QCOMPARE(client_gesture->fingerCount(), fingers); QCOMPARE(begin_spy.size(), 2); swipe_cancel(++time); QVERIFY(cancel_spy.wait()); - QCOMPARE(cancel_spy.back().back().toInt(), time); + QCOMPARE(cancel_spy.back().back().toUInt(), time); QCOMPARE(cancel_spy.size(), 1); QCOMPARE(end_spy.size(), 1); } @@ -112,7 +112,7 @@ TEST_CASE("gestures", "[input]") &Wrapland::Client::PointerPinchGesture::cancelled); // Arbitrary test values. - auto fingers = 3; + auto fingers = 3u; auto dx = 1; auto dy = 2; auto scale = 2; @@ -140,31 +140,31 @@ TEST_CASE("gestures", "[input]") cursor()->set_pos(QPoint(10, 10)); pinch_begin(fingers, ++time); QVERIFY(begin_spy.wait()); - QCOMPARE(begin_spy.back().back().toInt(), time); + QCOMPARE(begin_spy.back().back().toUInt(), time); QCOMPARE(client_gesture->fingerCount(), fingers); QCOMPARE(begin_spy.size(), 1); pinch_update(fingers, ++dx, ++dy, ++scale, ++rotation, ++time); QVERIFY(update_spy.wait()); QCOMPARE(update_spy.back().front().toSizeF(), QSizeF(dx, dy)); - QCOMPARE(update_spy.back().back().toInt(), time); + QCOMPARE(update_spy.back().back().toUInt(), time); QCOMPARE(client_gesture->fingerCount(), fingers); QCOMPARE(update_spy.size(), 1); pinch_end(++time); QVERIFY(end_spy.wait()); - QCOMPARE(end_spy.back().back().toInt(), time); + QCOMPARE(end_spy.back().back().toUInt(), time); QCOMPARE(end_spy.size(), 1); pinch_begin(++fingers, ++time); QVERIFY(begin_spy.wait()); - QCOMPARE(begin_spy.back().back().toInt(), time); + QCOMPARE(begin_spy.back().back().toUInt(), time); QCOMPARE(client_gesture->fingerCount(), fingers); QCOMPARE(begin_spy.size(), 2); pinch_cancel(++time); QVERIFY(cancel_spy.wait()); - QCOMPARE(cancel_spy.back().back().toInt(), time); + QCOMPARE(cancel_spy.back().back().toUInt(), time); QCOMPARE(cancel_spy.size(), 1); QCOMPARE(end_spy.size(), 1); } @@ -186,7 +186,7 @@ TEST_CASE("gestures", "[input]") &Wrapland::Client::pointer_hold_gesture::cancelled); // Arbitrary test values. - auto fingers = 3; + auto fingers = 3u; uint32_t time{0}; auto surface = create_surface(); @@ -206,24 +206,24 @@ TEST_CASE("gestures", "[input]") cursor()->set_pos(QPoint(10, 10)); hold_begin(fingers, ++time); QVERIFY(begin_spy.wait()); - QCOMPARE(begin_spy.back().back().toInt(), time); + QCOMPARE(begin_spy.back().back().toUInt(), time); QCOMPARE(client_gesture->fingerCount(), fingers); QCOMPARE(begin_spy.size(), 1); hold_end(++time); QVERIFY(end_spy.wait()); - QCOMPARE(end_spy.back().back().toInt(), time); + QCOMPARE(end_spy.back().back().toUInt(), time); QCOMPARE(end_spy.size(), 1); hold_begin(++fingers, ++time); QVERIFY(begin_spy.wait()); - QCOMPARE(begin_spy.back().back().toInt(), time); + QCOMPARE(begin_spy.back().back().toUInt(), time); QCOMPARE(client_gesture->fingerCount(), fingers); QCOMPARE(begin_spy.size(), 2); hold_cancel(++time); QVERIFY(cancel_spy.wait()); - QCOMPARE(cancel_spy.back().back().toInt(), time); + QCOMPARE(cancel_spy.back().back().toUInt(), time); QCOMPARE(cancel_spy.size(), 1); QCOMPARE(end_spy.size(), 1); } diff --git a/autotests/integration/screens.cpp b/autotests/integration/screens.cpp index 276b65133..7a5f8cd39 100644 --- a/autotests/integration/screens.cpp +++ b/autotests/integration/screens.cpp @@ -191,7 +191,7 @@ TEST_CASE("screens", "[base]") SECTION("current") { struct data { - int current; + size_t current; bool signal; }; diff --git a/autotests/integration/subspace.cpp b/autotests/integration/subspace.cpp index 8d00b9d2b..173825e12 100644 --- a/autotests/integration/subspace.cpp +++ b/autotests/integration/subspace.cpp @@ -581,7 +581,7 @@ TEST_CASE("subspace", "[win]") win::subspace_grid grid; - QCOMPARE(vd_manager->subspaces.size(), int(test_data.init_count)); + QCOMPARE(vd_manager->subspaces.size(), test_data.init_count); grid.update(test_data.size, test_data.orientation, vd_manager->subspaces); QCOMPARE(grid.size(), test_data.size); From a1920e1662d052ffa8e9ac6209a0dad27cb4a42d Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 09:52:55 +0100 Subject: [PATCH 06/25] fix(plugin): compare desktop number not pointer Taking the distance between the pointers is wrong. A warning on the for-loop number types indicated this issue. --- plugins/effects/cubeslide/cubeslide.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/effects/cubeslide/cubeslide.cpp b/plugins/effects/cubeslide/cubeslide.cpp index 4a0537b14..15097d260 100644 --- a/plugins/effects/cubeslide/cubeslide.cpp +++ b/plugins/effects/cubeslide/cubeslide.cpp @@ -530,7 +530,7 @@ void CubeSlideEffect::slotDesktopChanged(win::subspace* old, left = effects->desktops().size() + left; } - auto right = current - old; + auto right = current->x11DesktopNumber() - old->x11DesktopNumber(); if (right < 0) { right = effects->desktops().size() + right; } From 4e4fb4bed8229e542e19ece7d756c5e88685330b Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 18:54:20 +0100 Subject: [PATCH 07/25] fix: cast to int for comparison with zero The desktop numbers are unsinged, so cast to int before comparing to zero. --- plugins/effects/cubeslide/cubeslide.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/effects/cubeslide/cubeslide.cpp b/plugins/effects/cubeslide/cubeslide.cpp index 15097d260..f895270e2 100644 --- a/plugins/effects/cubeslide/cubeslide.cpp +++ b/plugins/effects/cubeslide/cubeslide.cpp @@ -525,12 +525,12 @@ void CubeSlideEffect::slotDesktopChanged(win::subspace* old, } } else { // ignore pager layout - auto left = old->x11DesktopNumber() - current->x11DesktopNumber(); + auto left = static_cast(old->x11DesktopNumber() - current->x11DesktopNumber()); if (left < 0) { left = effects->desktops().size() + left; } - auto right = current->x11DesktopNumber() - old->x11DesktopNumber(); + auto right = static_cast(current->x11DesktopNumber() - old->x11DesktopNumber()); if (right < 0) { right = effects->desktops().size() + right; } From 5cd7027bf89ca2c9fa4865b8d77d02ffe0d84f1a Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Sun, 18 Feb 2024 22:47:49 +0100 Subject: [PATCH 08/25] test: explicitly default ctors They were declared but not defined. --- autotests/integration/keyboard_keymap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autotests/integration/keyboard_keymap.cpp b/autotests/integration/keyboard_keymap.cpp index b2361bb18..404af8143 100644 --- a/autotests/integration/keyboard_keymap.cpp +++ b/autotests/integration/keyboard_keymap.cpp @@ -24,8 +24,8 @@ struct test_window { test_window() = default; test_window(test_window const&) = delete; test_window& operator=(test_window const&) = delete; - test_window(test_window&& other) noexcept; - test_window& operator=(test_window&& other) noexcept; + test_window(test_window&& other) noexcept = default; + test_window& operator=(test_window&& other) noexcept = default; ~test_window() { client_toplevel.reset(); From 03abf83d26240580ae644f921ee172a06c57b750 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 12:08:31 +0100 Subject: [PATCH 09/25] build: add control files to input lib The keyboard and by that the device files are referenced in X11 too. --- como/input/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/como/input/CMakeLists.txt b/como/input/CMakeLists.txt index cfdeaf9d0..6c37d33e8 100644 --- a/como/input/CMakeLists.txt +++ b/como/input/CMakeLists.txt @@ -13,6 +13,8 @@ target_sources(input PUBLIC FILE_SET HEADERS FILES + control/device.h + control/keyboard.h filters/decoration_event.h filters/dpms.h filters/drag_and_drop.h @@ -60,6 +62,8 @@ target_sources(input types.h window_find.h PRIVATE + control/device.cpp + control/keyboard.cpp keyboard.cpp keyboard_redirect.cpp platform_qobject.cpp @@ -124,8 +128,6 @@ target_sources(input-wl FILE_SET HEADERS FILES control/config.h - control/device.h - control/keyboard.h control/pointer.h control/pointer_config.h control/pointer_types.h @@ -164,8 +166,6 @@ target_sources(input-wl xkb/manager.h xkb/numlock.h PRIVATE - control/device.cpp - control/keyboard.cpp control/pointer.cpp control/switch.cpp control/touch.cpp From cb7cc66a0febef2687b7dfe7827b9654297e69fc Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 12:09:14 +0100 Subject: [PATCH 10/25] fix: export class Otherwise might not compile with sanitizers enabled. --- como/win/x11/client_machine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/como/win/x11/client_machine.h b/como/win/x11/client_machine.h index 2e2c2d698..4e25b9bd6 100644 --- a/como/win/x11/client_machine.h +++ b/como/win/x11/client_machine.h @@ -20,7 +20,7 @@ class QFutureWatcher; namespace como::win::x11 { -class get_addr_info_wrapper : public QObject +class COMO_EXPORT get_addr_info_wrapper : public QObject { Q_OBJECT public: From 4a47c55901ce8ad4b7ff0104f983b53d2049d94a Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 10:51:17 +0100 Subject: [PATCH 11/25] fix(wl): remove unique connection specifier The unique connection can give a runtime exception, likely because of the multi-inheritance, what seems to be a bug in Qt. Since it's not needed here actually, we just remove it. --- como/input/filters/popup.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/como/input/filters/popup.h b/como/input/filters/popup.h index 7f7abf0ca..aed7b980f 100644 --- a/como/input/filters/popup.h +++ b/como/input/filters/popup.h @@ -122,18 +122,12 @@ class popup_filter : public QObject, public event_filter } if (window->transient->input_grab) { // TODO: verify that the Toplevel is allowed as a popup - connect( - window->qobject.get(), - &win::window_qobject::windowShown, - this, - [this, window] { handle_window_added(window); }, - Qt::UniqueConnection); - connect( - window->qobject.get(), - &win::window_qobject::closed, - this, - [this, window] { remove_all(m_popups, window); }, - Qt::UniqueConnection); + connect(window->qobject.get(), &win::window_qobject::windowShown, this, [this, window] { + handle_window_added(window); + }); + connect(window->qobject.get(), &win::window_qobject::closed, this, [this, window] { + remove_all(m_popups, window); + }); m_popups.push_back(window); } } From 90c6e5a7f6b5ca063b35e868aa94c8c4c9f20598 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 09:54:06 +0100 Subject: [PATCH 12/25] build: include ECM sanitizers support This makes it easy to compile with sanitizers. For example like this: ECM_ENABLE_SANITIZERS='address;leak;undefined' --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a0a5bacd..f6b240e69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,7 @@ include(ECMConfiguredInstall) include(ECMQmlModule) include(ECMGenerateQmlTypes) include(ECMSetupVersion) +include(ECMEnableSanitizers) ecm_setup_version(PROJECT VARIABLE_PREFIX COMO From 399afcac24526d8b0ee6b6e6bf161430e67c0370 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 13:42:06 +0100 Subject: [PATCH 13/25] build: find Kirigami package with new name The old name has been deprecated. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6b240e69..943d7f693 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,8 +121,8 @@ set_package_properties(KF6DocTools PROPERTIES ) add_feature_info("KF6DocTools" KF6DocTools_FOUND "Enable building documentation") -find_package(KF6Kirigami2 ${KF6_MIN_VERSION} CONFIG) -set_package_properties(KF6Kirigami2 PROPERTIES +find_package(KF6Kirigami ${KF6_MIN_VERSION} CONFIG) +set_package_properties(KF6Kirigami PROPERTIES DESCRIPTION "A QtQuick based components set" PURPOSE "Required at runtime for several QML effects" TYPE RUNTIME From c6f2ef766df8a5449ef885068e8a22ad40fc77a5 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 13:44:49 +0100 Subject: [PATCH 14/25] fix(x11): order initializer list The base variable is declared after qobject. --- como/render/x11/platform.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/como/render/x11/platform.h b/como/render/x11/platform.h index a8dc42b62..04562f95f 100644 --- a/como/render/x11/platform.h +++ b/como/render/x11/platform.h @@ -78,9 +78,9 @@ class platform using shadow_t = render::shadow; platform(Base& base) - : base{base} - , qobject{std::make_unique( - [this](auto te) { return handle_timer_event(te); })} + : qobject{std::make_unique( + [this](auto te) { return handle_timer_event(te); })} + , base{base} , options{std::make_unique(base.operation_mode, base.config.main)} , night_color{std::make_unique>(base)} , m_suspended(options->qobject->isUseCompositing() ? suspend_reason::none From 8749c61230c0642e91cc7a11c8a0716fe8dde701 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 13:45:31 +0100 Subject: [PATCH 15/25] test: compare as std::string There is a warning comparing the raw strings. --- autotests/integration/xcb_wrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autotests/integration/xcb_wrapper.cpp b/autotests/integration/xcb_wrapper.cpp index 1501bb9eb..8375f764f 100644 --- a/autotests/integration/xcb_wrapper.cpp +++ b/autotests/integration/xcb_wrapper.cpp @@ -322,7 +322,7 @@ TEST_CASE("xcb wrapper", "[win],[xwl]") QVERIFY(!ok); ok = true; QVERIFY(!prop.value()); - QCOMPARE(prop.value("bar", &ok), "bar"); + REQUIRE(prop.value("bar", &ok) == std::string("bar")); QVERIFY(!ok); QCOMPARE( QByteArray(base::x11::xcb::string_property(connection, testWindow, XCB_ATOM_WM_NAME)), From 8cf5256196ba5c4c9b64b18825f14dbeee186579 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 13:46:13 +0100 Subject: [PATCH 16/25] fix(plugin): use different names for Qt properties These properties don't seem to be used, but they should still have different names. Otehrwise a warning by Qt moc is issued. --- plugins/effects/mousemark/mousemark.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/effects/mousemark/mousemark.h b/plugins/effects/mousemark/mousemark.h index a6ad2ff16..02a486340 100644 --- a/plugins/effects/mousemark/mousemark.h +++ b/plugins/effects/mousemark/mousemark.h @@ -18,8 +18,8 @@ class MouseMarkEffect : public Effect Q_OBJECT Q_PROPERTY(int width READ configuredWidth) Q_PROPERTY(QColor color READ configuredColor) - Q_PROPERTY(Qt::KeyboardModifiers modifiers READ freedraw_modifiers) - Q_PROPERTY(Qt::KeyboardModifiers modifiers READ arrowdraw_modifiers) + Q_PROPERTY(Qt::KeyboardModifiers freedrawModifiers READ freedraw_modifiers) + Q_PROPERTY(Qt::KeyboardModifiers arrowdrawModifiers READ arrowdraw_modifiers) public: MouseMarkEffect(); ~MouseMarkEffect() override; From 16228f89932e4c4b30bf83b8d2650c15ca4e8227 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 18:29:45 +0100 Subject: [PATCH 17/25] test: compare with braces Silences a GCC warning. --- autotests/integration/idle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autotests/integration/idle.cpp b/autotests/integration/idle.cpp index 6e868f080..6d4a382c5 100644 --- a/autotests/integration/idle.cpp +++ b/autotests/integration/idle.cpp @@ -145,8 +145,8 @@ TEST_CASE("idle", "[input]") notification_wrap notification1(test_data.duration1); - QCOMPARE(notification1.idle_spy.wait(test_data.pause), - test_data.pause > test_data.duration1); + REQUIRE(notification1.idle_spy.wait(test_data.pause) + == (test_data.pause > test_data.duration1)); notification_wrap notification2(test_data.duration2); From a57a28e6994f77f464e7dd44b2dd322961187d36 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 18:30:17 +0100 Subject: [PATCH 18/25] fix: mark fallthrough Silences a GCC warning. --- como/render/effect/interface/types.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/como/render/effect/interface/types.h b/como/render/effect/interface/types.h index f328d8907..91e8a3a4e 100644 --- a/como/render/effect/interface/types.h +++ b/como/render/effect/interface/types.h @@ -190,16 +190,19 @@ inline QMatrix4x4 get_transform_matrix(transform_type type) break; case transform_type::flipped_90: flip(); + [[fallthrough]]; case transform_type::rotated_90: rot(90); break; case transform_type::flipped_180: flip(); + [[fallthrough]]; case transform_type::rotated_180: rot(180); break; case transform_type::flipped_270: flip(); + [[fallthrough]]; case transform_type::rotated_270: rot(270); break; From 51d6b21bceced1510881b5674f1c49b62f1d5f75 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 18:30:38 +0100 Subject: [PATCH 19/25] test: return without move Silences a GCC warning. --- autotests/integration/virtual_keyboard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autotests/integration/virtual_keyboard.cpp b/autotests/integration/virtual_keyboard.cpp index af746e077..0631cf6c8 100644 --- a/autotests/integration/virtual_keyboard.cpp +++ b/autotests/integration/virtual_keyboard.cpp @@ -62,7 +62,7 @@ TEST_CASE("virtual keyboard", "[input]") ret.client_toplevel = create_xdg_shell_toplevel(client, ret.client_surface); ret.window = render_and_wait_for_shown(client, ret.client_surface, QSize(1280, 1024), Qt::red); - return std::move(ret); + return ret; }; auto create_keymap = []() { From 39f46c95f8f275be269b81407efea1576ca511ad Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 19 Feb 2024 13:47:25 +0100 Subject: [PATCH 20/25] refactor(x11): remove unused key server functions We don't use these functions internally and the call to XKeycodeToKeysym produces a deprecation warning. Before trying to fix the warning, we may simply remove the unused functions. --- como/win/x11/key_server.cpp | 155 ------------------------------------ como/win/x11/key_server.h | 12 --- 2 files changed, 167 deletions(-) diff --git a/como/win/x11/key_server.cpp b/como/win/x11/key_server.cpp index 500022cc1..327ae9f71 100644 --- a/como/win/x11/key_server.cpp +++ b/como/win/x11/key_server.cpp @@ -825,101 +825,6 @@ bool keyboardHasMetaKey() return modXMeta() != 0; } -uint getModsRequired(uint sym) -{ - if (!QX11Info::isPlatformX11()) { - return 0; - } - - uint mod = 0; - - // FIXME: This might not be true on all keyboard layouts! - if (sym == XK_Sys_Req) { - return Qt::ALT; - } - if (sym == XK_Break) { - return Qt::CTRL; - } - - if (sym < 0x3000) { - QChar c(sym); - if (c.isLetter() && c.toLower() != c.toUpper() && sym == c.toUpper().unicode()) { - return Qt::SHIFT; - } - } - - uchar code = XKeysymToKeycode(QX11Info::display(), sym); - if (code) { - // need to check index 0 before the others, so that a null-mod - // can take precedence over the others, in case the modified - // key produces the same symbol. - if (sym == XKeycodeToKeysym(QX11Info::display(), code, 0)) { - ; - } else if (sym == XKeycodeToKeysym(QX11Info::display(), code, 1)) { - mod = Qt::SHIFT; - } else if (sym == XKeycodeToKeysym(QX11Info::display(), code, 2)) { - mod = MODE_SWITCH; - } else if (sym == XKeycodeToKeysym(QX11Info::display(), code, 3)) { - mod = Qt::SHIFT | MODE_SWITCH; - } - } - return mod; -} - -bool keyQtToCodeX(int keyQt, int* keyCode) -{ - if (!QX11Info::isPlatformX11()) { - return false; - } - - int sym; - uint mod; - keyQtToSymX(keyQt, &sym); - keyQtToModX(keyQt, &mod); - - // Get any extra mods required by the sym. - // E.g., XK_Plus requires SHIFT on the en layout. - uint modExtra = getModsRequired(sym); - // Get the X modifier equivalent. - if (!sym || !keyQtToModX((keyQt & Qt::KeyboardModifierMask) | modExtra, &mod)) { - *keyCode = 0; - return false; - } - - *keyCode = XKeysymToKeycode(QX11Info::display(), sym); - return true; -} - -bool keyQtToSymX(int keyQt, int* keySym) -{ - int symQt = keyQt & ~Qt::KeyboardModifierMask; - - if (keyQt & Qt::KeypadModifier) { - if (symQt >= Qt::Key_0 && symQt <= Qt::Key_9) { - *keySym = XK_KP_0 + (symQt - Qt::Key_0); - return true; - } - } else { - if (symQt < 0x1000) { - *keySym = QChar(symQt).toUpper().unicode(); - return true; - } - } - - for (const TransKey& tk : g_rgQtToSymX) { - if (tk.keySymQt == symQt) { - if ((keyQt & Qt::KeypadModifier) && !is_keypad_key(tk.keySymX)) { - continue; - } - *keySym = tk.keySymX; - return true; - } - } - - *keySym = 0; - return false; -} - bool symXModXToKeyQt(uint32_t keySym, uint16_t modX, int* keyQt) { int keyModQt = 0; @@ -963,26 +868,6 @@ bool symXModXToKeyQt(uint32_t keySym, uint16_t modX, int* keyQt) return false; } -bool keyQtToModX(int modQt, uint* modX) -{ - if (!g_bInitializedMods) { - initializeMods(); - } - - *modX = 0; - for (int i = 0; i < 4; i++) { - if (modQt & g_rgX11ModInfo[i].modQt) { - if (g_rgX11ModInfo[i].modX) { - *modX |= g_rgX11ModInfo[i].modX; - } else { - // The qt modifier has no x equivalent. Return false - return false; - } - } - } - return true; -} - bool modXToQt(uint modX, int* modQt) { if (!g_bInitializedMods) { @@ -1023,46 +908,6 @@ uint accelModMaskX() return modXShift() | modXCtrl() | modXAlt() | modXMeta(); } -bool xEventToQt(XEvent* e, int* keyQt) -{ - Q_ASSERT(e->type == KeyPress || e->type == KeyRelease); - - uchar keyCodeX = e->xkey.keycode; - uint keyModX = e->xkey.state & (accelModMaskX() | MODE_SWITCH); - - KeySym keySym; - char buffer[16]; - XLookupString((XKeyEvent*)e, buffer, 15, &keySym, nullptr); - uint keySymX = (uint)keySym; - - // If numlock is active and a keypad key is pressed, XOR the SHIFT state. - // e.g., KP_4 => Shift+KP_Left, and Shift+KP_4 => KP_Left. - if (e->xkey.state & modXNumLock()) { - uint sym = XKeycodeToKeysym(QX11Info::display(), keyCodeX, 0); - // TODO: what's the xor operator in c++? - // If this is a keypad key, - if (sym >= XK_KP_Space && sym <= XK_KP_9) { - switch (sym) { - // Leave the following keys unaltered - // FIXME: The proper solution is to see which keysyms don't change when shifted. - case XK_KP_Multiply: - case XK_KP_Add: - case XK_KP_Subtract: - case XK_KP_Divide: - break; - default: - if (keyModX & modXShift()) { - keyModX &= ~modXShift(); - } else { - keyModX |= modXShift(); - } - } - } - } - - return symXModXToKeyQt(keySymX, keyModX, keyQt); -} - bool xcbKeyPressEventToQt(xcb_generic_event_t* e, int* keyQt) { if ((e->response_type & ~0x80) != XCB_KEY_PRESS diff --git a/como/win/x11/key_server.h b/como/win/x11/key_server.h index b6f5394c6..b7498537b 100644 --- a/como/win/x11/key_server.h +++ b/como/win/x11/key_server.h @@ -66,24 +66,12 @@ COMO_EXPORT uint modXModeSwitch(); /// Returns bitwise OR'ed mask containing Shift, Ctrl, Alt, and Win (if available). COMO_EXPORT uint accelModMaskX(); -/// Extracts the symbol from the given Qt key and converts it to an X11 symbol + modifiers. -COMO_EXPORT bool keyQtToSymX(int keyQt, int* sym); - -/// Extracts the code from the given Qt key. -COMO_EXPORT bool keyQtToCodeX(int keyQt, int* keyCode); - -/// Extracts the modifiers from the given Qt key and converts them in a mask of X11 modifiers. -COMO_EXPORT bool keyQtToModX(int keyQt, uint* mod); - /// Converts the given symbol and modifier combination to a Qt key code. COMO_EXPORT bool symXModXToKeyQt(uint32_t keySym, uint16_t modX, int* keyQt); /// Converts the mask of ORed X11 modifiers to a mask of ORed Qt key code modifiers. COMO_EXPORT bool modXToQt(uint modX, int* modQt); -/// Converts an X keypress event into a Qt key + modifier code -COMO_EXPORT bool xEventToQt(XEvent* e, int* keyModQt); - /// Converts an XCB keypress event into a Qt key + modifier code COMO_EXPORT bool xcbKeyPressEventToQt(xcb_generic_event_t* e, int* keyModQt); COMO_EXPORT bool xcbKeyPressEventToQt(xcb_key_press_event_t* e, int* keyModQt); From 5bfe293db8e19204b179d5408a615b4af78e239b Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Sun, 18 Feb 2024 15:18:38 +0100 Subject: [PATCH 21/25] docs: improve readme Small changes to the text. --- README.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b9a4341ca..3b7f0a2f4 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ This cross-desktop interoperability will be expanded upon in the future. **Ease of Use**
-With the Compositor Modules a Wayland compositor can be created with a handful of lines only. +With The Compositor Modules a Wayland compositor can be created with a handful of lines only. See our MVP [Minico](tests/minico) for an example of that. **Customizability** @@ -38,19 +38,19 @@ See our MVP [Minico](tests/minico) for an example of that. The Compositor Modules make heavy use of C++ templates. This allows consumers to replace many functions and types with customized versions when required. -# Values +# Tenets -**Stability and robustness** +**Stability and Robustness** This is achieved through upholding strict development standards and deploying modern development methods to prevent regressions and code smell. -**Collaboration with competitors and upstream partners** +**Collaboration With Downstream and Upstream Partners** -We want to overcome antiquated notions on community divisions -and work together on the best possible Linux graphics platform. +We want to overcome antiquated notions on community division +and work together on the best possible Linux graphics platform instead. -**Value the knowledge of experts but also the curiosity of beginners** +**Value the Knowledge of Experts and the Curiosity of Beginners** Well defined and transparent decision processes enable expert knowledge to proliferate and new contributors to easily find help on their first steps. @@ -64,12 +64,15 @@ You can also make use of the FDBuild tool to automate that process as described [here](CONTRIBUTING.md#compiling). # Usage -It's easiest to link via CMake to the Compositor Modules libraries that you want to use. -As an example check out the test code of [Minico](tests/minico) and the [Plasma binaries](tests/plasma). +It's easiest to link via CMake to The Compositor Modules libraries that you want to make use of +and then create their central platform types from your main function to launch the compositor session. + +[Minico](tests/minico) as a minimal example and the [Plasma test binaries](tests/plasma) +as a more complex one demonstrate this in a straightforward way. # Development The [CONTRIBUTING.md](CONTRIBUTING.md) document contains all information on how to get started with: * providing useful debug information, -* building the Compositor Modules +* building The Compositor Modules * and doing your first code submission to the project. From 210de835877f92bf73ec14a7e794a05605859041 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Sun, 18 Feb 2024 09:52:02 +0100 Subject: [PATCH 22/25] docs: add feature table Provides an overview of already available and planned features in the Wayland session. --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/README.md b/README.md index 3b7f0a2f4..a6ce0acde 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,58 @@ See our MVP [Minico](tests/minico) for an example of that. The Compositor Modules make heavy use of C++ templates. This allows consumers to replace many functions and types with customized versions when required. +## Wayland Feature Table +X11 support is feature complete. +For the current state of Wayland the following table provides a detailed look at available and planned features. + +| Feature | | Available | Planned | +| ------------------- | ----------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| Composition | :white_check_mark: | With OpenGL or in software | | +| Input methods | :white_check_mark: | [text-input v2][text-input-v2] [v3][text-input-v3], [input-method v2][input-method-v2] | | +| Primary selection | :white_check_mark: | [primary-selection][primary-selection] protocol | | +| Xwayland | :white_check_mark: | Optional at run *and* compile time | | +| VR | :white_check_mark: | [DRM lease][drm-lease] protocol support | | +| Adaptive sync / VRR | :white_check_mark: | Via wlroots [backend][wlr-adaptive-sync] and [protocol][wlr-prot-adaptive-sync] | | +| Present feedback | :white_check_mark: | [presentation-time][presentation-time] protocol support | | +| CSD and SSD | :white_check_mark: | CSD by convention and KWin SSD | | +| Windowing logic | :ballot_box_with_check: | Floating WM; optional rules, scripts | Tiling WM functions | +| Effects | :ballot_box_with_check: | KWin effects plugins | Plugin system similar to Wayfire | +| Desktop shells | :ballot_box_with_check: | KDE Plasma, [wlr-layer-shell][wlr-layer-shell] | [wlr-foreign-toplevel-management][wlr-foreign-toplevel-management] | +| Lockscreen | :ballot_box_with_check: | KDE Plasma lockscreen integration | [session-lock][session-lock] protocol | +| Fractional scaling | :ballot_box_with_check: | Downscaling for Wayland surfaces | Xwayland, [factional-scale][factional-scale] protocol | +| Output control | :ballot_box_with_check: | [wlr-output-management][wlr-output-management] | [Mirroring][clone-wlroots-mr] | +| Configuration | :ballot_box_with_check: | KWin config files via [KConfig][kconfig] | Generic API independent of KDE | +| Video capture | :x: | | Using xdg-portals and pipewire | +| HDR | :x: | | When [protocol][color-management-protocol] lands or [KWin-like][hdr-kwin] | +| Direct scanout | :x: | | With more wlroots render integration | +| Vulkan render | :x: | | With more wlroots render integration | +| Graphic tablets | :x: | | [tablet][tablet-protocol] protocol | +| Multiseat | :x: | | Full support, but low priority | +| C++20 modules | :x: | | When compiler support improves | +| No Qt/KDE linking | :x: | | For a subset of features | + + +[clone-wlroots-mr]: https://gitlab.freedesktop.org/wlroots/wlr-protocols/-/merge_requests/116 +[presentation-time]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/tree/main/stable/presentation-time +[drm-lease]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/tree/main/staging/drm-lease +[vrr]: https://en.wikipedia.org/wiki/Variable_refresh_rate +[kconfig]: https://api.kde.org/frameworks/kconfig/html/ +[wlr-adaptive-sync]: https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/842093bb843ae6c719c2b1cf32eb749cab9e46ca/include/wlr/types/wlr_output.h#L87 +[wlr-prot-adaptive-sync]: https://gitlab.freedesktop.org/wlroots/wlr-protocols/-/blob/2b8d43325b7012cc3f9b55c08d26e50e42beac7d/unstable/wlr-output-management-unstable-v1.xml#L344-L357 +[text-input-v2]: https://github.com/winft/wrapland/blob/master/server/text_input_v2.h +[text-input-v3]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/unstable/text-input/text-input-unstable-v3.xml +[input-method-v2]: https://github.com/swaywm/wlroots/blob/master/protocol/input-method-unstable-v2.xml +[factional-scale]: https://wayland.app/protocols/fractional-scale-v1 +[wlr-foreign-toplevel-management]: https://wayland.app/protocols/wlr-foreign-toplevel-management-unstable-v1 +[wlr-layer-shell]: https://wayland.app/protocols/wlr-layer-shell-unstable-v1 +[wlr-output-management]: https://wayland.app/protocols/wlr-output-management-unstable-v1 +[session-lock]: https://wayland.app/protocols/ext-session-lock-v1 +[primary-selection]: https://wayland.app/protocols/primary-selection-unstable-v1 +[color-management-protocol]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/14 +[hdr-kwin]: https://zamundaaa.github.io/wayland/2023/12/18/update-on-hdr-and-colormanagement-in-plasma.html +[tablet-protocol]: https://wayland.app/protocols/tablet-unstable-v2 + + # Tenets **Stability and Robustness** From 26676e736a70a7bd816a6087858baaa9c39b8e84 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Sun, 18 Feb 2024 18:53:44 +0100 Subject: [PATCH 23/25] docs: update contact information There is a Matrix room now. --- CONTRIBUTING.md | 5 ----- README.md | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 562814e77..453bfe8c2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,6 @@ SPDX-License-Identifier: GPL-2.0-or-later - [Commit Message Guideline](#commit-message-guideline) - [Example](#example) - [Tooling](#tooling) - - [Contact](#contact) ## Logging and Debugging The first step in contributing to the project by either providing meaningful feedback or by directly @@ -240,16 +239,12 @@ amendments: ### Tooling See [Wrapland's documentation][wrapland-tooling] for available tooling. -## Contact -See [Wrapland's documentation][wrapland-contact] for contact information. - [angular-revert]: https://github.com/angular/angular/blob/3cf2005a936bec2058610b0786dd0671dae3d358/CONTRIBUTING.md#revert [angular-subject]: https://github.com/angular/angular/blob/3cf2005a936bec2058610b0786dd0671dae3d358/CONTRIBUTING.md#subject [conventional-commits]: https://www.conventionalcommits.org/en/v1.0.0/#specification [frameworks-style]: https://community.kde.org/Policies/Frameworks_Coding_Style [issue]: https://github.com/winft/como/issues [pull-requests]: https://github.com/winft/como/pulls -[wrapland-contact]: https://github.com/winft/wrapland/blob/master/CONTRIBUTING.md#contact [wrapland-large-changes]: https://github.com/winft/wrapland/blob/master/CONTRIBUTING.md#issues-for-large-changes [wrapland-submissions]: https://github.com/winft/wrapland/blob/master/CONTRIBUTING.md#submission-guideline [wrapland-tooling]: https://github.com/winft/wrapland/blob/master/CONTRIBUTING.md#tooling diff --git a/README.md b/README.md index a6ce0acde..1bc61a541 100644 --- a/README.md +++ b/README.md @@ -128,3 +128,7 @@ on how to get started with: * providing useful debug information, * building The Compositor Modules * and doing your first code submission to the project. + +# Contact +Issue tickets can be created for feature requests, bug reports or general discussions. +For direct communication join our [Matrix room](https://matrix.to/#/#como:matrix.org). From 36a8b233e9197e5873f7b19709cce8ed69ac7661 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Sun, 18 Feb 2024 18:45:32 +0100 Subject: [PATCH 24/25] ci: provide package name This makes the code more generic. Being used this way in Wrapland too. --- .github/workflows/change.yml | 1 + .github/workflows/package.yml | 12 ++++++++---- .github/workflows/rebuild.yml | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/change.yml b/.github/workflows/change.yml index f415af2ab..80509e760 100644 --- a/.github/workflows/change.yml +++ b/.github/workflows/change.yml @@ -38,3 +38,4 @@ jobs: needs: build with: image: registry.gitlab.com/kwinft/ci-images/archlinux/kwinft-base-master + package-name: como diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index c88b22765..c0a9768ea 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -11,6 +11,10 @@ on: required: false type: string default: 'build' + package-name: + description: Name of the resulting packages + required: true + type: string jobs: deb: @@ -30,12 +34,12 @@ jobs: - name: Untar artifact run: tar -xzf build-dir.tar - name: Run CPack - run: cd build && cpack -G DEB -D CPACK_DEBIAN_FILE_NAME=como.deb + run: cd build && cpack -G DEB -D CPACK_DEBIAN_FILE_NAME=${{ inputs.package-name }}.deb - name: Upload artifact uses: actions/upload-artifact@v4 with: name: deb-package - path: build/_CPack_Packages/Linux/DEB/como.deb + path: build/_CPack_Packages/Linux/DEB/${{ inputs.package-name }}.deb retention-days: 8 tar: @@ -55,10 +59,10 @@ jobs: - name: Run CPack # Need to use CPACK_PACKAGE_FILE_NAME instead of CPACK_ARCHIVE_FILE_NAME # See: https://gitlab.kitware.com/cmake/cmake/-/issues/20419 - run: cd build && cpack -G TGZ -D CPACK_PACKAGE_FILE_NAME=como + run: cd build && cpack -G TGZ -D CPACK_PACKAGE_FILE_NAME=${{ inputs.package-name }} - name: Upload artifact uses: actions/upload-artifact@v4 with: name: tar-package - path: build/_CPack_Packages/Linux/TGZ/como.tar.gz + path: build/_CPack_Packages/Linux/TGZ/${{ inputs.package-name }}.tar.gz retention-days: 8 diff --git a/.github/workflows/rebuild.yml b/.github/workflows/rebuild.yml index f32540364..87854a702 100644 --- a/.github/workflows/rebuild.yml +++ b/.github/workflows/rebuild.yml @@ -14,3 +14,4 @@ jobs: needs: build with: image: registry.gitlab.com/kwinft/ci-images/archlinux/kwinft-base-master + package-name: como From de9eb4aa349f9123ea69b0f398f55d6f20b48c63 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Sun, 18 Feb 2024 19:19:17 +0100 Subject: [PATCH 25/25] ci: install Wrapland from package artifact Instead of using the separate CI image, install Wrapland from the latest package artifact, that Wrapland's actions provide. --- .../actions/dep-artifact-generic/action.yml | 35 +++++++++++++++++++ .github/actions/dep-artifacts/action.yml | 17 +++++++++ .github/workflows/build.yml | 4 +++ .github/workflows/test.yml | 4 +++ 4 files changed, 60 insertions(+) create mode 100644 .github/actions/dep-artifact-generic/action.yml create mode 100644 .github/actions/dep-artifacts/action.yml diff --git a/.github/actions/dep-artifact-generic/action.yml b/.github/actions/dep-artifact-generic/action.yml new file mode 100644 index 000000000..b2427025a --- /dev/null +++ b/.github/actions/dep-artifact-generic/action.yml @@ -0,0 +1,35 @@ +# SPDX-FileCopyrightText: 2024 Roman Gilg +# SPDX-License-Identifier: MIT +name: Install Dependency via Artifact +description: Uses tar package from other workflow to install on Arch +inputs: + repo: + description: Path to repo where to download the dependency from + required: true + branch: + description: Branch from which to download the artifact + required: false + default: master + dep-name: + description: Name of the dependency file + required: true + secret: + description: Secret + required: true +runs: + using: "composite" + steps: + - name: Download artifact + uses: dawidd6/action-download-artifact@v3 + with: + name: tar-package + repo: ${{ inputs.repo }} + branch: ${{ inputs.branch }} + workflow_search: true + github_token: ${{ inputs.secret }} + - name: Untar + run: tar -xf ${{ inputs.dep-name }}.tar.gz + shell: bash + - name: Install + run: cp -r ${{ inputs.dep-name }}/* /usr + shell: bash diff --git a/.github/actions/dep-artifacts/action.yml b/.github/actions/dep-artifacts/action.yml new file mode 100644 index 000000000..f41d0663c --- /dev/null +++ b/.github/actions/dep-artifacts/action.yml @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: 2024 Roman Gilg +# SPDX-License-Identifier: MIT +name: Specialized Install Dependency via Artifact +description: Calls into more generic dep-artifact-generic to install dependency +inputs: + secret: + description: Secret + required: true +runs: + using: "composite" + steps: + - name: Install Wrapland + uses: ./.github/actions/dep-artifact-generic + with: + repo: winft/wrapland + dep-name: wrapland + secret: ${{ inputs.secret }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0a1101271..628a82201 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,6 +66,10 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 + - name: Install Dependencies + uses: ./.github/actions/dep-artifacts + with: + secret: ${{ secrets.GITHUB_TOKEN }} - run: mkdir build - name: Configure run: cmake -S . -B build ${{ needs.set-cmake-args.outputs.args }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e6c2edefd..9f510311c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,10 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 + - name: Install Dependencies + uses: ./.github/actions/dep-artifacts + with: + secret: ${{ secrets.GITHUB_TOKEN }} - name: Download artifact uses: actions/download-artifact@v4 with: