Skip to content

fix(macos): dragging in the search box no longer moves the window - #43

Open
TZANTOU wants to merge 1 commit into
gridoe:mainfrom
TZANTOU:fix/macos-search-drag
Open

TZANTOU wants to merge 1 commit into
gridoe:mainfrom
TZANTOU:fix/macos-search-drag

Conversation

@TZANTOU

@TZANTOU TZANTOU commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On macOS, drag-selecting text in the search bar moved the window.

Causes

  1. The pill fell through to the drag surface. The search pill only sensed hover, and the text field is a short row inside it (36px pill, ~18px of text, plus the magnifier inset). A press on the padding or the magnifier went to the top bar's drag surface underneath, which starts a window drag.
  2. AppKit's own title-bar drag. The macOS window is a native one with its title bar hidden and the content running under it (main.rs). AppKit still moves the window on a press anywhere in that hidden strip, and it does so before egui sees the event. So it ignores the controls egui draws there, the search field included.

Fix

  • ui/topbar.rs: the whole pill takes the press (click_and_drag), and a click or press there focuses the field.
  • chrome::NativeDrag: each frame it sets the NSWindow's movable flag from egui's hit test. Native moving is allowed only where a press lands on nothing or on a drag_surface; AppKit is only called when the value changes. drag_surface records its ids so they can be told apart from the controls on top of them.

Nothing changes on other platforms or with --decorated.

Testing

  • cargo clippy --all-targets, cargo fmt and cargo test --lib (684 passed) pass on macOS.
  • Not yet checked by hand in the running app: drag-select in the search box, press on the pill's padding, and drag the window from empty top-bar and sidebar space.

Two things moved the window on a drag in the search box:

- The pill only sensed hover, and the text field is a short row inside
  it, so a press on the padding or the magnifier fell through to the
  top bar's drag surface. The whole pill now takes the press, and a
  click there focuses the field.
- The macOS window keeps a native, hidden title bar with the content
  under it. AppKit moves the window on a press anywhere in that strip
  before egui sees the event. `chrome::NativeDrag` now sets the
  window's `movable` flag from egui's hit test each frame: native
  moving only where a press lands on nothing or on a drag surface.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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