# gpui_macos: Fix traffic light hitbox after repositioning \(\#58534\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 138139f830e6a3a0271c8aac60ed494b752dbc46

Requested commit: 138139f830e6a3a0271c8aac60ed494b752dbc46

Commit: 138139f830e6a3a0271c8aac60ed494b752dbc46

Tree: 84ba038a206545f76aede321a6cf506c9f1b62ca

Author: Mayank Verma

Committer: GitHub

## Message

```
gpui_macos: Fix traffic light hitbox after repositioning (#58534)

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

This is a follow up to https://github.com/zed-industries/zed/pull/58169
and https://github.com/zed-industries/zed/pull/58518 after removing a
bunch of unsafe usage.

Before this, GPUI moved traffic lights by directly changing the native
button frames inside AppKit’s existing titlebar layout and the old
y-coordinate was based on the native titlebar height, so the buttons
moved visually while the titlebar tracking geometry could still be based
on the old layout.

Now the native titlebar container is resized and repositioned to contain
the traffic lights. We capture the original AppKit titlebar/button
frames, resize the titlebar container to fit the requested position,
move the native close/minimize/zoom buttons inside that container and
update AppKit tracking areas. This keeps the visible buttons and
hover/click geometry aligned.

### Before


https://github.com/user-attachments/assets/77dde6cb-3fc8-4166-bc86-22cf2c93e119

### After


https://github.com/user-attachments/assets/da84ade6-ef47-4e53-ae4a-3779315773f9

---------

Co-authored-by: Yara 🏳️‍⚧️ <git@yara.blue>
```

## Parents

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

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