Skip to content

fix: create the filter preview buttons inside their scroll area - #542

Open
liuwenhuan wants to merge 1 commit into
linuxdeepin:masterfrom
liuwenhuan:fix-filter-buttons-shown-as-windows
Open

liuwenhuan wants to merge 1 commit into
linuxdeepin:masterfrom
liuwenhuan:fix-filter-buttons-shown-as-windows

Conversation

@liuwenhuan

@liuwenhuan liuwenhuan commented Nov 9, 2026 •

Copy link
Copy Markdown

On X11, takePhotoSettingAreaWidget::initButtons() creates every filter preview button without a parent and calls show() / setVisible(true) before adding it to the scroll layout. Each call maps a short-lived, translucent top-level window while the main window is still being built.

The first of these windows ends the application's startup notification before the main window is mapped. The window manager then has nothing to match the main window against, so it cannot place it on the screen the camera was launched from: with two screens and the dock on the second one, the camera always opened on the primary screen.

This PR creates the buttons with m_scrollAreaWidget as parent and removes show() / setVisible(true). Visibility in the layout is unchanged, because a child that was not explicitly hidden is shown with its parent. The early show() came in with 627a6d8 ("修改窗口最小尺寸,顺便改了滤镜布局") together with the parentless construction; I found nothing that relies on it.

Tested on deepin-camera 6.5.47 with this change backported (Debian 13, KWin 6.3 X11, two screens, dock on the second screen):

  • Launched from the launcher and the dock on the second screen, the window now opens on that screen. Before, it opened on the primary screen, and an xev trace showed the startup notification removed before the main window was mapped.

Not tested: the filter list, because the VM has no camera device. This PR was not built on master; the code at this place is the same as in 6.5.47.


滤镜预览按钮以前没有父控件就调用了 show(),在主窗口构建期间映射出临时的顶层窗口,导致启动通知被提前结束,多屏时相机总是开在主屏。现在直接以滚动区域为父控件创建按钮,并去掉 show()/setVisible(true);按钮在布局中的可见性不变。

Summary by Sourcery

Bug Fixes:

  • Ensure filter preview buttons do not create transient top-level windows during startup, preserving startup notification handling and correct multi-screen window placement.

1. takePhotoSettingAreaWidget::initButtons() created every filter preview
   button without a parent and called show()/setVisible(true) before
   adding it to the scroll layout. On X11 each call mapped a short-lived
   translucent top-level window while the main window was being built.
2. The first of these windows made Qt end the application's startup
   notification before the main window was mapped, so the window manager
   could not place the main window on the screen the camera was launched
   from (multi-screen: it always opened on the primary screen).
3. The buttons are now created with m_scrollAreaWidget as parent and are
   shown with it; show()/setVisible(true) are removed. Visibility in the
   layout does not change: a child that was not explicitly hidden is shown
   with its parent.

Log: The camera window opens on the screen it was launched from.

Influence:
1. Launch the camera from the dock or launcher on a second screen: the
   window opens on that screen.
2. Filter list: open and close it, select filters; previews show as before.

fix: 滤镜预览按钮直接创建在滚动区域内

1. takePhotoSettingAreaWidget::initButtons() 创建滤镜预览按钮时没有父控件,
   并在加入滚动布局之前调用 show()/setVisible(true)。X11 下每次调用都会在主
   窗口构建期间映射一个短暂存在的透明顶层窗口。
2. 第一个这样的窗口让 Qt 在主窗口映射之前就结束了应用的启动通知,窗口管理
   器因此无法把主窗口放到启动它的屏幕上(多屏时总是出现在主屏)。
3. 现在按钮以 m_scrollAreaWidget 为父控件创建,随父控件显示,去掉了
   show()/setVisible(true)。按钮在布局中的可见性不变:未被显式隐藏的子控件会
   随父控件一起显示。

Log: 相机窗口出现在启动它的屏幕上。

Influence:
1. 在第二块屏幕上从任务栏或启动器启动相机:窗口出现在该屏幕。
2. 滤镜列表:展开、收起、选择滤镜,预览与之前一致。
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: liuwenhuan

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 Nov 9, 2026

Copy link
Copy Markdown

Reviewer's Guide

UI

Create filter preview buttons as children of the scroll area and remove the early visibility calls to avoid mapping temporary top-level windows during startup.

  • src/src/takephotosettingareawidget.cpp L185, L188 (removed lines)

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T15:20:46.353768Z 2976ca6 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@deepin-ci-robot

Copy link
Copy Markdown

Hi @liuwenhuan. Thanks for your PR. 😃

@deepin-ci-robot

Copy link
Copy Markdown

Hi @liuwenhuan. 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 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 ✨

@deepin-bot

deepin-bot Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.5.50
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #543

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.

2 participants