Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package waycheck for openSUSE:Factory checked in at 2024-02-11 15:46:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/waycheck (Old) and /work/SRC/openSUSE:Factory/.waycheck.new.1815 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "waycheck" Sun Feb 11 15:46:14 2024 rev:5 rq:1145857 version:1.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/waycheck/waycheck.changes 2024-01-23 22:57:27.799308927 +0100 +++ /work/SRC/openSUSE:Factory/.waycheck.new.1815/waycheck.changes 2024-02-11 15:46:19.728303005 +0100 @@ -1,0 +2,11 @@ +Sat Feb 10 23:10:10 UTC 2024 - Neal Gompa <ngo...@opensuse.org> + +- Update to v1.1.0 + + Update protocol list to wayland-protocols v1.33 + + Add XDG Foreign v1 + + Add captions and environment info to screenshot metadata + + Shorten app summary + + Add missing interface for XDG Foreign v2 + + Fix aura-shell protocol detection + +------------------------------------------------------------------- Old: ---- waycheck-v1.0.0.tar.gz New: ---- waycheck-v1.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ waycheck.spec ++++++ --- /var/tmp/diff_new_pack.IBioOq/_old 2024-02-11 15:46:20.780340831 +0100 +++ /var/tmp/diff_new_pack.IBioOq/_new 2024-02-11 15:46:20.780340831 +0100 @@ -19,7 +19,7 @@ %global qt6_minver 6.5 Name: waycheck -Version: 1.0.0 +Version: 1.1.0 Release: 0 Summary: GUI that displays protocols implemented by a Wayland compositor ++++++ waycheck-v1.0.0.tar.gz -> waycheck-v1.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waycheck-v1.0.0/.clang-format new/waycheck-v1.1.0/.clang-format --- old/waycheck-v1.0.0/.clang-format 2023-10-15 20:51:45.000000000 +0200 +++ new/waycheck-v1.1.0/.clang-format 2024-02-10 23:14:55.000000000 +0100 @@ -3,11 +3,10 @@ AccessModifierOffset: -2 AlignAfterOpenBracket: DontAlign AlignConsecutiveAssignments: false -AlignEscapedNewlinesLeft: false AlignOperands: true AlignTrailingComments: true AllowAllParametersOfDeclarationOnNextLine: false -AllowShortBlocksOnASingleLine: false +AllowShortBlocksOnASingleLine: Empty AllowShortCaseLabelsOnASingleLine: false AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: Empty @@ -16,7 +15,6 @@ BinPackArguments: true BinPackParameters: true BreakBeforeBinaryOperators: None -BreakBeforeBinaryOperators: None BreakBeforeBraces: Attach BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: false @@ -41,7 +39,7 @@ PenaltyExcessCharacter: 10000 PenaltyReturnTypeOnItsOwnLine: 600 PointerAlignment: Left -SortIncludes: true +SortIncludes: CaseSensitive SpaceAfterCStyleCast: true SpaceBeforeAssignmentOperators: true SpaceBeforeParens: ControlStatements @@ -51,7 +49,7 @@ SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false -Standard: Cpp11 +Standard: c++20 TabWidth: 4 UseTab: Never ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waycheck-v1.0.0/meson.build new/waycheck-v1.1.0/meson.build --- old/waycheck-v1.0.0/meson.build 2023-10-15 20:51:45.000000000 +0200 +++ new/waycheck-v1.1.0/meson.build 2024-02-10 23:14:55.000000000 +0100 @@ -1,7 +1,7 @@ project( 'waycheck', 'cpp', - version: '1.0.0', + version: '1.1.0', license: 'Apache-2.0', meson_version: '>= 0.59.0', default_options: [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waycheck-v1.0.0/resources/dev.serebit.Waycheck.metainfo.xml new/waycheck-v1.1.0/resources/dev.serebit.Waycheck.metainfo.xml --- old/waycheck-v1.0.0/resources/dev.serebit.Waycheck.metainfo.xml 2023-10-15 20:51:45.000000000 +0200 +++ new/waycheck-v1.1.0/resources/dev.serebit.Waycheck.metainfo.xml 2024-02-10 23:14:55.000000000 +0100 @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright 2023 Campbell Jones <git at serebit dot com> --> +<!-- Copyright 2024 Campbell Jones <git at serebit dot com> --> <component type="desktop-application"> <id>dev.serebit.Waycheck</id> <metadata_license>CC0-1.0</metadata_license> <project_license>Apache-2.0</project_license> <name>Waycheck</name> - <summary>Displays the protocols implemented by a Wayland compositor</summary> + <summary>Show Wayland compositor details</summary> <description> <p> Waycheck is a simple graphical application that connects to your Wayland compositor and displays the list of Wayland protocols that it supports, along with the list of protocols that it doesn't. @@ -22,7 +22,8 @@ <keyword>wayland</keyword> </keywords> <branding> - <color type="primary">#194dff</color> + <color type="primary" scheme_preference="light">#194dff</color> + <color type="primary" scheme_preference="dark">#194dff</color> </branding> <developer_name>Campbell Jones</developer_name> @@ -51,15 +52,29 @@ <content_rating type="oars-1.1"/> <screenshots> - <screenshot type="default"> - <image>https://serebit.dev/images/waycheck-dark.png</image> + <screenshot environment="plasma" type="default"> + <caption>The Waycheck main window</caption> + <image xml:lang="en">https://serebit.dev/images/waycheck-dark.png</image> </screenshot> - <screenshot> - <image>https://serebit.dev/images/waycheck-light.png</image> + <screenshot environment="plasma"> + <caption>The Waycheck main window in light theme mode</caption> + <image xml:lang="en">https://serebit.dev/images/waycheck-light.png</image> </screenshot> </screenshots> <releases> + <release version="1.1.0" date="2024-02-10"> + <description> + <ul> + <li>Update protocol list to wayland-protocols v1.33</li> + <li>Add XDG Foreign v1</li> + <li>Add missing interface for XDG Foreign v2</li> + <li>Fix aura-shell protocol detection</li> + <li>Shorten app summary</li> + <li>Add captions and environment info to screenshot metadata</li> + </ul> + </description> + </release> <release version="1.0.0" date="2023-10-15"> <description> <ul> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waycheck-v1.0.0/src/main.cpp new/waycheck-v1.1.0/src/main.cpp --- old/waycheck-v1.0.0/src/main.cpp 2023-10-15 20:51:45.000000000 +0200 +++ new/waycheck-v1.1.0/src/main.cpp 2024-02-10 23:14:55.000000000 +0100 @@ -6,11 +6,11 @@ int main(int argc, char** argv) { auto app = QApplication(argc, argv); - app.setDesktopFileName(QStringLiteral("dev.serebit.Waycheck")); + QApplication::setDesktopFileName(QStringLiteral("dev.serebit.Waycheck")); - auto waylandApp = qApp->nativeInterface<QNativeInterface::QWaylandApplication>(); - QMessageBox msgBox; + const auto waylandApp = qApp->nativeInterface<QNativeInterface::QWaylandApplication>(); if (waylandApp == nullptr) { + QMessageBox msgBox; msgBox.setText("Waycheck must be started within a Wayland session."); return msgBox.exec(); } @@ -18,5 +18,5 @@ auto window = Window(waylandApp); window.show(); - return app.exec(); + return QApplication::exec(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waycheck-v1.0.0/src/model.cpp new/waycheck-v1.1.0/src/model.cpp --- old/waycheck-v1.0.0/src/model.cpp 2023-10-15 20:51:45.000000000 +0200 +++ new/waycheck-v1.1.0/src/model.cpp 2024-02-10 23:14:55.000000000 +0100 @@ -2,7 +2,7 @@ #include "protocols.hpp" Model::Model(const ProtocolSource source) - : searchModel(), supportModel(), searchFilter(""), supportFilter(ALL), sourceModel(), filteredModel(&supportModel), + : searchFilter(""), supportFilter(ALL), filteredModel(&supportModel), name(QString::fromStdString(source_to_string(source))), includeStatus(source == UPSTREAM), includeName(source != UNKNOWN) { searchModel.setSourceModel(&sourceModel); @@ -40,7 +40,7 @@ updateFilter(); } -void Model::setSupportFilter(const supportFilters supportFilter) { +void Model::setSupportFilter(const SupportFilters supportFilter) { this->supportFilter = supportFilter; switch (supportFilter) { default: @@ -58,5 +58,5 @@ } void Model::updateFilter() { - emit filterChanged(!searchFilter.isEmpty() || !(supportFilter == ALL)); + emit filterChanged(!searchFilter.isEmpty() || supportFilter != ALL); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waycheck-v1.0.0/src/model.hpp new/waycheck-v1.1.0/src/model.hpp --- old/waycheck-v1.0.0/src/model.hpp 2023-10-15 20:51:45.000000000 +0200 +++ new/waycheck-v1.1.0/src/model.hpp 2024-02-10 23:14:55.000000000 +0100 @@ -6,11 +6,11 @@ #include <QSortFilterProxyModel> #include <QStandardItemModel> -class Model : public QObject { +class Model final : public QObject { Q_OBJECT public: - enum supportFilters { + enum SupportFilters { ALL, SUPPORTED, UNSUPPORTED @@ -20,11 +20,11 @@ QSortFilterProxyModel searchModel; QSortFilterProxyModel supportModel; QString searchFilter; - supportFilters supportFilter; + SupportFilters supportFilter; public: - Model(ProtocolSource source); - ~Model(); + explicit Model(ProtocolSource source); + ~Model() override; QStandardItemModel sourceModel; QSortFilterProxyModel* const filteredModel; @@ -34,7 +34,7 @@ void setSearchFilter(const QString& searchFilter); - void setSupportFilter(const supportFilters supportFilter); + void setSupportFilter(SupportFilters supportFilter); void updateFilter(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waycheck-v1.0.0/src/protocols.cpp new/waycheck-v1.1.0/src/protocols.cpp --- old/waycheck-v1.0.0/src/protocols.cpp 2023-10-15 20:51:45.000000000 +0200 +++ new/waycheck-v1.1.0/src/protocols.cpp 2024-02-10 23:14:55.000000000 +0100 @@ -1,6 +1,130 @@ #include "protocols.hpp" +#include <QString> +#include <cassert> +#include <ranges> +#include <utility> -std::string source_to_string(ProtocolSource source) { +ProtocolStore::ProtocolStore() noexcept { + // clang-format off + add({UPSTREAM, STABLE, "Presentation time", "presentation-time"}, {"wp_presentation"}); + add({UPSTREAM, STABLE, "Viewporter", "viewporter"}, {"wp_viewporter"}); + add({UPSTREAM, STABLE, "XDG shell", "xdg-shell"}, {"xdg_wm_base"}); + add({UPSTREAM, STABLE, "Linux DMA-BUF", "linux-dmabuf-v1"}, {"zwp_linux_dmabuf_v1"}); + + add({UPSTREAM, STAGING, "XDG activation", "xdg-activation-v1"}, {"xdg_activation_v1"}); + add({UPSTREAM, STAGING, "DRM lease", "drm-lease-v1"}, {"wp_drm_lease_device_v1"}); + add({UPSTREAM, STAGING, "Session lock", "ext-session-lock-v1"}, {"ext_session_lock_manager_v1"}); + add({UPSTREAM, STAGING, "Single-pixel buffer", "single-pixel-buffer-v1"}, {"wp_single_pixel_buffer_manager_v1"}); + add({UPSTREAM, STAGING, "Content type hint", "content-type-v1"}, {"wp_content_type_manager_v1"}); + add({UPSTREAM, STAGING, "Idle notify", "ext-idle-notify-v1"}, {"ext_idle_notifier_v1"}); + add({UPSTREAM, STAGING, "Tearing control", "tearing-control-v1"}, {"wp_tearing_control_manager_v1"}); + add({UPSTREAM, STAGING, "Xwayland shell", "xwayland-shell-v1"}, {"xwayland_shell_v1"}); + add({UPSTREAM, STAGING, "Fractional scale", "fractional-scale-v1"}, {"wp_fractional_scale_manager_v1"}); + add({UPSTREAM, STAGING, "Cursor shape", "cursor-shape-v1"}, {"wp_cursor_shape_manager_v1"}); + add({UPSTREAM, STAGING, "Foreign toplevel list", "ext-foreign-toplevel-list-v1"}, {"ext_foreign_toplevel_list_v1"}); + add({UPSTREAM, STAGING, "Security context", "security-context-v1"}, {"wp_security_context_manager_v1"}); + add({UPSTREAM, STAGING, "Transient seat", "ext-transient-seat-v1"}, {"ext_transient_seat_manager_v1"}); + + add({UPSTREAM, UNSTABLE, "Fullscreen shell", "fullscreen-shell-unstable-v1"}, {"zwp_fullscreen_shell_v1"}); + add({UPSTREAM, UNSTABLE, "Idle inhibit", "idle-inhibit-unstable-v1"}, {"zwp_idle_inhibit_manager_v1"}); + add({UPSTREAM, UNSTABLE, "Input method", "input-method-unstable-v1"}, {"zwp_input_method_context_v1"}); + add({UPSTREAM, UNSTABLE, "Input timestamps", "input-timestamps-unstable-v1"}, {"zwp_input_timestamps_manager_v1"}); + add({UPSTREAM, UNSTABLE, "Keyboard shortcuts inhibit", "keyboard-shortcuts-inhibit-unstable-v1"}, {"zwp_keyboard_shortcuts_inhibit_manager_v1"}); + add({UPSTREAM, UNSTABLE, "Linux explicit synchronization", "linux-explicit-synchronization-unstable-v1"}, {"zwp_linux_explicit_synchronization_v1"}); + add({UPSTREAM, UNSTABLE, "Pointer constraints", "pointer-constraints-unstable-v1"}, {"zwp_pointer_constraints_v1"}); + add({UPSTREAM, UNSTABLE, "Pointer gestures", "pointer-gestures-unstable-v1"}, {"zwp_pointer_gestures_v1"}); + add({UPSTREAM, UNSTABLE, "Primary selection", "primary-selection-unstable-v1"}, {"zwp_primary_selection_device_manager_v1"}); + add({UPSTREAM, UNSTABLE, "Relative pointer", "relative-pointer-unstable-v1"}, {"zwp_relative_pointer_manager_v1"}); + add({UPSTREAM, UNSTABLE, "Tablet", "tablet-unstable-v2"}, {"zwp_tablet_manager_v2"}); + add({UPSTREAM, UNSTABLE, "Text input", "text-input-unstable-v3"}, {"zwp_text_input_v3"}); + add({UPSTREAM, UNSTABLE, "XDG decoration", "xdg-decoration-unstable-v1"}, {"zxdg_decoration_manager_v1"}); + add({UPSTREAM, UNSTABLE, "XDG foreign v1", "xdg-foreign-unstable-v1"}, {"zxdg_importer_v1", "zxdg_exporter_v1"}); + add({UPSTREAM, UNSTABLE, "XDG foreign v2", "xdg-foreign-unstable-v2"}, {"zxdg_importer_v2", "zxdg_exporter_v2"}); + add({UPSTREAM, UNSTABLE, "XDG output", "xdg-output-unstable-v1"}, {"zxdg_output_manager_v1"}); + add({UPSTREAM, UNSTABLE, "Xwayland keyboard grabbing", "xwayland-keyboard-grab-unstable-v1"}, {"zwp_xwayland_keyboard_grab_manager_v1"}); + + add({WLROOTS, NONE, "Data control", "wlr-data-control-unstable-v1"}, {"zwlr_data_control_manager_v1"}); + add({WLROOTS, NONE, "Export DMA-BUF", "wlr-export-dmabuf-unstable-v1"}, {"zwlr_export_dmabuf_manager_v1"}); + add({WLROOTS, NONE, "Foreign toplevel management", "wlr-foreign-toplevel-management-unstable-v1"}, {"zwlr_foreign_toplevel_manager_v1"}); + add({WLROOTS, NONE, "Gamma control", "wlr-gamma-control-unstable-v1"}, {"zwlr_gamma_control_manager_v1"}); + add({WLROOTS, NONE, "Input inhibitor", "wlr-input-inhibitor-unstable-v1"}, {"zwlr_input_inhibit_manager_v1"}); + add({WLROOTS, NONE, "Layer shell", "wlr-layer-shell-unstable-v1"}, {"zwlr_layer_shell_v1"}); + add({WLROOTS, NONE, "Output management", "wlr-output-management-unstable-v1"}, {"zwlr_output_manager_v1"}); + add({WLROOTS, NONE, "Output power management", "wlr-output-power-management-unstable-v1"}, {"zwlr_output_power_manager_v1"}); + add({WLROOTS, NONE, "Screencopy", "wlr-screencopy-unstable-v1"}, {"zwlr_screencopy_manager_v1"}); + add({WLROOTS, NONE, "Virtual pointer", "wlr-virtual-pointer-unstable-v1"}, {"zwlr_virtual_pointer_manager_v1"}); + + add({KDE, NONE, "AppMenu", "appmenu"}, {"org_kde_kwin_appmenu_manager"}); + add({KDE, NONE, "Blur", "blur"}, {"org_kde_kwin_blur_manager"}); + add({KDE, NONE, "Contrast", "contrast"}, {"org_kde_kwin_contrast_manager"}); + add({KDE, NONE, "DPMS", "dpms"}, {"org_kde_kwin_dpms_manager"}); + add({KDE, NONE, "Fake input", "fake-input"}, {"org_kde_kwin_fake_input"}); + add({KDE, NONE, "Idle", "idle"}, {"org_kde_kwin_idle"}); + add({KDE, NONE, "Key state", "keystate"}, {"org_kde_kwin_keystate"}); + add({KDE, NONE, "Lockscreen overlay", "kde-lockscreen-overlay-v1"}, {"kde_lockscreen_overlay_v1"}); + add({KDE, NONE, "Output management", "output-management"}, {"org_kde_kwin_outputmanagement"}); + add({KDE, NONE, "Output management v2", "kde-output-management-v2"}, {"kde_output_management_v2"}); + add({KDE, NONE, "Output device", "outputdevice"}, {"org_kde_kwin_outputdevice"}); + add({KDE, NONE, "Output device v2", "kde-output-device-v2"}, {"kde_output_device_v2"}); + add({KDE, NONE, "Output order", "kde-output-order-v1"}, {"kde_output_order_v1"}); + add({KDE, NONE, "Plasma shell", "plasma-shell"}, {"org_kde_plasma_shell"}); + add({KDE, NONE, "Plasma virtual desktop", "plasma-virtual-desktop"}, {"org_kde_plasma_virtual_desktop_management"}); + add({KDE, NONE, "Plasma window management", "plasma-window-management"}, {"org_kde_plasma_window_management"}); + add({KDE, NONE, "Primary output", "kde-primary-output-v1"}, {"kde_primary_output_v1"}); + add({KDE, NONE, "Screencast", "zkde-screencast-unstable-v1"}, {"zkde_screencast_unstable_v1"}); + add({KDE, NONE, "Server decoration", "server-decoration"}, {"org_kde_kwin_server_decoration_manager"}); + add({KDE, NONE, "Server decoration palette", "server-decoration-palette"}, {"org_kde_kwin_server_decoration_palette_manager"}); + add({KDE, NONE, "Shadow", "shadow"}, {"org_kde_kwin_shadow_manager"}); + add({KDE, NONE, "Slide", "slide"}, {"org_kde_kwin_slide_manager"}); + + add({WESTON, NONE, "In-vehicle infotainment application", "ivi-application"}, {"ivi_application"}); + add({WESTON, NONE, "In-vehicle infotainment HMI controller", "ivi-hmi-controller"}, {"ivi_hmi_controller"}); + add({WESTON, NONE, "Text cursor position", "text-cursor-position"}, {"text_cursor_position"}); + add({WESTON, NONE, "Content protection", "weston-content-protection"}, {"weston_content_protection"}); + add({WESTON, NONE, "Desktop shell", "weston-desktop-shell"}, {"weston_desktop_shell"}); + add({WESTON, NONE, "Direct display", "weston-direct-display"}, {"weston_direct_display_v1"}); + add({WESTON, NONE, "Output capture", "weston-output-capture"}, {"weston_capture_v1"}); + add({WESTON, NONE, "Screenshooter", "weston-screenshooter"}, {"weston_screenshooter"}); + add({WESTON, NONE, "Touch calibration", "weston-touch-calibration"}, {"weston_touch_calibration"}); + + add({CHROMEOS, NONE, "Aura shell", "aura-shell"}, {"zaura_shell"}); + add({CHROMEOS, NONE, "Color management", "chrome-color-management"}, {"zcr_color_manager_v1"}); + add({CHROMEOS, NONE, "Overlay prioritizer", "overlay-prioritizer"}, {"overlay_prioritizer"}); + add({CHROMEOS, NONE, "Surface augmenter", "surface-augmenter"}, {"surface_augmenter"}); + // clang-format on +} + +void ProtocolStore::add(const Protocol& protocol, const std::set<std::string>& interfaces) noexcept { + const auto name = QString::fromStdString(protocol.name); + auto id = QStringLiteral("%1-%2-%3").arg(protocol.source).arg(protocol.status).arg(name).toStdString(); + if (known_protocols.contains(id)) { + std::printf("Known protocols already contains id %s\n", id.c_str()); + return; + } + + known_protocols.emplace(id, protocol); + for (auto& interface : interfaces) { + known_interfaces.emplace(interface, id); + } +} + +std::optional<Protocol> ProtocolStore::protocolForInterface(const std::string& interface) const noexcept { + if (!known_interfaces.contains(interface)) { + return {}; + } + + return known_protocols.at(known_interfaces.at(interface)); +} + +std::set<const Protocol*> ProtocolStore::getProtocols() const noexcept { + std::set<const Protocol*> ret; + for (auto& it : std::ranges::views::values(known_protocols)) { + ret.emplace(&it); + } + return ret; +} + +std::string source_to_string(const ProtocolSource source) { switch (source) { case UPSTREAM: return "Upstream"; @@ -17,7 +141,7 @@ } } -std::string status_to_string(ProtocolStatus status) { +std::string status_to_string(const ProtocolStatus status) { switch (status) { case STABLE: return "Stable"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waycheck-v1.0.0/src/protocols.hpp new/waycheck-v1.1.0/src/protocols.hpp --- old/waycheck-v1.0.0/src/protocols.hpp 2023-10-15 20:51:45.000000000 +0200 +++ new/waycheck-v1.1.0/src/protocols.hpp 2024-02-10 23:14:55.000000000 +0100 @@ -1,6 +1,8 @@ #ifndef WAYCHECK_PROTOCOLS_HPP #define WAYCHECK_PROTOCOLS_HPP +#include <optional> +#include <set> #include <string> #include <unordered_map> @@ -27,93 +29,18 @@ std::string name; }; -// clang-format off -static std::unordered_map<std::string, const Protocol> known_protocols = { - {"wp_presentation", {UPSTREAM, STABLE, "Presentation time", "presentation-time"}}, - {"wp_viewporter", {UPSTREAM, STABLE, "Viewporter", "viewporter"}}, - {"xdg_wm_base", {UPSTREAM, STABLE, "XDG shell", "xdg-shell"}}, - - {"xdg_activation_v1", {UPSTREAM, STAGING, "XDG activation", "xdg-activation-v1"}}, - {"wp_drm_lease_device_v1", {UPSTREAM, STAGING, "DRM lease", "drm-lease-v1"}}, - {"ext_session_lock_manager_v1", {UPSTREAM, STAGING, "Session lock", "ext-session-lock-v1"}}, - {"wp_single_pixel_buffer_manager_v1", {UPSTREAM, STAGING, "Single-pixel buffer", "single-pixel-buffer-v1"}}, - {"wp_content_type_manager_v1", {UPSTREAM, STAGING, "Content type hint", "content-type-v1"}}, - {"ext_idle_notifier_v1", {UPSTREAM, STAGING, "Idle notify", "ext-idle-notify-v1"}}, - {"wp_tearing_control_manager_v1", {UPSTREAM, STAGING, "Tearing control", "tearing-control-v1"}}, - {"xwayland_shell_v1", {UPSTREAM, STAGING, "Xwayland shell", "xwayland-shell-v1"}}, - {"wp_fractional_scale_manager_v1", {UPSTREAM, STAGING, "Fractional scale", "fractional-scale-v1"}}, - {"wp_cursor_shape_manager_v1", {UPSTREAM, STAGING, "Cursor shape", "cursor-shape-v1"}}, - {"ext_foreign_toplevel_list_v1", {UPSTREAM, STAGING, "Foreign toplevel list", "ext-foreign-toplevel-list-v1"}}, - {"wp_security_context_manager_v1", {UPSTREAM, STAGING, "Security context", "security-context-v1"}}, - - {"zwp_fullscreen_shell_v1", {UPSTREAM, UNSTABLE, "Fullscreen shell", "fullscreen-shell-unstable-v1"}}, - {"zwp_idle_inhibit_manager_v1", {UPSTREAM, UNSTABLE, "Idle inhibit", "idle-inhibit-unstable-v1"}}, - {"zwp_input_method_context_v1", {UPSTREAM, UNSTABLE, "Input method", "input-method-unstable-v1"}}, - {"zwp_input_timestamps_manager_v1", {UPSTREAM, UNSTABLE, "Input timestamps", "input-timestamps-unstable-v1"}}, - {"zwp_keyboard_shortcuts_inhibit_manager_v1", {UPSTREAM, UNSTABLE, "Keyboard shortcuts inhibit", "keyboard-shortcuts-inhibit-unstable-v1"}}, - {"zwp_linux_dmabuf_v1", {UPSTREAM, UNSTABLE, "Linux DMA-BUF", "linux-dmabuf-unstable-v1"}}, - {"zwp_linux_explicit_synchronization_v1", {UPSTREAM, UNSTABLE, "Linux explicit synchronization", "linux-explicit-synchronization-unstable-v1"}}, - {"zwp_pointer_constraints_v1", {UPSTREAM, UNSTABLE, "Pointer constraints", "pointer-constraints-unstable-v1"}}, - {"zwp_pointer_gestures_v1", {UPSTREAM, UNSTABLE, "Pointer gestures", "pointer-gestures-unstable-v1"}}, - {"zwp_primary_selection_device_manager_v1", {UPSTREAM, UNSTABLE, "Primary selection", "primary-selection-unstable-v1"}}, - {"zwp_relative_pointer_manager_v1", {UPSTREAM, UNSTABLE, "Relative pointer", "relative-pointer-unstable-v1"}}, - {"zwp_tablet_manager_v2", {UPSTREAM, UNSTABLE, "Tablet", "tablet-unstable-v2"}}, - {"zwp_text_input_v3", {UPSTREAM, UNSTABLE, "Text input", "text-input-unstable-v3"}}, - {"zxdg_decoration_manager_v1", {UPSTREAM, UNSTABLE, "XDG decoration", "xdg-decoration-unstable-v1"}}, - {"zxdg_exporter_v2", {UPSTREAM, UNSTABLE, "XDG foreign", "xdg-foreign-unstable-v2"}}, - {"zxdg_output_manager_v1", {UPSTREAM, UNSTABLE, "XDG output", "xdg-output-unstable-v1"}}, - {"zwp_xwayland_keyboard_grab_manager_v1", {UPSTREAM, UNSTABLE, "Xwayland keyboard grabbing", "xwayland-keyboard-grab-unstable-v1"}}, - - {"zwlr_data_control_manager_v1", {WLROOTS, NONE, "Data control", "wlr-data-control-unstable-v1"}}, - {"zwlr_export_dmabuf_manager_v1", {WLROOTS, NONE, "Export DMA-BUF", "wlr-export-dmabuf-unstable-v1"}}, - {"zwlr_foreign_toplevel_manager_v1", {WLROOTS, NONE, "Foreign toplevel management", "wlr-foreign-toplevel-management-unstable-v1"}}, - {"zwlr_gamma_control_manager_v1", {WLROOTS, NONE, "Gamma control", "wlr-gamma-control-unstable-v1"}}, - {"zwlr_input_inhibit_manager_v1", {WLROOTS, NONE, "Input inhibitor", "wlr-input-inhibitor-unstable-v1"}}, - {"zwlr_layer_shell_v1", {WLROOTS, NONE, "Layer shell", "wlr-layer-shell-unstable-v1"}}, - {"zwlr_output_manager_v1", {WLROOTS, NONE, "Output management", "wlr-output-management-unstable-v1"}}, - {"zwlr_output_power_manager_v1", {WLROOTS, NONE, "Output power management", "wlr-output-power-management-unstable-v1"}}, - {"zwlr_screencopy_manager_v1", {WLROOTS, NONE, "Screencopy", "wlr-screencopy-unstable-v1"}}, - {"zwlr_virtual_pointer_manager_v1", {WLROOTS, NONE, "Virtual pointer", "wlr-virtual-pointer-unstable-v1"}}, - - {"org_kde_kwin_appmenu_manager", {KDE, NONE, "AppMenu", "appmenu"}}, - {"org_kde_kwin_blur_manager", {KDE, NONE, "Blur", "blur"}}, - {"org_kde_kwin_contrast_manager", {KDE, NONE, "Contrast", "contrast"}}, - {"org_kde_kwin_dpms_manager", {KDE, NONE, "DPMS", "dpms"}}, - {"org_kde_kwin_fake_input", {KDE, NONE, "Fake input", "fake-input"}}, - {"org_kde_kwin_idle", {KDE, NONE, "Idle", "idle"}}, - {"org_kde_kwin_keystate", {KDE, NONE, "Key state", "keystate"}}, - {"kde_lockscreen_overlay_v1", {KDE, NONE, "Lockscreen overlay", "kde-lockscreen-overlay-v1"}}, - {"org_kde_kwin_outputmanagement", {KDE, NONE, "Output management", "output-management"}}, - {"kde_output_management_v2", {KDE, NONE, "Output management v2", "kde-output-management-v2"}}, - {"org_kde_kwin_outputdevice", {KDE, NONE, "Output device", "outputdevice"}}, - {"kde_output_device_v2", {KDE, NONE, "Output device v2", "kde-output-device-v2"}}, - {"kde_output_order_v1", {KDE, NONE, "Output order", "kde-output-order-v1"}}, - {"org_kde_plasma_shell", {KDE, NONE, "Plasma shell", "plasma-shell"}}, - {"org_kde_plasma_virtual_desktop_management", {KDE, NONE, "Plasma virtual desktop", "plasma-virtual-desktop"}}, - {"org_kde_plasma_window_management", {KDE, NONE, "Plasma window management", "plasma-window-management"}}, - {"kde_primary_output_v1", {KDE, NONE, "Primary output", "kde-primary-output-v1"}}, - {"zkde_screencast_unstable_v1", {KDE, NONE, "Screencast", "zkde-screencast-unstable-v1"}}, - {"org_kde_kwin_server_decoration_manager", {KDE, NONE, "Server decoration", "server-decoration"}}, - {"org_kde_kwin_server_decoration_palette_manager", {KDE, NONE, "Server decoration palette", "server-decoration-palette"}}, - {"org_kde_kwin_shadow_manager", {KDE, NONE, "Shadow", "shadow"}}, - {"org_kde_kwin_slide_manager", {KDE, NONE, "Slide", "slide"}}, - - {"ivi_application", {WESTON, NONE, "In-vehicle infotainment application", "ivi-application"}}, - {"ivi_hmi_controller", {WESTON, NONE, "In-vehicle infotainment HMI controller", "ivi-hmi-controller"}}, - {"text_cursor_position", {WESTON, NONE, "Text cursor position", "text-cursor-position"}}, - {"weston_content_protection", {WESTON, NONE, "Content protection", "weston-content-protection"}}, - {"weston_desktop_shell", {WESTON, NONE, "Desktop shell", "weston-desktop-shell"}}, - {"weston_direct_display_v1", {WESTON, NONE, "Direct display", "weston-direct-display"}}, - {"weston_capture_v1", {WESTON, NONE, "Output capture", "weston-output-capture"}}, - {"weston_screenshooter", {WESTON, NONE, "Screenshooter", "weston-screenshooter"}}, - {"weston_touch_calibration", {WESTON, NONE, "Touch calibration", "weston-touch-calibration"}}, - - {"zaura_shell", {CHROMEOS, NONE, "Aura shell", "surface-augmenter"}}, - {"zcr_color_manager_v1", {CHROMEOS, NONE, "Color management", "chrome-color-management"}}, - {"overlay_prioritizer", {CHROMEOS, NONE, "Overlay prioritizer", "overlay-prioritizer"}}, - {"surface_augmenter", {CHROMEOS, NONE, "Surface augmenter", "surface-augmenter"}}, +class ProtocolStore { + std::unordered_map<std::string, const Protocol> known_protocols; + std::unordered_map<std::string, const std::string> known_interfaces; + + void add(const Protocol& protocol, const std::set<std::string>& interfaces) noexcept; + + public: + ProtocolStore() noexcept; + + std::optional<Protocol> protocolForInterface(const std::string& interface) const noexcept; + std::set<const Protocol*> getProtocols() const noexcept; }; -// clang-format on std::string source_to_string(ProtocolSource source); std::string status_to_string(ProtocolStatus status); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waycheck-v1.0.0/src/window.cpp new/waycheck-v1.1.0/src/window.cpp --- old/waycheck-v1.0.0/src/window.cpp 2023-10-15 20:51:45.000000000 +0200 +++ new/waycheck-v1.1.0/src/window.cpp 2024-02-10 23:14:55.000000000 +0100 @@ -14,18 +14,18 @@ #include <wayland-client-protocol.h> #include <wayland-client.h> -static pid_t pid_from_fd(int fd) { - struct ucred ucred; +static pid_t pid_from_fd(const int fd) { + ucred cred{}; socklen_t len = sizeof(struct ucred); - if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == -1) { + if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &len) == -1) { perror("getsockopt failed"); exit(1); } - return ucred.pid; + return cred.pid; } static std::string process_name_from_pid(const pid_t pid) { - std::string procpath = QString::asprintf("/proc/%d/comm", pid).toStdString(); + const std::string procpath = QString::asprintf("/proc/%d/comm", pid).toStdString(); std::ifstream infile(procpath); if (infile.is_open()) { @@ -33,18 +33,17 @@ std::getline(infile, out); infile.close(); return out; - } else if (getenv("container") != nullptr) { + } + + if (getenv("container") != nullptr) { // running in a flatpak, most likely return "Unknown (Sandboxed)"; - } else { - return "Unknown"; } -} -static void registry_global(void* data, wl_registry* registry, uint32_t name, const char* interface, uint32_t version) { - (void) registry; - (void) name; + return "Unknown"; +} +static void registry_global(void* data, wl_registry*, uint32_t, const char* interface, const uint32_t version) { if (std::string(interface).starts_with("wl_")) { return; } @@ -53,13 +52,9 @@ window->newGlobal(interface, version); } -static void registry_global_remove(void* data, struct wl_registry* registry, uint32_t name) { - (void) data; - (void) registry; - (void) name; -} +static void registry_global_remove(void*, wl_registry*, uint32_t) {} -Window::Window(QNativeInterface::QWaylandApplication* waylandApp, QWidget* parent) +Window::Window(const QNativeInterface::QWaylandApplication* waylandApp, QWidget* parent) : QMainWindow(parent), ui(std::make_unique<Ui::Window>()), searchBox(ui->toolbar), supportBox(ui->toolbar) { ui->setupUi(this); @@ -70,8 +65,10 @@ initTable(CHROMEOS, *ui->chromeosTable); initTable(UNKNOWN, *ui->unknownTable); - for (auto protocol : known_protocols) { - addProtocol(protocol.second); + const auto store = ProtocolStore(); + + for (auto* protocol : store.getProtocols()) { + addProtocol(*protocol); } ui->upstreamTable->sortByColumn(1, Qt::AscendingOrder); @@ -80,18 +77,18 @@ } auto* display = waylandApp->display(); - auto fd = wl_display_get_fd(display); - auto pid = pid_from_fd(fd); - auto pname = process_name_from_pid(pid); + const auto fd = wl_display_get_fd(display); + const auto pid = pid_from_fd(fd); + const auto pname = process_name_from_pid(pid); - auto listener = wl_registry_listener{.global = registry_global, .global_remove = registry_global_remove}; + constexpr auto listener = wl_registry_listener{.global = registry_global, .global_remove = registry_global_remove}; auto* registry = wl_display_get_registry(display); - wl_registry_add_listener(registry, &listener, (void*) this); + wl_registry_add_listener(registry, &listener, this); wl_display_roundtrip(display); // Toolbar components - QLabel* compositor = new QLabel(ui->toolbar); + auto* compositor = new QLabel(ui->toolbar); compositor->setText(QString::asprintf("Compositor: %s", pname.c_str())); compositor->setContentsMargins(4, 0, 0, 0); QFont font = compositor->font(); @@ -99,36 +96,36 @@ compositor->setFont(font); ui->toolbar->addWidget(compositor); - QWidget* spacer = new QWidget(ui->toolbar); + auto* spacer = new QWidget(ui->toolbar); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); ui->toolbar->addWidget(spacer); searchBox.setPlaceholderText("Searchâ¦"); searchBox.setContentsMargins(4, 0, 4, 0); searchBox.setFixedWidth(16 * 14); - QShortcut* shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F), &searchBox); - QObject::connect(shortcut, &QShortcut::activated, [this]() { searchBox.setFocus(); }); + const auto* shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F), &searchBox); + connect(shortcut, &QShortcut::activated, [this] { searchBox.setFocus(); }); ui->toolbar->addWidget(&searchBox); - supportBox.addItem("All protocols", Model::supportFilters::ALL); - supportBox.addItem("Supported protocols", Model::supportFilters::SUPPORTED); - supportBox.addItem("Unsupported protocols", Model::supportFilters::UNSUPPORTED); + supportBox.addItem("All protocols", Model::SupportFilters::ALL); + supportBox.addItem("Supported protocols", Model::SupportFilters::SUPPORTED); + supportBox.addItem("Unsupported protocols", Model::SupportFilters::UNSUPPORTED); ui->toolbar->addWidget(&supportBox); } Window::~Window() = default; -void Window::newGlobal(const std::string interface, const uint32_t version) { - const Protocol& protocol = known_protocols[interface]; - if (protocol.source == UNKNOWN) { +void Window::newGlobal(const std::string& interface, const uint32_t version) { + const auto maybeProtocol = store.protocolForInterface(interface); + if (!maybeProtocol.has_value()) { auto versionItem = new QStandardItem(false); versionItem->setCheckState(Qt::Checked); versionItem->setText(QString::asprintf("%d", version)); - auto items = QList<QStandardItem*>({new QStandardItem(QString::fromStdString(interface)), versionItem}); + auto items = QList({new QStandardItem(QString::fromStdString(interface)), versionItem}); - for (auto item : std::as_const(items)) { + for (const auto item : std::as_const(items)) { item->setData(true, Qt::UserRole); auto font = item->font(); font.setWeight(QFont::DemiBold); @@ -136,22 +133,23 @@ item->setData(true, Qt::UserRole); } - models[protocol.source]->sourceModel.appendRow(items); + models[UNKNOWN]->sourceModel.appendRow(items); return; } - auto& model = models[protocol.source]; + const auto& [source, status, pretty, name] = maybeProtocol.value(); + const auto& model = models[source]; - auto column = (model->includeStatus) ? 2 : 1; - auto matches = model->sourceModel.findItems(QString::fromStdString(protocol.name), Qt::MatchExactly, column); + const auto column = model->includeStatus ? 2 : 1; + auto matches = model->sourceModel.findItems(QString::fromStdString(name), Qt::MatchExactly, column); - for (auto match : matches) { - auto versionItem = model->sourceModel.item(match->row(), column + 1); + for (const auto match : matches) { + const auto versionItem = model->sourceModel.item(match->row(), column + 1); versionItem->setCheckState(Qt::Checked); versionItem->setText(QString::asprintf("%d", version)); for (auto i = 0; i < model->sourceModel.columnCount(); i++) { - auto item = model->sourceModel.item(match->row(), i); + const auto item = model->sourceModel.item(match->row(), i); auto font = item->font(); font.setWeight(QFont::DemiBold); item->setFont(font); @@ -161,13 +159,13 @@ } void Window::addProtocol(const Protocol& protocol) { - auto& model = models[protocol.source]; + const auto& model = models[protocol.source]; auto versionItem = new QStandardItem(false); versionItem->setCheckState(Qt::Unchecked); versionItem->setText("N/A"); - auto items = QList<QStandardItem*>({ + auto items = QList({ new QStandardItem(QString::fromStdString(protocol.pretty)), new QStandardItem(QString::fromStdString(protocol.name)), versionItem, @@ -178,7 +176,7 @@ items.prepend(statusItem); } - for (auto item : std::as_const(items)) { + for (const auto item : std::as_const(items)) { item->setData(false, Qt::UserRole); } @@ -218,28 +216,28 @@ table.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); // Connect filters to UI - QObject::connect(&searchBox, &QLineEdit::textChanged, [&model](const QString& text) { model->setSearchFilter(text); }); + connect(&searchBox, &QLineEdit::textChanged, [&model](const QString& text) { model->setSearchFilter(text); }); - QObject::connect(&supportBox, &QComboBox::currentIndexChanged, [&model, this](const int& index) { - model->setSupportFilter(static_cast<Model::supportFilters>(supportBox.itemData(index).toInt())); + connect(&supportBox, &QComboBox::currentIndexChanged, [&model, this](const int& index) { + model->setSupportFilter(static_cast<Model::SupportFilters>(supportBox.itemData(index).toInt())); }); // Resize table columns when model is updated - auto resizeColumns = [&table]() { + auto resizeColumns = [&table] { table.setVisible(false); table.resizeColumnsToContents(); table.setVisible(true); }; - QObject::connect(model->filteredModel, &QSortFilterProxyModel::rowsInserted, resizeColumns); - QObject::connect(model->filteredModel, &QSortFilterProxyModel::rowsRemoved, resizeColumns); + connect(model->filteredModel, &QSortFilterProxyModel::rowsInserted, resizeColumns); + connect(model->filteredModel, &QSortFilterProxyModel::rowsRemoved, resizeColumns); // Set tab title auto titleTab = [this, &model, &table](bool filtering) { - int index = ui->toolBox->indexOf(&table); - int count = model->filteredModel->rowCount(); + const int index = ui->toolBox->indexOf(&table); + const int count = model->filteredModel->rowCount(); - bool tabVisible = ui->toolBox->isTabVisible(index); + const bool tabVisible = ui->toolBox->isTabVisible(index); bool tabShouldBeVisible = true; if (count == 0) { @@ -267,13 +265,13 @@ }; titleTab(false); - QObject::connect(model.get(), &Model::filterChanged, titleTab); + connect(model.get(), &Model::filterChanged, titleTab); } TableItemDelegate::TableItemDelegate(QObject* parent) : QStyledItemDelegate(parent) {} void TableItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { - bool enabled = index.data(Qt::UserRole).toBool(); + const bool enabled = index.data(Qt::UserRole).toBool(); if (!enabled) { QStyleOptionViewItem newOption(option); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waycheck-v1.0.0/src/window.hpp new/waycheck-v1.1.0/src/window.hpp --- old/waycheck-v1.0.0/src/window.hpp 2023-10-15 20:51:45.000000000 +0200 +++ new/waycheck-v1.1.0/src/window.hpp 2024-02-10 23:14:55.000000000 +0100 @@ -20,22 +20,23 @@ } QT_END_NAMESPACE -class Window : public QMainWindow { +class Window final : public QMainWindow { Q_OBJECT std::map<ProtocolSource, std::unique_ptr<Model>> models; + ProtocolStore store; public: - Window(QNativeInterface::QWaylandApplication* waylandApp, QWidget* parent = nullptr); - ~Window(); + explicit Window(const QNativeInterface::QWaylandApplication* waylandApp, QWidget* parent = nullptr); + ~Window() override; - void newGlobal(const std::string interface, const uint32_t version); + void newGlobal(const std::string& interface, uint32_t version); void addProtocol(const Protocol& protocol); private: - void initTable(const ProtocolSource source, QTableView& table); + void initTable(ProtocolSource source, QTableView& table); - Model* modelForStatus(const ProtocolStatus status); + Model* modelForStatus(ProtocolStatus status); private: std::unique_ptr<Ui::Window> const ui; @@ -43,9 +44,9 @@ QComboBox supportBox; }; -class TableItemDelegate : public QStyledItemDelegate { +class TableItemDelegate final : public QStyledItemDelegate { public: - TableItemDelegate(QObject* parent = nullptr); + explicit TableItemDelegate(QObject* parent = nullptr); void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override; };