Skip to content

fix(surface): set maximized/fullscreen geometry on initial surface co…#984

Draft
zzxyb wants to merge 1 commit into
linuxdeepin:masterfrom
zzxyb:fix-maximized
Draft

fix(surface): set maximized/fullscreen geometry on initial surface co…#984
zzxyb wants to merge 1 commit into
linuxdeepin:masterfrom
zzxyb:fix-maximized

Conversation

@zzxyb

@zzxyb zzxyb commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

…mmit

Move initial commit handling from WXdgToplevelSurfaceItem to SurfaceWrapper to properly configure window geometry when the client requests maximized or fullscreen state at first commit.

Log: set maximized/fullscreen geometry on initial surface commit PMS: BUG-366199
Influence:

Summary by Sourcery

Bug Fixes:

  • Ensure windows created in maximized or fullscreen state use the output geometry instead of a zero-size configure on initial surface commit.

@zzxyb zzxyb requested a review from zccrs June 15, 2026 03:20
@sourcery-ai

sourcery-ai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Reviewer's Guide

Move initial xdg_toplevel commit handling from WXdgToplevelSurfaceItem into SurfaceWrapper so that maximized/fullscreen geometry is correctly applied on the first commit, wiring a one-shot surface commit handler and configuring size/state based on requested maximized/fullscreen flags.

Sequence diagram for initial xdg_toplevel surface commit handling

sequenceDiagram
    actor Client
    participant WSurface
    participant SurfaceWrapper
    participant WXdgToplevelSurface
    participant WXdgToplevelHandle
    participant Output

    Client->>WSurface: commit
    WSurface-->>SurfaceWrapper: commit(quint32) (Qt::SingleShotConnection)
    SurfaceWrapper->>SurfaceWrapper: onInitialSurfaceCommit(serial)
    alt m_type == Type::XdgToplevel
        SurfaceWrapper->>WXdgToplevelSurface: handle()
        WXdgToplevelSurface-->>WXdgToplevelHandle: handle()
        WXdgToplevelHandle-->>WXdgToplevelHandle: base->initial_commit
        alt base->initial_commit
            WXdgToplevelHandle-->>WXdgToplevelHandle: requested.maximized
            alt requested.maximized
                SurfaceWrapper->>Output: validRect()
                Output-->>SurfaceWrapper: size
                SurfaceWrapper->>WXdgToplevelHandle: set_maximized(true)
            end
            WXdgToplevelHandle-->>WXdgToplevelHandle: requested.fullscreen
            alt requested.fullscreen
                SurfaceWrapper->>Output: rect()
                Output-->>SurfaceWrapper: size
                SurfaceWrapper->>WXdgToplevelHandle: set_fullscreen(true)
            end
            SurfaceWrapper->>WXdgToplevelSurface: resize(QSize)
        end
    end
Loading

File-Level Changes

Change Details Files
Handle initial xdg_toplevel surface commit in SurfaceWrapper and configure maximized/fullscreen geometry and state there.
  • Import WXdgToplevelSurface and qwxdgshell headers needed to access low-level xdg toplevel handles and requested states.
  • In SurfaceWrapper::setup, connect the WSurface::commit signal (single-shot) to a new onInitialSurfaceCommit slot for non-proxy surfaces before other toplevel signal hookups.
  • Implement SurfaceWrapper::onInitialSurfaceCommit to check for xdg initial_commit, inspect requested.maximized/fullscreen, compute the target size from the owning output, set the toplevel maximized/fullscreen state, and apply a resize to that size.
  • Declare onInitialSurfaceCommit as a private slot in SurfaceWrapper to receive the commit serial.
src/surface/surfacewrapper.cpp
src/surface/surfacewrapper.h
Remove initial-commit configure logic from WXdgToplevelSurfaceItem now that it is handled centrally in SurfaceWrapper.
  • Delete the code in WXdgToplevelSurfaceItem::onSurfaceCommit that checked xdg_surface->initial_commit and forced a 0x0 configure size on first commit.
waylib/src/server/qtquick/wxdgtoplevelsurfaceitem.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

@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 left some high level feedback:

  • In onInitialSurfaceCommit, consider adding defensive checks (e.g., for a null toplevel from qobject_cast and for toplevel->handle() / handle->base) before dereferencing to avoid hard-to-trace crashes if assumptions about m_shellSurface ever change.
  • When neither requested.maximized nor requested.fullscreen is set, toplevel->resize(size) is still called with a default-constructed QSize; if that’s not intentional, you may want to guard the resize with if (size.isValid()).
  • If both requested.maximized and requested.fullscreen are true, the second branch will overwrite the size from the first; it might be clearer to explicitly choose one state (or assert they are mutually exclusive) so the behavior is well-defined.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `onInitialSurfaceCommit`, consider adding defensive checks (e.g., for a null `toplevel` from `qobject_cast` and for `toplevel->handle()` / `handle->base`) before dereferencing to avoid hard-to-trace crashes if assumptions about `m_shellSurface` ever change.
- When neither `requested.maximized` nor `requested.fullscreen` is set, `toplevel->resize(size)` is still called with a default-constructed `QSize`; if that’s not intentional, you may want to guard the resize with `if (size.isValid())`.
- If both `requested.maximized` and `requested.fullscreen` are true, the second branch will overwrite the `size` from the first; it might be clearer to explicitly choose one state (or assert they are mutually exclusive) so the behavior is well-defined.

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.

Comment thread src/surface/surfacewrapper.cpp Outdated
@deepin-bot

deepin-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.8.10
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #983

@zzxyb zzxyb force-pushed the fix-maximized branch 2 times, most recently from b53dfe6 to 2e6572e Compare June 15, 2026 06:51
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@zzxyb zzxyb requested a review from zccrs June 15, 2026 06:56
Comment thread waylib/src/server/qtquick/wxdgtoplevelsurfaceitem.cpp Outdated
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 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 force-pushed the fix-maximized branch 2 times, most recently from c9e59d1 to 11e5c14 Compare June 15, 2026 09:32
@zzxyb zzxyb requested a review from zccrs June 15, 2026 09:57
@zzxyb zzxyb marked this pull request as draft June 15, 2026 10:17
…mmit

Move initial commit handling from WXdgToplevelSurfaceItem to
SurfaceWrapper to properly configure window geometry when the
client requests maximized or fullscreen state at first commit.

Log: set maximized/fullscreen geometry on initial surface commit
PMS: BUG-366199
Influence:
@deepin-bot

deepin-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.8.11
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #999

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