You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "1625567290 (via GitHub)" <gi...@apache.org> on 2026/08/22 07:49:52 UTC
[PR] fix(desktop): resync renderer after Windows maximize [maka]
1625567290 opened a new pull request, #3472:
URL: https://github.com/apache/maka/pull/3472
## Summary
- Re-run Electron's root view layout after a native Windows maximize so the primary renderer fills the new client area.
- Coalesce maximize and resize notifications, and skip work after restore or teardown.
- Add focused coverage for platform gating, event coalescing, layout/repaint order, and destroyed-window guards.
Fixes #3416
## Verification
- `npm --workspace @maka/desktop run typecheck`
- Windows maximize renderer sync tests: 4/4 passed.
- Desktop suite on the refreshed base: 1095/1096 passed. The only failure was the existing shell environment timeout test reading its temporary PID file before creation under full-suite concurrency.
- Re-ran `apps/desktop/dist/main/__tests__/shell-env.test.js` three times in isolation: 12/12 passed on every run.
## Validation limit
The current host is macOS, so the packaged Windows 11 maximize transition still needs Windows CI or a Windows machine for final visual confirmation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han merged PR #3472:
URL: https://github.com/apache/maka/pull/3472
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "1625567290 (via GitHub)" <gi...@apache.org>.
1625567290 commented on PR #3472:
URL: https://github.com/apache/maka/pull/3472#issuecomment-5384593403
@Astro-Han Both new P3s are addressed in `dbd401e15` and replied to inline. The branch is also rebased onto current `main` (`6ada6b546`).
Post-rebase local validation is green: workspace dependency build, Desktop main-process build, maximize sync and Windows harness tests (43/43), Desktop typecheck, lint, format, ASF headers, and diff checks.
The new-head `CI` and `Release Windows check` runs are both `action_required`; please approve them so the exact-head checks can run.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "1625567290 (via GitHub)" <gi...@apache.org>.
1625567290 commented on code in PR #3472:
URL: https://github.com/apache/maka/pull/3472#discussion_r3837521903
##########
apps/desktop/src/main/__tests__/windows-maximize-renderer-sync.test.ts:
##########
@@ -0,0 +1,105 @@
+import assert from 'node:assert/strict';
+import { describe, it } from 'node:test';
+import {
+ createWindowsMaximizeRendererSync,
+ type MaximizedRendererSyncWindow,
+} from '../windows-maximize-renderer-sync.js';
+
+function createFixture() {
+ const calls: string[] = [];
+ const deferred: Array<() => void> = [];
+ let destroyed = false;
+ let maximized = true;
+ let webContentsDestroyed = false;
+ const contentView = {};
+ const window: MaximizedRendererSyncWindow<object> = {
+ contentView,
+ webContents: {
+ isDestroyed: () => webContentsDestroyed,
+ invalidate: () => calls.push('invalidate'),
+ },
+ isDestroyed: () => destroyed,
+ isMaximized: () => maximized,
+ setContentView: (view) => {
+ assert.equal(view, contentView);
+ calls.push('layout');
+ },
+ };
+
+ return {
+ calls,
+ deferred,
+ window,
+ defer: (callback: () => void) => deferred.push(callback),
+ setDestroyed: (value: boolean) => { destroyed = value; },
+ setMaximized: (value: boolean) => { maximized = value; },
+ setWebContentsDestroyed: (value: boolean) => { webContentsDestroyed = value; },
+ };
+}
+
+describe('Windows maximize renderer sync', () => {
+ it('defers one root layout and repaint for a maximized Windows window', () => {
+ const fixture = createFixture();
+ const schedule = createWindowsMaximizeRendererSync(fixture.window, {
+ platform: 'win32',
+ defer: fixture.defer,
+ });
+
+ schedule();
+ schedule();
+ assert.equal(fixture.deferred.length, 1);
+ assert.deepEqual(fixture.calls, []);
+
+ fixture.deferred.shift()?.();
+ assert.deepEqual(fixture.calls, ['layout', 'invalidate']);
Review Comment:
Addressed. The Windows release check now runs the packaged app through a native restore β maximize β restore smoke. It reads `GetClientRect` and `IsZoomed` from the real HWND, reads the renderer viewport through CDP, and verifies DPR plus `html`/`body`/`#root`/`.appFrame` alignment against the native client bounds. The macOS helper and harness coverage is green; the new Windows workflow run is currently waiting for maintainer approval.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "1625567290 (via GitHub)" <gi...@apache.org>.
1625567290 commented on PR #3472:
URL: https://github.com/apache/maka/pull/3472#issuecomment-5385885431
@Astro-Han Rebased once more onto current `main` (`a2f2a1afa`) after the branch drifted into conflict. The new head is `d95e89c5f`, and GitHub reports it mergeable.
The verifier conflict was resolved by retaining both the current rollback-registration coverage from `main` and this PR's maximize/renderer coverage.
Exact-head local validation:
- Desktop workspace dependencies and main-process build
- maximize renderer-sync tests: 5/5
- Windows harness tests: 39/39
- Desktop typecheck
- ASF header check
- `git diff --check`
Fresh exact-head checks should be created for this push.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "1625567290 (via GitHub)" <gi...@apache.org>.
1625567290 commented on code in PR #3472:
URL: https://github.com/apache/maka/pull/3472#discussion_r3837838762
##########
apps/desktop/src/main/windows-maximize-renderer-sync.ts:
##########
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export interface MaximizedRendererSyncWindow<ContentView = unknown> {
+ readonly contentView: ContentView;
+ readonly webContents: {
+ isDestroyed(): boolean;
+ invalidate(): void;
+ };
+ isDestroyed(): boolean;
+ isMaximized(): boolean;
+ setContentView(view: ContentView): void;
+}
+
+interface MaximizedRendererSyncOptions {
+ platform?: NodeJS.Platform;
+ defer?: (callback: () => void) => void;
+}
+
+/**
+ * Re-runs Electron's root view layout after a native Windows maximize.
+ *
+ * Electron's BrowserWindow WebContentsView and the public contentView are
+ * siblings under one default-fill root view. Re-applying the same contentView
+ * makes Electron invalidate and immediately lay out that root without changing
+ * the native window bounds or its restored bounds. The repaint then covers the
+ * newly maximized client area.
+ */
+export function createWindowsMaximizeRendererSync<ContentView>(
+ window: MaximizedRendererSyncWindow<ContentView>,
+ options: MaximizedRendererSyncOptions = {},
+): () => void {
+ const platform = options.platform ?? process.platform;
+ const defer = options.defer ?? setImmediate;
+ let pending = false;
+
+ return () => {
+ if (platform !== 'win32' || pending) return;
+ if (window.isDestroyed() || !window.isMaximized()) return;
+ pending = true;
+
+ defer(() => {
Review Comment:
Addressed in `dbd401e15`. The deferred callback now clears `pending` before entering a `try`/`catch`, catches guard and native layout/invalidation failures, and reports them through an injectable error reporter (defaulting to a Desktop warning) instead of allowing an uncaught exception. The new regression test proves the callback does not throw, reports the exact error, and remains schedulable afterward.
##########
scripts/verify-packaged-app.mjs:
##########
@@ -353,6 +353,268 @@ export async function waitForUsableRenderer(
}
}
+const WINDOW_LAYOUT_EXPRESSION = `(async () => {
+ await new Promise((resolve) => requestAnimationFrame(() => resolve()));
+ const rect = (selector) => {
+ const element = document.querySelector(selector);
+ if (!element) return null;
+ const bounds = element.getBoundingClientRect();
+ return {
+ x: bounds.x,
+ y: bounds.y,
+ width: bounds.width,
+ height: bounds.height,
+ };
+ };
+ return {
+ devicePixelRatio: window.devicePixelRatio,
+ innerWidth: window.innerWidth,
+ innerHeight: window.innerHeight,
+ outerWidth: window.outerWidth,
+ outerHeight: window.outerHeight,
+ documentWidth: document.documentElement.clientWidth,
+ documentHeight: document.documentElement.clientHeight,
+ visualViewportWidth: window.visualViewport?.width ?? null,
+ visualViewportHeight: window.visualViewport?.height ?? null,
+ screenAvailWidth: window.screen.availWidth,
+ screenAvailHeight: window.screen.availHeight,
+ html: rect('html'),
+ body: rect('body'),
+ root: rect('#root'),
+ appFrame: rect('.appFrame'),
+ };
+})()`;
+
+function dimensionsMatch(actual, expected, tolerance = 1) {
+ return Number.isFinite(actual) && Math.abs(actual - expected) <= tolerance;
+}
+
+export function rendererLayoutMatchesViewport(layout) {
+ if (!Number.isFinite(layout?.innerWidth) || layout.innerWidth <= 0) return false;
+ if (!Number.isFinite(layout?.innerHeight) || layout.innerHeight <= 0) return false;
+ if (!dimensionsMatch(layout.documentWidth, layout.innerWidth)) return false;
+ if (!dimensionsMatch(layout.documentHeight, layout.innerHeight)) return false;
+ if (!dimensionsMatch(layout.visualViewportWidth, layout.innerWidth)) return false;
+ if (!dimensionsMatch(layout.visualViewportHeight, layout.innerHeight)) return false;
+ for (const bounds of [layout.html, layout.body, layout.root, layout.appFrame]) {
+ if (!bounds) return false;
+ if (!dimensionsMatch(bounds.x, 0) || !dimensionsMatch(bounds.y, 0)) return false;
+ if (!dimensionsMatch(bounds.width, layout.innerWidth)) return false;
+ if (!dimensionsMatch(bounds.height, layout.innerHeight)) return false;
+ }
+ return true;
+}
+
+export function rendererViewportMatchesNativeClient(layout, nativeWindow) {
+ if (!rendererLayoutMatchesViewport(layout)) return false;
+ if (!Number.isFinite(layout.devicePixelRatio) || layout.devicePixelRatio <= 0) return false;
+ if (!Number.isFinite(nativeWindow?.clientWidth) || nativeWindow.clientWidth <= 0) return false;
+ if (!Number.isFinite(nativeWindow?.clientHeight) || nativeWindow.clientHeight <= 0) return false;
+ const widthScale = nativeWindow.clientWidth / layout.innerWidth;
+ const heightScale = nativeWindow.clientHeight / layout.innerHeight;
+ return (
+ dimensionsMatch(widthScale, heightScale, 0.01) &&
+ dimensionsMatch(widthScale, layout.devicePixelRatio, 0.05)
Review Comment:
Addressed in `dbd401e15`. The verifier no longer requires the native-to-renderer scale to equal `devicePixelRatio`; it now keeps the stable contract that the renderer tree fills its viewport and the native client width/height scales agree proportionally. A new `devicePixelRatio = 1.5` case covers a packaged environment that reports physical viewport pixels without weakening the stale-height rejection.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "1625567290 (via GitHub)" <gi...@apache.org>.
1625567290 commented on PR #3472:
URL: https://github.com/apache/maka/pull/3472#issuecomment-5379972915
Received. I'll handle it
π π
***@***.***
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #3472:
URL: https://github.com/apache/maka/pull/3472#discussion_r3837687627
##########
apps/desktop/src/main/windows-maximize-renderer-sync.ts:
##########
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export interface MaximizedRendererSyncWindow<ContentView = unknown> {
+ readonly contentView: ContentView;
+ readonly webContents: {
+ isDestroyed(): boolean;
+ invalidate(): void;
+ };
+ isDestroyed(): boolean;
+ isMaximized(): boolean;
+ setContentView(view: ContentView): void;
+}
+
+interface MaximizedRendererSyncOptions {
+ platform?: NodeJS.Platform;
+ defer?: (callback: () => void) => void;
+}
+
+/**
+ * Re-runs Electron's root view layout after a native Windows maximize.
+ *
+ * Electron's BrowserWindow WebContentsView and the public contentView are
+ * siblings under one default-fill root view. Re-applying the same contentView
+ * makes Electron invalidate and immediately lay out that root without changing
+ * the native window bounds or its restored bounds. The repaint then covers the
+ * newly maximized client area.
+ */
+export function createWindowsMaximizeRendererSync<ContentView>(
+ window: MaximizedRendererSyncWindow<ContentView>,
+ options: MaximizedRendererSyncOptions = {},
+): () => void {
+ const platform = options.platform ?? process.platform;
+ const defer = options.defer ?? setImmediate;
+ let pending = false;
+
+ return () => {
+ if (platform !== 'win32' || pending) return;
+ if (window.isDestroyed() || !window.isMaximized()) return;
+ pending = true;
+
+ defer(() => {
Review Comment:
**[P3] The deferred body has no `try`/`catch`, so a throw here becomes a main-process `uncaughtException`.**
```ts
defer(() => {
pending = false;
if (window.isDestroyed() || !window.isMaximized()) return;
if (window.webContents.isDestroyed()) return;
window.setContentView(window.contentView);
window.webContents.invalidate();
});
```
This runs on a `setImmediate` tick with no caller left on the stack, so nothing above it can catch. The three guards cover the states this module knows about, but `setContentView` and `invalidate` are native calls whose failure modes are Electron's, not ours β a window teardown landing between the guard and the call, or a native error on an unusual driver/DPI path, has nowhere to go but the process.
**Why it is P3:** the guards are genuinely good. I checked that `pending = false` is the **first** statement in the deferred body, before both early returns, so an early return can never strand the flag and permanently disable resync. That was the failure I went looking for, and it is not there.
**Why it is still worth a `try`/`catch`:** this is layout-polish code. Its entire job is making a repaint cover the newly maximized client area. **Cosmetic correction code should not be able to take the main process down**, and the asymmetry between what it does and what it can cost is the whole argument. A `catch` that swallows and logs leaves the worst case as "one maximize did not resync" β which is exactly the bug this file exists to soften.
*Independent line, verified at the gate: 2026-08-23 12:40 UTC.*
##########
scripts/verify-packaged-app.mjs:
##########
@@ -353,6 +353,268 @@ export async function waitForUsableRenderer(
}
}
+const WINDOW_LAYOUT_EXPRESSION = `(async () => {
+ await new Promise((resolve) => requestAnimationFrame(() => resolve()));
+ const rect = (selector) => {
+ const element = document.querySelector(selector);
+ if (!element) return null;
+ const bounds = element.getBoundingClientRect();
+ return {
+ x: bounds.x,
+ y: bounds.y,
+ width: bounds.width,
+ height: bounds.height,
+ };
+ };
+ return {
+ devicePixelRatio: window.devicePixelRatio,
+ innerWidth: window.innerWidth,
+ innerHeight: window.innerHeight,
+ outerWidth: window.outerWidth,
+ outerHeight: window.outerHeight,
+ documentWidth: document.documentElement.clientWidth,
+ documentHeight: document.documentElement.clientHeight,
+ visualViewportWidth: window.visualViewport?.width ?? null,
+ visualViewportHeight: window.visualViewport?.height ?? null,
+ screenAvailWidth: window.screen.availWidth,
+ screenAvailHeight: window.screen.availHeight,
+ html: rect('html'),
+ body: rect('body'),
+ root: rect('#root'),
+ appFrame: rect('.appFrame'),
+ };
+})()`;
+
+function dimensionsMatch(actual, expected, tolerance = 1) {
+ return Number.isFinite(actual) && Math.abs(actual - expected) <= tolerance;
+}
+
+export function rendererLayoutMatchesViewport(layout) {
+ if (!Number.isFinite(layout?.innerWidth) || layout.innerWidth <= 0) return false;
+ if (!Number.isFinite(layout?.innerHeight) || layout.innerHeight <= 0) return false;
+ if (!dimensionsMatch(layout.documentWidth, layout.innerWidth)) return false;
+ if (!dimensionsMatch(layout.documentHeight, layout.innerHeight)) return false;
+ if (!dimensionsMatch(layout.visualViewportWidth, layout.innerWidth)) return false;
+ if (!dimensionsMatch(layout.visualViewportHeight, layout.innerHeight)) return false;
+ for (const bounds of [layout.html, layout.body, layout.root, layout.appFrame]) {
+ if (!bounds) return false;
+ if (!dimensionsMatch(bounds.x, 0) || !dimensionsMatch(bounds.y, 0)) return false;
+ if (!dimensionsMatch(bounds.width, layout.innerWidth)) return false;
+ if (!dimensionsMatch(bounds.height, layout.innerHeight)) return false;
+ }
+ return true;
+}
+
+export function rendererViewportMatchesNativeClient(layout, nativeWindow) {
+ if (!rendererLayoutMatchesViewport(layout)) return false;
+ if (!Number.isFinite(layout.devicePixelRatio) || layout.devicePixelRatio <= 0) return false;
+ if (!Number.isFinite(nativeWindow?.clientWidth) || nativeWindow.clientWidth <= 0) return false;
+ if (!Number.isFinite(nativeWindow?.clientHeight) || nativeWindow.clientHeight <= 0) return false;
+ const widthScale = nativeWindow.clientWidth / layout.innerWidth;
+ const heightScale = nativeWindow.clientHeight / layout.innerHeight;
+ return (
+ dimensionsMatch(widthScale, heightScale, 0.01) &&
+ dimensionsMatch(widthScale, layout.devicePixelRatio, 0.05)
Review Comment:
**[P3] This DPR assertion looks specific to a 96-DPI runner and may fail on real high-DPI machines.**
```js
dimensionsMatch(widthScale, layout.devicePixelRatio, 0.05)
```
A real-machine verification run on Windows at 2560Γ1440 / **150% scaling** reported `devicePixelRatio = 1.5` while `innerWidth` came back as the physical `2560` rather than the CSS `1707` β which makes `widthScale` `1.0` and fails a check demanding `β 1.5`. CI runners are 96 DPI, so `dpr === 1` and the assertion is trivially satisfied there; it would never surface in the lane it currently runs in.
**Stated honestly, because it changes what you should do with this:** that measurement came from `npm run dev` under Vite, **not** from the packaged app this script actually drives. Packaged and dev can differ on exactly this (DPI-awareness manifest, `--force-device-scale-factor`, zoom factor), so **this is a suspicion with a concrete measurement behind it, not a confirmed failure of this script.** Confirming it needs one packaged run on a scaled display.
**Why raise it anyway:** the two neighbouring assertions β `rendererLayoutMatchesViewport` and `widthScale β heightScale` β already carry the property this check exists for, namely that the renderer viewport covers the native client area **proportionally**. The third clause adds "and the proportion is exactly the DPR", which is a stronger claim about how Electron reports `innerWidth` under a given DPI configuration. If that turns out to be environment-specific, dropping it costs nothing and keeps the check honest on every display; if it does hold on packaged builds at 150%, it deserves a comment saying so, because the next person on a scaled monitor will suspect it.
Probe scripts and the raw JSON/screenshots from that run can be shared if a repro would help.
*Real-machine verification line, `c733e773` vs base `f19eede`. Reported 2026-08-23 12:40 UTC.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "1625567290 (via GitHub)" <gi...@apache.org>.
1625567290 commented on PR #3472:
URL: https://github.com/apache/maka/pull/3472#issuecomment-5383778854
Rebased onto current `main` at `f19eede03` and force-updated the branch to `9fcd1826d`. The workflow trigger conflict is resolved, both new TypeScript files have ASF headers, and GitHub now reports the PR as mergeable.
Local validation completed:
- `npm run build`
- Desktop typecheck
- lint and format checks
- ASF header check
- Windows helper/harness tests: 65/65
- maximize renderer sync tests: 4/4
The new `CI` and `Release Windows check` runs are currently marked `action_required`, so they need maintainer approval before they can execute. I also replied to and resolved the packaged Windows smoke review thread. Please approve the two workflow runs; I will follow up once they finish.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #3472:
URL: https://github.com/apache/maka/pull/3472#discussion_r3835643395
##########
apps/desktop/src/main/__tests__/windows-maximize-renderer-sync.test.ts:
##########
@@ -0,0 +1,105 @@
+import assert from 'node:assert/strict';
+import { describe, it } from 'node:test';
+import {
+ createWindowsMaximizeRendererSync,
+ type MaximizedRendererSyncWindow,
+} from '../windows-maximize-renderer-sync.js';
+
+function createFixture() {
+ const calls: string[] = [];
+ const deferred: Array<() => void> = [];
+ let destroyed = false;
+ let maximized = true;
+ let webContentsDestroyed = false;
+ const contentView = {};
+ const window: MaximizedRendererSyncWindow<object> = {
+ contentView,
+ webContents: {
+ isDestroyed: () => webContentsDestroyed,
+ invalidate: () => calls.push('invalidate'),
+ },
+ isDestroyed: () => destroyed,
+ isMaximized: () => maximized,
+ setContentView: (view) => {
+ assert.equal(view, contentView);
+ calls.push('layout');
+ },
+ };
+
+ return {
+ calls,
+ deferred,
+ window,
+ defer: (callback: () => void) => deferred.push(callback),
+ setDestroyed: (value: boolean) => { destroyed = value; },
+ setMaximized: (value: boolean) => { maximized = value; },
+ setWebContentsDestroyed: (value: boolean) => { webContentsDestroyed = value; },
+ };
+}
+
+describe('Windows maximize renderer sync', () => {
+ it('defers one root layout and repaint for a maximized Windows window', () => {
+ const fixture = createFixture();
+ const schedule = createWindowsMaximizeRendererSync(fixture.window, {
+ platform: 'win32',
+ defer: fixture.defer,
+ });
+
+ schedule();
+ schedule();
+ assert.equal(fixture.deferred.length, 1);
+ assert.deepEqual(fixture.calls, []);
+
+ fixture.deferred.shift()?.();
+ assert.deepEqual(fixture.calls, ['layout', 'invalidate']);
Review Comment:
[P2] This unit test proves only that the two mocked methods are called; it cannot show that Electron 43 actually expands and repaints the renderer after the native Windows maximize transition, which is the entire user-visible contract of this PR. Could we add a Windows packaged/CI smoke that restores β maximizes β waits one frame, then checks renderer `innerWidth`/`innerHeight` (or WebContents size) against the maximized client bounds and restores again? If we keep only one additional test, the real Windows transition is more valuable than another mock branch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on PR #3472:
URL: https://github.com/apache/maka/pull/3472#issuecomment-5385806423
Hi β thanks for the `dbd401e15` fix addressing the two P3s.
Heads-up that this branch now **conflicts with current `main`** and can't be merged as-is. I tested a rebase locally in a throwaway worktree (your branch was not touched); it stops on:
- `scripts/verify-windows-harness.test.mjs`
That's a single real source conflict, so it needs your judgement rather than a mechanical resolution:
```
git fetch upstream && git rebase upstream/main
# resolve, then
git push --force-with-lease
```
Once the branch is conflict-free and CI is green on the new head, I'll pick the review back up β the P3 fixes themselves aren't in question here, this is purely the branch having drifted behind `main`.
---
*AI-assisted maintenance note, not a review. It does not count as the required human review under `CONTRIBUTING.md` Β§Review.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on PR #3472:
URL: https://github.com/apache/maka/pull/3472#issuecomment-5383828020
Reviewed at `9fcd1826`. No blocking findings from me. Recording what I checked and one small note.
The problem statement holds β a native Windows maximize changes the HWND client area, and Electron's root view layout does not reliably follow the native transition, so the renderer keeps the pre-maximize height. That is an ordinary user path, not a constructed one.
What I liked about the shape of the fix: `createWindowsMaximizeRendererSync` does not introduce a second source of truth for window size. It re-applies the *same* `contentView` to force a root-view layout, and never touches native bounds or restored bounds. The guards are complete in both directions β it returns early on non-`win32`, on a destroyed window, on a non-maximized window, and re-checks all of those inside the deferred callback, plus `webContents.isDestroyed()`. The `pending` flag coalesces bursts. I walked the deferred callback's exits for restore, window teardown, WebContents teardown, repeated events, and non-win32, and did not find one that escapes a guard.
The verification is the strongest part. Rather than asserting against mocks, the new packaged smoke drives `normal β maximized β normal` through the real HWND (`GetClientRect` / `IsZoomed`) and checks DPR, document and visual viewport, and `html` / `body` / `#root` / `.appFrame` against the native client rect over CDP. That also answers the question I had while reading β whether *restore* is broken the same way as maximize, given the mechanism is symmetric β because the smoke exercises the restore leg too.
**[P3] `handleResize` and `handleMaximize` are byte-identical.**
```js
const handleResize = (): void => { scheduleSave(); scheduleMaximizedRendererSync(); };
const handleMaximize = (): void => { scheduleSave(); scheduleMaximizedRendererSync(); };
```
Two names for one function, bound to two events. One shared handler would read the same and remove the chance of the two drifting apart later under the impression that they are meant to differ. Purely cosmetic β no behavioural consequence, since `pending` already coalesces the pair of events Windows emits on maximize.
**On CI:** both workflow runs on this head are `action_required` with 0s elapsed, so nothing has actually executed. That is a fork-PR approval gate rather than anything wrong with the branch, but it does mean there is no CI evidence for this head yet β worth a maintainer kicking the runs off, particularly since the Windows smoke this PR adds is the part that would prove the fix. I did not treat the author's local verification or the reviews on earlier heads as a substitute.
One thing I could not check: the fix depends on `setContentView(sameView)` causing Electron to invalidate and re-lay-out the root view. That is a side effect of the current implementation rather than a documented contract, so a future Electron could stop honouring it. The packaged Windows smoke is the right mitigation β it would fail loudly rather than silently regressing β so this is a note, not a finding.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on PR #3472:
URL: https://github.com/apache/maka/pull/3472#issuecomment-5382084133
Heads up β this has drifted into conflict with `main` and can't be merged or reviewed as-is.
Worth knowing before you rebase: [#3397](https://github.com/apache/maka/pull/3397) landed on 2026-08-22 and added ASF license headers across ~2685 files, so a rebase will touch more than you'd expect, and any file you add now needs a header (`npm run write:asf-headers`). A green check from before that date no longer proves anything about the current tree.
I'd like to review this β just ping me once it's rebased and CI is green.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on code in PR #3472:
URL: https://github.com/apache/maka/pull/3472#discussion_r3839045656
##########
scripts/verify-packaged-app.mjs:
##########
@@ -353,6 +353,268 @@ export async function waitForUsableRenderer(
}
}
+const WINDOW_LAYOUT_EXPRESSION = `(async () => {
+ await new Promise((resolve) => requestAnimationFrame(() => resolve()));
+ const rect = (selector) => {
+ const element = document.querySelector(selector);
+ if (!element) return null;
+ const bounds = element.getBoundingClientRect();
+ return {
+ x: bounds.x,
+ y: bounds.y,
+ width: bounds.width,
+ height: bounds.height,
+ };
+ };
+ return {
+ devicePixelRatio: window.devicePixelRatio,
+ innerWidth: window.innerWidth,
+ innerHeight: window.innerHeight,
+ outerWidth: window.outerWidth,
+ outerHeight: window.outerHeight,
+ documentWidth: document.documentElement.clientWidth,
+ documentHeight: document.documentElement.clientHeight,
+ visualViewportWidth: window.visualViewport?.width ?? null,
+ visualViewportHeight: window.visualViewport?.height ?? null,
+ screenAvailWidth: window.screen.availWidth,
+ screenAvailHeight: window.screen.availHeight,
+ html: rect('html'),
+ body: rect('body'),
+ root: rect('#root'),
+ appFrame: rect('.appFrame'),
+ };
+})()`;
+
+function dimensionsMatch(actual, expected, tolerance = 1) {
+ return Number.isFinite(actual) && Math.abs(actual - expected) <= tolerance;
+}
+
+export function rendererLayoutMatchesViewport(layout) {
+ if (!Number.isFinite(layout?.innerWidth) || layout.innerWidth <= 0) return false;
+ if (!Number.isFinite(layout?.innerHeight) || layout.innerHeight <= 0) return false;
+ if (!dimensionsMatch(layout.documentWidth, layout.innerWidth)) return false;
+ if (!dimensionsMatch(layout.documentHeight, layout.innerHeight)) return false;
+ if (!dimensionsMatch(layout.visualViewportWidth, layout.innerWidth)) return false;
+ if (!dimensionsMatch(layout.visualViewportHeight, layout.innerHeight)) return false;
+ for (const bounds of [layout.html, layout.body, layout.root, layout.appFrame]) {
+ if (!bounds) return false;
+ if (!dimensionsMatch(bounds.x, 0) || !dimensionsMatch(bounds.y, 0)) return false;
+ if (!dimensionsMatch(bounds.width, layout.innerWidth)) return false;
+ if (!dimensionsMatch(bounds.height, layout.innerHeight)) return false;
+ }
+ return true;
+}
+
+export function rendererViewportMatchesNativeClient(layout, nativeWindow) {
+ if (!rendererLayoutMatchesViewport(layout)) return false;
+ if (!Number.isFinite(layout.devicePixelRatio) || layout.devicePixelRatio <= 0) return false;
+ if (!Number.isFinite(nativeWindow?.clientWidth) || nativeWindow.clientWidth <= 0) return false;
+ if (!Number.isFinite(nativeWindow?.clientHeight) || nativeWindow.clientHeight <= 0) return false;
+ const widthScale = nativeWindow.clientWidth / layout.innerWidth;
+ const heightScale = nativeWindow.clientHeight / layout.innerHeight;
+ // Electron can report CSS or physical viewport pixels depending on the
+ // packaged app's DPI-awareness mode. Proportional agreement with the native
+ // client is the stable contract; equating that scale to DPR is not.
+ return dimensionsMatch(widthScale, heightScale, 0.01);
Review Comment:
[P3] This now checks only that the native/client width and height have the same scale, so any uniformly scaled stale renderer is accepted. Calling this production function with a renderer/layout of `800Γ600`, a maximized native client of `1600Γ1200`, and DPR `1` returns `true`, even though the renderer is still at the restored size. The existing guards do not catch it: the document can fill its own stale viewport and both scales are still exactly `2`. The negative test uses `1920Γ900`, whose aspect-ratio mismatch exercises a different case. Please add a uniformly scaled stale case and require the common scale to be approximately `1` (native reports CSS pixels) or approximately `devicePixelRatio` (native reports physical pixels). This is non-blocking because the reported #3416 path (`1240Γ820 β 1920Γ1080`) changes aspect ratio and remains covered.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "1625567290 (via GitHub)" <gi...@apache.org>.
1625567290 commented on PR #3472:
URL: https://github.com/apache/maka/pull/3472#issuecomment-5383960026
Addressed the P3 in : and now share the same callback, removing the duplicate handlers without changing behavior.\n\nLocal validation is green:\n- desktop main-process build\n- Windows maximize renderer-sync tests (4/4)\n- desktop typecheck\n- repository lint and format checks\n- ASF header check\n- \n\nThe GitHub workflows will rerun against the updated head.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): resync renderer after Windows maximize [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on PR #3472:
URL: https://github.com/apache/maka/pull/3472#issuecomment-5379963903
Heads up on the failing `Release Windows check` β **it isn't caused by anything in this PR.**
It fails at `scripts/verify-windows-sandbox-e2e.mjs:97` with:
```
FilesystemWorkerClientError: The target was created while this call waited for the lock; re-read before writing.
```
That's a regression from #3001, which merged into main earlier today: `FilesystemWorkerClient` now rejects a write to an existing file when the caller doesn't supply `expectedIdentity`, and the Windows sandbox verifier calls the client directly rather than through `FilesystemExecutor`. Tracked in #3484 β nothing for you to fix here.
The `CI` job on this head is green, and the review of the actual change is clean: the native `GetClientRect`/`IsZoomed` probes are a stronger check than the CDP path they replace, and adding `rendererViewportMatchesNativeClient` catches DPI-scaling mismatches the previous viewport comparison couldn't. We also confirmed the 108 removed lines are the superseded CDP helpers rather than unrelated checks, and that the packaged-Git verification strengthened in #3473 is untouched.
We'll approve once #3484 is resolved and the Windows job can go green on this head.
---
*AI-assisted review.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org