Run cargo format
This commit is contained in:
parent
4db2e3ec25
commit
61692b21ad
6 changed files with 80 additions and 43 deletions
|
|
@ -307,7 +307,9 @@ impl State {
|
||||||
let surface = device.surfaces.remove(&crtc).unwrap();
|
let surface = device.surfaces.remove(&crtc).unwrap();
|
||||||
if surface.output.mirroring().is_none() {
|
if surface.output.mirroring().is_none() {
|
||||||
// TODO: move up later outputs?
|
// 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,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -864,9 +864,10 @@ impl Drop for MoveGrab {
|
||||||
let pointer = seat.get_pointer().unwrap();
|
let pointer = seat.get_pointer().unwrap();
|
||||||
let current_location = pointer.current_location();
|
let current_location = pointer.current_location();
|
||||||
|
|
||||||
if let Some((target, offset)) =
|
if let Some((target, offset)) = mapped.focus_under(
|
||||||
mapped.focus_under(current_location - position.as_logical().to_f64(), WindowSurfaceType::ALL)
|
current_location - position.as_logical().to_f64(),
|
||||||
{
|
WindowSurfaceType::ALL,
|
||||||
|
) {
|
||||||
pointer.motion(
|
pointer.motion(
|
||||||
state,
|
state,
|
||||||
Some((
|
Some((
|
||||||
|
|
|
||||||
|
|
@ -732,41 +732,60 @@ impl FloatingLayout {
|
||||||
self.space
|
self.space
|
||||||
.elements()
|
.elements()
|
||||||
.rev()
|
.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)| {
|
.filter(|(e, render_location)| {
|
||||||
let mut bbox = e.bbox();
|
let mut bbox = e.bbox();
|
||||||
bbox.loc += *render_location;
|
bbox.loc += *render_location;
|
||||||
bbox.to_f64().contains(location.as_logical())
|
bbox.to_f64().contains(location.as_logical())
|
||||||
})
|
})
|
||||||
.find_map(|(e, render_location)| {
|
.find_map(|(e, render_location)| {
|
||||||
let render_location = render_location
|
let render_location = render_location.as_local().to_f64();
|
||||||
.as_local()
|
|
||||||
.to_f64();
|
|
||||||
let point = location - render_location;
|
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())
|
Some(e.clone().into())
|
||||||
} else {
|
} else {
|
||||||
None
|
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
|
self.space
|
||||||
.elements()
|
.elements()
|
||||||
.rev()
|
.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)| {
|
.filter(|(e, render_location)| {
|
||||||
let mut bbox = e.bbox();
|
let mut bbox = e.bbox();
|
||||||
bbox.loc += *render_location;
|
bbox.loc += *render_location;
|
||||||
bbox.to_f64().contains(location.as_logical())
|
bbox.to_f64().contains(location.as_logical())
|
||||||
})
|
})
|
||||||
.find_map(|(e, render_location)| {
|
.find_map(|(e, render_location)| {
|
||||||
let render_location = render_location
|
let render_location = render_location.as_local().to_f64();
|
||||||
.as_local()
|
|
||||||
.to_f64();
|
|
||||||
let point = location - render_location;
|
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())
|
Some(e.clone().into())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
@ -781,16 +800,19 @@ impl FloatingLayout {
|
||||||
self.space
|
self.space
|
||||||
.elements()
|
.elements()
|
||||||
.rev()
|
.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)| {
|
.filter(|(e, render_location)| {
|
||||||
let mut bbox = e.bbox();
|
let mut bbox = e.bbox();
|
||||||
bbox.loc += *render_location;
|
bbox.loc += *render_location;
|
||||||
bbox.to_f64().contains(location.as_logical())
|
bbox.to_f64().contains(location.as_logical())
|
||||||
})
|
})
|
||||||
.find_map(|(e, render_location)| {
|
.find_map(|(e, render_location)| {
|
||||||
let render_location = render_location
|
let render_location = render_location.as_local().to_f64();
|
||||||
.as_local()
|
|
||||||
.to_f64();
|
|
||||||
let point = location - render_location;
|
let point = location - render_location;
|
||||||
e.focus_under(
|
e.focus_under(
|
||||||
point.as_logical(),
|
point.as_logical(),
|
||||||
|
|
@ -809,7 +831,12 @@ impl FloatingLayout {
|
||||||
self.space
|
self.space
|
||||||
.elements()
|
.elements()
|
||||||
.rev()
|
.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)| {
|
.filter(|(e, render_location)| {
|
||||||
let mut bbox = e.bbox();
|
let mut bbox = e.bbox();
|
||||||
bbox.loc += *render_location;
|
bbox.loc += *render_location;
|
||||||
|
|
@ -823,10 +850,7 @@ impl FloatingLayout {
|
||||||
WindowSurfaceType::TOPLEVEL | WindowSurfaceType::SUBSURFACE,
|
WindowSurfaceType::TOPLEVEL | WindowSurfaceType::SUBSURFACE,
|
||||||
)
|
)
|
||||||
.map(|(surface, surface_offset)| {
|
.map(|(surface, surface_offset)| {
|
||||||
(
|
(surface, render_location + surface_offset.as_local())
|
||||||
surface,
|
|
||||||
render_location + surface_offset.as_local(),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3104,8 +3104,11 @@ impl TilingLayout {
|
||||||
|
|
||||||
None
|
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();
|
let location = location_f64.to_i32_round();
|
||||||
|
|
||||||
for (mapped, geo) in self.mapped() {
|
for (mapped, geo) in self.mapped() {
|
||||||
|
|
@ -3113,18 +3116,24 @@ impl TilingLayout {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if mapped.focus_under(
|
if mapped
|
||||||
(location_f64 - geo.loc.to_f64()).as_logical() + mapped.geometry().loc.to_f64(),
|
.focus_under(
|
||||||
WindowSurfaceType::POPUP | WindowSurfaceType::SUBSURFACE,
|
(location_f64 - geo.loc.to_f64()).as_logical() + mapped.geometry().loc.to_f64(),
|
||||||
).is_some() {
|
WindowSurfaceType::POPUP | WindowSurfaceType::SUBSURFACE,
|
||||||
|
)
|
||||||
|
.is_some()
|
||||||
|
{
|
||||||
return Some(mapped.clone().into());
|
return Some(mapped.clone().into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
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();
|
let location = location_f64.to_i32_round();
|
||||||
|
|
||||||
for (mapped, geo) in self.mapped() {
|
for (mapped, geo) in self.mapped() {
|
||||||
|
|
@ -3132,10 +3141,13 @@ impl TilingLayout {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if mapped.focus_under(
|
if mapped
|
||||||
(location_f64 - geo.loc.to_f64()).as_logical() + mapped.geometry().loc.to_f64(),
|
.focus_under(
|
||||||
WindowSurfaceType::TOPLEVEL | WindowSurfaceType::SUBSURFACE,
|
(location_f64 - geo.loc.to_f64()).as_logical() + mapped.geometry().loc.to_f64(),
|
||||||
).is_some() {
|
WindowSurfaceType::TOPLEVEL | WindowSurfaceType::SUBSURFACE,
|
||||||
|
)
|
||||||
|
.is_some()
|
||||||
|
{
|
||||||
return Some(mapped.clone().into());
|
return Some(mapped.clone().into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1960,13 +1960,14 @@ impl Shell {
|
||||||
self.pending_windows.retain(|(s, _, _)| s.alive());
|
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() {
|
for (o, set) in self.workspaces.sets.iter_mut() {
|
||||||
if o == output {
|
if o == output {
|
||||||
set.sticky_layer.update_pointer_position(Some(location));
|
set.sticky_layer.update_pointer_position(Some(location));
|
||||||
for (i, workspace) in set.workspaces.iter_mut().enumerate() {
|
for (i, workspace) in set.workspaces.iter_mut().enumerate() {
|
||||||
if i == set.active {
|
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 {
|
} else {
|
||||||
workspace.update_pointer_position(None, self.overview_mode.clone());
|
workspace.update_pointer_position(None, self.overview_mode.clone());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -200,10 +200,7 @@ where
|
||||||
.instances
|
.instances
|
||||||
.push(instance);
|
.push(instance);
|
||||||
} else {
|
} else {
|
||||||
let _ = data_init.init(
|
let _ = data_init.init(cosmic_toplevel, ToplevelHandleStateInner::empty());
|
||||||
cosmic_toplevel,
|
|
||||||
ToplevelHandleStateInner::empty(),
|
|
||||||
);
|
|
||||||
error!(?foreign_toplevel, "Toplevel for foreign-toplevel-list not registered for cosmic-toplevel-info.");
|
error!(?foreign_toplevel, "Toplevel for foreign-toplevel-list not registered for cosmic-toplevel-info.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue