Reset modifiers when the window active state changes (#28348)

Conrad Irwin and Dino created

Closes #23449

Release Notes:

- Fixed a bug causing shift to get stuck down when the window focus
changes

---------

Co-authored-by: Dino <dinojoaocosta@gmail.com>

Change summary

crates/gpui/src/window.rs                       | 1 +
crates/project_panel/src/project_panel_tests.rs | 1 +
2 files changed, 2 insertions(+)

Detailed changes

crates/gpui/src/window.rs 🔗

@@ -845,6 +845,7 @@ impl Window {
                 handle
                     .update(&mut cx, |_, window, cx| {
                         window.active.set(active);
+                        window.modifiers = window.platform_window.modifiers();
                         window
                             .activation_observers
                             .clone()

crates/project_panel/src/project_panel_tests.rs 🔗

@@ -2736,6 +2736,7 @@ async fn test_multiple_marked_entries(cx: &mut gpui::TestAppContext) {
         shift: true,
         ..Default::default()
     };
+    cx.run_until_parked();
     cx.simulate_modifiers_change(modifiers_with_shift);
     cx.update(|window, cx| {
         panel.update(cx, |this, cx| {