fix(notify): toasts stop pushing themselves above the Snipping Tool
- The 33 ms tick re-placed every open toast, pill and call toast with HWND_TOPMOST, so they jumped above the Snipping Tool overlay 30 times a second - A window now goes topmost once when it opens; later moves keep the z-order, unchanged positions are skipped Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -1,3 +1,4 @@
1
use std::cell::Cell;
1
2
use std::collections::{HashMap, HashSet};
2
3
use std::time::{Duration, Instant};
3
4
@@ -60,11 +61,17 @@ struct OpenWindow {
60
61
handle: AnyWindowHandle,
61
62
native: Option<NativeHandle>,
62
63
opened: Instant,
64
placed: Cell<Option<(i32, i32, i32, i32)>>,
63
65
}
64
66
65
67
impl OpenWindow {
66
68
fn place(&self, native: NativeHandle, slot: Slot, x: i32, cx: &mut App) {
67
platform::place(native, x, slot.y, slot.width, slot.height);
69
let rect = (x, slot.y, slot.width, slot.height);
70
match self.placed.replace(Some(rect)) {
71
Some(previous) if previous == rect => return,
72
Some(_) => platform::place_rect(native, x, slot.y, slot.width, slot.height),
73
None => platform::place(native, x, slot.y, slot.width, slot.height),
74
}
68
75
// WM_SIZE arrives while the app is borrowed, so GPUI drops its own resize report.
69
76
self.handle
70
77
.update(cx, |_, window, cx| window.bounds_changed(cx))
@@ -1425,6 +1432,7 @@ fn open_popup<V: Into<AnyView>>(
1425
1432
handle,
1426
1433
native,
1427
1434
opened: Instant::now(),
1435
placed: Cell::new(None),
1428
1436
};
1429
1437
center.update(cx, |this, _| opened(this, Some(window)));
1430
1438
});
@@ -1,3 +1,4 @@1
use std::cell::Cell;1
use std::collections::{HashMap, HashSet};2
use std::collections::{HashMap, HashSet};2
use std::time::{Duration, Instant};3
use std::time::{Duration, Instant};3
4
@@ -60,11 +61,17 @@ struct OpenWindow {60
handle: AnyWindowHandle,61
handle: AnyWindowHandle,61
native: Option<NativeHandle>,62
native: Option<NativeHandle>,62
opened: Instant,63
opened: Instant,64
placed: Cell<Option<(i32, i32, i32, i32)>>,63
}65
}64
66
65
impl OpenWindow {67
impl OpenWindow {66
fn place(&self, native: NativeHandle, slot: Slot, x: i32, cx: &mut App) {68
fn place(&self, native: NativeHandle, slot: Slot, x: i32, cx: &mut App) {67
platform::place(native, x, slot.y, slot.width, slot.height);69
let rect = (x, slot.y, slot.width, slot.height);70
match self.placed.replace(Some(rect)) {71
Some(previous) if previous == rect => return,72
Some(_) => platform::place_rect(native, x, slot.y, slot.width, slot.height),73
None => platform::place(native, x, slot.y, slot.width, slot.height),74
}68
// WM_SIZE arrives while the app is borrowed, so GPUI drops its own resize report.75
// WM_SIZE arrives while the app is borrowed, so GPUI drops its own resize report.69
self.handle76
self.handle70
.update(cx, |_, window, cx| window.bounds_changed(cx))77
.update(cx, |_, window, cx| window.bounds_changed(cx))@@ -1425,6 +1432,7 @@ fn open_popup<V: Into<AnyView>>(1425
handle,1432
handle,1426
native,1433
native,1427
opened: Instant::now(),1434
opened: Instant::now(),1435
placed: Cell::new(None),1428
};1436
};1429
center.update(cx, |this, _| opened(this, Some(window)));1437
center.update(cx, |this, _| opened(this, Some(window)));1430
});1438
});