Skip to content

Fix regression of main window dragging on Windows - #59967

Merged
reflectronic merged 1 commit into
zed-industries:mainfrom
milkowski:windows-drag-fix
Jun 29, 2026
Merged

Fix regression of main window dragging on Windows#59967
reflectronic merged 1 commit into
zed-industries:mainfrom
milkowski:windows-drag-fix

Conversation

@milkowski

@milkowski milkowski commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes the issue with main Zed window which cannot be moved by dragging the title bar on Windows.

Root cause

is_movable: false was set for macOS but breaks Windows
crates/zed/src/zed.rs:381 sets is_movable: false for the main window, introduced by commit ec7c11c65c (PR #59836) to fix macOS 27 Beta titlebar click delays. The comment says "disable AppKit's titlebar dragging", but the setting applies to all platforms, including Windows.

Why it breaks on Windows

On Windows, window dragging relies on WM_NCHITTEST returning HTCAPTION, not start_window_move() (which is an empty no-op on Windows - crates/gpui/src/platform.rs:703, never overridden in gpui_windows).
The hit test at crates/gpui_windows/src/events.rs:903-904 gates HTCAPTION on is_movable:

WindowControlArea::Drag if self.is_movable => Some(HTCAPTION as _),
WindowControlArea::Drag => None,

Since is_movable is false, HTCAPTION is never returned, the title bar is treated as client area (HTCLIENT), mouse events go to gpui's on_mouse_move handler (crates/platform_title_bar/src/platform_title_bar.rs:218), which calls window.start_window_move(), which does nothing on Windows.

On macOS this works because start_window_move() IS implemented (crates/gpui_macos/src/window.rs:1801, using performWindowDragWithEvent).

Test

The fix was successfully built and tested on Windows 11 platform.


Release Notes:

  • N/A

@cla-bot

cla-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @milkowski on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jun 26, 2026
@milkowski

Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 26, 2026
@cla-bot

cla-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@maxdeviant maxdeviant changed the title Fix regression of main window dragging on Windows. Fix regression of main window dragging on Windows Jun 26, 2026
`is_movable` is now false only on macOS (preserving the macOS 27 Beta titlebar-click fix from PR zed-industries#59836) and true everywhere else, restoring native window dragging on Windows.
@lingyaochu lingyaochu mentioned this pull request Jun 28, 2026
5 tasks
@reflectronic reflectronic self-assigned this Jun 29, 2026

@reflectronic reflectronic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way the title bar dragging works in GPUI is a bit messed up, unfortunately, but this will do for now.

@reflectronic
reflectronic added this pull request to the merge queue Jun 29, 2026
Merged via the queue into zed-industries:main with commit 480796c Jun 29, 2026
37 checks passed
@Prohect

Prohect commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

The way the title bar dragging works in GPUI is a bit messed up, unfortunately, but this will do for now.

related PR
see: #60064

jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
## Summary
This PR fixes the issue with main Zed window which cannot be moved by
dragging the title bar on Windows.

## Root cause 

`is_movable: false` was set for macOS but breaks Windows
`crates/zed/src/zed.rs:381` sets `is_movable: false` for the main
window, introduced by commit `f725e90385` (PR zed-industries#59836) to fix macOS 27
Beta titlebar click delays. The comment says "disable AppKit's titlebar
dragging", but the setting applies to all platforms, including Windows.

## Why it breaks on Windows

On Windows, window dragging relies on `WM_NCHITTEST` returning
`HTCAPTION`, not `start_window_move()` (which is an empty no-op on
Windows - `crates/gpui/src/platform.rs:703`, never overridden in
`gpui_windows`).
The hit test at `crates/gpui_windows/src/events.rs:903-904` gates
`HTCAPTION` on `is_movable`:

```rust
WindowControlArea::Drag if self.is_movable => Some(HTCAPTION as _),
WindowControlArea::Drag => None,
```

Since `is_movable` is false, `HTCAPTION` is never returned, the title
bar is treated as client area (`HTCLIENT`), mouse events go to gpui's
`on_mouse_move` handler
(`crates/platform_title_bar/src/platform_title_bar.rs:218`), which calls
`window.start_window_move()`, which does nothing on Windows.

On macOS this works because `start_window_move()` IS implemented
(`crates/gpui_macos/src/window.rs:1801`, using
`performWindowDragWithEvent`).

## Test
The fix was successfully built and tested on Windows 11 platform.

---

Release Notes:

- N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants