Explain runtime invariants and avoid redundant unwraps
This commit is contained in:
1 parent
34f2f07301
commit
1b51ba83b4
116 files changed
+1643
-515
No files matched your search
@@ -21,8 +21,12 @@ fn menu_positioner(
|
||||
};
|
||||
SctkPositioner {
|
||||
anchor_rect: rectangle,
|
||||
anchor: anchor.try_into().unwrap(),
|
||||
gravity: gravity.try_into().unwrap(),
|
||||
anchor: anchor
|
||||
.try_into()
|
||||
.expect("popup placement uses supported anchor and gravity combinations"),
|
||||
gravity: gravity
|
||||
.try_into()
|
||||
.expect("popup placement uses supported anchor and gravity combinations"),
|
||||
offset: (rectangle.width / 2, gap),
|
||||
size_limits: Limits::NONE
|
||||
.max_width(368.0)
|
||||
|
||||
@@ -164,7 +164,10 @@ impl OpenMenu {
|
||||
}
|
||||
}
|
||||
if let Some(effects) = &self.effects {
|
||||
let regions = self.regions.lock().unwrap();
|
||||
let regions = self
|
||||
.regions
|
||||
.lock()
|
||||
.expect("surface rendering state must remain consistent across callbacks");
|
||||
if let Err(error) = effects.set_regions(®ions) {
|
||||
eprintln!("ferese-shell: could not prepare popover material: {error}");
|
||||
}
|
||||
@@ -355,7 +358,9 @@ impl FereseShell {
|
||||
|now| {
|
||||
if let Some(effects) = &menu.effects {
|
||||
let _ = effects.set_presentation(
|
||||
&menu.regions.lock().unwrap(),
|
||||
&menu.regions.lock().expect(
|
||||
"surface rendering state must remain consistent across callbacks",
|
||||
),
|
||||
menu.motion.progress_at(now),
|
||||
[],
|
||||
super::ferese_surface_effects_v1::Role::Popover,
|
||||
|
||||
Reference in new issue
Block a user