You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by wy...@apache.org on 2026/09/10 02:33:59 UTC

(maka) 01/02: fix(desktop): disable manual resizing for compact WorkHub

This is an automated email from the ASF dual-hosted git repository.

M4n5ter pushed a commit to branch feat/workhub-progress-input
in repository https://gitbox.apache.org/repos/asf/maka.git

commit 7acc04a489615162134ac0b295118da747ff9133
Author: Wang <m4...@gmail.com>
AuthorDate: Thu Sep 10 10:10:42 2026 +0800

    fix(desktop): disable manual resizing for compact WorkHub
    
    Generated-by: OpenAI Codex
---
 apps/desktop/e2e/workhub-reconstruction.spec.ts              | 4 +++-
 apps/desktop/src/main/__tests__/workhub-presentation.test.ts | 6 ++++++
 apps/desktop/src/main/workhub-presentation.ts                | 4 +++-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/apps/desktop/e2e/workhub-reconstruction.spec.ts b/apps/desktop/e2e/workhub-reconstruction.spec.ts
index e0fe89deb6..d82a2259d5 100644
--- a/apps/desktop/e2e/workhub-reconstruction.spec.ts
+++ b/apps/desktop/e2e/workhub-reconstruction.spec.ts
@@ -93,14 +93,16 @@ test('WorkHub moves the same renderer and draft between the main window and floa
   await expect(workhub.locator('.workHubLive')).toHaveAttribute('data-conversation-expanded', 'false');
   const capabilities = await app.evaluate(({ BrowserWindow }) => {
     const floating = BrowserWindow.getAllWindows().find((window) => window.getTitle() === 'WorkHub')!;
-    return { maximizable: floating.isMaximizable(), fullscreenable: floating.isFullScreenable() };
+    return { maximizable: floating.isMaximizable(), fullscreenable: floating.isFullScreenable(), resizable: floating.isResizable() };
   });
   expect(capabilities.fullscreenable).toBe(false);
+  expect(capabilities.resizable).toBe(false);
   if (process.platform !== 'linux') expect(capabilities.maximizable).toBe(false);
   await expect(workhub.locator('.workHubHistory')).toBeHidden();
   await expect.poll(() => workhub.evaluate(() => Math.abs(innerHeight - document.querySelector('.workHubComposerSurface')!.getBoundingClientRect().height))).toBeLessThanOrEqual(1);
   await workhub.getByRole('button', { name: /展开对话|Expand conversation/ }).click();
   await expect(workhub.locator('.workHubHistory')).toBeVisible();
+  await expect.poll(() => app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows().find((window) => window.getTitle() === 'WorkHub')!.isResizable())).toBe(true);
   await workhub.getByRole('button', { name: /^(Hide|隐藏|隱藏)$/ }).click();
   await expect.poll(() => workhub.evaluate(() => window.maka.workHubPresentation.getSnapshot())).toMatchObject({ placement: 'docked', floatingVisible: false });
   await expect(page.locator('.workHubDockPlaceholder')).toBeHidden();
diff --git a/apps/desktop/src/main/__tests__/workhub-presentation.test.ts b/apps/desktop/src/main/__tests__/workhub-presentation.test.ts
index 970d30b3d6..91dea1bc0b 100644
--- a/apps/desktop/src/main/__tests__/workhub-presentation.test.ts
+++ b/apps/desktop/src/main/__tests__/workhub-presentation.test.ts
@@ -219,13 +219,19 @@ test('opens an empty floating conversation at its composer height', async () =>
   await h.command(view.webContents, 'conversation-layout', { expanded: false, compactHeight: 110 });
   await h.command(view.webContents, 'detach');
   assert.equal(h.windows[1]!.bounds.height, 110);
+  assert.equal(h.windows[1]!.resizable, false);
   await h.command(view.webContents, 'conversation-layout', { expanded: true, compactHeight: 110 });
   assert.equal(h.windows[1]!.bounds.height, 720);
+  assert.equal(h.windows[1]!.resizable, true);
+  await h.command(view.webContents, 'conversation-layout', { expanded: false, compactHeight: 160 });
+  assert.equal(h.windows[1]!.resizable, false);
+  assert.equal(h.windows[1]!.bounds.height, 160, 'compact input still grows programmatically');
   await h.command(view.webContents, 'dock');
   await h.command(view.webContents, 'conversation-layout', { expanded: false, compactHeight: 110 });
   h.movePointer({ x: 1600, y: -900, width: 1000, height: 800 });
   await h.controller.toggle(true);
   const bounds = h.windows[1]!.bounds;
+  assert.equal(h.windows[1]!.resizable, false);
   assert.equal(bounds.x + bounds.width / 2, 2100);
   assert.equal(bounds.y + bounds.height, -100 - 96);
   h.controller.dispose();
diff --git a/apps/desktop/src/main/workhub-presentation.ts b/apps/desktop/src/main/workhub-presentation.ts
index 2caa52b6f0..304285508b 100644
--- a/apps/desktop/src/main/workhub-presentation.ts
+++ b/apps/desktop/src/main/workhub-presentation.ts
@@ -217,6 +217,7 @@ export function createWorkHubPresentation(deps: WorkHubPresentationDeps) {
       type: process.platform === 'darwin' ? 'panel' : undefined,
       x: area.x + Math.round((area.width - width) / 2), y: Math.max(area.y, area.y + area.height - height - 96),
       minWidth: Math.min(360, width), minHeight: Math.min(80, height),
+      resizable: conversationExpanded,
       alwaysOnTop: true, autoHideMenuBar: true, maximizable: false, fullscreenable: false,
       frame: false, transparent: true, backgroundColor: '#00000000',
       hasShadow: true, roundedCorners: true,
@@ -284,7 +285,7 @@ export function createWorkHubPresentation(deps: WorkHubPresentationDeps) {
     // Summoning follows the pointer's display, including an existing window
     // that was last used on another monitor.
     const old = conversationBounds ?? target.getBounds();
-    if (conversationBounds) target.setResizable(true);
+    target.setResizable(conversationExpanded);
     conversationBounds = undefined;
     const area = screen.getDisplayNearestPoint(screen.getCursorScreenPoint()).workArea;
     const width = Math.min(old.width, area.width);
@@ -536,6 +537,7 @@ export function createWorkHubPresentation(deps: WorkHubPresentationDeps) {
             const area = screen.getDisplayMatching(bounds).workArea;
             const height = Math.min(area.height, value.expanded ? expandedHeight : compactHeight);
             const animate = conversationExpanded !== value.expanded || !!resizeTarget;
+            if (conversationExpanded !== value.expanded) floating.setResizable(value.expanded);
             conversationExpanded = value.expanded;
             if (bounds.height !== height) {
               resizeFloating({ ...bounds, height, y: Math.max(area.y, Math.min(bounds.y + bounds.height - height, area.y + area.height - height)) }, animate);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org