gpui: Fix hide, activate method on Windows to hide/show application (#18164)

Release Notes:

- N/A

Continue #18161 to fix `cx.hide`, `cx.activate` method on Windows to
hide/show application.

## After


https://github.com/user-attachments/assets/fe0070f9-7844-4c2a-b859-3e22ee4b8d22

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
Jason Lee 2024-10-01 14:20:24 +08:00 committed by GitHub
parent 8d795ff882
commit 72be8c5d14
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 4 deletions

View file

@ -150,6 +150,18 @@ impl Render for WindowDemo {
)
.unwrap();
}))
.child(button("Hide Application", |cx| {
cx.hide();
// Restore the application after 3 seconds
cx.spawn(|mut cx| async move {
Timer::after(std::time::Duration::from_secs(3)).await;
cx.update(|cx| {
cx.activate(false);
})
})
.detach();
}))
}
}