# gpui: Stop synthetic mouse drags after button release on macOS \(\#64175\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/382ff7a64b334ab59a3dc0e3f3185705f79cd0ab)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 382ff7a64b334ab59a3dc0e3f3185705f79cd0ab

Requested commit: 382ff7a64b334ab59a3dc0e3f3185705f79cd0ab

Commit: 382ff7a64b334ab59a3dc0e3f3185705f79cd0ab

Tree: 5a0afda424491ed83cf6cf28e4f0bcdbaae523c8

Author: Vitaly Kravchenko

Committer: GitHub

## Message

```
gpui: Stop synthetic mouse drags after button release on macOS (#64175)

## Objective

Native menu tracking can consume the mouse-up event that normally
cancels synthetic drag replay. Replaying that drag afterward would
alternate the stale pointer position with real mouse moves and flicker
hover state.

## Solution

Check `NSEvent.pressedMouseButtons` before replaying a synthetic drag
and stop when the original button is no longer physically pressed.
Another held button does not keep the old drag alive. Also stop the
timer when its window no longer exists.

The existing replay interval, generation cancellation, and callback
locking remain unchanged.

## Testing

To reproduce, slightly move while secondary-clicking a tab, dismiss its
native menu, then move across tabs and content. Before the fix, the old
tab's hover highlight can flicker as stale drag events repeat.

Release Notes:

- Fixed stale synthetic mouse drags causing hover flicker after native
menus are dismissed on macOS.
- [GPUI] Fix bug where native menu tracking could consume mouse up
events
```

## Parents

- [baee1ca6de0feb9b87d4e5288cf40b02bdf4c370](https://git.cafe/gitcafe/zed/commit/baee1ca6de0feb9b87d4e5288cf40b02bdf4c370?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/382ff7a64b334ab59a3dc0e3f3185705f79cd0ab?format=markdown)
