Skip to content

Fix title bar buttons unclickable on Windows - #12

Merged
JetSquirrel merged 2 commits into
JetSquirrel:mainfrom
jettiandeng:fix/windows-titlebar-clicks
Oct 1, 2026
Merged

JetSquirrel merged 2 commits into
JetSquirrel:mainfrom
jettiandeng:fix/windows-titlebar-clicks

Conversation

@jettiandeng

Copy link
Copy Markdown
Contributor

Problem

On Windows, every button in the title bar was dead: the expand-sidebar button did nothing, the language toggle felt stuck and never switched, and the Open / setup / UI-size / theme buttons had the same defect.

Root cause

gpui-kit's TitleBar marks its whole content strip as a native WindowControlArea::Drag region. On Windows, WM_NCHITTEST then answers HTCAPTION for every child of the bar (gpui's hit-test collects all ancestor hitboxes containing the cursor). A mouse press is treated as a window move: the click event never dispatches, and the unconsumed press falls through to DefWindowProc's modal move loop — hence the "laggy and ineffective" feel. macOS never takes this hit-test path, which is why the bug is Windows-only.

Fix

  • Add .occlude() to the expand-sidebar, open-data, setup, ui-size and toggle-theme buttons: their hitboxes get BlockMouse behavior, the upward hitbox collection stops there, and Windows returns HTCLIENT — clicks dispatch normally while empty bar space still drags the window.
  • Consume the left mouse press on the toggle-language button (prevent_default + stop_propagation), the same defence gpui-kit's own AppMenuBar uses.
  • Add headless UI regression tests for the language toggle (the switch takes effect and the button relabels; the press does not bubble to ancestors), enabling gpui-kit's test-support feature in dev-dependencies.

Verification

  • cargo check --bin ducklocal --tests: passes
  • New language-toggle tests: 2/2 pass
  • Existing cli (13) + lsp (8) tests: all pass, no regressions

jettiandeng and others added 2 commits October 1, 2026 12:47
gpui-kit's TitleBar marks its whole content strip as a native
WindowControlArea::Drag region. On Windows, WM_NCHITTEST then answers
HTCAPTION for every child of the bar: a mouse press is treated as a
window move, the click never dispatches, and the press falls into the
OS move loop — so the expand-sidebar button did nothing and the
language toggle felt stuck. macOS never takes this hit-test path.

- Occlude the expand-sidebar, open-data, setup, ui-size and
  toggle-theme buttons so their hitboxes stop the upward collection
  and Windows returns HTCLIENT for them; empty bar space still drags.
- Consume the left press on the toggle-language button, the same
  defence gpui-kit's own AppMenuBar uses.
- Add headless UI regression tests for the language toggle (switch
  takes effect, the press does not bubble to ancestors), enabling
  gpui-kit's test-support feature for the test build.
- Wildcard paths under a drive letter or share (`C:\data\*.csv`) matched
  nothing: glob() gave up on any path with a prefix component. Start the
  walk from the drive or share root instead.
- canonicalize() returns verbatim paths on Windows (`\?\C:\...`). The `?`
  read as a pattern, so reopening an attached file failed, and the prefix
  showed in the sidebar. Strip it for drive and UNC paths.
- `~` never expanded or compacted outside a Unix-style shell, because
  Windows does not set HOME. Fall back to USERPROFILE, as setup.rs does,
  and accept `\` as a separator.
- CI built Windows but ran the tests only on macOS, so none of this
  surfaced; run them on the Windows job too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JetSquirrel
JetSquirrel merged commit e2416ab into JetSquirrel:main Oct 1, 2026
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