Run cargo format

This commit is contained in:
Ian Douglas Scott 2024-11-14 13:19:47 -08:00 committed by Victoria Brekenfeld
parent 4db2e3ec25
commit 61692b21ad
6 changed files with 80 additions and 43 deletions

View file

@ -307,7 +307,9 @@ impl State {
let surface = device.surfaces.remove(&crtc).unwrap();
if surface.output.mirroring().is_none() {
// TODO: move up later outputs?
w = w.saturating_sub(surface.output.config().transformed_size().w as u32);
w = w.saturating_sub(
surface.output.config().transformed_size().w as u32,
);
}
}

View file

@ -864,9 +864,10 @@ impl Drop for MoveGrab {
let pointer = seat.get_pointer().unwrap();
let current_location = pointer.current_location();
if let Some((target, offset)) =
mapped.focus_under(current_location - position.as_logical().to_f64(), WindowSurfaceType::ALL)
{
if let Some((target, offset)) = mapped.focus_under(
current_location - position.as_logical().to_f64(),
WindowSurfaceType::ALL,
) {
pointer.motion(
state,
Some((

View file

@ -732,41 +732,60 @@ impl FloatingLayout {
self.space
.elements()
.rev()
.map(|e| (e, self.space.element_location(e).unwrap() - e.geometry().loc))
.map(|e| {
(
e,
self.space.element_location(e).unwrap() - e.geometry().loc,
)
})
.filter(|(e, render_location)| {
let mut bbox = e.bbox();
bbox.loc += *render_location;
bbox.to_f64().contains(location.as_logical())
})
.find_map(|(e, render_location)| {
let render_location = render_location
.as_local()
.to_f64();
let render_location = render_location.as_local().to_f64();
let point = location - render_location;
if e.focus_under(point.as_logical(), WindowSurfaceType::POPUP | WindowSurfaceType::SUBSURFACE).is_some() {
if e.focus_under(
point.as_logical(),
WindowSurfaceType::POPUP | WindowSurfaceType::SUBSURFACE,
)
.is_some()
{
Some(e.clone().into())
} else {
None
}
})
}
pub fn toplevel_element_under(&self, location: Point<f64, Local>) -> Option<KeyboardFocusTarget> {
pub fn toplevel_element_under(
&self,
location: Point<f64, Local>,
) -> Option<KeyboardFocusTarget> {
self.space
.elements()
.rev()
.map(|e| (e, self.space.element_location(e).unwrap() - e.geometry().loc))
.map(|e| {
(
e,
self.space.element_location(e).unwrap() - e.geometry().loc,
)
})
.filter(|(e, render_location)| {
let mut bbox = e.bbox();
bbox.loc += *render_location;
bbox.to_f64().contains(location.as_logical())
})
.find_map(|(e, render_location)| {
let render_location = render_location
.as_local()
.to_f64();
let render_location = render_location.as_local().to_f64();
let point = location - render_location;
if e.focus_under(point.as_logical(), WindowSurfaceType::TOPLEVEL | WindowSurfaceType::SUBSURFACE).is_some() {
if e.focus_under(
point.as_logical(),
WindowSurfaceType::TOPLEVEL | WindowSurfaceType::SUBSURFACE,
)
.is_some()
{
Some(e.clone().into())
} else {
None
@ -781,16 +800,19 @@ impl FloatingLayout {
self.space
.elements()
.rev()
.map(|e| (e, self.space.element_location(e).unwrap() - e.geometry().loc))
.map(|e| {
(
e,
self.space.element_location(e).unwrap() - e.geometry().loc,
)
})
.filter(|(e, render_location)| {
let mut bbox = e.bbox();
bbox.loc += *render_location;
bbox.to_f64().contains(location.as_logical())
})
.find_map(|(e, render_location)| {
let render_location = render_location
.as_local()
.to_f64();
let render_location = render_location.as_local().to_f64();
let point = location - render_location;
e.focus_under(
point.as_logical(),
@ -809,7 +831,12 @@ impl FloatingLayout {
self.space
.elements()
.rev()
.map(|e| (e, self.space.element_location(e).unwrap() - e.geometry().loc))
.map(|e| {
(
e,
self.space.element_location(e).unwrap() - e.geometry().loc,
)
})
.filter(|(e, render_location)| {
let mut bbox = e.bbox();
bbox.loc += *render_location;
@ -823,10 +850,7 @@ impl FloatingLayout {
WindowSurfaceType::TOPLEVEL | WindowSurfaceType::SUBSURFACE,
)
.map(|(surface, surface_offset)| {
(
surface,
render_location + surface_offset.as_local(),
)
(surface, render_location + surface_offset.as_local())
})
})
}

View file

@ -3104,8 +3104,11 @@ impl TilingLayout {
None
}
pub fn popup_element_under(&self, location_f64: Point<f64, Local>) -> Option<KeyboardFocusTarget> {
pub fn popup_element_under(
&self,
location_f64: Point<f64, Local>,
) -> Option<KeyboardFocusTarget> {
let location = location_f64.to_i32_round();
for (mapped, geo) in self.mapped() {
@ -3113,18 +3116,24 @@ impl TilingLayout {
continue;
}
if mapped.focus_under(
(location_f64 - geo.loc.to_f64()).as_logical() + mapped.geometry().loc.to_f64(),
WindowSurfaceType::POPUP | WindowSurfaceType::SUBSURFACE,
).is_some() {
if mapped
.focus_under(
(location_f64 - geo.loc.to_f64()).as_logical() + mapped.geometry().loc.to_f64(),
WindowSurfaceType::POPUP | WindowSurfaceType::SUBSURFACE,
)
.is_some()
{
return Some(mapped.clone().into());
}
}
None
}
pub fn toplevel_element_under(&self, location_f64: Point<f64, Local>) -> Option<KeyboardFocusTarget> {
pub fn toplevel_element_under(
&self,
location_f64: Point<f64, Local>,
) -> Option<KeyboardFocusTarget> {
let location = location_f64.to_i32_round();
for (mapped, geo) in self.mapped() {
@ -3132,10 +3141,13 @@ impl TilingLayout {
continue;
}
if mapped.focus_under(
(location_f64 - geo.loc.to_f64()).as_logical() + mapped.geometry().loc.to_f64(),
WindowSurfaceType::TOPLEVEL | WindowSurfaceType::SUBSURFACE,
).is_some() {
if mapped
.focus_under(
(location_f64 - geo.loc.to_f64()).as_logical() + mapped.geometry().loc.to_f64(),
WindowSurfaceType::TOPLEVEL | WindowSurfaceType::SUBSURFACE,
)
.is_some()
{
return Some(mapped.clone().into());
}
}

View file

@ -1960,13 +1960,14 @@ impl Shell {
self.pending_windows.retain(|(s, _, _)| s.alive());
}
pub fn update_pointer_position(&mut self, location: Point<f64, Local>, output: &Output) {
pub fn update_pointer_position(&mut self, location: Point<f64, Local>, output: &Output) {
for (o, set) in self.workspaces.sets.iter_mut() {
if o == output {
set.sticky_layer.update_pointer_position(Some(location));
for (i, workspace) in set.workspaces.iter_mut().enumerate() {
if i == set.active {
workspace.update_pointer_position(Some(location), self.overview_mode.clone());
workspace
.update_pointer_position(Some(location), self.overview_mode.clone());
} else {
workspace.update_pointer_position(None, self.overview_mode.clone());
}

View file

@ -200,10 +200,7 @@ where
.instances
.push(instance);
} else {
let _ = data_init.init(
cosmic_toplevel,
ToplevelHandleStateInner::empty(),
);
let _ = data_init.init(cosmic_toplevel, ToplevelHandleStateInner::empty());
error!(?foreign_toplevel, "Toplevel for foreign-toplevel-list not registered for cosmic-toplevel-info.");
}
}