Skip to content

Use system from PlasmaWaylandProtocols by default.#1585

Merged
wengxt merged 3 commits into
masterfrom
protocol
Jun 19, 2026
Merged

Use system from PlasmaWaylandProtocols by default.#1585
wengxt merged 3 commits into
masterfrom
protocol

Conversation

@wengxt

@wengxt wengxt commented Jun 19, 2026

Copy link
Copy Markdown
Member

Extend global framework to allow only subscribe for a minimum version.

Fix #1584

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a build option to use system-installed Plasma Wayland protocols, including blur and window-management protocol XMLs.
    • Extended Plasma window management with stacking-order helpers/events (including stacking_order_changed_2) and activation feedback wrappers.
    • Added client_geometry support and introduced a dedicated stacking-order helper interface.
  • Bug Fixes

    • Improved Wayland global negotiation and signal emission to avoid notifications on failed/unsupported global creation.
  • Chores

    • Refreshed CI build dependencies for Wayland/Plasma protocol compatibility.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b0a07ee4-a43a-4758-a947-59c0eab673eb

📥 Commits

Reviewing files that changed from the base of the PR and between bea3124 and 4efb328.

📒 Files selected for processing (8)
  • src/lib/fcitx-wayland/core/wl_buffer.cpp
  • src/lib/fcitx-wayland/core/wl_data_offer.cpp
  • src/lib/fcitx-wayland/core/wl_data_source.cpp
  • src/lib/fcitx-wayland/core/wl_region.cpp
  • src/lib/fcitx-wayland/core/wl_shm_pool.cpp
  • src/lib/fcitx-wayland/core/wl_subcompositor.cpp
  • src/lib/fcitx-wayland/core/wl_subsurface.cpp
  • src/lib/fcitx-wayland/core/wl_surface.cpp

📝 Walkthrough

Walkthrough

Adds a USE_SYSTEM_PLASMA_WAYLAND_PROTOCOLS CMake option to prefer system-installed Plasma protocol XMLs over bundled copies. The bundled plasma-window-management.xml is updated to version 20, introducing new org_kde_plasma_stacking_order and activation interfaces. New C++ wrapper classes are generated for these interfaces. Display gains a version-gated global binding mechanism via requestGlobalsWithMinimalVersion<T>(), and PlasmaAppMonitor is updated to require protocol version 17. Core Wayland wrapper destructors are simplified to remove version-gated cleanup logic.

Changes

Plasma Wayland Protocol v20 + System Protocol Build Support

Layer / File(s) Summary
CMake system protocol option and path selection
CMakeLists.txt, src/lib/fcitx-wayland/blur/CMakeLists.txt, src/lib/fcitx-wayland/blur/blur.xml, src/lib/fcitx-wayland/plasma-window-management/CMakeLists.txt
Adds USE_SYSTEM_PLASMA_WAYLAND_PROTOCOLS option (default On) to the root build; conditionally calls find_package(PlasmaWaylandProtocols 1.21) when enabled; updates blur and plasma-window-management sub-builds to select either system or local XML paths via computed variables.
CI dependencies for system protocols
.github/workflows/check.yml
Updates the check job's Arch package installation to include additional build and runtime dependencies (Wayland, X11, systemd, etc.) needed for the system protocol build path.
Protocol XML update to version 20
src/lib/fcitx-wayland/plasma-window-management/plasma-window-management.xml
Bumps org_kde_plasma_window_management and org_kde_plasma_window to version 20; rewrites state enum to explicit hex bitmasks and adds exclude_from_capture flag (since 20); marks stacking_order_changed and stacking_order_uuid_changed as deprecated since 17; adds stacking_order_changed_2 event and get_stacking_order request (since 17); adds client_geometry event to org_kde_plasma_window (since 18); introduces the new org_kde_plasma_stacking_order interface (version 17) with window/done events.
Display: version-gated global binding
src/lib/fcitx-wayland/core/display.h, src/lib/fcitx-wayland/core/display.cpp
Adds GlobalsFactoryWithVersion<T> template that rejects globals advertised below a minimum version; adds Display::requestGlobalsWithMinimalVersion<T>(uint32_t version) method to request interfaces with version gating; adds null-pointer early-return guards in Display::createGlobalHelper and globalRemove callback.
New OrgKdePlasmaStackingOrder C++ wrapper
src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_stacking_order.h, src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_stacking_order.cpp
New wrapper class with window and done signals, version/user-data accessors, raw-pointer conversion, and rawPointer helper; implementation defines listener callbacks, constructor capturing version/pointer, and destructor via org_kde_plasma_stacking_order_destroy.
New OrgKdePlasmaActivation and OrgKdePlasmaActivationFeedback C++ wrappers
src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_activation.h, src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_activation.cpp, src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_activation_feedback.h, src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_activation_feedback.cpp
OrgKdePlasmaActivation wraps app_id and finished events with listener callbacks and unconditional destructor. OrgKdePlasmaActivationFeedback wraps the activation event, allocating and forwarding OrgKdePlasmaActivation objects from callback payloads, with unconditional destructor.
Updated OrgKdePlasmaWindow and OrgKdePlasmaWindowManagement wrappers
src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_window.h, src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_window.cpp, src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_window_management.h, src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_window_management.cpp
Bumps both wrapper versions to 20; adds clientGeometry signal and listener callback to OrgKdePlasmaWindow; simplifies destructor to unconditional destroy; adds forward declaration, getStackingOrder() method, stackingOrderChanged2 signal, and listener callback to OrgKdePlasmaWindowManagement.
PlasmaAppMonitor version gating and blur destructor fix
src/frontend/waylandim/plasmaappmonitor.cpp, src/lib/fcitx-wayland/blur/org_kde_kwin_blur.cpp
Switches PlasmaAppMonitor to requestGlobalsWithMinimalVersion(17) for OrgKdePlasmaWindowManagement binding; wraps OrgKdeKwinBlur destructor's release logic behind ORG_KDE_KWIN_BLUR_RELEASE_SINCE_VERSION compile-time guard with runtime version check.
Core Wayland wrapper destructor simplification
src/lib/fcitx-wayland/core/wl_buffer.cpp, src/lib/fcitx-wayland/core/wl_data_offer.cpp, src/lib/fcitx-wayland/core/wl_data_source.cpp, src/lib/fcitx-wayland/core/wl_region.cpp, src/lib/fcitx-wayland/core/wl_shm_pool.cpp, src/lib/fcitx-wayland/core/wl_subcompositor.cpp, src/lib/fcitx-wayland/core/wl_subsurface.cpp, src/lib/fcitx-wayland/core/wl_surface.cpp
Removes version-gated and compile-time-guarded destruction logic from eight core Wayland wrapper destructors, replacing conditional calls with direct unconditional destroy() calls to simplify lifetime management patterns.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐇 Hopping through protocols, versions anew,
The blur and the stacking now properly queue.
With hex flags and signals and wrappers so fine,
A system XML keeps the build in line.
From version sixteen to twenty we leap—
No more crashing Plasma shall interrupt sleep! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: using system PlasmaWaylandProtocols by default instead of bundled version.
Linked Issues check ✅ Passed The PR successfully implements the requirements from #1584: adds system PlasmaWaylandProtocols support with CMake option, updates protocol wrapper implementations to handle version requirements, and resolves outdated bundled XML incompatibility.
Out of Scope Changes check ✅ Passed All changes are scope-aligned: protocol system integration, version-aware global handling, destructor simplifications, and CI dependencies. No unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch protocol

Comment @coderabbitai help to get the list of available commands and usage tips.

@wengxt wengxt force-pushed the protocol branch 2 times, most recently from bb51576 to be7dd9c Compare June 19, 2026 05:51
Extend global framework to allow only subscribe for a minimum version.

Fix #1584

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/fcitx-wayland/core/display.cpp`:
- Around line 23-25: The globalRemove code path emits globalRemovedSignal_
without verifying that the global was actually created (has a non-null pointer).
Add a null pointer check before emitting globalRemovedSignal_ using the same
pattern as the create path to ensure remove signals are only sent for globals
that were successfully created, maintaining create/remove signal symmetry and
preventing crashes in listeners that dereference the removal payload.

In `@src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_window.cpp`:
- Around line 171-179: The destructor function for OrgKdePlasmaWindow only calls
org_kde_plasma_window_destroy when the version is >= 4, leaving no cleanup path
for older versions or when the macro is undefined, causing resource leaks. Add
an unconditional fallback call to org_kde_plasma_window_destroy(data) after the
conditional version check block (outside the if statement) to ensure the cleanup
function is always invoked, following the same pattern used in similar wrapper
classes like OrgKdeKwinBlur.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ba3ea1ac-343a-441e-a235-fcf2c0731f27

📥 Commits

Reviewing files that changed from the base of the PR and between 6ac6ae2 and be7dd9c.

📒 Files selected for processing (19)
  • CMakeLists.txt
  • src/frontend/waylandim/plasmaappmonitor.cpp
  • src/lib/fcitx-wayland/blur/CMakeLists.txt
  • src/lib/fcitx-wayland/blur/blur.xml
  • src/lib/fcitx-wayland/blur/org_kde_kwin_blur.cpp
  • src/lib/fcitx-wayland/core/display.cpp
  • src/lib/fcitx-wayland/core/display.h
  • src/lib/fcitx-wayland/plasma-window-management/CMakeLists.txt
  • src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_activation.cpp
  • src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_activation.h
  • src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_activation_feedback.cpp
  • src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_activation_feedback.h
  • src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_stacking_order.cpp
  • src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_stacking_order.h
  • src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_window.cpp
  • src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_window.h
  • src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_window_management.cpp
  • src/lib/fcitx-wayland/plasma-window-management/org_kde_plasma_window_management.h
  • src/lib/fcitx-wayland/plasma-window-management/plasma-window-management.xml
💤 Files with no reviewable changes (1)
  • src/lib/fcitx-wayland/blur/blur.xml

Comment thread src/lib/fcitx-wayland/core/display.cpp
@wengxt wengxt merged commit bebf9d9 into master Jun 19, 2026
6 checks passed
@wengxt wengxt deleted the protocol branch June 19, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not use a bundled plasma-wayland-protocol XML for window management

1 participant