Skip to content

feat: Add Win32 platform window interface support - #404

Open
kt286 wants to merge 1 commit into
linuxdeepin:masterfrom
kt286:feat/dwin32platform
Open

feat: Add Win32 platform window interface support#404
kt286 wants to merge 1 commit into
linuxdeepin:masterfrom
kt286:feat/dwin32platform

Conversation

@kt286

@kt286 kt286 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
  • Add DWin32PlatformWindowInterface class implementation
  • Support Windows 10/11 window effects (rounded corners, shadows, transparency)
  • Integrate DWM API for immersive dark mode
  • Add Win32 CMake build configuration

feat: 添加 Win32 平台窗口接口支持

  • 新增 DWin32PlatformWindowInterface 类实现
  • 支持 Windows 10/11 的窗口效果(圆角、阴影、透明等)
  • 集成 DWM API 实现沉浸式深色模式
  • 添加 Win32 CMake 构建配置

Summary by Sourcery

Add a Win32 platform window interface and wire it into the platform handle to support native Windows window effects and theming.

New Features:

  • Introduce DWin32PlatformWindowInterface to provide platform-specific window controls and effects on Windows.
  • Enable Win32 builds by adding a Win32 plugins CMake configuration and linking against the DWM API.

Enhancements:

  • Detect Windows light/dark theme from the registry in DGuiApplicationHelper to select the appropriate palette.

Build:

  • Include Win32 platform plugin sources in the main library build when targeting Windows and link against dwmapi.

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

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

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kt286

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
Copy Markdown
Contributor

Hi @kt286. 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 commented Jul 30, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR adds a Win32-specific platform window interface and build integration, enabling Windows 10/11 visual effects (rounded corners, blur/transparency, frameless windows) and immersive dark mode, and wires it into the existing platform abstraction and palette handling.

Sequence diagram for Win32 window show and dark mode application

sequenceDiagram
    participant QWindow
    participant DWin32PlatformWindowInterface as Win32Interface
    participant WindowsRegistry
    participant DwmApi

    QWindow->>Win32Interface: eventFilter(QEvent::Show)
    Win32Interface->>Win32Interface: setEnabledNoTitlebar(m_enabled)
    Win32Interface->>Win32Interface: updateShadow()
    Win32Interface->>Win32Interface: updateRoundedCorners()
    Win32Interface->>Win32Interface: updateSystemTheme()
    Win32Interface->>WindowsRegistry: RegOpenKeyExW(Personalize)
    WindowsRegistry-->>Win32Interface: AppsUseLightTheme value
    Win32Interface->>DwmApi: DwmSetWindowAttribute(DWMWA_USE_IMMERSIVE_DARK_MODE)
    Win32Interface->>Win32Interface: updateTranslucentBackground()
    Win32Interface->>Win32Interface: updateBlurWindow()
Loading

File-Level Changes

Change Details Files
Introduce a Win32 platform window interface implementation that maps DPlatformWindowInterface APIs to Win32/DWM behavior.
  • Add DWin32PlatformWindowInterface class deriving from DPlatformWindowInterface and QObject
  • Implement window styling toggles for frameless mode, system resize/move, and cursor override flags using Win32 window styles
  • Implement radius, border, shadow, clip path, frame mask, translucent background, blur, and startup/effect properties with DWM and GDI regions
  • Add eventFilter-based mouse handling to trigger startSystemMove from a custom titlebar area
  • Add helper functions for HWND retrieval and runtime OS version checks for Windows 10/11 feature availability
  • Implement system theme detection and immersive dark mode via registry and DwmSetWindowAttribute
src/plugins/platform/win32/dwin32platformwindowinterface.h
src/plugins/platform/win32/dwin32platformwindowinterface.cpp
Wire the Win32 window interface into the platform handle factory so Windows builds use the new implementation.
  • Include dwin32platformwindowinterface header conditionally on Q_OS_WIN
  • Instantiate DWin32PlatformWindowInterface in createWindowInterface when running on Windows
src/kernel/dplatformhandle.cpp
Add Win32-specific build configuration and linkage for the new plugin and DWM API.
  • Introduce win32.cmake that glob-collects Win32 plugin headers/sources into win32_SRC
  • Include win32.cmake and add win32_SRC to target_sources when WIN32 is true
  • Link dwmapi library on Windows
src/plugins/plugins.cmake
src/plugins/platform/win32/win32.cmake
Adjust palette/theme detection on Windows to derive dark/light mode from system settings instead of theme names.
  • Add Q_OS_WIN branch in fetchPalette to read AppsUseLightTheme from the Windows registry
  • Set palette type to DarkType or LightType based on registry value and skip theme->fetchPalette path on Windows
src/kernel/dguiapplicationhelper.cpp
Update SPDX copyright metadata to cover the new years and Win32 implementation.
  • Extend dplatformhandle copyright range to 2022–2026
  • Add copyright/license headers to Win32 interface files
src/kernel/dplatformhandle.cpp
src/plugins/platform/win32/dwin32platformwindowinterface.h
src/plugins/platform/win32/dwin32platformwindowinterface.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

@kt286
kt286 force-pushed the feat/dwin32platform branch from 08846df to ae0e3d8 Compare July 30, 2026 06:42
Comment thread src/kernel/dguiapplicationhelper.cpp
Comment thread src/plugins/plugins.cmake

# Win32
if(WIN32)
message("Support Win32!")

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.

这个message好像不太必要?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

这个其实是抄的上面 XCB 那块的,那里就有

Comment thread src/plugins/platform/win32/dwin32platformwindowinterface.cpp Outdated
Comment thread src/plugins/platform/win32/dwin32platformwindowinterface.cpp Outdated
- Add DWin32PlatformWindowInterface class implementation
- Support Windows 10/11 window effects (rounded corners, shadows, transparency)
- Integrate DWM API for immersive dark mode
- Add Win32 CMake build configuration

feat: 添加 Win32 平台窗口接口支持

- 新增 DWin32PlatformWindowInterface 类实现
- 支持 Windows 10/11 的窗口效果(圆角、阴影、透明等)
- 集成 DWM API 实现沉浸式深色模式
- 添加 Win32 CMake 构建配置
@kt286
kt286 force-pushed the feat/dwin32platform branch from ae0e3d8 to 4e20a89 Compare July 30, 2026 10:55
@kt286
kt286 requested a review from BLumia July 30, 2026 11:30
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