zed/crates/gpui_windows
roboin 826f28eb8f
gpui_windows: Align inactive GPUI popup behavior on Windows with other platforms (#61411)
*As an LLM was used to translate the PR message, the original text is
included alongside the translation in accordance with the contributing
guidelines.

# Objective

> On Windows, GPUI accepted `WindowKind::PopUp` and `focus: false`, but
the window creation path ignored both options. This caused two problems
with the notification popup shown when an agent finished its work:
> 
> * When another window had focus, the popup could appear behind it.
> * When Zed had focus, the popup could steal focus.
> 
> This pull request applies `WindowKind::PopUp` and `focus: false` to
windows on Windows, bringing popup behavior in line with other operating
systems.

Windows版GPUIでは、`WindowKind::PopUp`と`focus:
false`を指定しても、それらのオプションが実際のウィンドウ生成処理では無視されていました。そのため、エージェントの作業が完了したときに表示される通知で次のような問題が発生していました。

- ほかのウィンドウにフォーカスがある場合にポップアップがほかのウィンドウの背後に隠れてしまう
- Zedにフォーカスがある場合はポップアップがフォーカスを奪ってしまう

このプルリクエストでは、Windows上でも`WindowKind::PopUp`と`focus:
false`をウィンドウに反映させるようにし、ポップアップの挙動をほかのOSと一致させます。

## Solution

> This PR updates popup creation in GPUI on Windows to match the
behavior on other platforms. When you specify `WindowKind::PopUp` and
`focus: false`, GPUI now keeps the popup above other windows without
stealing focus.
> 
> Keeping a `focus: false` popup above other windows caused the IME to
commit text under composition when the popup appeared. This PR also
fixes that issue.


Windows版GPUIのポップアップの生成処理をほかのプラットフォームの挙動と一致するように変更しました。このPRでは、`WindowKind::PopUp`と`focus:
false`を指定したときにポップアップウィンドウを最前面に表示し、フォーカスを奪わないようにしました。

また、`focus:
false`のポップアップが最前面に表示されるようにしたことで、ポップアップが表示されたときにIMEで入力中のテキストが意図せず確定されるようになってしまったため、それに対する修正も含まれています。

## Testing

> I built Zed on Windows and displayed a test agent notification to
verify the following:
> 
> * The popup stays above other windows when another window has focus.
> * When Zed has focus, a popup with `focus: false` does not steal focus
or interrupt IME input.
> * The buttons in the popup remain clickable.

Windows上でZedをビルドし、テスト用のエージェント通知を表示して次の項目をテストしました。

- ほかのウィンドウにフォーカスがある場合でもポップアップが最前面に表示される
- Zedにフォーカスがある場合に`focus: false`のポップアップがフォーカスを奪わず、IMEを使った入力も阻害しない
- ポップアップ内のボタンをクリックできる

## Self-Review Checklist:

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

## Showcase

> Note: I added a button to display an agent notification for testing in
this video, but this PR does not include that button.

※この動画ではテスト目的でエージェント通知を表示するボタンを追加していますが、このPRの変更には含まれていません。

### Before

The popup window is hidden when another window has focus:


https://github.com/user-attachments/assets/5312729b-1409-4c81-a169-dd031099059b

A popup with `focus: false` steals focus:


https://github.com/user-attachments/assets/dd1ac2a2-d5e8-4f8f-bc47-6cc659a10951

### After

The popup window stays on top even when another window has focus:


https://github.com/user-attachments/assets/af058921-14fc-4ca5-9698-758202c4c888

A popup with `focus: false` does not steal focus or interrupt text
input:


https://github.com/user-attachments/assets/9bc487c6-ae68-4ec0-9073-1257b91e06a9

---

Release Notes:

- Fixed Windows agent notifications appearing behind other windows,
stealing input focus, or committing active IME composition.

---------

Co-authored-by: John Tur <john-tur@outlook.com>
2026-07-25 20:38:42 +00:00
..
src gpui_windows: Align inactive GPUI popup behavior on Windows with other platforms (#61411) 2026-07-25 20:38:42 +00:00
build.rs gpui: Extract gpui_platform out of gpui (#49277) 2026-02-19 18:57:49 +01:00
Cargo.toml zed: Unify dependencies (#61381) 2026-07-21 07:58:16 +00:00
LICENSE-APACHE gpui: Extract gpui_platform out of gpui (#49277) 2026-02-19 18:57:49 +01:00