Skip to content

DO NOT MERGE: some bug fixes pending to verify and merge - #249

Draft
wangwenx190 wants to merge 56 commits into
mainfrom
wwx190/bugfixes
Draft

wangwenx190 wants to merge 56 commits into
mainfrom
wwx190/bugfixes

Conversation

@wangwenx190

Copy link
Copy Markdown
Collaborator

No description provided.

The macOS theme notification dispatcher iterated the live set of raw
StyleAgentPrivate pointers. Synchronous signal handlers could delete the
current agent before its accent-color notification, or create/delete other
agents and invalidate the ongoing iteration.

Build a separate snapshot of private pointers and QPointer guards before
emitting any signals. Before each theme or accent-color notification,
check both the owner's lifetime and the agent's current registration.
This skips destroyed agents, keeps newly created agents out of the current
snapshot, and prevents a replacement allocated at the same address from
being mistaken for the original agent. The registration check also covers
private-object teardown before QObject clears its guarded pointers.

Add explicit utility and Qt container/guard includes. Keep the public API
and other platform implementations unchanged.

Validation: statically reviewed self-deletion, deletion of another agent,
creation during callbacks, address reuse, teardown ordering, and access
safety during reentrant notification dispatch. git diff --check passed.
macOS compilation and runtime validation were not performed because the
available environment is Windows.
The Widgets and Quick system button area callbacks captured raw QWidget
and QQuickItem pointers. Deleting a registered area while keeping its
window and agent alive left the Cocoa callback pointing at freed memory.
Subsequent resize or fullscreen-related layout updates could dereference
that pointer. The agents' area getters also retained dangling pointers.

Store the registered areas as QPointer and capture guarded pointers in
both geometry callbacks, returning an empty rectangle when the object no
longer exists. Remove the unused raw area pointers from the helpers.
Connect each area's destroyed signal to its registration helper to clear
the context callback and propagate the removal to the Cocoa proxy.

Retire the previous helper before installing another area or switching to
a custom callback. Keep null-area cleanup active when a helper still
exists, even if QPointer has already cleared during destruction. This
ensures an earlier destroyed-signal handler can replace the registration
without the old cleanup connection erasing the new callback. Helper
connections also disconnect before the owning agent's context is torn
down. Public API signatures and coordinate calculations remain unchanged.

Validation: statically reviewed area deletion, replacement, explicit
clearing, custom callback transitions, replacement from destroyed-signal
handlers, guarded callback copies, and agent-before-area destruction.
Verified callback removal propagates through the Cocoa context and that
registration helpers are destroyed before the context. git diff --check
passed. macOS compilation and runtime checks were not performed because
the available environment is Windows.
The Quick border was owned only by the window's content item while its
raw context pointer belonged to the agent. Deleting the agent first left
the border, its event filters and its render callback alive with a freed
context. The painted-item rendering path also queried context and host
state during scene graph rendering.

Keep a QPointer to the decoration in QuickWindowAgentPrivate and delete
it before the base class releases the context. If the window destroys the
item first, the guard prevents a second deletion. Disconnect window render
callbacks before tearing down the border and let Qt release its scene
graph nodes on the correct thread.

Implement emulated borders as QQuickItem content backed by a rectangle
node from QQuickWindow::createRectangleNode(). Use a filled rectangle at
y=0 with height 1/effectiveDevicePixelRatio, public geometry updates instead
of private anchors, and explicit input exclusion. Refresh state on size,
DPR, screen, window-state, native-handle, activation and theme changes.
Prepare border color and native handle on the GUI thread so neither
updatePaintNode nor afterSynchronizing dereferences the context.

Extract the existing Windows border color selection into a private hook
shared with the legacy painter path. Extract native GDI drawing into a
handle-only helper with DC and client-rectangle failure checks. Preserve
the original native backend selection and afterSynchronizing timing, but
trigger native drawing independently of painted-item dirtiness. Retain a
native-only transparent painted surface with the original 0.5 height,
-0.49 offset and opacity settings pending Windows 10 DWM validation; the
emulated path no longer uses a painted surface or texture.

Add Windows-only Qt Test/CTest regressions that force the production
border through a controlled context on any Windows version. Cover both
object destruction orders, post-deletion repaint, one-physical-pixel
output at DPR 1/1.25/1.5/2, resizing, color refresh, maximize/restore,
scene detachment/reattachment, input exclusion, and D3D11 WARP threaded
rendering lifetime safety. Tests run offline, serialize desktop access,
have timeouts, and preserve local text reports for CTest failure output.

Validation: Release Core/Quick/Widgets builds passed with system borders
both enabled and disabled using MSVC and Qt 6.12.0 on Windows 11. All five
quickborder CTest jobs passed. Temporarily omitting agent-side cleanup
made the lifetime regression fail as expected; cleanup was restored and
the full targeted suite passed. Static review covered ownership order,
filter disconnection, scene graph cleanup, GUI/render synchronization,
backend and feature guards, and retained native workaround behavior.
git diff --check passed.

The controlled-context tests do not certify actual Windows 10 DWM
appearance, physical multi-monitor DPI transitions, or all supported Qt
versions and graphics backends. These remain unverified; native seam
compatibility code is intentionally retained. No audit document or
submodule changes are included.
…trols

Resolve AUDIT-004 in FramelessWindow.qml. Previously the root window called
setup() from its Component.onCompleted handler, while the title bar and
system buttons registered themselves from separate child completion handlers.
Qt does not guarantee the order of these handlers. A child handler could
therefore dereference QuickWindowAgent's null context before setup created it.

Keep initialization in one root completion handler: require setup to succeed,
register the title bar, register the four non-macOS system buttons, apply the
dark-mode attribute, and finally honor showWhenReady. Log an error and return
immediately when setup fails. Remove the child registration handlers and
explain why the calls must stay together. Preserve the macOS button exclusion
and the delayed visibility used by secondary windows.

Validation:
- Strict static review of setup/context creation, all completion handlers,
  item availability, registration order, platform conditions and visibility.
- Windows Release QWKExample_QML build passed with Qt 6.12.0 and MSVC 19.51.
- A temporary local harness loaded the actual FramelessWindow.qml resources
  for default-visible and showWhenReady=false windows. An instrumented agent
  forwarded successful calls to the production implementation and verified
  the complete call order and the identity of each registered control.
- Injected setup failure in the same harness: both windows only called setup,
  performed no registrations or attribute writes, and remained hidden.
- git diff --check passed.

Validation limits: loading the full main.qml encountered the pre-existing
"FrameAnimation is not a type" error, so runtime checks loaded FramelessWindow
itself instead. This commit does not claim successful full-demo startup or
runtime coverage on Linux/macOS. Temporary harness files remain in the ignored
build directory. The audit document and submodule changes are excluded.
QWKQuick previously registered WindowAgent only through qmlRegisterType().
No qmldir or qmltypes file described the module to editors and static tools,
so valid QWindowKit imports, methods and enum values could be marked unknown.

For Qt 6.3 and newer, define QWindowKit 1.0 with qt6_add_qml_module and mark
QuickWindowAgent as the WindowAgent QML element. Extract Core metatypes and
expose WindowAgentBase through an anonymous foreign declaration so generated
type information includes inherited methods and the SystemButton enum without
adding a Qt Qml dependency to Core. Keep the existing public registerTypes()
entry point and its once-only behavior, invoking Qt's generated registration
function explicitly so static linkers retain the registration object too.
Older Qt releases keep their procedural registration path.

Generate qmldir and QWKQuick.qmltypes under the build tree's qml/QWindowKit
and install them to <prefix>/qml/QWindowKit using qm_install_qml_modules.
Support both the old Qml and new QtQml qmsetup module names without changing
the submodule. Export/install Qt-generated auxiliary resource targets needed
by static consumers. Fix the installed static package's missing Qt private
component dependencies, uncovered by the new installed Quick consumer test.
No separate runtime QML plugin is introduced.

Expose QWindowKit_QML_IMPORT_PATH for build-tree and installed CMake users;
resolve installed paths relative to the package prefix for relocation.
Populate qmake's QML_IMPORT_PATH when installed metadata exists. Document
Qt Creator, other editor import paths, qt_add_qml_module IMPORT_PATH and
qmllint usage in both READMEs, including the Qt version and runtime setup
requirements.

Add a Windows CTest regression that stages a real installation, checks the
metadata files, runs qmllint against only that custom import root, and builds
and executes a separate qt_add_qml_module consumer of the installed package.
It checks the inherited API, actual title-bar/button registration, enum values,
repeated registerTypes calls, two engines and stable type IDs. A negative
control without qmltypes must diagnose the missing WindowAgent. Parse qmllint's
JSON success field as well as its exit status because newer Qt versions can
return zero even when warnings are present.

Validation on Windows, Qt 6.12.0, MSVC 19.51:
- Shared Release and Debug builds passed.
- All 8 registered Release CTests passed, including installed CMake/QML
  consumers and the existing software/D3D11 border regressions.
- Installed QML consumer test passed separately for shared Debug and static
  Release, including lint, generated QML code, runtime and negative control.
- Final scoped static review and git diff --check passed.

Qt 5, Qt 6.0-6.2 and non-Windows runtime behavior were not executed; their
existing registration path is retained. Editor UI highlighting itself was
not exercised; tooling recognition was verified with qmllint. Submodule
changes and STATIC_AUDIT.md are intentionally excluded from this commit.
Linux builds with Qt 6.0-6.4 compiled and instantiated LinuxWaylandContext
although QNativeInterface::QWaylandApplication was only introduced in
Qt 6.5. Runtime platform selection could not prevent this compile error,
including for applications intended to run on X11 (AUDIT-005).

Define a shared availability guard in the private Wayland context header.
Require Linux and Qt 6.5 or later; on Qt 6.7 and later also require the
wayland feature, matching Qt's native interface declaration. Do not query
that feature on Qt versions that predate it. Apply the same guard to the
class, implementation, native includes and factory construction branch.
Unsupported Wayland configurations reach the existing QtWindowContext
fallback while the X11 and forced-Qt factory paths remain intact.

Validation:
- Reviewed Qt's official native interface documentation and 6.4, 6.5,
  6.6, 6.7 and 6.8 headers; reviewed declarations, implementation, factory,
  automatic MOC input and CMake's unconditional Linux source list.
- Built all configured targets on Windows with MSVC and Qt 6.12.0 Release.
- Checked 20 preprocessor configurations across Qt 5.12, 6.0, 6.2, 6.4,
  6.5, 6.6, 6.7 and 6.12, including feature and forced-Qt variations.
  Production directives with dependency includes stripped passed all
  branch checks; the same check found 10 mismatches on the original HEAD.
  This is a local preprocessor check, not a Linux compilation or unit test.
- All eight registered CTest cases passed. The CMake consumer and installed
  QML tests initially hit MSBuild FileTracker E_ACCESSDENIED in the sandbox;
  rerunning those two tests and their install fixture outside it passed.
- git diff --check passed.

Linux Qt SDKs and WSL are unavailable here, so real Linux compilation,
linking, MOC generation, X11 and Wayland runtime behavior remain untested.
No unit test was added: this is a platform/header availability defect
requiring actual Linux Qt build coverage, and the audit's current test
scope defers Linux test infrastructure. Existing qmake/MSBuild consumer
tests were not registered because their tools were not found in this
shell. The local audit report is maintained separately and is not part
of this commit; existing submodule changes are excluded.
Remove the Linux prefix from the private X11Context and WaylandContext
classes, their source/header filenames and include guards. Update factory
references and the CMake source list to match.

Split the shared qwindowkit_linux helpers into qwindowkit_x11 and
qwindowkit_wayland header/source pairs. Rename their private API structs
to X11API and WaylandAPI and update includes at each call site. Refresh
the tracked TODO references and the separately maintained local audit.

This is a naming and file-organization change only. Preserve platform and
Qt-version guards, context selection order, native library loading,
function bodies, coordinates and fallback behavior. No additional platform
support or audit fixes are included.

Validation:
- Compared every context file and the factory against HEAD with only the
  intended name/include substitutions; all matched exactly.
- Verified both API structs and all four moved helper functions against
  HEAD after the API type rename; their bodies are unchanged.
- Checked the source list, header ownership and remaining old references.
- Built all configured targets on Windows/MSVC with Qt 6.12.0 Release.
  MSBuild FileTracker initially hit sandbox E_ACCESSDENIED; the build
  succeeded outside the sandbox.
- All eight registered CTest cases passed outside the sandbox.
- git diff --check passed. No new tests for this behavior-preserving rename.

Actual Linux compilation and X11/Wayland execution remain untested because
this host has no Linux Qt SDK or WSL. Existing qmsetup changes and the local
STATIC_AUDIT.md are excluded from this commit.
When system borders are disabled, a normal window with only its width or
height fixed returns HTCLIENT for every non-edge point in the single-axis
WM_NCHITTEST branch. That early return bypasses the later title-bar check,
preventing native caption dragging for both Widgets and Quick (AUDIT-006).

Return HTCAPTION for a draggable title-bar point in that branch and keep
HTCLIENT for other interior points. Preserve all edge/corner handling,
excluded controls, system-button precedence, fullscreen/maximized paths,
fully fixed windows and system-border behavior.

Add a Windows native-message integration test using real WidgetWindowAgent
and QuickWindowAgent fixtures in separate processes. Validate native Windows
QPA, the production Win32 context, HWND ownership, size constraints and the
actual system-border mode. Query WM_NCHITTEST with cross-process timeouts:
- Title bar, excluded control and content for fixed width, fixed height,
  both fixed and unconstrained windows.
- All four edges and corners for each single-axis constraint.

CTest serializes desktop access. The driver closes or kills fixture children;
fixtures have a shutdown deadline. Text/XML reports are regenerated on each
run and the wrapper verifies the expected pass count without skipped rows.
No external assets, network services or commercial test tools are needed.
The new regression runs in existing Windows test builds; add a separate
no-system-borders build/test step to the Windows MSVC CI job.

Validation on Windows 11, MSVC, Qt 6.12.0 Release:
- Before the production fix, exactly four title-bar rows failed: Widgets
  and Quick with fixed width or fixed height returned HTCLIENT instead
  of HTCAPTION. The other rows passed (10 passes, 4 failures including
  Qt Test initialization/cleanup).
- After the fix, all 12 data rows plus initialization/cleanup passed in
  both system-border ON and OFF builds, with zero skips.
- Built the default configuration and the no-system-borders test target.
  All nine registered default CTest cases passed, including existing
  installation, QML tooling and Quick border regressions.
- Rechecked both native-message runs after finalizing report cleanup.
- Reviewed result recording, size constraints, platform/version branches
  and unchanged edge/system-button/state handling; git diff --check passed.

Coverage limits: these are native message integration tests, not unit tests
or SendInput end-to-end tests. Actual mouse dragging/resizing, hosted runner
execution, CI Debug/Qt 6.8.1, Qt 5, other Windows versions, physical multi-DPI
setups and firewall-enforced offline execution were not tested. Local qmake
and MSBuild consumer tests were not registered in this shell. Local builds
and installation-consumer checks ran outside the sandbox because of the
previously confirmed MSBuild FileTracker access restriction.

Remove the resolved item from the locally maintained audit and record the
new regression's scope there without staging that document. Preserve and
exclude existing qmsetup submodule changes; do not push this commit.
QuickItemDelegate previously mapped only the item's origin to scene space
and kept its untransformed size. Scaling therefore lost visible hit areas
or retained invisible ones, and rotation disagreed with title-bar, system
button and hit-test-visible control geometry (AUDIT-007).

Add a private containsScenePoint delegate query and use it for all three
shared hit-test paths. Its default implementation preserves the existing
rectangle-based behavior for Widgets and other delegates. Quick inverts
the complete item-to-scene transform, including ancestor transforms, then
checks the point against the local item dimensions with exclusive right
and bottom edges. Reject non-invertible transforms instead of accepting
QTransform's identity fallback for collapsed items. Keep rectangular item
semantics without invoking custom containment masks or adding callbacks.

Map the full Quick item rectangle for geometry queries and use outward
integer alignment so fractional transformed geometry is not truncated.
Retain this bounding rectangle for the existing title/window intersection
check and Windows system-menu geometry; do not use the rotated bounding
box as the precise hit area. Visibility, enabled-state and exclusion order
remain unchanged. No public window-agent API changes are introduced.

Add 12 delegate unit cases for mapped bounds, item/ancestor scale and
rotation, mirroring, empty rotated bounding-box corners, fractional edges,
singular transforms and live transform changes. These use QQuickItems
without windows under offscreen QPA and are reported as unit tests.

Extend the Windows cross-process native-message regression with a bundled
QML fixture and 30 transform scenarios: title bar, excluded control and
system button, transformed directly or through an ancestor, with scale-up,
scale-down, rotation, nonuniform transform-list scaling and zero scale.
Use independently calculated interior/exterior points, including empty
corners inside rotated bounding boxes. Keep these reported as QML/native
message integration, not mouse-input or rendering tests. The existing
Windows CI builds automatically include the new coverage; the no-system-
borders CI target includes all native transform rows.

Validation on Windows 11, MSVC, Qt 6.12.0 Release:
- A pre-fix run failed all 30 new transform rows while the existing rows
  passed. Rotation samples were moved strictly inside the shape during
  test review to avoid exact-edge floating-point rounding ambiguity.
- Final default build and all 10 registered CTest cases passed.
- Final system-border OFF build passed quickgeometry.unit (14 passes
  including initialization/cleanup) and windows.hittest (44 passes,
  including 42 data rows and initialization/cleanup). The same counts
  passed with system borders ON, with no skips in either configuration.
- Existing Widgets, single-axis sizing, installation, QML tooling and
  Quick border regressions passed in the default configuration.
- Reviewed all mapping/hit-test callers, item lifetime assumptions, singular
  and fractional behavior, and Qt 5.12/6.8 itemTransform implementations;
  git diff --check passed.

Not covered: actual mouse input, visual pixel alignment, physical multi-DPI
setups, custom 3D projective scenes, non-Windows platforms, Qt 5 runtime or
hosted GitHub Actions execution. Local qmake/MSBuild consumer tests were
not registered in this shell. Build/consumer verification used the already
established sandbox exception for MSBuild FileTracker.

Update the local audit separately and remove the resolved entry, leaving
AUDIT-008 and AUDIT-009. Do not stage that report or the existing qmsetup
submodule changes, and do not push.
The title-bar mouse path and public showSystemMenu API supply global Qt
coordinates, but the Wayland hook forwarded them unchanged to the
xdg_toplevel.show_window_menu request. That request uses surface-local
coordinates, so a window offset or Qt coordinate scaling could displace
the menu anchor.

Map the global point through QWindow::mapFromGlobal, then convert the
floating-point local result with QHighDpi::toNativeLocalPosition before
rounding for the protocol. This accounts for Qt coordinate scaling without
multiplying by the Wayland buffer scale. QtWindowContext installs
FramelessWindowHint, which disables Qt client-side decorations, so the
content and surface origins coincide. Guard absent window handles/IDs
before mapping or looking up the native toplevel.

Document the public coordinate contract and replace the obsolete TODO
with explicit compositor runtime validation steps. Other backends and the
existing input serial, seat and flush behavior are unchanged.

Validation:
- Reviewed the xdg-shell coordinate contract, Qt window mapping, Wayland
  decoration behavior, existing context lifecycle and Qt feature guards.
- Windows Qt 6.12 / MSVC Release build passed.
- All 10 existing CTest tests passed, including install consumers, QML
  metadata, hit testing, geometry and software/D3D11 border checks.
- git diff --check passed.

Limitations: no Linux/Wayland toolchain or compositor is available here.
The Windows build excludes this backend, and these tests do not validate
its compilation or runtime placement. No mocked Wayland test was added:
reliable coverage needs a real backend/compositor with input serials and
scale variations; Linux UI test infrastructure is outside the current
Windows-only test scope. Remaining manual scenarios are in docs/TODO.md.
Installed static-library property sheets wrote QWK_CORE_STATIC,
QWK_WIDGETS_STATIC and QWK_QUICK_STATIC into PropertyGroup instead of
ClCompile item definitions. MSBuild did not pass those properties to cl,
so consumers still treated static exports as dllimport and could fail to
link methods or staticMetaObject references.

Generate the static definitions as a semicolon-delimited prefix in
ItemDefinitionGroup/ClCompile/PreprocessorDefinitions and retain inherited
metadata. Explicitly leave the prefix empty for shared builds and remove
the ineffective property group.

Extend the installed MSBuild consumer to cover Core, Widgets and Quick.
Check static/shared macro selection and a compiler definition established
before the property-sheet import. Read each module's static metaobject and
call exported agent methods so optimized builds retain real linker
references. The test supplies the static Windows backend's existing
uxtheme dependency separately from the property sheet under test.
Normalize the new CMake booleans before passing them to MSBuild. Add a
Windows MSVC CI configuration that builds a static install, requires the
MSBuild regression to register, and runs it with the install fixture.

Validation on Windows x64, MSVC 19.51, Qt 6.12:
- The new static Release consumer failed before the production fix with
  the explicit missing QWK_CORE_STATIC compiler error.
- The same installed static consumer passed after the fix in Release and
  Debug, compiling and linking all three QWindowKit modules.
- Inspected compiler command logs for the three static macros, enabled
  modules and inherited definition; shared builds contain no static macros.
- Shared Release build and all 11 registered CTests passed, including the
  expanded MSBuild consumer and existing CMake, QML and native UI checks.
- Property-sheet/project XML parsing and git diff --check passed.

This is an installation/compile/link regression, not a UI or unit test.
GitHub Actions execution and other Qt/compiler/architecture combinations
were not run. The local audit report is maintained outside this commit;
pre-existing qmsetup submodule changes are untouched.
Introduce shared CMake helpers for registering fast Qt Test executables and
an aggregate qwk_fast_unit_tests target that builds only those executables
and their library dependencies. Load the helpers before the other test
directories and migrate the existing Quick geometry suite to this runner.

Run GUI-dependent cases with offscreen QPA and the software Quick backend.
Set local Qt/QWindowKit DLL search paths on Windows, regenerate text and XML
reports, enforce an eight-second process deadline and a ten-second CTest
timeout, and fail on unexpected pass counts, skips or expected failures.
Label these tests unit and fast so developers can exclude installation,
consumer compilation and native desktop tests from short feedback cycles.

The runner uses the existing CMake/CTest tools and Qt only. It performs no
downloads, package installation or network access and needs no visible
desktop or external testing framework. Preserve the geometry suite's
existing Windows/Quick registration conditions and all 12 business cases.

Validation on the completed series, Windows/MSVC with Qt 6.12.0:
- Quick geometry passed in Release and Debug with 14 Qt Test passes,
  including initialization and cleanup, and no skips.
- All five fast suites passed in approximately 0.20 seconds in Release
  and 0.28 seconds in Debug; the aggregate target built successfully.
- git diff --check passed. Other platforms and hosted CI were not run.
Add 22 business cases against the production shared/native event dispatchers
and register them as core.eventdispatch.unit with the bounded offline runner.
Use small adapters to run the same independently specified call sequences
against both dispatch implementations without duplicating dispatch logic.

Cover empty dispatch, argument and native-result forwarding, registration
order, event consumption, duplicate and foreign registration, transfer
between dispatchers, self-removal, destruction of a subsequent filter,
self-destruction with consumption, appending filters during dispatch,
nested removal, and both dispatcher/filter destruction orders.

Exercise application-wide native filter removal through Qt's event dispatcher
using synthetic events. Verify that deleting the last filter from inside
its callback leaves subsequent dispatch safe and permits a replacement
filter to register and unregister normally. No OS messages or input are
injected, and no native window or display server is required.

Validation on the completed series, Windows/MSVC with Qt 6.12.0:
- Release and Debug passed all 24 Qt Test entries, including lifecycle
  entries, with no failures or skips.
- Twenty consecutive Release runs passed.
- The suite also passed in a Core-only static build with Widgets, Quick,
  StyleAgent and installation disabled and the Qt context selected.
- Other platforms and hosted CI were not executed locally.
Add 15 business cases for AbstractWindowContext and register them as
core.windowcontext.unit. Supply deterministic window IDs, item properties
and platform callback results while retaining the production attribute
storage, replay, registration and hit-test implementations.

Verify attribute creation, replacement and deletion without a handle;
atomic rejection of writes and deletes; successful-write replay order;
adjacent replay failures and removal from subsequent replays; unchanged
handles; handle loss; and reuse of a previous handle value. Record platform
callbacks to assert both values and ordering instead of merely checking
that execution does not crash.

Cover title-bar replacement and registration cleanup, destroyed title/button/
exclusion objects, hidden or disabled titles, titles outside the window,
exclusion toggles, system-button visibility and overlap priority, and six
fixed-size configurations including a missing window.

Validation on the completed series, Windows/MSVC with Qt 6.12.0:
- Release and Debug passed 17 Qt Test entries, including initialization
  and cleanup, with no failures or skips.
- Twenty consecutive Release runs and the Core-only static configuration
  passed. The latter disables UI modules, StyleAgent and installation.

These tests validate the base context contract with simulated handle
transitions; they do not claim to recreate real Win32/Cocoa/X11/Wayland
handles or verify native window interaction. Other platforms were not run.
Add nine business cases for StyleAgent's platform-independent state and
notification behavior, registered only when StyleAgent is enabled.

Compile the unchanged production styleagent.cpp and its moc output into
the test because StyleAgentPrivate notification methods are not exported.
Replace only platform subscription hooks with deterministic local counters
and avoid linking another StyleAgent implementation from QWKCore. This
keeps tests independent of the user's actual theme, registry and native
notification delivery without changing production exports or behavior.

Assert initial unknown/invalid values, transitions to every theme, duplicate
notification suppression, valid and invalid accent colors, observable state
at signal delivery, reentrant theme changes, and balanced hook lifetime
across multiple agents. Use Qt Test and QSignalSpy without additional
mocking libraries or external services.

Validation on the completed series, Windows/MSVC with Qt 6.12.0:
- Release and Debug passed all 11 Qt Test entries, including lifecycle
  entries, with no failures or skips.
- Twenty consecutive Release runs passed.
- A StyleAgent-disabled Core-only build correctly omitted this suite.

OS theme detection and native subscription delivery remain outside this
unit suite. Other platforms and hosted CI were not executed locally.
Add the agents.unit suite with five business cases per enabled UI module.
Register and link each module conditionally, adjusting the expected pass
count for Widgets-only, Quick-only or combined builds. Omit the target when
neither UI module is enabled.

Use real public agents, delegates and base context state with the existing
context factory seam to bypass native hooks and border installation.
Restore the factory on exit and keep all windows hidden under offscreen
QPA; no desktop input, rendering waits or network access is needed.

Verify rejection of repeated setup on the same or another window, title-bar
signal counts and arguments, state visibility during signal delivery,
registration preservation on identical title assignment and cleanup on
replacement. Check registration/replacement/removal signals for all five
system-button roles, hit-test exclusion toggles, and queries and subsequent
registration after referenced objects have been destroyed.

Validation on the completed series, Windows/MSVC with Qt 6.12.0:
- Combined Widgets/Quick Release and Debug runs passed all ten business
  cases plus initialization and cleanup, with no failures or skips.
- Twenty consecutive Release runs passed.
- A Core-only static build correctly omitted this target.

The individual Widgets-only/Quick-only combinations and other platforms
were not run locally. Native hooks, real dragging and compositor output
remain the responsibility of separate integration tests.
Extend the existing matrix and MinGW registration checks to require the
new event-dispatch, window-context, StyleAgent and agent suites, plus the
existing Quick geometry suite on Windows. Anchor CTest selection patterns,
use literal name checks and report missing required tests consistently.
The normal build/test steps execute the suites; preserve existing workflow
triggers and avoid adding a duplicate test run.

Document how to configure with local dependencies, build the dedicated
qwk_fast_unit_tests target and select only fast tests through CTest labels.
Describe the Qt-only dependencies, offline/no-desktop execution, bounded
timeouts, report locations, strict pass/skip checks, conditional suites and
the distinction between compilation time and test execution time.

Record the 56 newly added business cases and 68 total fast cases, explain
which tests use platform substitutes, and identify native interactions
that the suite does not claim to cover. Keep the local audit reports out
of the implementation commits.

Validation on Windows/MSVC with Qt 6.12.0:
- All five fast suites passed in Release (~0.20 seconds) and Debug
  (~0.28 seconds), including CTest and process startup.
- Twenty consecutive runs per Release suite passed: 100 process runs
  in approximately 3.46 seconds, with no skips.
- Core-only static configuration passed both applicable suites (~0.08
  seconds) with UI modules, StyleAgent and installation disabled and the
  Qt fallback selected.
- The full Release regression passed all 15 registered CTest entries.
- git diff --check passed. qmake was unavailable in this local shell;
  other platforms and hosted GitHub Actions were not executed.
The install fixture and CMake, qmake and MSBuild consumer tests had no
explicit CTest TIMEOUT. Their shared consumer driver also launched build
tools without an execute_process deadline, so a stalled tool could hold
the test run for an excessive amount of time.

Give installation a 15-second CTest limit and each build consumer a
60-second total limit. Require a positive, bounded timeout argument in
the shared consumer helper: use 25 seconds for configure/build/MSBuild,
15 seconds for qmake, and 25 seconds for make. Bound the configure-time
qmake prefix query to five seconds and report failed or timed-out queries
instead of silently continuing with incomplete discovery results.

Reduce the QML installation consumer from 180 to 60 seconds overall.
Use separate budgets for installation (10 seconds), configure/build
(20 seconds each), runtime (8 seconds) and lint (5 seconds per invocation).
Treat nonnumeric timeout/launch results as failures before interpreting
lint JSON, and compare process results as strings where timeout diagnostics
may be returned in place of an exit code.

Reduce each Quick border test from 60 to 20 seconds at CTest level and
from 45 to 15 seconds for its executable. Reduce native hit testing from
120 to 45 seconds overall and from 100 to 40 seconds for the driver.
Preserve existing native fixture, message and cleanup deadlines. Keep
the fast unit tests at their existing 8-second process/10-second CTest
limits. No product code, external dependencies or network access is added.

Validation on Windows/MSVC with Qt 6.12.0:
- All 17 registered Release tests in the completed change passed in
  approximately 21.92 seconds, including the newly enabled local qmake
  consumer and the timeout-policy check added in the follow-up commit.
- A deliberately sleeping consumer command with a one-second budget
  was terminated and reported failure after approximately 1.03 seconds.
- Inspected every main-project execute_process call and CTest deadline;
  git diff --check passed.

Other platforms and hosted CI have not been run with these tighter
budgets. Independent qmsetup/stdcorelib submodule tests already have
their own registered timeouts and are not modified here.
Add testpolicy.timeouts to inspect CTest's generated JSON registrations
across all enabled test directories. Reject any test without an explicit
positive TIMEOUT or with a limit above 60 seconds, including TIMEOUT=0
which CTest treats as unlimited. Give the inspection process a five-second
deadline and the policy test itself a ten-second CTest limit. Use the
project's existing CMake/CTest facilities without extra frameworks.

Require the policy test in both the compiler-matrix and MinGW registration
checks. Cap the complete CI test steps at three minutes, the static
MSBuild consumer step at two minutes, and the no-system-borders hit-test
step at one minute. Preserve existing workflow triggers and build/setup
steps; these aggregate deadlines apply specifically to test execution.

Document per-test and per-operation budgets, failure behavior, commands
for the full and fast suites, and the distinction between local per-test
limits and CI-wide step deadlines. Record measured validation results and
the separate scope of dependency submodule test suites. Link the timeout
policy from the fast unit-test documentation.

Validation on Windows/MSVC with Qt 6.12.0:
- All 17 enabled Release CTests passed in approximately 21.92 seconds.
- The generated manifest contains an explicit 10-60 second TIMEOUT for
  every registered entry, including qmake and the policy test itself.
- Negative fixtures with missing, zero and 61-second timeouts were
  rejected; a ten-second fixture was accepted.
- A consumer timeout probe failed after approximately 1.03 seconds.
- git diff --check passed. Hosted Actions and other platforms were not run.

Keep both local audit reports and temporary validation fixtures outside
the commits. Do not change the dependency submodule revisions.
Extract the deterministic window delegate and handle filter into a reusable
fixture, recording state, flags, geometry and window-action calls without
showing a window or invoking native operations.

Add 11 cases covering invalid/repeated setup, raise and minimized-state
restoration while preserving other state bits, actions without a handle,
centering, attribute replay before handle notification, unchanged-handle
suppression, host-window event-filter replacement and destruction cleanup.
Update the strict runner pass count from 17 to 28, including Qt Test setup
and cleanup; retain the 8-second process and 10-second CTest deadlines.

Validation: expanded context suite passes in shared Release/Debug and
Core-only static Release builds with Qt 6.12.0/MSVC. All 26 business cases
execute synchronously without network access, sleeps or desktop input.
Add 22 deterministic cases against the real QtWindowContext implementation.
Cover maximize/restore bit preservation, double-click eligibility guards,
scene versus global coordinates, system-menu requests, title/client mouse
release transitions, unrelated events and frameless flags on handle loss
and recreation. Record menu and delegate calls instead of triggering native
menus or interactive move/resize operations.

Compile the unchanged private fallback implementation into shared-library
tests because its symbols are not exported. Static tests link the existing
implementation directly to avoid duplicate moc definitions. Register the
suite with strict pass counts and the existing 8/10-second deadlines.

Validation: all cases pass with shared Release/Debug and Core-only static
Release builds on Qt 6.12.0/MSVC; 20 consecutive Release runs also pass.
Add five synchronous cases for production forwardObjectEventFilters using
real QObject filter registrations. Verify forwarding starts after the
current filter in Qt order, preserves receiver/event identity, stops when
a filter consumes an event, handles absent or last current filters, skips
destroyed filters and excludes the application object as receiver.

Register a Qt-only guiless suite with an exact seven-pass requirement
including initialization/cleanup, an 8-second subprocess deadline and a
10-second CTest limit. No additional framework, network or event-loop waits
are required.

Validation: all cases pass in shared Release/Debug and Core-only static
Release builds on Qt 6.12.0/MSVC, including 20 repeated Release runs.
Require QObject filter and Qt fallback test registration in both the main
platform matrix and MinGW job. Extend the existing static Windows test
step to include unit suites and the timeout policy check alongside the
MSBuild consumer, retaining the two-minute aggregate deadline.

Document the expanded 106 business cases across seven fast processes,
private fallback linkage strategy, deterministic test boundaries and
current timings. Keep the distinction between offline unit coverage and
native integration coverage explicit.

Validation on Windows with Qt 6.12.0/MSVC: shared Release fast suites pass
in 0.30 seconds, Debug in 0.33 seconds; 140 repeated Release process runs
pass in 4.72 seconds. Core-only static tests plus timeout policy pass 5/5
in 0.19 seconds. Full Release regression passes 19/19 in 20.11 seconds.
Other platforms and hosted CI have not been run locally.
A Windows Widgets border callback can forward UpdateRequest or Expose to
another filter that deletes the receiver and its agent. The old code then
called drawBorderNative through the destroyed handler/context. Deleting only
the agent, or deleting it from the widget event handler, had the same risk.
Shared and native dispatchers also continued accessing their filter list and
dispatch depth after a callback destroyed the dispatcher itself.

Guard the handler, receiver and context across forwarding. Deliver an
unconsumed event once to a surviving receiver even when its agent is gone,
and draw the border only when all required objects still exist. Preserve
normal delivery and the single post-event draw, including consuming filters.

Give each dispatcher an independently retained lifetime token. Destruction
invalidates every active frame; a returning callback then stops delivery
without touching the dead filter list or depth counter. This also protects
nested dispatch and immediate construction of a new dispatcher at the same
address. Check the Win32 context/window before additional native forwarding
on the handled windowProc path. Leave window-procedure storage and nested
message-context restoration for their separate audit rounds.

Add eight isolated dispatcher cases and thirteen Windows border component
cases. Assert callback order, replacement-dispatcher self-removal behavior,
event/draw counts and object lifetimes; retain child failure reports and
bounded subprocess waits. Register both suites in the applicable CI test
presence checks and document their coverage and limitations.

Validation on Windows 11, MSVC and Qt 6.12.0, Release:
- Full project build and all 21 registered CTest entries passed, including
  build consumers, native hit testing, QML installation and Quick rendering.
- Negative controls restored the original dispatch/forwarding implementations:
  all eight dispatcher rows failed order assertions, and both window-deletion
  rows retaining the agent drew once instead of zero times.
- Restoring the fix passed both new suites; their final diagnostic handling
  was rebuilt and rechecked. Static review and git diff --check passed.

The border suite uses the production handler and the existing context factory
with offscreen Qt and a recording draw hook. It does not verify Windows 10
workaround auto-selection, native GDI/DWM output or destructive native-message
integration. Other Qt versions, compilers/platforms, sanitizers and hosted CI
were not run. Private dispatcher layouts changed; dependent binaries must
be rebuilt. Local audit reports and submodules are excluded from this commit.
Using one global predecessor for all HWNDs routed later windows through the
first window's subclass and restored that same incorrect function on detach.
An agent detached below a later subclass also lost the information needed to
forward messages correctly, and reattaching could create a procedure cycle.

Store a retained registration per HWND containing its predecessor and guarded
context. Capture the registration for active dispatch, reuse inactive hooks
on reattachment, and unlink only when our hook is the current procedure.
Retain forwarding records below later subclasses until native destruction.
Always pass WM_NCDESTROY through the predecessor before retiring the matching
record. Context identity checks prevent an old owner removing a newer entry.
Failed installation publishes no registration; failed restoration preserves
the forwarding record and reports an error.

Add five isolated integration cases using real QWidget HWNDs and production
Win32 contexts: distinct predecessors, detach restoration, later subclasses
and reattachment, detached teardown, and removal from a callback. Assert
message arguments/results, procedure identity, callback order, teardown
counts, and fresh registration after teardown. Require the suite in Windows
CI registration checks and document its bounded execution and coverage.

Validation on Windows 11, Qt 6.12.0, MSVC, Release:
- Full project build and all 22 CTest entries passed (21.65 seconds).
- Restoring the original implementation failed distinct-window forwarding
  (130 instead of 131) and restoration of the second predecessor pointer.
- Restored fixed source passed the native suite and complete regression.
- Static lifetime/reentrancy review and git diff --check passed.

Installation/restoration failure paths and exact numeric HWND reuse were
reviewed statically, not fault-injected. Other Qt versions, compilers, Windows
versions, sanitizers and hosted CI were not run. Nested native-message context
restoration is intentionally reserved for the next independent fix. Local
audit reports and submodules are excluded; this is a local commit only.
The Windows hook stored only one raw context pointer and cleared it whenever
a message returned. Nested messages therefore erased the outer context before
Qt's WM_NCCALCSIZE filter ran, restoring the standard caption/client geometry.
Messages for unhooked or inactive windows could also borrow an unrelated outer
context because the native filter did not associate it with a specific message.

Keep a guarded context in each synchronous WndProc stack frame and restore
the preceding frame on every exit, including inactive hooks and teardown.
Match HWND, message type and parameters before nonclient processing, then
verify that the same live context still owns the registered native window.
QPointer invalidates saved outer contexts on deletion, so replacing an agent
inside an inner callback cannot revive or substitute the old frame's owner.

Extend the isolated native HWND suite with eight reentrancy cases. Check
same-window and cross-window calls, unmanaged/inactive windows, two nested
levels, and deleting/replacing the outer agent. Compare client rectangles
and return values with non-nested native calls; assert callback counts and
depth. An explicit native-dispatcher probe with a different payload must stay
unconsumed and leave its rectangle/result untouched. Reuse bounded child
execution and require all thirteen business cases with no skips.

Validation on Windows 11, Qt 6.12.0, MSVC, Release, system borders enabled:
- Full build and all 22 CTest entries passed (22.48 seconds), including all
  thirteen procedure-chain and reentrancy cases.
- Restoring the prior source made seven reentrancy rows fail on incorrect
  client geometry or unwanted consumption; the deletion-only row still passed.
- Restoring the fix passed the complete suite and existing regressions.
- Static dispatch/lifetime review and git diff --check passed.

These tests cover synchronous native messages, not injected mouse/keyboard
input or DWM pixels. Other Qt/compiler/Windows versions, the system-borders-off
configuration, sanitizers and hosted CI were not run for this change. Native
subclass API failure injection and exact numeric HWND reuse retain the limits
recorded by the preceding chain fix. Local audit reports and submodules are
excluded, and no push is performed.
The installed config repeated find_dependency(QT NAMES Qt6 Qt5) and used the
consumer's QT_VERSION_MAJOR even though exported targets already referred to
the Qt major used to build QWindowKit. A Qt 5 build could therefore select Qt 6
when both packages were discoverable, leaving its Qt5 targets unresolved.

Substitute the build-time major into Core/Gui, Widgets and Quick dependency
lookups and the static Qt 6 private-dependency condition. Report it as
QWindowKit_QT_VERSION_MAJOR. Do not impose an exact Qt patch version or rely on
ambient consumer variables to determine the dependency namespace.

Add twelve isolated configuration cases generated from the production template:
Qt 5/6, shared/static, matching-only, both majors with the wrong one first,
and wrong-major-only discovery. Check selected/public targets and static Qt 6
private targets; reject a missing matching major. Require this offline matrix
in the existing CI jobs and document its configuration-only limits.

Validation on Windows/MSVC with Qt 6.12.0, Release:
- Regenerated and built the full project.
- All twelve discovery cases passed. The original template failed the Qt 5
  mixed-major case with 'Selected Qt 6, expected Qt 5'.
- Installed CMake, qmake and MSBuild consumers, the installation fixture and
  timeout policy all passed (6 selected CTest entries).
- Static package-generation review and git diff --check passed.

The matrix uses minimal Qt package/export substitutes; real Qt 5 compilation,
dual-major ABI/linking, and a new static binary build were not performed for
this commit. Other platforms/toolchains and hosted CI were not run. Required
component semantics are reserved for the next independent audit fix. Local
audit reports and submodules are excluded; no push is performed.
Core-only installations previously accepted REQUIRED Widgets and unknown
component names because the package neither published component states nor
checked them. Explicit REQUIRED Qt lookups also prevented optional component
dependencies from behaving as optional, while an unqualified lookup did not
load dependencies for all exported modules.

Generate the standard required-component checker without modifying qmsetup.
Publish the installed component manifest and reject missing required modules
with a package-level diagnostic before searching for Qt. Resolve all installed
modules for an unqualified lookup, honor optional Qt dependency failures, and
reset package state for subsequent lookups. Preserve the build-time Qt major
and load private Qt 6 targets only when the selected static modules need them.

Add nine independent installed-package configure/link scenarios, register them
in CI, and cover default selection, Core-only use, absent/unknown required and
optional components, quiet failures, repeated lookups, and missing optional Qt.
Use the fixture's actual config location for non-default lib directories.
Strengthen negative tests so a timeout cannot count as successful rejection.

Validation: Windows/MSVC, Qt 6.12.0, Release full shared build and all 32 CTest
entries passed. Real static Core-only (lib64) and Core+Quick installation tests
passed all 14 build-system cases (Core-only after correcting the lib64 fixture).
Core+Widgets passed all CMake component, Qt-major, MSBuild and CMake consumers;
its existing qmake consumer exposed 49 unresolved Win32 references. The original
consumer reproduces that failure; its dependency repair will be a separate
commit. The old config accepted REQUIRED Widgets and MisspelledComponent from
the real Core-only install; the repaired config rejected both during discovery.
The Qt-major discovery matrix passed all 12 substitute-package cases.

No real Qt 5 or dual-major ABI/link validation, macOS/Linux execution, MinGW,
Debug builds, or hosted CI was performed. Package consumers compile/link only;
these checks do not establish QML or native-window runtime behavior.
A qmake application linking static QWKWidgets pulls QWKCore's native window
context into its executable. The installed .pri files supplied the QWK archives
and static definitions but omitted their Win32 dependencies. Qt's shared import
libraries do not forward those libraries, leaving 49 unresolved references in
the Windows/MSVC consumer (including GetDeviceCaps and SHAppBarMessage).

Generate user32, gdi32 and shell32 link flags in QWKCore.pri for Windows static
installations, together with the existing CMake uxtheme dependency. Widgets and
Quick inherit the flags through their existing guarded Core include. Shared and
non-Windows installations receive no additional system libraries. Require and
run the existing qmake consumer in the Windows static CI configuration so this
real compile/link regression cannot silently remain outside the test selection.

Validation: reproduced the 49 unresolved symbols with the original consumer
source against the unmodified static .pri files. After regenerating the metadata,
the real static Core+Widgets install/qmake tests passed 2/2 on Windows/MSVC with
Qt 6.12.0 in Release. Shared install/qmake tests also passed 2/2; inspected the
generated files to confirm only the static installation gained the link flags.
git diff --check passed. The preceding CMake repair passed the full shared
32-test suite; it was not repeated for this isolated qmake metadata change.

No hosted CI, MinGW, Debug, Qt 5, or non-Windows runtime validation was performed.
The existing qmake consumer exercises Core/Widgets linking, not Quick runtime
registration or interactive window behavior.
AUDIT-015: fixing only a window's width or height previously left forbidden
resize edges and diagonal cursors active. The press could be consumed as a
resize instead of reaching title dragging or ordinary client input. Fully
fixing the size also skipped cursor restoration after an earlier resize hover.

Filter horizontal and vertical edges using the existing host constraint
queries, then derive both cursor and press handling from those final edges.
Refresh the cursor on hover and left press, including when no resize edges
remain. Preserve the macOS no-resize and maximized/fullscreen branches. Add
private virtual move/resize boundaries so tests record production event
choices without entering an OS interactive operation.

Add 150 edge/corner/title/client cases across five constraint modes and three
visibility states, plus ten dynamic cursor cases. Check edges, cursors,
consumption, drag fallthrough and release state. The old decision logic with
only the recording boundary retained fails 20 cases; the fix passes all 184
Qt Test checks with no skips. Review covered the shared event state machine,
constraint helpers, X11/Wayland inheritance and shared/static linkage.

Validation: Windows 11, MSVC, Qt 6.12.0, Release full build. Full CTest first
passed 31/32; qmake lacked the compiler environment, then passed with its
install fixture after vcvars64 initialization. All 32 tests have passing
results. Static Core-only FORCE_QT_WINDOW_CONTEXT build and CTest pass 6/6.
Initial sandbox FileTracker E_ACCESSDENIED required an unsandboxed build.
Not validated: real native resize/input, physical monitors, Linux/macOS,
Qt 5/other Qt versions, Debug, other compilers or hosted CI. Offscreen Qt
state-machine tests do not establish compositor behavior. Audit documents
and submodules are excluded; no push is performed.
Window attribute setters retained hash/list iterators and QVariant references
across platform calls. Synchronous native callbacks could grow the hash,
remove or replace the active entry, destroy the context, or recreate its HWND.
The outer call then used invalid storage or overwrote a newer successful write.
Replay iterated the mutable list directly, allowing callbacks to skip, repeat
or invalidate entries and resume work for an obsolete window generation.

Copy setter inputs and previous values before callbacks, and re-find storage
only after checking context/window validity. Track active calls with stack-owned
frames: a successful inner write or removal supersedes every active call for
that key; a rejected inner write does not. Independent keys remain independent.
Interrupted or superseded outer setters return false without committing cache
changes. No-op removal of an uncached key also cancels an active insertion.

Assign successful entries revisions and replay an immutable ordered snapshot.
Skip revisions changed by callbacks, and remove rejected entries only if they
still match that snapshot. Increment the window generation on native ID or
host-window changes, including teardown/recreation with the same numeric ID.
Stop obsolete replay/initialization frames before further processing or dispatch.

Use the active frame inside Windows effect operations to stop after context
loss, native-window changes or superseding writes. Complete temporary geometry
restoration when the same window survives a newer same-key write. Guard native
initialization after synchronous style/frame/property calls as well. The old
Qt custom-margins branch also checks QWindow survival after setProperty.
Document cache acceptance, precedence, interrupted-call results and replay rules.
Native side effects already performed are not promised to roll back.

Add 21 isolated Core attribute regressions and eight native Windows cases.
Core cases assert queries, replay order, list/hash sizes, stable callback values,
failures, destruction, hash growth, and numeric handle reuse. Native cases use
real MoveWindow/WM_WINDOWPOSCHANGING and WM_STYLECHANGING callbacks with the
production Win32 implementation, real Windows QPA and page-protected retired
contexts. Check callback reachability, return values, cache state, subsequent
writes, and native geometry. Consume the old native message when a test callback
recreates its QPA window, preventing Qt from processing an obsolete receiver.

Validation on Windows 11 build 26200, MSVC 19.51 and Qt 6.12.0:
- Full shared Release build passed; final affected targets were rebuilt after
  the test message-consumption correction and old-Qt-only guard.
- Release related regression: 22/22 CTest entries passed. Final Core context,
  native windowproc and windowlifetime targets were rechecked: 3/3 passed.
- Shared Debug Core context/windowproc/windowlifetime: 3/3 passed.
- Static QWindowKit Release Core context/windowlifetime: 2/2 passed.
- Context and lifetime runners required 49 and 23 passes respectively, with
  zero skips in all three configurations.
- Negative control using original Core/Win32 sources and private header from
  c4a9d14 failed 18 Core cases and five native cases, including seven access
  violations. This run preceded the final native initialization case and the
  test's message-consumption correction.
- Static review and git diff --check passed; no additional UI jobs or network
  dependencies were introduced.

Core tests use controlled platform callbacks; native QWindow tests control
non-lifecycle delegate operations. No physical-input or effect-pixel validation
is claimed. Other Windows/Qt/compiler versions, macOS/Linux runtime integration,
Qt versions below 6.7, hosted CI and sanitizers were not run. The private context
layout changed, so consumers deriving from private headers must rebuild. The
public agent API is unchanged. Local FIXPLAN/audit files stay outside this commit.
The Core systemButton getter indexed its QPointer array without validation,
while the setter only rejected Unknown. Widgets and Quick forwarded numeric
roles directly to these methods. Out-of-range roles could therefore read or
write unrelated memory, including through QML's invokable methods. Unknown
also asserted in Debug instead of following the Release rejection behavior.

Use one constexpr valid-role predicate for both accessors before indexing.
Unknown and out-of-range getters return nullptr; setters return false without
changing state, allowing both agents to suppress systemButtonChanged. Preserve
all five valid role values, duplicate-write behavior and null unregistration.
Give SystemButton an explicit int underlying type so negative values and the
full int range have defined enum conversion semantics before validation.
Document the common Widgets/Quick behavior and Qt's numeric conversion boundary.

Add a shared eleven-case input table covering the five valid roles, Unknown,
-1, 6, 7, INT_MIN and INT_MAX. Add 11 Core cases and 11 cases for each agent,
checking queries, updates, duplicates, removals, other registrations and signals.
Core boundary cases run in bounded child processes. Add 11 real QML integration
cases that import the production module, create its WindowAgent, and pass numbers
through QML functions into the production invokables without a context substitute.
Check enum metadata, state preservation, signal counts and absence of warnings.

Register systembuttons.qml in existing Windows shared/static CI checks, with
mandatory pass counts, zero skips and the existing 8s inner/10s CTest deadlines.
No Linux/macOS UI job, network dependency or external test framework was added.

Validation on Windows 11 build 26200, MSVC 19.51 and Qt 6.12.0:
- Full shared Release build passed after restoring both negative mutations.
- Release related regression: 16/16 CTest entries passed, including native
  hit testing/window lifetimes, fallback behavior, Quick/Widgets borders,
  Core/agent/QML tests and timeout policy.
- Shared Debug Core context, agents and QML: 3/3 passed.
- Static QWindowKit Release Core context, agents, QML and timeout policy:
  4/4 passed, with Quick enabled in the static configuration.
- Core/agent/QML suites required 60/34/13 passes respectively, with zero
  failures or skips in all three configurations (44 added business cases).
- Independent negative controls restored the unchecked getter and the
  Unknown-only setter separately. Core failed three getter cases and five
  setter cases; agent and real QML tests crashed with access violations in
  both controls. All three selected CTest entries failed in each run.
  Keep the fixed int definition during these controls so enum casts themselves
  remain defined and failures specifically exercise the missing bounds checks.
- Static review found every external array index guarded and the internal
  hit-test loop already bounded. git diff --check passed.

The QML suite uses a hidden window on the offscreen QPA; it validates actual
QML conversion and production agent behavior, not physical input or native
rendering. Conversion of JavaScript numbers outside the tested int range is
still handled by Qt. Other Qt/compiler/platform versions, nondefault enum ABI
flags, hosted CI and sanitizers were not exercised. Numeric role values and
public method signatures are unchanged; the enum representation is now int.
Local FIXPLAN and audit files are excluded from this code commit.
FIX-005: the border helper reapplied dark-mode=true and default extra-margins
whenever an HWND appeared. Activation changes also replaced the persistent
margins with the inactive title-bar workaround, losing application settings.

Only initialize missing attributes and let the existing revision-aware context
replay restore explicit values. Send activation through a private platform hook
instead of the public attribute setter. Keep inactivity as native state, extend
only the necessary top margin, preserve other edges/larger top values and
negative full-glass requests, and restore application margins on activation.
Use the same effective margins for explicit updates and effect restoration.
Reset transient state on handle changes. Guard border callbacks against owner
or context destruction, including the Quick post-dispatch geometry refresh.

Add windows.borderattributes using real Widget/Quick agents, delegates, HWNDs
and Win32 attribute code. A controlled win10-border-needed getter selects the
Windows 10 decoration on this Windows 11 host. The frame-extension boundary
records effective margins and still calls real DWM; dark-mode is queried back
from DWM. Cover missing/false/true settings, pre-setup and pre-show caching,
existing surfaces, repeated native recreation, close/show, flag changes,
inactive updates, large/negative margins, nested defaults, rejected margin
updates and deletion during initialization. Require the suite in Windows CI
and the static Windows job, with fixed pass counts and bounded execution.

Validation on Windows 11 build 26200, MSVC 19.51 and Qt 6.12.0:
- Full shared Release build succeeded. Final related selection: 12/12 CTests
  passed, including borderattributes (42 passes, zero skips), context replay,
  native procedure/lifetime/hit-test, Widget lifetime, four Quick software
  scales, D3D11 lifecycle and timeout policy.
- Shared Debug: borderattributes and windowcontext passed (2/2 CTests).
- Static Release: borderattributes, windowcontext and timeout policy passed
  (3/3 CTests). The new suite had 42 passes and zero skips in both variants.
- Independent negative controls produced 14 failed rows for unconditional dark
  defaults and 38 failed rows for activation writes to persistent margins.
  Restored sources, forced recompilation and reran the final Release selection.
- Static review and git diff --check passed. Existing MSBuild manifest warnings
  and optional Vulkan-header discovery notices remain unchanged.

Limits: this is real HWND/DWM validation on Windows 11 plus controlled entry
into the Windows 10 decoration, not Windows 10 visual acceptance. Windows 10
seam, native top-border/shadow, theme/accent and DPI appearance remain open
under FIX-005 in the local FIXPLAN.md. Qt 5, MinGW and other operating systems
were not run locally. No plan/audit files, build output or submodules committed.
Entering a resize edge replaced the host cursor, while leaving it merely
called unsetCursor(). This permanently discarded application cursor shapes,
pixmap/bitmap data and hotspots. The recording delegate in the existing
fallback unit test restored CrossCursor itself and masked the production bug.

Save the first complete QCursor in each production delegate and retain it
across consecutive edge changes. Widgets also save WA_SetCursor, explicitly
clearing it before unsetCursor when restoring an inherited/default cursor;
Qt does not clear that attribute for top-level windows. Clear saved state
before calling Qt so CursorChange callbacks can reenter or delete the agent.
Application cursor writes during ownership are temporary: ending ownership
restores the initial snapshot. Inherited widgets resume current parent state.

Restore on client/release/leave, hide, window-state changes, native handle
changes and context destruction. Observe QWindow constraint/state signals;
QWidget constraint setters bypass those signals, so their constraints and
fixed-size flags are rechecked on subsequent mouse input. Preserve existing
move/resize decisions. Weak host references and Destroy handling avoid
restoring into a dead widget/window; cursor callback lifetime checks prevent
continuing a mouse dispatch after synchronous agent/host deletion.

Add Windows-only regressions through real Widgets/Quick agents, production
delegates and the production fallback selected by the existing factory.
Separate offscreen component tests from real Windows QPA window/handle tests.
Cover standard/color/monochrome cursors and hotspots, repeated ownership and
recreation, constraints/flags, application writes, both destruction orders,
host-owned agents, widget inheritance and agent deletion in CursorChange.
Enforce exact pass counts, no skips/xfails, bounded processes and desktop
serialization. Require the new tests in existing Windows CI registrations
and the static test selection, without adding non-Windows UI jobs.

Validation on Windows 11 build 26200, MSVC and Qt 6.12.0:
- Shared Release and Debug: Core/Widgets/Quick and affected test targets built;
  fallbackcursor.offscreen, fallbackcursor.windows, core.qtwindowcontext.unit,
  agents.unit and testpolicy.timeouts all passed (5 CTest entries per config).
- Static Release: production libraries and fallback targets built; both
  cursor suites and core.qtwindowcontext.unit passed (3 CTest entries).
- All six cursor-suite runs reported exactly 70 passes and zero skips/failures.
  The existing fallback decision suite retained its 184-pass expectation.
- Negative control: temporarily restoring the three pre-fix implementation
  files from HEAD made the new offscreen suite report 8 passes and 60 failed
  cases. Restored the fixed sources, rebuilt and reran the positive suites.
- Reviewed delegate/context destruction order, synchronous cursor callbacks,
  host and handle replacement, repeated snapshots, Qt-version test branches,
  private-header layout and unaffected native-context callers. No new virtual
  delegate methods or public API changes. git diff --check passed.

Limits: Qt5, other Qt6 versions, Linux/macOS, sanitizer instrumentation and
hosted CI were not run. Windows tests use Qt-delivered mouse events and real
windows; they do not assert physical system input or rendered cursor pixels.
No network access is needed by test execution; network isolation was not
independently enforced. The separate real Windows 10 border acceptance item
remains open. FIXPLAN.md and the audit report remain local and uncommitted;
no submodule contents were modified.
…lures

The Acrylic branch used DWMWA_SYSTEMBACKDROP_TYPE on every Windows 11 build,
ignored its HRESULT and unconditionally changed margins. Failed writes could
therefore be cached as successful and leave a partially applied frame state.

Use the documented backdrop API on build 22621+ and restore the project's
original private ACCENT_POLICY path on earlier Windows 11 builds. Git history
0e9c2e4 contains the original hack:
WCA_ACCENT_POLICY=19, ACCENT_ENABLE_ACRYLICBLURBEHIND=4 and luminosity flags 482.
Retain those values and the historical zero AABBGGRR gradient. Do not simply
reject Windows 11 22000 based on the documented API's minimum version.
The Mica branch, including both _DWMWA_MICA_EFFECT=1029 calls, matches HEAD
verbatim; its enumeration and compatibility path remain untouched.

For official DWM, read the actual current backdrop, check the requested write,
then apply margins. If margin application fails, restore the previous backdrop.
For the private path, apply margins first, then check SetWindowCompositionAttribute.
A failed setter restores the previously successful QWK margins. Do not require
a private accent-policy getter: a native probe on build 26200 returned error 87
for that query while accepting the setter. Runtime symbol availability and BOOL
success determine whether the legacy setter is usable.

Track successful QWK margin applications across extra-margins, material effects
and temporary border corrections. Reset on HWND generation changes, and guard
tracking against context destruction and successful nested margin updates.
Preserve newer inner extra-margins writes instead of rolling them back after a
failed outer effect call. Successful same-key inner writes retain priority;
obsolete or deleted contexts are not rolled back into.

Failures do not commit the requested attribute. If rollback also fails, return
false, warn, and retain the last successful cache. The platform may then differ;
an explicit boolean retry can repair it. Removing an absent cache entry remains
the base setter's no-op and cannot repair a failed first application. Tracking
does not claim knowledge of external raw DWM margin writes. Document these limits.

Add bounded Windows component/native tests through real agents and HWNDs.
Cover both API paths, absent capability, failed query/set/margins/rollback,
enable/disable/removal, explicit retry, foreign prior backdrop, preserved private
policy, latest margins, nested writes, deletion, HWND replacement and replay.
Native Widgets/Quick tests query official DWM state, switch from Mica/Mica Alt,
and exercise both official and forced private setters through recreation.
Register the suite in existing Windows CI and static test selections.

Validation on Windows 11 build 26200, MSVC, Qt 6.12.0:
- Shared Release and Debug builds passed. Each configuration passed five CTest
  entries: windows.acrylic, windows.borderattributes, windows.windowlifetime,
  core.windowcontext.unit and testpolicy.timeouts.
- Static Release build passed windows.acrylic, windows.borderattributes and
  windows.windowlifetime (three CTest entries).
- Each final Acrylic run reported exactly 92 passes and zero skips/failures.
- Negative control ignored the modern HRESULT and legacy BOOL while preserving
  the call sites: 22 cases failed (70 passed). Restored sources, rebuilt final
  Release binaries and reran the positive regressions successfully.
- Static review covered callback lifetimes, attribute commit/replay rules,
  margin tracking and rollback ordering, private symbols, version routing and
  unchanged Mica 1029 branches. git diff --check passed.

Limits: genuine Windows 11 21H2/22000, rendered material pixels, Qt5, other Qt6
versions, other compilers and hosted CI were not tested. Forced private calls
on 26200 establish API acceptance there, not 22000 visual acceptance. No physical
input or independently enforced network isolation is claimed. FIX-007 therefore
retains its platform/visual acceptance work in the local FIXPLAN.md. Neighboring
Mica/Mica Alt/blur/dark-mode/border-color unchecked returns are recorded separately
as FIX-017, without expanding this patch into an effects-system rewrite.
FIXPLAN.md and the audit report remain local; submodules are unchanged.
Mica, Mica Alt, DWM blur, dark mode and border color previously ignored native
HRESULT/BOOL failures. Mica/blur also ignored frame-margin failures, allowing
the public attribute setter and replay cache to report success after the
platform rejected an update.

Apply material margins first for Mica/Mica Alt/blur, check the effect setter,
and restore the last successful QWK margins when it rejects the request.
Check restoration failures, warn and return false without committing the
requested cache value. Preserve successful newer extra-margins writes.
Dark mode checks its per-window DWM write before changing process-wide menu
policy; border color propagates the DWM result. Retain the pre-Windows-8
DwmEnableBlurBehindWindow branch and check its HRESULT.

Keep legacy Mica's attribute 1029 for both BOOL enable and disable, as well
as Acrylic's policy 19/state 4/luminosity 482 compatibility path and the
left-only 65536 margin workaround. No private getter prerequisite is added.
Share a material revision guard across Mica, Mica Alt, Acrylic and blur:
successful inner effects and partial state left by failed inner rollback
must not be overwritten by an older request. Rejected inner requests with
restored state remain eligible for outer completion. Retain window-generation
and lifetime checks and the existing Quick geometry workaround.

Add windows.effects using real production agents/delegates and HWNDs, with
narrow controllable API boundaries for failures. Cover both cached states,
enable/disable/boolean removal, initial rejection, unavailable capability,
margin/set/rollback failures, retry, replay, same-key and cross-material
reentry, failed inner requests, newer margins, HWND recreation and deletion.
Native Widgets and Quick cases exercise setters, recreation and material
switching. Read back supported backdrop/dark-mode attributes through DWM.
For blur and border color assert the actual setter's accepted payload:
the border-color getter returned E_INVALIDARG on the local build.

Register the bounded suite in existing Windows CI configurations, including
static and MinGW registration checks. Document cache/native-state drift,
explicit retry and the distinction between component, native and visual
acceptance. Update the Acrylic fixture to select the modern Mica setup path
separately from the legacy Acrylic path under test.

Validation on Windows 11 build 26200, Qt 6.12.0, MSVC:
- Shared Release and Debug builds of Core/Widgets/Quick and affected tests.
- In both configurations, windows.effects, windows.acrylic,
  windows.borderattributes, windows.windowlifetime, core.windowcontext.unit
  and testpolicy.timeouts pass.
- Static Release build and all four affected Windows suites pass.
- The effects suite has exactly 205 passes and no skips/non-pass incidents
  in each configuration; Acrylic retains 92 passes with no skips.
- A targeted negative-control mutation ignoring effect setter results
  produces 82 failing cases and 123 passes. Restore sources in finally,
  rebuild Release and rerun the six required suites successfully.
- Static lifetime/reentry review, retained private constants, CI registration,
  submodule boundaries and git diff whitespace checks verified.

Limits: no real build 22000 Mica 1029 acceptance, native Windows 7/8/10
acceptance, material/border/menu pixel checks, theme/accessibility transitions,
physical input or independently enforced offline isolation. Qt 5, other Qt 6
versions, other compilers and hosted CI were not run locally. Margin tracking
covers QWK writes only; failed restoration or interrupted native work can
leave native state different from cache until an explicit retry.

Keep FIX-017 open locally only for remaining old-platform/visual acceptance.
FIXPLAN.md and the local audit report are excluded; no submodule changes
and no push.
If an application moved registered system buttons or hit-test exclusions out
of an old title bar and then destroyed that title, its QPointer became null.
setTitleBar used that pointer as the cleanup condition, so assigning a new
title retained those still-live registrations. Both Widgets and Quick then
reported stale public registrations and returned HTCLOSE/HTCLIENT where
the replacement title should be draggable.

Track whether a title has ever been assigned separately from its weak
pointer. Clear the old registrations on replacement even after destruction,
without deleting the registered objects. Preserve registrations made before
the first title, the duplicate-setter no-op, existing title/button signal
behavior, and cleanup before the replacement notification. Do not introduce
title destruction callbacks that could later clear a newer registration.
Clarify this contract in the shared Widgets/Quick API documentation.

Add independent offscreen agent cases for surviving registrations and
first-title registration order. Add windows.titlebar with real production
Widget/Quick agents, Win32 contexts, visible HWNDs and WM_NCHITTEST. Reparent
both the visual and QObject ownership of Quick items before deleting their
old title. Cover dead/live old titles, objects destroyed first, survival,
public queries, signal state/counts, repeated setters, consecutive
replacement and valid registrations on the new title. Register the bounded
suite in existing Windows CI configurations and document test boundaries.

Validation on Windows 11 build 26200, Qt 6.12.0, MSVC:
- Before changing production code, the new offscreen survivor cases fail
  for both Widgets and Quick. With explicit native fixture placement,
  both native survivor cases also fail: old button positions return
  HTCLOSE (20), old exclusion positions HTCLIENT (1), instead of HTCAPTION
  (2), and the title-change signal observes stale registrations.
- Shared Release, shared Debug and static Release builds pass.
- In all three configurations, agents.unit (38 passes), windows.titlebar
  (8), core.windowcontext.unit (60), core.qtwindowcontext.unit (184),
  windows.hittest (44), and testpolicy.timeouts pass without skips.
- Static review covers duplicate/initial assignment, expired weak pointers,
  ownership, notification ordering and the existing macOS area cleanup.
  Both macOS agent setters already retire a registered system-button area
  on an accepted title replacement; their platform code needs no change.
- Git whitespace checks pass; no submodules or material compatibility paths
  are changed.

Limits: native macOS/Linux, Qt 5, other Qt 6 versions, other compilers and
hosted CI were not run. WM_NCHITTEST integration is not physical input or
pixel acceptance. Tests do not download dependencies, but no independently
enforced network-isolation claim is made. The initial native fixture used
default placement and failed its first Widgets exposure wait; explicit
geometry and SW_SHOWNOACTIVATE fixed the fixture before the production
before/after comparison.

Remove FIX-008 and its completed round from the local plan, leaving 11 open
items. FIXPLAN.md and the local audit remain outside this commit. No push.
Disabling Widgets or Quick in a previously configured build leaves their pri
files in the build data directory. Generation already followed the enabled
target list, but install(DIRECTORY) copied the entire historical directory,
so a fresh install advertised modules whose libraries were not installed.

Collect the exact paths produced by the current configure and install that
file list. Keep historical build outputs intact. Library names, debug
postfixes, static definitions, dependencies and relative install-prefix
calculation retain their existing behavior. Installing over an old prefix
does not remove files from a previous installation.

Add real qmake reconfiguration integration using an isolated QWindowKit
build, not fake libraries or a copied install script. Configure and build
all modules, then install/consume all, Core-only, Widgets-only, Quick-only
and restored-all configurations in the same build tree. Each transition
gets a fresh install prefix and consumer build. Assert exact installed pri
names, matching presence/absence of module libraries, and continued presence
of stale pri files in the build output after disabling optional modules.
Use nested custom data/lib/bin/include paths and inherit the parent Qt,
compiler/generator, StyleAgent setting, shared/static mode and configuration.

Extend the existing qmake consumer to actually link Quick when enabled and
accept a custom qmake metadata directory. Register nine fixture-ordered
CTest stages with explicit subprocess limits and a resource lock. Cold
Core/Widgets/Quick builds have separate stages so each CTest entry stays
within the existing 60-second policy. Require registration in CI and run
reconfiguration in dedicated four-minute shared/static steps.

Validation on Windows 11 build 26200, Qt 6.12.0, MSVC:
- Before the production fix, a real all-modules -> Core-only transition
  installed QWKCore.pri, QWKWidgets.pri and QWKQuick.pri where only Core was
  expected. Its dependent stages were correctly not run.
- Shared Release/Debug and static Release/Debug reconfiguration pass:
  five real install trees and qmake compile/link consumers per combination,
  covering all 20 module/configuration installations without skips.
- Final shared Release/Debug runs pass all nine reconfiguration stages,
  existing default-layout qmake/MSBuild/CMake consumers, install fixtures
  and testpolicy.timeouts. Static Release also passes the default-layout
  qmake/MSBuild consumers, install fixture and timeout policy; static Debug
  passes the full reconfiguration chain.
- All consumer runs use the Visual Studio developer environment so nmake
  and MSBuild are available. A combined initial Debug cold-build test hit
  its deadline during harness development; the final per-module build
  stages pass from clean test directories without raising the CTest limit.
- Static review covers current-config list reset, target selection, custom
  install paths, fixture ordering, resolved cleanup paths, CMake 3.19 script
  policies and CI registration. Git whitespace checks pass.

Limits: consumer programs are compiled and linked, not executed. Linux,
macOS, Qt 5, other Qt 6 versions, other compilers and hosted CI were not run
locally. Tests download nothing, but independently enforced network
isolation is not claimed. Existing populated user install prefixes are
not cleaned. No submodule or platform effect compatibility changes.

Remove FIX-009 and its completed round from the local plan, leaving 10
open items. FIXPLAN.md and the local audit report remain outside this
commit; no push.
The Cocoa mouse filter read WindowMaximizeButtonHint but did not test it.
A left double-click in a resizable, non-fullscreen custom title bar could
therefore maximize or restore a window after the application cleared the
flag, contradicting the existing tutorial's opt-out and Qt fallback policy.

Require the flag before either state transition. Preserve the existing
left-button, draggable-area, fixed-size and fullscreen checks and toggle
only the maximized state bit. No mouse state machine, native traffic-light
handler, exported interface or swizzle lifetime is changed.

Clarify the Widgets/Quick contract in both tutorials, including restoration
of an already maximized window and the distinction from direct application
state changes. Preserve the existing custom title bar policy independently
of macOS native title bar double-click preferences. Add a manual native
acceptance matrix and the source/documentation basis for this decision.

Validation performed on Windows 11 build 26200 with MSVC and Qt 6.12.0:
- Built Release QWKCore, QWKWidgets, QWKQuick and tst_qtwindowcontext.
- core.qtwindowcontext.unit passed: 184 passes, zero failures/skips.
- git diff --check passed.
- Statically reviewed context selection, Widgets/Quick flag/state delegates,
  title-bar exclusions, size/fullscreen guards, Qt-version branches and
  callback/lifetime effects of the added condition.

The build emitted the existing LNK4075 manifest-option warning. Windows
does not compile cocoawindowcontext.mm; the fallback tests are comparison
coverage, not a Cocoa regression result. No macOS SDK/desktop was available,
so native Qt 5/6 builds, physical double-click input, state/geometry checks,
runtime flag/handle changes and the before/after reproduction remain
unverified. No new macOS UI job or platform substitute test was introduced.
FIX-010 remains open for those native checks in the local-only FIXPLAN.md.
NSWindowProxy replaced NSWindow sendEvent: for the lifetime of its proxy
registry even though the wrapper only called the previous IMP. Its event
capture logic was disabled with #if 0. This introduced a global method
replacement/restoration with no active QWindowKit behavior.

Remove that hook's installation, restoration, callback, saved IMP/type and
disabled event-capture remnants. Also remove the disabled key/main-window
hook pairs and their uncalled callbacks/storage, the unused mac_getNSWindow
helper, and Cocoa's write-only cursor member and initializer. The active
Qt fallback cursor state remains unchanged.

Retain the style-mask, transparent-title-bar and native-view drag hooks,
observer ownership, registry transitions, lifetime token and async native
button work. The prior double-click policy is unchanged. These deleted
helpers are defined only in the Objective-C++ implementation, without
export annotations or Qt metadata; no header or virtual interface changes.

Reviewed tracked callers/build integration, local patch availability and
cached local refs, including origin/dev and origin/wwx190/bugfixes. No
required local consumer was found. Remote-only downstream patches were
not inspected. Add a manual native build/symbol/behavior acceptance matrix
covering mixed Widgets/Quick windows, last-agent teardown, reinstallation,
input, fullscreen, system buttons and native handle changes.

Validation on Windows/MSVC with Qt 6.12.0:
- Release Core, Widgets, Quick and the two relevant test targets built.
- core.eventdispatch.unit: 24 passes, zero failures/skips.
- agents.unit: 38 passes, zero failures/skips.
- Static comparison confirmed nine retained callback/lifecycle function
  bodies are identical, all three remaining hook pairs are present, and
  deleted Cocoa symbols have no residual implementation references.
- git diff --check passed.

Windows excludes cocoawindowcontext.mm; the builds/tests above only check
available shared infrastructure and do not validate Cocoa behavior. No
macOS SDK/desktop or before/after Mach-O binaries were available. Native
Qt 5/6 builds, symbol comparison and the documented integration matrix
remain pending. No mirror test or macOS UI job was added for this cleanup.
FIX-011 and FIX-012 remain open in the local-only FIXPLAN.md for acceptance.
SharedEventDispatcher and NativeEventDispatcher duplicated registration,
tombstone removal, nested iteration, owner detachment and lifetime-token
handling. Any future dispatch fix had to preserve the same invariants in
two implementations, including callbacks destroying and reconstructing a
dispatcher at the same address.

Introduce the small internal EventDispatchState<Filter> class and move
the list, depth and lifetime token into it. Both dispatchers now adapt their
existing callback signatures and pass the appropriate filter owner member.
Keep registrations independent between channels. Replace the Windows hot
path's direct list inspection and the app master's direct depth/list check
with state queries, retaining their existing empty-list and cleanup policy.

New filters still participate in the current delivery. Removals leave null
slots until the outermost frame returns. Consumption short-circuits, while
owner destruction invalidates a per-lifetime token and stops all remaining
frames before any further state access. No iterator or list reference is
retained across callbacks. AppNativeEventFilter keeps its existing Qt-wide
installation/unsubscription lifecycle, including reuse of an empty master
after the final subscriber destroys itself during dispatch.

The user authorized ABI changes to prioritize consolidation. Replace the
old protected list/depth/token members rather than retaining compatibility
aliases or duplicate storage. Existing callable dispatcher interfaces are
unchanged, but consumers using private members must adapt and rebuild;
no cross-version private binary compatibility guarantee is made. Install
the new private header with the existing private dispatcher headers.

Expand behavior tests for a filter independently registered in both channels
and final app-subscriber destruction in direct/nested callbacks returning
either true or false. The expanded 28-pass dispatch suite also passed before
the refactor, establishing preservation rather than claiming a new bug fix.
Installed-package consumers now include and instantiate both dispatchers,
checking that the common state header and dependencies are shipped.

Validation on Windows 11/MSVC with Qt 6.12.0, Release:
- Shared and static Core/Widgets/Quick and fast-test targets built.
- All 13 fast CTest suites passed in each build, with enforced exact pass
  counts and no skips/expected failures. This includes dispatch destruction,
  immediate address reuse, attribute reentrancy/replay, agents and real QML.
- windows.windowproc and windows.windowlifetime passed (15 and 23 passes),
  covering native messages and callback-driven context/WinId destruction.
- testpolicy.timeouts passed.
- Staged install and CMake consumer compile/link passed. MSBuild FileTracker
  initially failed with E_ACCESSDENIED inside the sandbox, including with
  the developer environment loaded; the same bounded tests passed outside
  the sandbox with authorized access, without skipping compiler checks.
- git diff --check passed; no old state-member references remain. Static
  review covered destruction ordering, nested cleanup, the member-pointer
  adapters, callback captures and Qt-version-dependent native result types.

Existing optional Vulkan-header configure notices and LNK4075 manifest
warnings remain. Qt 5 builds and native Linux/macOS runs were unavailable;
the helper adds no platform API or new Qt-version-dependent operation.
FIX-013 is removed from the local-only plan after these checks; unrelated
platform acceptance items remain open. No submodule changes are included.
…macOS

Windows and macOS duplicated their subscriber set, owner-guard snapshot,
membership checks and notification revision. Keeping these paths separate
made reentrant lifetime fixes easy to apply inconsistently.

Introduce the private StyleAgentRegistry and use it in both platform paths.
It owns the QSet and revision and captures guarded owners before delivery.
Advance the revision before reading the platform appearance so reentry
during sampling cannot publish a stale snapshot. Preserve the QSet key and
iteration policy, defer agents added during delivery to a later snapshot,
and reject removed/destroyed owners even when addresses are reused.
Publish theme/accent as one local value pair through the existing per-agent
notification implementation.

Keep platform value readers, initial sampling, native subscription order
and cleanup in their platform files. Windows deferred uninstall and macOS
distributed-observer release behavior are unchanged. The asynchronous Linux
portal and StyleAgent's per-agent notification logic are unchanged. ABI
changes were authorized, but this extraction needs no public layout change,
compatibility shim or duplicated state.

Add nine common-registry cases covering paired values, deduplication,
creation/deletion during delivery, final-agent destruction, live-owner
unregistration, owner address reuse, nested snapshots, pending accent
notification and reentry during sampling. Expected outcomes do not depend
on QSet order. Add a Windows native-message suite using real hidden HWNDs,
SendMessageW, production StyleAgents and production application native
subscriptions. Cache invalidation makes refresh observable without changing
system settings. It covers four accepted message types, direct/nested
last-subscriber destruction, reinstallation and replacement while uninstall
is pending. Require the suite in Windows CI, including the static job.

Validation on Windows 11 build 26200, MSVC and Qt 6.12.0, Release:
- Built Core, Widgets, Quick and relevant tests in shared and static builds.
- core.styleagent.unit: 20 passes in each build, zero failures/skips.
- core.portalstyle.component: 25 passes in each build, zero failures/skips.
- windows.styleagent: 9 passes in each build, zero failures/skips.
- testpolicy.timeouts passed in both builds. Native execution has a
  15-second inner / 20-second CTest deadline with exact pass-count checking.
- git diff --check passed. Static review verified guarded snapshot lifetime,
  revision-before-read ordering, membership and owner checks, unchanged
  platform subscription/teardown, Qt 5-compatible operations, and exclusion
  of Linux portal code from the synchronous registry.

Existing optional Vulkan-header notices and LNK4075 manifest warnings remain.
The Windows test verifies native message delivery/subscriptions; it does not
toggle OS settings, inject physical input or inspect pixels. Common tests
control subscription boundaries and values and do not stand in for macOS.
No macOS SDK/desktop, Qt 5 run or native Linux environment was available.
Document the required macOS build and observer acceptance; FIX-014 remains
open in the local-only plan, specifically including observer release during
callbacks and later resubscription. No new macOS UI job or submodule change
is included.
FIX-015: WindowAgentBasePrivate, WidgetWindowAgentPrivate and
QuickWindowAgentPrivate each declared an empty init() called only by their
agent constructor. QtWindowContext::virtual_hook only forwarded to the
AbstractWindowContext implementation. These extra entry points obscured
initialization and dispatch without providing behavior.

Remove the empty declarations, definitions and constructor calls together.
Keep the base constructor's q_ptr assignment and all meaningful style-agent
initialization. Inherit the abstract context hook implementation directly;
make the X11/Wayland default fallback target explicit. Also drop the unused
QPainter include from the generic Widgets implementation.

This deliberately removes the exported private WindowAgentBasePrivate::init
symbol, plus the static QtWindowContext hook definition. Private consumers
that reference these removed definitions need source adjustment/rebuilding;
this change does not preserve their binary compatibility. No data members or
virtual slots are removed. Public agent APIs remain unchanged.

Validation of the round-13 cleanup tree on Windows 11 build 26200, Qt 6.12.0,
MSVC x64 Release:
- Built Core/Widgets/Quick and relevant tests in native shared, native static,
  shared system-borders-off and shared force-Qt-context configurations.
- All 13 fast CTest suites passed in each configuration, including agent,
  Qt context, dispatch, geometry and QML regressions.
- Both fallbackcursor platforms and testpolicy.timeouts passed in all four
  configurations. Shared/static widgetborder, five quickborder configurations
  and windows.borderattributes passed. Test runners enforce expected pass
  counts without skipped/expected-failure cases.
- Staged shared/static installations and rebuilt their CMake consumers,
  including the installed private-header consumer: 2/2 tests in each tree.
- Compared decorated DLL exports: Core 114 -> 113, only the private init
  removed; Widgets 43 -> 43 and Quick 44 -> 44 unchanged. Static Core symbol
  inspection confirms both removed definitions are absent.
- Reviewed repository consumers, constructors, inherited hook dispatch,
  platform branches and generated builds; git diff --check passed.

These checks were run together with the adjacent dead-border cleanup. No
new mirror tests were added for empty code. Qt 5, Linux/X11/Wayland, macOS,
other compilers and external private consumers were not built or tested.
Linux fallback edits were reviewed statically, not treated as native tests.
FIX-016: Windows10BorderHandler retained unused drawBorderEmulated,
drawBorderNative and borderThickness wrappers. The emulated hook's only
production caller was the unused wrapper; its QPainter implementation was
obsolete. Keeping these paths made border ownership harder to follow.

Remove those wrappers and the emulated Win32 hook implementation, unused
painting includes and a stale commented-out margin call. Include QRegion
and QEvent directly where they are still needed. Reserve the old emulated
hook enumerator so all existing hook numbers stay unchanged.

Retain the active native draw hook and the shared native drawing helper:
Widgets invokes the hook directly and Quick uses native drawing plus its
scene-graph color path. Activation, margins, geometry and color logic are
unchanged. Private source consumers of the deleted inline helpers must
adapt; invoking the reserved emulated hook no longer draws anything. The
round's only DLL export removal is the preceding private init cleanup.

Validation of the combined round-13 cleanup on Windows 11 build 26200 with
Qt 6.12.0/MSVC x64 Release:
- Core/Widgets/Quick rebuilt in native shared/static, shared borders-off and
  shared force-Qt-context configurations; 13 fast suites passed per tree.
- Shared/static: widgetborder.lifetime, quickborder software scales 1, 1.25,
  1.5 and 2, quickborder.native.d3d11, windows.borderattributes, both
  fallbackcursor platforms and timeout policy all passed (10 tests/tree).
- Borders-off/force-Qt: both fallbackcursor platforms and timeout policy
  passed (3 tests/tree). Runners check expected passes and reject skips.
- Shared/static installation and CMake consumer rebuild passed (2 tests/tree).
- Rechecked all draw-hook consumers and enum order; inspected export/static
  symbol differences and ran git diff --check. No duplicate behavior tests
  were added solely for removing dead code.

Native Quick surface lifecycle uses D3D11 on this Windows 11 host. Controlled
border-handler tests do not establish Windows 10 pixel/rendering acceptance;
that existing platform requirement remains open. Qt 5, Linux/macOS, older
Windows versions and downstream private patches were not tested. Tests did
not require network access, but network isolation was not enforced/verified.
QWindowKit only reads three DWORD registry settings, but WindowsRegistryKey
maintained separate implementations and QWinRegistryKey adapters across Qt
5.14, 6.8.1 and 6.10.1. Replace this compatibility class with the internal
readRegistryDword function and migrate ColorPrevalence, AppsUseLightTheme and
AccentColor. Query type, data and length in one Win32 operation, close the key
before returning, and represent missing/unreadable/wrong-type or malformed
values with nullopt. Valid zero remains distinguishable from failure. Retain
the callers' existing default behavior and accent channel conversion.

Remove unused size/rectangle/margin/string helpers, synonymous Windows version
queries, the isolated Windows-10-only query pair, unused inline/color macros,
and the never-called uxtheme ordinal 104/133 pointers and resolution. Retain
DwmFlush, active conversion helpers, layout-sensitive native structures and
legacy material support. Declare advapi32 for Core and static qmake consumers;
include cwchar directly instead of relying on the removed Qt private header.

Add a Windows-only production-linked registry suite with 13 business cases
(15 required Qt Test passes): zero/nonzero/full unsigned DWORD values, wrong
types, short/oversized/empty DWORD data, Unicode key/value names, missing
keys/values and updates/deletion. Each case owns a unique temporary HKCU leaf
and cleans it up; personalization settings are not modified. Require suite
registration in Windows shared/static/MinGW CI configurations. Update the fast
suite inventory, including the existing 18 agent cases per UI module.

Compatibility: downstream users of the removed WindowsRegistryKey or private
helpers must rebuild and migrate their source. The Qt < 5.14 exported registry
class is intentionally removed; ABI changes are allowed. Supported Qt/Windows
baselines and the public window/style agent behavior are not raised or changed.
Malformed DWORD lengths are now explicitly rejected. This is primarily a
refactor/dead-code cleanup, not a claim of a pre-change reproduced UI defect.

Validation on Windows 11 build 26200, MSVC 14.51 and Qt 6.12.0:
- Full Release Core/Widgets/Quick, examples and tests: shared and static built.
- Debug shared Core/Widgets/Quick and registry test built.
- Final shared Release: 17/17 CTest entries passed, including registry, style,
  acrylic/effects, border attributes, Widgets lifetime, Quick software/D3D11
  borders, timeout policy and installed CMake/qmake/MSBuild consumers.
- Final static Release: the same 17/17 entries passed.
- Final shared Debug registry test: 1/1 CTest entry, all 15 Qt Test passes.
- Reference searches found no remaining removed identifiers in source, tests,
  examples or install scripts; git diff --check passed. Reviewed handle closure,
  conditional defaults, remaining dynamic API use and static link dependencies.

Not validated: Qt 5, older Qt 6 registry-based theme/accent branches, older
Windows versions, Linux/macOS builds or hosted CI. Keep those compatibility
acceptance items pending; current Windows 11/Qt 6.12 tests do not replace them.
The Widgets and Quick agents stored a second host pointer solely to reject
repeated setup and construct Windows borders, although their context already
owns the same host association. WindowItemDelegate::window had no callers,
and WindowAgentBasePrivate::createContext had no overriding implementations.

Remove the dead delegate virtual member, both production implementations and
the fixture override. Keep hostWindow, whose Quick host type differs from
the removed item query. Use the completed context as the single-use setup
guard and obtain typed border hosts directly from context->host(). Remove
both duplicate fields. Make createContext nonvirtual while retaining the
factory callback used by tests and the virtual private destructor.

Preserve null-input handling, context publication after setup, backend
selection and handler-before-context destruction. Add regression coverage
for setup rejection after host destruction and null inputs in release builds.
Update exact expected case counts to 19 per enabled UI module. These are
behavior-preservation checks for a refactoring, not a claimed bug fix.

Compatibility: this intentionally changes private-class layouts and vtables
in installed headers. Rebuild Core, Widgets, Quick and downstream binaries
together. Downstream private delegates must remove obsolete window overrides;
private createContext overrides must use the retained factory callback instead.
Code accessing removed private host fields must use context->host() with the
correct type. Public agent APIs and minimum Qt requirements are unchanged.

Validation on Windows 11 build 26200, Qt 6.12.0 and MSVC 14.51:
- Full Release shared and static library/test builds passed; the shared build
  also rebuilt examples. Debug agent test and its module dependencies rebuilt.
- Shared and static Release each passed 17 related CTest suites: timeout
  policy, agents, abstract/fallback context, Quick geometry and button area,
  QML system buttons, widget border lifetime, native Windows window procedure,
  window lifetime and titlebar, installed QML consumer, four software-border
  scales and the D3D11 native-border lifecycle path.
- Shared and static Release each passed all four install/CMake/qmake/MSBuild
  consumer checks. Debug agents.unit passed. Qt Test wrappers enforce exact
  pass counts and reject skips; agents.unit has 40 passes including fixtures.
- Static review found no remaining removed-interface consumers or duplicate
  agent host fields; git diff --check passed. Factory selection, initialization
  order and derived-private destruction were reviewed without further changes.

Qt 5, other Qt releases, Linux/macOS and older Windows were not run in this
round. Forced Windows 10 border component coverage on Windows 11 is not a
claim of Windows 10 DWM visual acceptance. The earlier platform acceptance
items remain in the local plan. No submodule changes or local audit/plan
documents are included in this commit.
The attribute setter and replay path supplied an oldAttribute argument that
no production override consumed. Legacy Acrylic also duplicated the same
margins-first effect transaction used by Mica and DWM blur, including the
revision and lifetime checks needed after synchronous native callbacks.

Remove the third callback argument across Abstract, Win32, Cocoa and every
in-tree test override. Remove the unused old-value snapshot and assertions
about that internal argument while retaining all existing behavioral cases.
Key/value snapshots, the previous committed cache, success-only commits,
same-key supersession, ordered revision-aware replay and HWND generation
checks remain intact.

Route legacy Acrylic through applyEffect and reuse materialMargins and
restoredMargins. Parameterize only the diagnostic name so Acrylic retains
its exact rollback warning. Keep margins-before-policy ordering, preservation
of newer extra-margins writes, material revision ownership after rollback
failure, and the existing workaround timing. Modern Acrylic still queries
and writes the backdrop before margins and restores the backdrop on failure.
Retain private accent state 4, luminosity flags 482 and the legacy Mica path.

Add four Acrylic reentrancy rows for nested Mica writes at both native stages
on modern and forced legacy paths. Assert the inner cache, native effect and
margins win; increase the checked Acrylic pass count from 92 to 96 with Quick
(and 90 to 94 without Quick). This is behavior-preserving simplification,
not a newly reproduced defect; no pre-change failure is claimed.

Compatibility: windowAttributeChanged is in installed private headers. Its
virtual signature and exported symbols change, requiring downstream private
subclasses to remove the third parameter and all binary consumers to rebuild.
The public WindowAgent API and minimum Qt/system versions are unchanged.

Validation on Windows build 26200, MSVC and Qt 6.12.0:
- Full shared Release/Debug and static Release Core, Widgets, Quick and test
  builds passed; shared examples rebuilt. MSBuild required execution outside
  the sandbox after its file tracker initialization failed inside it.
- Each configuration passed 12 selected CTest entries: windowcontext,
  acrylic, effects, borderattributes, windowlifetime, widgetborder, all five
  quickborder variants and timeout policy. Checked Qt Test totals include
  60/96/205/42/23/15 for those first six suites, with no skips or failures.
- Shared/static Release install plus CMake, qmake and MSBuild consumer tests
  passed (4 entries each). Installed private headers have matching signatures.
- Static review covered every override/caller, cache/replay ordering, callback
  destruction, frame/material revisions, rollback and platform version paths;
  no oldAttribute/oldValue references remain in src or tests. Diff check passed.

Limits: injected failure/reentrancy cases are component checks on real HWNDs.
Current-host native Acrylic/Effects API checks, including forced compatibility
paths, do not establish old-Windows or material pixel/visual acceptance.
Quick border software pixel/D3D lifecycle checks do not validate material
appearance. No system-input or enforced-offline acceptance was performed.
Qt 5 and Cocoa/macOS builds and native behavior were unavailable; Cocoa was
reviewed statically only. FIXPLAN.md is maintained locally and excluded.
StyleAgentPrivate::init only forwarded to setupSystemThemeHook, while the
single-property notification wrappers had no production callers. They added
private entry points and let tests exercise a different interface from the
registry and Portal production publishers.

Call setupSystemThemeHook directly from the owning StyleAgent constructor
after assigning q_ptr. Remove init, notifyThemeChanged and
notifyAccentColorChanged from the private declaration and implementation.
Migrate every StyleAgent/Portal test call to notifyAppearanceChanged, passing
the current value of the unchanged property through the public getter.
Strengthen the existing single-property cases with non-default companion
values and assertions that the companion signal is not emitted.

The production publication algorithm is unchanged: both getters commit the
same snapshot before signals, equal snapshots are suppressed, pending accent
notifications survive nested theme-only updates, and owner deletion ends
delivery. Registry revision/snapshot/membership checks, platform subscription
ordering and the independent asynchronous Portal state machine are retained.

Compatibility: three methods are removed from the installed private
StyleAgentPrivate header; private source consumers must publish paired
snapshots or call setupSystemThemeHook at their existing initialization site.
Rebuild consumers that use these internals. Public StyleAgent signatures,
signals, object layout and minimum Qt/system requirements are unchanged.

Validation on Windows build 26200, Qt 6.12.0 and MSVC:
- Full shared Release/Debug and static Release builds passed, including Core,
  Widgets, Quick, tests and shared-build examples.
- Each configuration passed core.styleagent.unit (20 cases),
  core.portalstyle.component (25 cases), windows.styleagent (9 cases) and
  testpolicy.timeouts, with exact expected counts and no skips/failures.
  Coverage includes paired getters, deduplication, nested publication,
  pending accent, callback deletion, subscription changes and address reuse.
- Shared/static Release install and CMake/qmake/MSBuild consumer checks each
  passed all 4 entries. Native Windows tests exercised actual HWND messages
  and subscription teardown/recreation without changing system settings.
- Reviewed all platform setup/removal paths and publication callers; no removed
  wrapper references remain in src or tests. Diff whitespace check passed.

This is behavior-preserving cleanup; no pre-change defect failure is claimed.
Portal results use the existing injected source and do not establish real
Linux DBus/Portal acceptance. Qt 5 and macOS builds/native observer tests were
unavailable on this Windows host. No system-input, visual or enforced-offline
acceptance was performed. FIXPLAN.md remains local and is not committed.
The Qt 6 X11 system-menu path used DefaultRootWindow macros backed by local
copies of Xlib Screen and private Display layouts. Its only need for those
copies was reading the root of the default screen, unnecessarily coupling
menu dispatch to internal Xlib field offsets.

Add the Window (*)(Display *) XDefaultRootWindow function pointer to X11API,
resolve it through the existing QLibrary loader and require it in isValid.
Fetch the menu destination through that function and delete the copied
Screen/Display structures, their auxiliary declarations and all three
layout-access macros. Preserve the XClientMessageEvent and XEvent layouts
needed for sending the client message.

The requested window, _GTK_SHOW_WINDOW_MENU atom, format, button, DPR-rounded
coordinates, masks and ungrab/send/flush order are unchanged. A missing new
symbol leaves the API invalid, so createContext follows its existing
QtWindowContext fallback instead of selecting X11Context. No direct X11
linking, new development-package requirement or minimum Qt/system version
change is introduced; the implementation remains guarded by Qt >= 6.

Compatibility: the private X11API structure gains a pointer, so consumers
using its installed private header must rebuild and any custom API tables
must populate the new entry before isValid can succeed. Removed layout
declarations were translation-unit-local; public WindowAgent APIs do not
change. The official Xlib reference specifies the same default-screen root
semantics and Window return type for XDefaultRootWindow:
https://xorg.freedesktop.org/archive/current/doc/libX11/libX11/libX11.html

Validation and limits:
- Static review traced dynamic resolution, API validity, factory selection,
  fallback and the sole root-window call. No private Display/Screen layout
  accesses or helper macros remain in src/tests. Message ABI declarations
  and payload/order were checked against the prior implementation.
- Shared Release/Debug and static Release Windows builds passed with these
  changes present, including Core/Widgets/Quick and consumers; shared/static
  install plus CMake/qmake/MSBuild consumer checks each passed 4 entries.
  These establish non-X11 compatibility only: Windows does not compile or
  execute the X11 backend. Diff whitespace check passed.
- The host has no installed WSL/Linux environment or available Qt 5/macOS
  toolchain. Linux Qt 6 compilation, real xcb target/coordinate/order checks,
  missing-symbol integration fallback and Linux consumer rebuilds were not
  run. Qt 5 guards and unchanged platform selection were reviewed statically.
- No Linux/macOS UI job, platform substitute or implementation-mirroring test
  was added for this small refactor; no runtime defect or pre-change failing
  test is claimed. Platform gaps are recorded here under the plan's explicit
  platform-unavailability rule. FIXPLAN.md remains local and uncommitted.
With ENABLE_WINDOWS_SYSTEM_BORDERS=OFF, winIdChanged unconditionally wrote
extra-margins=(1,1,1,1) for every new HWND. Recreating a window therefore
replaced the user's cached margins and moved the default to the end of the
successful-write replay order, overwriting margins required by materials.
The same initializer existed before the current Context interface refactor.

Install the shadow-enabling default only if extra-margins has no cached
value. Keep explicit user values and their revisions/order for the normal
attribute replay, including when a material replay fails. The initial default
and the existing callback lifetime/generation checks remain unchanged.
Add explicit cache-preservation assertions to the existing Acrylic/Effects
replay cases without removing or skipping any cases. No public/private API
or ABI change is introduced by this fix.

Validation on Windows build 26200, MSVC, Qt 6.12.0:
- Before this fix, the round-six working tree with system borders disabled
  reproduced 12 Acrylic and 24 Effects case failures, with the last native
  margins reset to (1,1,1,1). The failing initializer was also checked in HEAD.
- After the fix, the same no-borders configuration passed Acrylic (96 cases),
  Effects (205), window lifetime/actions (26), core windowcontext,
  core qtwindowcontext, agents and timeout policy: all 7 CTest entries passed,
  with expected counts and no skips. This includes real HWND recreation,
  controlled API failure/reentry and native API calls.
- Shared Release/Debug and static Release builds passed with the concurrent
  round-six migration; their related native suites are validated together.
  The staged change is limited to the initializer and two replay assertions;
  the independent interface migration is committed separately.
- Static review checked default initialization, cache ordering, failed replay,
  and unchanged lifetime/generation guards. Diff whitespace check passed.

No material/shadow pixel acceptance, old-Windows or Qt 5 runtime acceptance
is claimed. Native setter success and current-host compatibility paths do not
establish those results. FIXPLAN.md and local validation logs are excluded.
…umers

The private WindowContextHook enum routed unrelated operations through an
integer and void pointer, including a color-map query with no callers and
an unimplemented emulated-border entry. Widgets duplicated event forwarding,
and the macOS Quick agent duplicated the observed button-area item pointer.

Replace the enum and virtual_hook with typed virtual operations for window
centering, raising and system menus, macOS button-area updates, and Windows
border color, temporary activation and native drawing. Migrate Abstract,
Win32, Cocoa, X11, Wayland, WindowAgentBase, both UI modules and all test
subclasses in one buildable change. Retain Abstract no-op/invalid-color
fallbacks and native branch guards. Delete the dead color-map branches and
kSampleColorSet, retaining kWindowsColorSet for live border rendering.
Remove unused painter/region dependencies and add direct QColor/config includes.

Merge Widget/QWindow painting forwarding with explicit receiver/currentFilter
arguments. Keep filter order, event consumption, spontaneous-flag reset,
handler/receiver/context guards and drawing after Qt painting. Remove the
constructor and WindowStateChange calls to the empty Widget updateGeometry;
retain the shared-interface override. UI consumers continue to use Abstract
Context virtuals without casts to Win32WindowContext.

Make the macOS Quick agent own a typed QuickSystemButtonArea and obtain the
item through handler->item(). Remove the duplicate QPointer, provide the
complete handler type at the out-of-line constructor/destructor definition,
and preserve destruction before the base context. Keep duplicate registration,
item-destroyed/handler-still-present cleanup, custom callbacks, reattachment
and guarded geometry notifications. The observer itself is unchanged.

Add three native public-agent action cases: centering preserves size, raising
a hidden window shows it, and raising a minimized window restores it. Keep
all existing cases and increase the window lifetime expected total from 23
to 26. The isolated minimized case supplies a foreground window and checks
that prerequisite explicitly; it does not inject input or assert OS focus
ownership. Existing fallback, event, menu, border and Quick observer cases
now exercise the retained typed production boundaries.

Compatibility: this intentionally changes the exported Abstract Context
vtable/symbols and removes the installed private hook enum. All binary
consumers must rebuild. Private subclasses/callers must migrate each former
hook to the corresponding named method; border color is returned as QColor,
activation takes bool, menus take const QPoint&. The macOS private Quick
layout also changes. Public WindowAgent APIs and minimum Qt/system versions
remain unchanged.

Validation on Windows build 26200, Qt 6.12.0 and MSVC:
- Full shared Release/Debug, static Release, borders-disabled Release and
  forced-Qt-context Release builds passed for Core/Widgets/Quick and tests;
  shared examples rebuilt. No new compiler warnings were reported.
- Shared Release/Debug and static Release each passed 27 selected CTest
  entries covering Context, dispatch/lifetime/filtering, agents, cursor,
  native window/menu/effects/hittest, Widgets border, Quick geometry/area,
  real QML system buttons, software border pixels at four scales, D3D border
  lifecycle and timeout policy. Existing case counts were preserved.
- After adding native actions and the separately committed borderless-margin
  fix, all three configurations passed final windowlifetime (26 cases),
  Acrylic (96), Effects (205) and borderattributes (42) suites. Counts and
  no-skip policies were enforced by the existing runners.
- Forced Qt fallback passed 14 selected tests. Borders-disabled validation
  initially exposed the pre-existing margins overwrite fixed separately;
  its final 7 selected tests all passed without skips.
- Shared/static install plus CMake/qmake/MSBuild and installed-QML consumer
  validation passed 5 entries each. DLL export inspection confirmed named
  Abstract operations and no virtual_hook export.
- Static review covered platform overrides/fallbacks, Qt version branches,
  native payload/order, ownership and event forwarding guards. No old hook
  IDs/dispatch, sample colors or duplicate Quick item state remain in src/tests.
  Diff whitespace checks passed.

Limits: the sandbox provided no foreground window and failed the explicit
native prerequisite; the final native action suites passed on the real
outside-sandbox desktop. Foreground/z-order policy and system-input acceptance
are not claimed. Windows 10/older-Windows DWM visuals, Qt 5, macOS builds and
native Quick registration/callback behavior, and X11/Wayland builds/menus
remain untested on this host. Windows observer components are not macOS
acceptance; native API calls are not material/shadow pixel acceptance. No
enforced-offline acceptance was performed. The pure refactor has no claimed
pre-change defect failure; the independently reproduced margins defect is
in the preceding commit. Local FIXPLAN and audit reports are not committed.
@wangwenx190 wangwenx190 self-assigned this Sep 23, 2026
@JulienMaille

Copy link
Copy Markdown
Contributor

Wow so many fixes!?

@wangwenx190

Copy link
Copy Markdown
Collaborator Author

Wow so many fixes!?

Some cleanups and refactorings are also included, not just bug fixes. And most bug fixes are just some edge cases which may never happen in reality.

@wangwenx190

Copy link
Copy Markdown
Collaborator Author

Also many of the commits are just adding new unit tests

@wangwenx190

Copy link
Copy Markdown
Collaborator Author

some commits have been cherry-picked to main branch, and I'm still verifying the rest

@wangwenx190
wangwenx190 marked this pull request as draft October 9, 2026 08:34
@wangwenx190 wangwenx190 changed the title Some bug fixes DO NOT MERGE: some bug fixes pending to verify and merge Oct 9, 2026

This branch has not been deployed

No deployments
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.

2 participants