Skip to content

Conversation

@calsys456
Copy link
Contributor

@calsys456 calsys456 commented Sep 3, 2025

This commit modifies X11DisplayServerType to start X11 with ddm. It use treeland as greeter to handle user login. Once user logged in, it kills the wayland compositor and start the X11 server.

Summary by Sourcery

Implement X11 session startup via ddm by launching a temporary Wayland greeter for authentication before tearing it down and starting the Xorg server, with new skip-auth support and simplified session launch logic.

New Features:

  • Support X11DisplayServerType: boot a SingleWaylandDisplayServer as greeter, then switch to XorgDisplayServer after login
  • Add skip-auth mode in Auth and Greeter to bypass authentication for X11 sessions

Bug Fixes:

  • Fix ioctl TIOCSCTTY flag to correctly take control of the terminal

Enhancements:

  • Unify UserSession command handling to directly use the configured X11 session command instead of a wrapper helper
  • Expose setUser and setSkipAuth methods in Greeter for dynamic login configuration

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: apr3vau

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

@deepin-ci-robot
Copy link

Hi @apr3vau. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai
Copy link

sourcery-ai bot commented Sep 3, 2025

Reviewer's Guide

This PR implements X11 session startup within ddm by first launching a minimal Wayland-based greeter for authentication, then tearing it down on successful login to start a full Xorg server with updated greeter settings and skip-auth support.

Sequence diagram for X11 session startup using ddm and Wayland greeter

sequenceDiagram
    actor User
    participant ddm as DDM Daemon
    participant Greeter
    participant Wayland as Wayland Compositor
    participant Xorg as Xorg Server

    User->>ddm: Selects X11 session (via ddm.conf)
    ddm->>Wayland: Start minimal Wayland compositor
    ddm->>Greeter: Start greeter in single mode
    User->>Greeter: Login credentials
    Greeter->>ddm: Authentication success
    ddm->>Wayland: Stop Wayland compositor
    ddm->>Greeter: Stop greeter
    ddm->>Xorg: Start Xorg server
    ddm->>Greeter: Start greeter with skip-auth and user context
    User->>Greeter: Session starts (no further auth)
    Greeter->>Xorg: Launch user session
Loading

Class diagram for updated Greeter and Auth classes with skip-auth support

classDiagram
    class Greeter {
        +void setSingleMode(bool on = true)
        +void setUser(QString user)
        +void setSkipAuth(bool on = true)
        +bool m_singleMode
        +QString m_user
        +bool m_skipAuth
    }
    class Auth {
        +void setSkipAuth(bool on = true)
        +bool skipAuth
        +void start()
    }
    Greeter --> Auth : uses
Loading

Class diagram for HelperApp with skip-auth logic

classDiagram
    class HelperApp {
        +bool m_skipAuth
        +void authenticate()
    }
    HelperApp --> Auth : uses
Loading

File-Level Changes

Change Details Files
Introduce a two-stage session flow: initial Wayland greeter then full Xorg server
  • Replaced direct Xorg instantiation with SingleWaylandDisplayServer in X11 mode
  • On login success, stop and delete the Wayland server, socket and greeter
  • Initialize XorgDisplayServer, new SocketServer and Greeter (skip-auth, user, session command) and start it
  • Updated stop conditions to exclude X11DisplayServerType
src/daemon/Display.cpp
Extend Greeter to support user propagation and skipping authentication
  • Added setUser() and setSkipAuth() methods
  • Pass m_user to Auth instead of hardcoded "dde"
  • Apply skipAuth flag before calling Auth::start
  • Conditional cookie setup only for x11 sessions
src/daemon/Greeter.cpp
src/daemon/Greeter.h
Add skipAuth flag in Auth backend
  • Introduce skipAuth property with setter
  • Append --skip-auth argument in Auth::start when flag is set
src/auth/Auth.cpp
src/auth/Auth.h
Honor skip-auth in helper process
  • Parse --skip-auth flag in HelperApp
  • Bypass backend authenticate() when skipAuth is true
src/helper/HelperApp.cpp
src/helper/HelperApp.h
Simplify X11 helper invocation and fix TIOCSCTTY flag
  • Always split m_displayServerCmd for program+args instead of conditional wrapper
  • Change ioctl TIOCSCTTY from parameter 0 to 1
src/helper/UserSession.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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and found some issues that need to be addressed.

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

### Comment 1
<location> `src/helper/UserSession.cpp:125` </location>
<code_context>
                 }

                 qInfo() << "Starting X11 session:" << m_displayServerCmd << command;
-                if (m_displayServerCmd.isEmpty()) {
-                    auto args = QProcess::splitCommand(command);
-                    setProgram(args.takeFirst());
-                    setArguments(args);
-                } else {
</code_context>

<issue_to_address>
Removal of fallback for empty m_displayServerCmd may break session startup.

Ensure m_displayServerCmd is always set, or add handling for empty values to prevent session startup failures.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@calsys456 calsys456 marked this pull request as draft September 5, 2025 01:49
@calsys456 calsys456 marked this pull request as ready for review September 16, 2025 03:50
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Sorry @apr3vau, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@zccrs zccrs requested a review from Copilot September 17, 2025 06:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements support for starting X11 sessions through ddm by using a temporary Wayland greeter for authentication before switching to the actual X11 server. The implementation includes authentication bypass capabilities and simplifies session command handling.

  • Adds X11DisplayServerType support that boots a SingleWaylandDisplayServer as greeter, then switches to XorgDisplayServer after login
  • Introduces skip-auth mode to bypass authentication for X11 sessions
  • Fixes terminal control flag and unifies session command handling

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/helper/UserSession.cpp Simplifies X11 session startup by removing wrapper helper and fixes terminal control flag
src/helper/HelperApp.h Adds skip-auth flag member variable
src/helper/HelperApp.cpp Implements skip-auth command line argument parsing and authentication bypass
src/daemon/Greeter.h Adds user and skip-auth configuration methods and success signal
src/daemon/Greeter.cpp Implements user/skip-auth setters and adds success signal handling
src/daemon/Display.cpp Major refactor to support X11 via temporary Wayland greeter with session switching logic
src/auth/Auth.h Adds session type tracking and skip-auth support
src/auth/Auth.cpp Implements session type and skip-auth functionality
data/scripts/Xsetup Adds xhost command for X11 access control

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@calsys456 calsys456 force-pushed the master branch 2 times, most recently from 793108c to 672874f Compare September 18, 2025 03:20
@deepin-bot
Copy link

deepin-bot bot commented Sep 18, 2025

TAG Bot

New tag: 0.2.1
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #45

This commit enables starting sessions other than treeland with ddm. It
use treeland as greeter to handle user login. Once user logged in, it
kills the wayland compositor and start the desired user session.
@zccrs zccrs merged commit df7c5a2 into linuxdeepin:master Sep 26, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants