# Maintain smooth frame rates when ProMotion and direct mode are enabled \(\#7305\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 15edc46827a08f4befeaecf0a7f6be692b8391a4

Requested commit: 15edc46827a08f4befeaecf0a7f6be692b8391a4

Commit: 15edc46827a08f4befeaecf0a7f6be692b8391a4

Tree: 9630f6cadd5a70fee70d9a7ef8c8f3a2f9f6027a

Author: Antonio Scandurra

Committer: GitHub

## Message

```
Maintain smooth frame rates when ProMotion and direct mode are enabled (#7305)

This is achieved by starting a `CADisplayLink` that will invoke the
`on_request_frame` callback at the refresh interval of the display.

We only actually draw frames when the window was dirty, or for 2 extra
seconds after the last input event to ensure ProMotion doesn't downclock
the refresh rate when the user is actively interacting with the window.

Release Notes:

- Improved performance when using a ProMotion display with fast key
repeat rates.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
```

## Parents

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

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