Skip to content

fix: use native Windows drag instead of custom timer polling#102

Merged
matej21 merged 1 commit intomainfrom
fix/windows-titlebar-native-drag
Apr 10, 2026
Merged

fix: use native Windows drag instead of custom timer polling#102
matej21 merged 1 commit intomainfrom
fix/windows-titlebar-native-drag

Conversation

@matej21
Copy link
Copy Markdown
Member

@matej21 matej21 commented Apr 10, 2026

Summary

  • Removed custom Win32 timer-based window drag that polled GetCursorPos + SetWindowPos every 16ms, bypassing Windows' native window move loop
  • Now uses GPUI's WindowControlArea::Drag on all platforms, which maps to HTCAPTION in WM_NCHITTEST on Windows
  • This re-enables native Windows behavior: snap gestures (drag to edge), snap layouts (Win11), and unmaximize-on-drag
  • Removed raw-window-handle dependency (no longer needed)

The original workaround (commit 8ee1a8f) was introduced under the assumption that WindowControlArea::Drag was a no-op on Windows, but GPUI fully implements the hit test callback chain: element hitbox → on_hit_test_window_controlHTCAPTION → native drag.

Closes #101

Test plan

  • Windows 11: drag titlebar to top edge → should snap/maximize
  • Windows 11: drag maximized window titlebar down → should unmaximize and follow cursor
  • Windows 11: hover maximize button → should show snap layout picker
  • Double-click titlebar → should maximize/restore
  • Titlebar buttons (min/max/close) still work
  • Linux/macOS: verify no regression in window dragging

🤖 Generated with Claude Code

The custom Win32 timer-based drag (SetTimer + SetWindowPos polling)
bypassed Windows' native window move loop, breaking snap gestures,
unmaximize-on-drag, and snap layouts on Windows 11. GPUI's
WindowControlArea::Drag properly maps to HTCAPTION in WM_NCHITTEST,
so native drag works correctly without the workaround.

Closes #101

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@matej21 matej21 merged commit 8110c7c into main Apr 10, 2026
8 checks passed
@matej21 matej21 deleted the fix/windows-titlebar-native-drag branch April 10, 2026 18:47
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.

Windows glitches

1 participant