# Refactor Windows platform implementation \(\#11393\) · gitcafe/zed

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

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

Visibility: public

Requested revision: c260f7d5acf6bd3605fc22a244510b0363075b20

Requested commit: c260f7d5acf6bd3605fc22a244510b0363075b20

Commit: c260f7d5acf6bd3605fc22a244510b0363075b20

Tree: 3a9c867e9a7ea1c839012b98308ba8727a5592c8

Author: 张小白

Committer: GitHub

## Message

```
Refactor Windows platform implementation (#11393)

This aligns the Windows platform implementation with a code style
similar to macOS platform, eliminating most of the `Cell`s and
`Mutex`es. This adjustment facilitates potential future porting to a
multi-threaded implementation if required.

Overall, this PR made the following changes: it segregated all member
variables in `WindowsPlatform` and `WindowsWindow`, grouping together
variables that remain constant throughout the entire app lifecycle,
while placing variables that may change during app runtime into
`RefCell`.

Edit: 
During the code refactoring process, a bug was also fixed.

**Before**: 
Close window when file has changed, nothing happen:


https://github.com/zed-industries/zed/assets/14981363/0bcda7c1-808c-4b36-8953-a3a3365a314e

**After**:
Now `should_close` callback is properly handled


https://github.com/zed-industries/zed/assets/14981363/c8887b72-9a0b-42ad-b9ab-7d0775d843f5


Release Notes:

- N/A
```

## Parents

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

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