Skip to content

add XKB settings to input manager - #1435

Merged
zzxyb merged 2 commits into
linuxdeepin:masterfrom
zzxyb:dconfig
Sep 22, 2026
Merged

zzxyb merged 2 commits into
linuxdeepin:masterfrom
zzxyb:dconfig

Conversation

@zzxyb

@zzxyb zzxyb commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

Add XKB keyboard rules support to the input manager and apply client-requested changes to the active seat.

New Features:

  • Support configuring and applying XKB layout, model, variant, and options through the input manager keyboard settings interface.
  • Expose XKB keyboard configuration options in the test input manager client.

Enhancements:

  • Synchronize XKB settings between seat configuration and keyboard settings clients, and apply changes immediately to the seat.

Chores:

  • Increase the input manager protocol interface version to include XKB settings support.

@sourcery-ai

sourcery-ai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds versioned XKB rule support to keyboard settings, including normalized protocol transport, initialization and live application with seat-config persistence, plus command-line coverage in the test client.

Sequence diagram for versioned XKB settings application

sequenceDiagram
    participant Client
    participant KeyboardSettingsInterfaceV1
    participant InputManager
    participant SeatConfig
    participant Seat

    InputManager->>KeyboardSettingsInterfaceV1: sendXkbRules(layout, model, variant, options, true)
    KeyboardSettingsInterfaceV1-->>Client: xkb_rules

    Client->>KeyboardSettingsInterfaceV1: set_xkb_rules(layout, model, variant, options)
    KeyboardSettingsInterfaceV1->>KeyboardSettingsInterfaceV1: apply()
    KeyboardSettingsInterfaceV1->>InputManager: onKeyboardSettingsApplied(XkbRulesChanged)
    InputManager->>SeatConfig: setXkbLayout(layout)
    InputManager->>SeatConfig: setXkbModel(model)
    InputManager->>SeatConfig: setXkbVariant(variant)
    InputManager->>SeatConfig: setXkbOptions(options)
    InputManager->>Seat: applyXkbConfig(seat, layout, model, variant, options)
Loading

File-Level Changes

Change Details Files
Extend the input-manager Wayland protocol and server-side state to carry XKB rules through keyboard settings.
  • Bump the input-manager interface version and add XKB rule change tracking.
  • Store, normalize, expose, and conditionally send layout, model, variant, and options values.
  • Handle client requests by applying the rules and persisting them in seat configuration.
src/modules/input-manager/inputmanagerinterfacev1.cpp
src/modules/input-manager/inputmanagerinterfacev1.h
src/input/inputmanager.cpp
src/input/inputmanager.h
misc/dconfig/org.deepin.dde.treeland.user.seat.json
Apply XKB configuration both during keyboard-settings initialization and when clients change it.
  • Send the seat's initial XKB rules alongside repeat and Num Lock settings.
  • Refactor XKB application to accept explicit rule values and apply client-provided changes to the seat.
  • Remove the previous direct configuration-change signal handlers from seat setup.
src/input/inputmanager.cpp
src/input/inputmanager.h
Update the test input-manager client to configure and observe XKB settings from the command line.
  • Add command-line options for layout, model, variant, and options.
  • Add client methods for sending XKB rules and logging the corresponding protocol event.
  • Use interface version 2 for the test client.
examples/test_input_manager/inputmanagerclient.cpp
examples/test_input_manager/inputmanagerclient.h
examples/test_input_manager/main.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Expose version 2 of treeland_input_manager_v1 and support configuring
XKB layout, model, variant, and options as a single rules snapshot.

Report the stored XKB rules when keyboard settings are created, persist
applied protocol changes to seat DConfig, and apply them directly to the
target seat. Normalize nullable protocol strings to empty values.

Log: add XKB settings to input manager
PMS: BUG-377251
Influence: Compatible change
Bind treeland_input_manager_v1 at version 2 and handle the xkb_rules
state event in the input manager example client.

Add command-line options for XKB layout, model, variant, and options.
Send them as a single rules snapshot through set_xkb_rules and apply
the configuration to exercise the version 2 protocol path.

Log: add XKB rules test to input manager example
PMS: BUG-377251
Influence: Compatible change

@sourcery-ai sourcery-ai 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.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/input/inputmanager.cpp" line_range="105-113" />
<code_context>

     applyXkbConfigForSeat(seat);

-    connect(config, &SeatUserDConfig::xkbLayoutChanged, this,
-            [this, seat] { applyXkbConfigForSeat(seat); });
-    connect(config, &SeatUserDConfig::xkbModelChanged, this,
-            [this, seat] { applyXkbConfigForSeat(seat); });
-    connect(config, &SeatUserDConfig::xkbVariantChanged, this,
-            [this, seat] { applyXkbConfigForSeat(seat); });
-    connect(config, &SeatUserDConfig::xkbOptionsChanged, this,
-            [this, seat] { applyXkbConfigForSeat(seat); });
-
     const auto devices = seat->deviceList();
     for (WInputDevice *device : devices)
</code_context>
<issue_to_address>
**issue (broader_impact):** XKB configuration changes made through seat DConfig no longer trigger `applyXkbConfigForSeat`; the removed signal connections were the only live-update path after initial seat setup, so external configuration changes are persisted but not applied to the target seat until a later seat reinitialization.

**Triggers:** When a seat's XKB layout, model, variant, or options are changed through DConfig rather than through the new Wayland protocol.

**Suggested fix:** Retain the four DConfig change-signal connections, or replace them with an equivalent connection that reapplies the complete XKB rules snapshot when any XKB setting changes.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread src/input/inputmanager.cpp
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zccrs, zzxyb

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@zzxyb
zzxyb merged commit c0d4bc2 into linuxdeepin:master Sep 22, 2026
7 of 9 checks passed
@zzxyb

zzxyb commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

相关协议变动pr:linuxdeepin/treeland-protocols#116

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.

3 participants