Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run cargo format, update smithay, and use WeakOutput instead of Option<WeakOutput>, Output #992

Merged
merged 5 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ jobs:
- run: cargo check --no-default-features
- run: cargo check --features debug
- run: cargo check --features profile-with-tracy
- run: cargo fmt --all -- --check
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ inherits = "release"
lto = "fat"

[patch."https://github.com/Smithay/smithay.git"]
smithay = { git = "https://github.com/smithay//smithay", rev = "05c49f7" }
smithay = { git = "https://github.com/smithay//smithay", rev = "ace2e6a" }
4 changes: 3 additions & 1 deletion src/backend/kms/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/shell/grabs/moving.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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((
Expand Down
66 changes: 45 additions & 21 deletions src/shell/layout/floating/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(),
Expand All @@ -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;
Expand All @@ -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())
})
})
}
Expand Down
36 changes: 24 additions & 12 deletions src/shell/layout/tiling/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3104,38 +3104,50 @@ 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() {
if !mapped.bbox().contains((location - geo.loc).as_logical()) {
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() {
if !mapped.bbox().contains((location - geo.loc).as_logical()) {
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());
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
6 changes: 3 additions & 3 deletions src/wayland/protocols/output_configuration/handlers/cosmic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl<D> Dispatch<ZcosmicOutputManagerV1, (), D> for OutputConfigurationState<D>
where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration>
Expand Down Expand Up @@ -150,7 +150,7 @@ impl<D> Dispatch<ZcosmicOutputConfigurationV1, Weak<ZwlrOutputConfigurationV1>,
where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration>
Expand Down Expand Up @@ -238,7 +238,7 @@ impl<D> Dispatch<ZcosmicOutputConfigurationHeadV1, Weak<ZwlrOutputConfigurationH
where
D: GlobalDispatch<ZwlrOutputManagerV1, OutputMngrGlobalData>
+ Dispatch<ZwlrOutputManagerV1, ()>
+ Dispatch<ZwlrOutputHeadV1, Output>
+ Dispatch<ZwlrOutputHeadV1, WeakOutput>
+ Dispatch<ZwlrOutputModeV1, Mode>
+ Dispatch<ZwlrOutputConfigurationV1, PendingConfiguration>
+ Dispatch<ZwlrOutputConfigurationHeadV1, PendingOutputConfiguration>
Expand Down
Loading
Loading