A full-featured download manager.
fix(add-task): shrink non-resizable window on Windows (#1926)
Dr_rOot9007d6930003
diff --git a/src/main/ipc/commands.test.ts b/src/main/ipc/commands.test.tsindex b9c47e81..2f7ea54f 100644--- a/src/main/ipc/commands.test.ts+++ b/src/main/ipc/commands.test.ts@@ -643,14 +643,14 @@ describe('buildCommandHandlers', () => {expect(result).toEqual({ ok: true })})- it('ResizeWindow resolves sender to BrowserWindow and calls setSize', async () => {- const setSize = vi.fn()+ it('ResizeWindow uses bounds so non-resizable windows can shrink', async () => {+ const setBounds = vi.fn()const getSize = vi.fn(() => [800, 600])const isDestroyed = vi.fn(() => false)fromWebContentsMock.mockReturnValueOnce({isDestroyed,getSize,- setSize,+ setBounds,})const ctx = fakeCtx()// @ts-expect-error partial ctx@@ -661,7 +661,7 @@ describe('buildCommandHandlers', () => {height: 300,})expect(fromWebContentsMock).toHaveBeenCalledWith(fakeSender)- expect(setSize).toHaveBeenCalledWith(400, 300, true)+ expect(setBounds).toHaveBeenCalledWith({ width: 400, height: 300 }, true)expect(result).toEqual({ ok: true })})diff --git a/src/main/ipc/commands.ts b/src/main/ipc/commands.tsindex 41e9cb46..e404ac56 100644--- a/src/main/ipc/commands.ts+++ b/src/main/ipc/commands.ts@@ -1041,7 +1041,9 @@ export function buildCommandHandlers(ctx: CommandContext): CommandHandlerMap {if (win && !win.isDestroyed()) {const [currentWidth, currentHeight] = win.getSize()if (currentWidth !== params.width || currentHeight !== params.height) {- win.setSize(params.width, params.height, true)+ // Electron #42258: setSize cannot shrink non-resizable windows on+ // Windows and Linux. Partial bounds preserve the window position.+ win.setBounds({ width: params.width, height: params.height }, true)}}return { ok: true }