Skip to content

fix(native): keep Windows drags under the pointer on scaled displays - #912

Merged
omartelo merged 2 commits into
mainfrom
fix/windows-drag-dpi
Oct 22, 2026
Merged

omartelo merged 2 commits into
mainfrom
fix/windows-drag-dpi

Conversation

@omartelo

Copy link
Copy Markdown
Collaborator

Summary

On Windows with display scaling above 100%, a drag drifted away from the cursor: an item dragged in Settings › Footer was drawn far from the pointer, and a selection dragged in the terminal extended to the wrong cells. Reported on a two-monitor setup (1920×1080 + 1920×1200).

Cause: Gio's Windows backend called SetCapture on WM_POINTERDOWN. That turns on DPI-unaware coordinate scaling for pointer events until the release, so only pointer.Drag events (never hover or click) came in scaled as if the screen were at 100%.

Upstream Gio fixed it in c170b581 ("app: [Windows] rely on implicit pointer capture", https://todo.sr.ht/~eliasnaur/gio/710): WM_POINTERDOWN already captures the pointer, so the calls go.

  • lichdotdev/gio branch lich: cherry-picked c170b581, then merged the rest of upstream main (Android key events and Back, 4th/5th mouse buttons on macOS and X11, key.NameInsert, lost GPU device recovery, text segmentation). The merge also fixes the fork's long-failing TestIndexPositionRunes.
  • native/go.mod moves the replace to that commit (12496229).
  • CHANGELOG.md [Unreleased] › Fixed entry.

Test plan

  • native/: gofmt -l . clean, go vet ./... and go test ./... green
  • native/build-windows.sh builds lich-native.exe; the binary no longer references SetCapture
  • Fork: GOOS=linux and GOOS=windows go build ./..., go test on app, io, text, widget

Gio's Windows backend called SetCapture on WM_POINTERDOWN, which turns on
DPI-unaware coordinate scaling for pointer events until the release. With
display scaling above 100%, every pointer.Drag landed away from the cursor:
the footer editor's dragged item and the terminal's selection alike.

Upstream fixed it in c170b581 ("app: [Windows] rely on implicit pointer
capture", gio#710). The fork's lich branch carries it now, merged with the
rest of upstream main, and native/go.mod moves to that commit.
@omartelo
omartelo merged commit 333e161 into main Oct 22, 2026
7 checks passed
@omartelo
omartelo deleted the fix/windows-drag-dpi branch October 22, 2026 19:56
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.

1 participant