Skip to content

fix(xdg-shell): handle unknown normal size when restoring - #1388

Open
zzxyb wants to merge 1 commit into
linuxdeepin:masterfrom
zzxyb:restore
Open

fix(xdg-shell): handle unknown normal size when restoring#1388
zzxyb wants to merge 1 commit into
linuxdeepin:masterfrom
zzxyb:restore

Conversation

@zzxyb

@zzxyb zzxyb commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Keep the normal geometry unknown when an XDG toplevel is initially maximized or fullscreen before a normal window size has been observed.

Send a 0x0 configure when restoring such a window so the client can choose its normal size. Avoid recording maximized or fullscreen geometry as the normal geometry during state transitions, and only persist fallback geometry for windows that are actually in the normal state.

Log: fix XDG toplevel restoration with unknown normal size
PMS: BUG-364225、364203
Influence: XDG toplevel maximize and fullscreen restoration

Summary by Sourcery

Fix XDG toplevel restoration so windows without a known normal size retain that state until a client-provided normal geometry is available.

Bug Fixes:

  • Preserve unknown normal geometry for XDG toplevels initially restored maximized or fullscreen, allowing clients to select their normal size when restored.
  • Prevent maximized or fullscreen geometry from being recorded as normal geometry and restrict fallback persistence to windows currently in the normal state.

Keep the normal geometry unknown when an XDG toplevel is initially
maximized or fullscreen before a normal window size has been observed.

Send a 0x0 configure when restoring such a window so the client can choose
its normal size. Avoid recording maximized or fullscreen geometry as the
normal geometry during state transitions, and only persist fallback geometry
for windows that are actually in the normal state.

Log: fix XDG toplevel restoration with unknown normal size
PMS: BUG-364225、364203
Influence: XDG toplevel maximize and fullscreen restoration
@zzxyb
zzxyb requested a review from zccrs September 10, 2026 06:56
@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

@sourcery-ai

sourcery-ai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR keeps normal geometry unset for XDG toplevels initially entering maximized or fullscreen, filters geometry updates during state transitions, and restores such windows with a 0x0 configure so clients choose their normal size instead of reusing maximized/fullscreen geometry.

Sequence diagram for restoring an XDG toplevel with unknown normal size

sequenceDiagram
    participant Compositor
    participant SurfaceWrapper
    participant XdgToplevel
    participant Client

    Compositor->>SurfaceWrapper: setSurfaceStateDirectly(Maximized or Fullscreen)
    SurfaceWrapper->>SurfaceWrapper: setNormalGeometry(QRectF())
    SurfaceWrapper->>SurfaceWrapper: applySurfaceStateWithoutGeometry(state)
    SurfaceWrapper->>XdgToplevel: resize(QSize(0, 0))
    XdgToplevel-->>Client: configure(0, 0)
    Client-->>XdgToplevel: choose normal size
Loading

File-Level Changes

Change Details Files
Preserve an unknown normal geometry for XDG toplevels that enter maximized or fullscreen before obtaining a normal size.
  • Clear stored normal geometry when an unmapped XDG toplevel is directly maximized or fullscreen.
  • Update normal geometry only for eligible normal-state transitions, excluding animations and maximized/fullscreen requested or current states.
  • Send a 0x0 resize before restoring a normal XDG toplevel so the client can select its normal size.
src/surface/surfacewrapper.cpp
src/surface/surfacewrapper.h
Prevent invalid fallback geometry from being persisted during XDG toplevel removal.
  • Use the current geometry as a fallback only when the wrapper is actually in the normal state.
src/core/shellhandler.cpp

Possibly linked issues

  • #unknown: PR修复初始最大化或全屏窗口恢复时正常尺寸未知及状态几何记录问题,直接对应该窗口状态与大小调整异常。

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 reviewed your changes and they look great!


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

if (!checkSetSurfaceState(newSurfaceState))
return;

if (m_type == Type::XdgToplevel && surface() && !surface()->mapped()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

没看出来这个做法有啥用,应该是多余的,对于初始化就是最大化状态的窗口,本身就不会有normal geometry

@deepin-bot

deepin-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.10.0
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1392

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