chore: Formatting updates
This commit is contained in:
parent
ac889f609d
commit
4ee2763139
9 changed files with 170 additions and 80 deletions
|
|
@ -1,18 +1,17 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
backend::render::cursor::CursorState,
|
||||||
config::{Action, Config, KeyPattern, WorkspaceLayout},
|
config::{Action, Config, KeyPattern, WorkspaceLayout},
|
||||||
shell::{
|
shell::{
|
||||||
focus::{target::PointerFocusTarget, FocusDirection},
|
focus::{target::PointerFocusTarget, FocusDirection},
|
||||||
grabs::{ResizeEdge, SeatMoveGrabState},
|
grabs::{ResizeEdge, SeatMoveGrabState},
|
||||||
layout::{
|
layout::tiling::{Direction, FocusResult, MoveResult},
|
||||||
tiling::{Direction, FocusResult, MoveResult},
|
OverviewMode, ResizeDirection, ResizeMode, Trigger, Workspace,
|
||||||
},
|
},
|
||||||
OverviewMode, ResizeDirection, ResizeMode, Workspace, Trigger,
|
|
||||||
}, // shell::grabs::SeatMoveGrabState
|
|
||||||
state::Common,
|
state::Common,
|
||||||
utils::prelude::*,
|
utils::prelude::*,
|
||||||
wayland::{handlers::screencopy::ScreencopySessions, protocols::screencopy::Session}, backend::render::cursor::CursorState,
|
wayland::{handlers::screencopy::ScreencopySessions, protocols::screencopy::Session},
|
||||||
};
|
};
|
||||||
use calloop::{timer::Timer, RegistrationToken};
|
use calloop::{timer::Timer, RegistrationToken};
|
||||||
use cosmic_protocols::screencopy::v1::server::zcosmic_screencopy_session_v1::InputType;
|
use cosmic_protocols::screencopy::v1::server::zcosmic_screencopy_session_v1::InputType;
|
||||||
|
|
@ -315,7 +314,7 @@ impl State {
|
||||||
modifiers: modifiers.clone().into(),
|
modifiers: modifiers.clone().into(),
|
||||||
key: handle.raw_code(),
|
key: handle.raw_code(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if state == KeyState::Released {
|
if state == KeyState::Released {
|
||||||
if let Some(tokens) = userdata.get::<SupressedKeys>().unwrap().filter(&handle) {
|
if let Some(tokens) = userdata.get::<SupressedKeys>().unwrap().filter(&handle) {
|
||||||
for token in tokens {
|
for token in tokens {
|
||||||
|
|
@ -334,7 +333,7 @@ impl State {
|
||||||
calloop::timer::TimeoutAction::ToDuration(Duration::from_millis(25))
|
calloop::timer::TimeoutAction::ToDuration(Duration::from_millis(25))
|
||||||
}).ok()
|
}).ok()
|
||||||
} else { None };
|
} else { None };
|
||||||
|
|
||||||
userdata
|
userdata
|
||||||
.get::<SupressedKeys>()
|
.get::<SupressedKeys>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -658,9 +657,12 @@ impl State {
|
||||||
let layers = layer_map_for_output(&output);
|
let layers = layer_map_for_output(&output);
|
||||||
if let Some(layer) = layers
|
if let Some(layer) = layers
|
||||||
.layer_under(WlrLayer::Overlay, relative_pos)
|
.layer_under(WlrLayer::Overlay, relative_pos)
|
||||||
.or_else(|| layers.layer_under(WlrLayer::Top, relative_pos))
|
.or_else(|| {
|
||||||
|
layers.layer_under(WlrLayer::Top, relative_pos)
|
||||||
|
})
|
||||||
{
|
{
|
||||||
let layer_loc = layers.layer_geometry(layer).unwrap().loc;
|
let layer_loc =
|
||||||
|
layers.layer_geometry(layer).unwrap().loc;
|
||||||
if layer.can_receive_keyboard_focus()
|
if layer.can_receive_keyboard_focus()
|
||||||
&& layer
|
&& layer
|
||||||
.surface_under(
|
.surface_under(
|
||||||
|
|
@ -685,9 +687,12 @@ impl State {
|
||||||
let layers = layer_map_for_output(&output);
|
let layers = layer_map_for_output(&output);
|
||||||
if let Some(layer) = layers
|
if let Some(layer) = layers
|
||||||
.layer_under(WlrLayer::Bottom, pos)
|
.layer_under(WlrLayer::Bottom, pos)
|
||||||
.or_else(|| layers.layer_under(WlrLayer::Background, pos))
|
.or_else(|| {
|
||||||
|
layers.layer_under(WlrLayer::Background, pos)
|
||||||
|
})
|
||||||
{
|
{
|
||||||
let layer_loc = layers.layer_geometry(layer).unwrap().loc;
|
let layer_loc =
|
||||||
|
layers.layer_geometry(layer).unwrap().loc;
|
||||||
if layer.can_receive_keyboard_focus()
|
if layer.can_receive_keyboard_focus()
|
||||||
&& layer
|
&& layer
|
||||||
.surface_under(
|
.surface_under(
|
||||||
|
|
@ -702,7 +707,12 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Common::set_focus(self, under.and_then(|target| target.try_into().ok()).as_ref(), seat, Some(serial));
|
Common::set_focus(
|
||||||
|
self,
|
||||||
|
under.and_then(|target| target.try_into().ok()).as_ref(),
|
||||||
|
seat,
|
||||||
|
Some(serial),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let OverviewMode::Started(Trigger::Pointer(action_button), _) =
|
if let OverviewMode::Started(Trigger::Pointer(action_button), _) =
|
||||||
|
|
@ -1239,7 +1249,9 @@ impl State {
|
||||||
MoveResult::Done => {
|
MoveResult::Done => {
|
||||||
if let Some(focused_window) = workspace.focus_stack.get(seat).last() {
|
if let Some(focused_window) = workspace.focus_stack.get(seat).last() {
|
||||||
if workspace.is_tiled(focused_window) {
|
if workspace.is_tiled(focused_window) {
|
||||||
self.common.shell.set_overview_mode(Some(Trigger::Keyboard(pattern.modifiers)));
|
self.common
|
||||||
|
.shell
|
||||||
|
.set_overview_mode(Some(Trigger::Keyboard(pattern.modifiers)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1376,10 +1388,7 @@ impl State {
|
||||||
return Some((or.clone().into(), or.geometry().loc));
|
return Some((or.clone().into(), or.geometry().loc));
|
||||||
}
|
}
|
||||||
if let Some((target, loc)) = workspace.element_under(relative_pos, overview) {
|
if let Some((target, loc)) = workspace.element_under(relative_pos, overview) {
|
||||||
return Some((
|
return Some((target, loc + (global_pos - relative_pos).to_i32_round()));
|
||||||
target,
|
|
||||||
loc + (global_pos - relative_pos).to_i32_round(),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
let layers = layer_map_for_output(output);
|
let layers = layer_map_for_output(output);
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,9 @@ impl CosmicMapped {
|
||||||
|
|
||||||
pub fn has_surface(&self, surface: &WlSurface, surface_type: WindowSurfaceType) -> bool {
|
pub fn has_surface(&self, surface: &WlSurface, surface_type: WindowSurfaceType) -> bool {
|
||||||
self.windows().any(|(w, _)| {
|
self.windows().any(|(w, _)| {
|
||||||
let Some(toplevel ) = w.wl_surface() else { return false };
|
let Some(toplevel) = w.wl_surface() else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
if surface_type.contains(WindowSurfaceType::TOPLEVEL) {
|
if surface_type.contains(WindowSurfaceType::TOPLEVEL) {
|
||||||
if toplevel == *surface {
|
if toplevel == *surface {
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,9 @@ impl CosmicStack {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(idx) = windows.iter().position(|w| w == window) else { return };
|
let Some(idx) = windows.iter().position(|w| w == window) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
let window = windows.remove(idx);
|
let window = windows.remove(idx);
|
||||||
window.try_force_undecorated(false);
|
window.try_force_undecorated(false);
|
||||||
window.set_tiled(false);
|
window.set_tiled(false);
|
||||||
|
|
@ -619,13 +621,7 @@ impl Program for CosmicStackInternal {
|
||||||
|
|
||||||
fn view(&self) -> CosmicElement<'_, Self::Message> {
|
fn view(&self) -> CosmicElement<'_, Self::Message> {
|
||||||
let windows = self.windows.lock().unwrap();
|
let windows = self.windows.lock().unwrap();
|
||||||
let Some(width) = self
|
let Some(width) = self.geometry.lock().unwrap().as_ref().map(|r| r.size.w) else {
|
||||||
.geometry
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.as_ref()
|
|
||||||
.map(|r| r.size.w)
|
|
||||||
else {
|
|
||||||
return iced_widget::row(Vec::new()).into();
|
return iced_widget::row(Vec::new()).into();
|
||||||
};
|
};
|
||||||
let active = self.active.load(Ordering::SeqCst);
|
let active = self.active.load(Ordering::SeqCst);
|
||||||
|
|
|
||||||
|
|
@ -722,13 +722,24 @@ where
|
||||||
let changes = if unknown_keys {
|
let changes = if unknown_keys {
|
||||||
Some(Difference::NewOrRemoved)
|
Some(Difference::NewOrRemoved)
|
||||||
} else {
|
} else {
|
||||||
current_state.iter().filter_map(|(a_id, a_bounds)| {
|
current_state
|
||||||
let Some(b_bounds) = last_state.get(a_id) else { return Some(Difference::Movement) };
|
.iter()
|
||||||
(a_bounds != b_bounds).then(|| if a_bounds.position() != b_bounds.position() { Difference::Movement } else { Difference::Focus })
|
.filter_map(|(a_id, a_bounds)| {
|
||||||
}).fold(None, |a, b| match (a, b) {
|
let Some(b_bounds) = last_state.get(a_id) else {
|
||||||
(None | Some(Difference::Movement), x) => Some(x),
|
return Some(Difference::Movement);
|
||||||
(a, _) => a,
|
};
|
||||||
})
|
(a_bounds != b_bounds).then(|| {
|
||||||
|
if a_bounds.position() != b_bounds.position() {
|
||||||
|
Difference::Movement
|
||||||
|
} else {
|
||||||
|
Difference::Focus
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.fold(None, |a, b| match (a, b) {
|
||||||
|
(None | Some(Difference::Movement), x) => Some(x),
|
||||||
|
(a, _) => a,
|
||||||
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
if unknown_keys || changes.is_some() {
|
if unknown_keys || changes.is_some() {
|
||||||
|
|
|
||||||
|
|
@ -260,11 +260,19 @@ impl FloatingLayout {
|
||||||
edge: ResizeEdge,
|
edge: ResizeEdge,
|
||||||
amount: i32,
|
amount: i32,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let Some(toplevel) = focused.toplevel() else { return false };
|
let Some(toplevel) = focused.toplevel() else {
|
||||||
let Some(mapped) = self.space.elements().find(|m| m.has_surface(&toplevel, WindowSurfaceType::TOPLEVEL)) else { return false };
|
return false;
|
||||||
|
};
|
||||||
|
let Some(mapped) = self
|
||||||
|
.space
|
||||||
|
.elements()
|
||||||
|
.find(|m| m.has_surface(&toplevel, WindowSurfaceType::TOPLEVEL))
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
let Some(original_geo) = self.space.element_geometry(mapped) else {
|
let Some(original_geo) = self.space.element_geometry(mapped) else {
|
||||||
return false // we don't have that window
|
return false; // we don't have that window
|
||||||
};
|
};
|
||||||
let mut geo = original_geo.clone();
|
let mut geo = original_geo.clone();
|
||||||
|
|
||||||
|
|
@ -297,13 +305,18 @@ impl FloatingLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(bounding_box) = self.space.outputs()
|
let Some(bounding_box) = self
|
||||||
|
.space
|
||||||
|
.outputs()
|
||||||
.map(|o| self.space.output_geometry(o).unwrap())
|
.map(|o| self.space.output_geometry(o).unwrap())
|
||||||
.filter(|output_geo| output_geo.overlaps(geo))
|
.filter(|output_geo| output_geo.overlaps(geo))
|
||||||
.fold(None, |res, output_geo| match res {
|
.fold(None, |res, output_geo| match res {
|
||||||
None => Some(output_geo),
|
None => Some(output_geo),
|
||||||
Some(other) => Some(other.merge(output_geo)),
|
Some(other) => Some(other.merge(output_geo)),
|
||||||
}) else { return true };
|
})
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
let (min_size, max_size) = (mapped.min_size(), mapped.max_size());
|
let (min_size, max_size) = (mapped.min_size(), mapped.max_size());
|
||||||
let min_width = min_size.map(|s| s.w).unwrap_or(360);
|
let min_width = min_size.map(|s| s.w).unwrap_or(360);
|
||||||
|
|
|
||||||
|
|
@ -737,9 +737,13 @@ impl TilingLayout {
|
||||||
let queue = self.queues.get_mut(&output).unwrap();
|
let queue = self.queues.get_mut(&output).unwrap();
|
||||||
let mut tree = queue.trees.back().unwrap().0.copy_clone();
|
let mut tree = queue.trees.back().unwrap().0.copy_clone();
|
||||||
|
|
||||||
let Some(target) = seat.get_keyboard().unwrap().current_focus() else { return MoveResult::Done };
|
let Some(target) = seat.get_keyboard().unwrap().current_focus() else {
|
||||||
let Some((node_id, data)) = TilingLayout::currently_focused_node(&mut tree, &seat.active_output(), target) else {
|
return MoveResult::Done;
|
||||||
return MoveResult::Done
|
};
|
||||||
|
let Some((node_id, data)) =
|
||||||
|
TilingLayout::currently_focused_node(&mut tree, &seat.active_output(), target)
|
||||||
|
else {
|
||||||
|
return MoveResult::Done;
|
||||||
};
|
};
|
||||||
|
|
||||||
// stacks may handle movement internally
|
// stacks may handle movement internally
|
||||||
|
|
@ -783,13 +787,16 @@ impl TilingLayout {
|
||||||
let Some(og_parent) = tree.get(&node_id).unwrap().parent().cloned() else {
|
let Some(og_parent) = tree.get(&node_id).unwrap().parent().cloned() else {
|
||||||
return match data {
|
return match data {
|
||||||
FocusedNodeData::Window(window) => MoveResult::MoveFurther(window.into()),
|
FocusedNodeData::Window(window) => MoveResult::MoveFurther(window.into()),
|
||||||
FocusedNodeData::Group(focus_stack, alive) => MoveResult::MoveFurther(WindowGroup {
|
FocusedNodeData::Group(focus_stack, alive) => MoveResult::MoveFurther(
|
||||||
node: node_id,
|
WindowGroup {
|
||||||
output: output.downgrade(),
|
node: node_id,
|
||||||
alive,
|
output: output.downgrade(),
|
||||||
focus_stack,
|
alive,
|
||||||
}.into()),
|
focus_stack,
|
||||||
}
|
}
|
||||||
|
.into(),
|
||||||
|
),
|
||||||
|
};
|
||||||
};
|
};
|
||||||
let og_idx = tree
|
let og_idx = tree
|
||||||
.children_ids(&og_parent)
|
.children_ids(&og_parent)
|
||||||
|
|
@ -1059,11 +1066,19 @@ impl TilingLayout {
|
||||||
let output = seat.active_output();
|
let output = seat.active_output();
|
||||||
let tree = &self.queues.get(&output).unwrap().trees.back().unwrap().0;
|
let tree = &self.queues.get(&output).unwrap().trees.back().unwrap().0;
|
||||||
|
|
||||||
let Some(target) = seat.get_keyboard().unwrap().current_focus() else { return FocusResult::None };
|
let Some(target) = seat.get_keyboard().unwrap().current_focus() else {
|
||||||
let Some(focused) = TilingLayout::currently_focused_node(tree, &seat.active_output(), target).or_else(|| {
|
return FocusResult::None;
|
||||||
TilingLayout::last_active_window(tree, focus_stack)
|
};
|
||||||
.map(|(id, mapped)| (id, FocusedNodeData::Window(mapped)))
|
let Some(focused) =
|
||||||
}) else { return FocusResult::None };
|
TilingLayout::currently_focused_node(tree, &seat.active_output(), target).or_else(
|
||||||
|
|| {
|
||||||
|
TilingLayout::last_active_window(tree, focus_stack)
|
||||||
|
.map(|(id, mapped)| (id, FocusedNodeData::Window(mapped)))
|
||||||
|
},
|
||||||
|
)
|
||||||
|
else {
|
||||||
|
return FocusResult::None;
|
||||||
|
};
|
||||||
|
|
||||||
let (last_node_id, data) = focused;
|
let (last_node_id, data) = focused;
|
||||||
|
|
||||||
|
|
@ -1248,10 +1263,14 @@ impl TilingLayout {
|
||||||
seat: &Seat<State>,
|
seat: &Seat<State>,
|
||||||
) {
|
) {
|
||||||
let output = seat.active_output();
|
let output = seat.active_output();
|
||||||
let Some(queue) = self.queues.get_mut(&output) else { return };
|
let Some(queue) = self.queues.get_mut(&output) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
let mut tree = queue.trees.back().unwrap().0.copy_clone();
|
let mut tree = queue.trees.back().unwrap().0.copy_clone();
|
||||||
|
|
||||||
let Some(target) = seat.get_keyboard().unwrap().current_focus() else { return };
|
let Some(target) = seat.get_keyboard().unwrap().current_focus() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
if let Some((last_active, _)) =
|
if let Some((last_active, _)) =
|
||||||
TilingLayout::currently_focused_node(&tree, &seat.active_output(), target)
|
TilingLayout::currently_focused_node(&tree, &seat.active_output(), target)
|
||||||
{
|
{
|
||||||
|
|
@ -1293,10 +1312,14 @@ impl TilingLayout {
|
||||||
|
|
||||||
pub fn toggle_stacking<'a>(&mut self, seat: &Seat<State>, mut focus_stack: FocusStackMut) {
|
pub fn toggle_stacking<'a>(&mut self, seat: &Seat<State>, mut focus_stack: FocusStackMut) {
|
||||||
let output = seat.active_output();
|
let output = seat.active_output();
|
||||||
let Some(queue) = self.queues.get_mut(&output) else { return };
|
let Some(queue) = self.queues.get_mut(&output) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
let mut tree = queue.trees.back().unwrap().0.copy_clone();
|
let mut tree = queue.trees.back().unwrap().0.copy_clone();
|
||||||
|
|
||||||
let Some(target) = seat.get_keyboard().unwrap().current_focus() else { return };
|
let Some(target) = seat.get_keyboard().unwrap().current_focus() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
if let Some((last_active, last_active_data)) =
|
if let Some((last_active, last_active_data)) =
|
||||||
TilingLayout::currently_focused_node(&tree, &seat.active_output(), target)
|
TilingLayout::currently_focused_node(&tree, &seat.active_output(), target)
|
||||||
{
|
{
|
||||||
|
|
@ -1409,7 +1432,9 @@ impl TilingLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn recalculate(&mut self, output: &Output) {
|
pub fn recalculate(&mut self, output: &Output) {
|
||||||
let Some(queue) = self.queues.get_mut(output) else { return };
|
let Some(queue) = self.queues.get_mut(output) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
let mut tree = queue.trees.back().unwrap().0.copy_clone();
|
let mut tree = queue.trees.back().unwrap().0.copy_clone();
|
||||||
let blocker = TilingLayout::update_positions(&output, &mut tree, self.gaps);
|
let blocker = TilingLayout::update_positions(&output, &mut tree, self.gaps);
|
||||||
queue.push_tree(tree, ANIMATION_DURATION, blocker);
|
queue.push_tree(tree, ANIMATION_DURATION, blocker);
|
||||||
|
|
@ -1553,16 +1578,22 @@ impl TilingLayout {
|
||||||
let Some((output, mut node_id)) = self.queues.iter().find_map(|(output, queue)| {
|
let Some((output, mut node_id)) = self.queues.iter().find_map(|(output, queue)| {
|
||||||
let tree = &queue.trees.back().unwrap().0;
|
let tree = &queue.trees.back().unwrap().0;
|
||||||
let root_id = tree.root_node_id()?;
|
let root_id = tree.root_node_id()?;
|
||||||
let id = match TilingLayout::currently_focused_node(tree, &output.output, focused.clone()) {
|
let id =
|
||||||
Some((_id, FocusedNodeData::Window(mapped))) => // we need to make sure the id belongs to this tree..
|
match TilingLayout::currently_focused_node(tree, &output.output, focused.clone()) {
|
||||||
tree.traverse_pre_order_ids(root_id)
|
Some((_id, FocusedNodeData::Window(mapped))) =>
|
||||||
.unwrap()
|
// we need to make sure the id belongs to this tree..
|
||||||
.find(|id| tree.get(id).unwrap().data().is_mapped(Some(&mapped))),
|
{
|
||||||
Some((id, FocusedNodeData::Group(_, _))) => Some(id), // in this case the output was already matched, so the id is to be trusted
|
tree.traverse_pre_order_ids(root_id)
|
||||||
_ => None,
|
.unwrap()
|
||||||
};
|
.find(|id| tree.get(id).unwrap().data().is_mapped(Some(&mapped)))
|
||||||
|
}
|
||||||
|
Some((id, FocusedNodeData::Group(_, _))) => Some(id), // in this case the output was already matched, so the id is to be trusted
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
id.map(|id| (output.output.clone(), id))
|
id.map(|id| (output.output.clone(), id))
|
||||||
}) else { return false };
|
}) else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
let queue = self.queues.get_mut(&output).unwrap();
|
let queue = self.queues.get_mut(&output).unwrap();
|
||||||
let mut tree = queue.trees.back().unwrap().0.copy_clone();
|
let mut tree = queue.trees.back().unwrap().0.copy_clone();
|
||||||
|
|
@ -1585,7 +1616,13 @@ impl TilingLayout {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let Some(other_idx) = (match edges {
|
let Some(other_idx) = (match edges {
|
||||||
x if x.intersects(ResizeEdge::TOP_LEFT) => node_idx.checked_sub(1),
|
x if x.intersects(ResizeEdge::TOP_LEFT) => node_idx.checked_sub(1),
|
||||||
_ => if tree.children_ids(&group_id).unwrap().count() - 1 > node_idx { Some(node_idx + 1) } else { None },
|
_ => {
|
||||||
|
if tree.children_ids(&group_id).unwrap().count() - 1 > node_idx {
|
||||||
|
Some(node_idx + 1)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
}) else {
|
}) else {
|
||||||
node_id = group_id.clone();
|
node_id = group_id.clone();
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1791,7 +1828,9 @@ impl TilingLayout {
|
||||||
match tree.get_mut(window_id).unwrap().data_mut() {
|
match tree.get_mut(window_id).unwrap().data_mut() {
|
||||||
Data::Mapped { mapped, .. } => {
|
Data::Mapped { mapped, .. } => {
|
||||||
mapped.convert_to_stack(std::iter::once((output, mapped.bbox())));
|
mapped.convert_to_stack(std::iter::once((output, mapped.bbox())));
|
||||||
let Some(stack) = mapped.stack_ref_mut() else { unreachable!() };
|
let Some(stack) = mapped.stack_ref_mut() else {
|
||||||
|
unreachable!()
|
||||||
|
};
|
||||||
for surface in window.windows().map(|s| s.0) {
|
for surface in window.windows().map(|s| s.0) {
|
||||||
stack.add_window(surface, None);
|
stack.add_window(surface, None);
|
||||||
}
|
}
|
||||||
|
|
@ -2456,7 +2495,9 @@ impl TilingLayout {
|
||||||
.children_ids(&res_id)
|
.children_ids(&res_id)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.position(|node| {
|
.position(|node| {
|
||||||
let Some(geo) = geometries.get(node) else { return false };
|
let Some(geo) = geometries.get(node) else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
match orientation {
|
match orientation {
|
||||||
Orientation::Vertical => location.x < geo.loc.x,
|
Orientation::Vertical => location.x < geo.loc.x,
|
||||||
Orientation::Horizontal => location.y < geo.loc.y,
|
Orientation::Horizontal => location.y < geo.loc.y,
|
||||||
|
|
|
||||||
|
|
@ -1442,8 +1442,12 @@ impl Shell {
|
||||||
let from_workspace = state.common.shell.workspaces.active_mut(from_output);
|
let from_workspace = state.common.shell.workspaces.active_mut(from_output);
|
||||||
let maybe_window = from_workspace.focus_stack.get(seat).last().cloned();
|
let maybe_window = from_workspace.focus_stack.get(seat).last().cloned();
|
||||||
|
|
||||||
let Some(mapped) = maybe_window else { return Ok(None); };
|
let Some(mapped) = maybe_window else {
|
||||||
let Some(window_state) = from_workspace.unmap(&mapped) else { return Ok(None); };
|
return Ok(None);
|
||||||
|
};
|
||||||
|
let Some(window_state) = from_workspace.unmap(&mapped) else {
|
||||||
|
return Ok(None);
|
||||||
|
};
|
||||||
|
|
||||||
for (toplevel, _) in mapped.windows() {
|
for (toplevel, _) in mapped.windows() {
|
||||||
state
|
state
|
||||||
|
|
@ -1610,7 +1614,9 @@ impl Shell {
|
||||||
pub fn resize(&mut self, seat: &Seat<State>, direction: ResizeDirection, edge: ResizeEdge) {
|
pub fn resize(&mut self, seat: &Seat<State>, direction: ResizeDirection, edge: ResizeEdge) {
|
||||||
let output = seat.active_output();
|
let output = seat.active_output();
|
||||||
let (_, idx) = self.workspaces.active_num(&output);
|
let (_, idx) = self.workspaces.active_num(&output);
|
||||||
let Some(focused) = seat.get_keyboard().unwrap().current_focus() else { return };
|
let Some(focused) = seat.get_keyboard().unwrap().current_focus() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
if let Some(workspace) = self.workspaces.get_mut(idx, &output) {
|
if let Some(workspace) = self.workspaces.get_mut(idx, &output) {
|
||||||
let amount = (self
|
let amount = (self
|
||||||
|
|
@ -1632,12 +1638,16 @@ impl Shell {
|
||||||
{
|
{
|
||||||
let workspace = self.workspaces.get(idx, &output).unwrap();
|
let workspace = self.workspaces.get(idx, &output).unwrap();
|
||||||
if old_direction == direction && old_edge == edge {
|
if old_direction == direction && old_edge == edge {
|
||||||
let Some(toplevel) = old_focused.toplevel() else { return };
|
let Some(toplevel) = old_focused.toplevel() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
let Some(mapped) = workspace
|
let Some(mapped) = workspace
|
||||||
.mapped()
|
.mapped()
|
||||||
.find(|m| m.has_surface(&toplevel, WindowSurfaceType::TOPLEVEL))
|
.find(|m| m.has_surface(&toplevel, WindowSurfaceType::TOPLEVEL))
|
||||||
.cloned()
|
.cloned()
|
||||||
else { return };
|
else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
let mut resize_state = mapped.resize_state.lock().unwrap();
|
let mut resize_state = mapped.resize_state.lock().unwrap();
|
||||||
if let Some(ResizeState::Resizing(data)) = *resize_state {
|
if let Some(ResizeState::Resizing(data)) = *resize_state {
|
||||||
*resize_state = Some(ResizeState::WaitingForCommit(data));
|
*resize_state = Some(ResizeState::WaitingForCommit(data));
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,9 @@ impl ScreencopyHandler for State {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn capture_toplevel(&mut self, toplevel: CosmicSurface, session: Session) -> Vec<BufferInfo> {
|
fn capture_toplevel(&mut self, toplevel: CosmicSurface, session: Session) -> Vec<BufferInfo> {
|
||||||
let Some(surface) = toplevel.wl_surface() else { return Vec::new() };
|
let Some(surface) = toplevel.wl_surface() else {
|
||||||
|
return Vec::new();
|
||||||
|
};
|
||||||
let size = toplevel.geometry().size.to_buffer(1, Transform::Normal);
|
let size = toplevel.geometry().size.to_buffer(1, Transform::Normal);
|
||||||
|
|
||||||
let mut _kms_renderer = None;
|
let mut _kms_renderer = None;
|
||||||
|
|
|
||||||
|
|
@ -626,7 +626,9 @@ where
|
||||||
output,
|
output,
|
||||||
cursor,
|
cursor,
|
||||||
} => {
|
} => {
|
||||||
let Some(cursor) = check_cursor(cursor, &data, resource) else { return; };
|
let Some(cursor) = check_cursor(cursor, &data, resource) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
match Output::from_resource(&output) {
|
match Output::from_resource(&output) {
|
||||||
Some(output) => {
|
Some(output) => {
|
||||||
|
|
@ -664,7 +666,9 @@ where
|
||||||
toplevel,
|
toplevel,
|
||||||
cursor,
|
cursor,
|
||||||
} => {
|
} => {
|
||||||
let Some(cursor) = check_cursor(cursor, &data, resource) else { return; };
|
let Some(cursor) = check_cursor(cursor, &data, resource) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
match window_from_handle::<<D as ToplevelInfoHandler>::Window>(toplevel) {
|
match window_from_handle::<<D as ToplevelInfoHandler>::Window>(toplevel) {
|
||||||
Some(window) => {
|
Some(window) => {
|
||||||
|
|
@ -704,7 +708,9 @@ where
|
||||||
output,
|
output,
|
||||||
cursor,
|
cursor,
|
||||||
} => {
|
} => {
|
||||||
let Some(cursor) = check_cursor(cursor, &data, resource) else { return; };
|
let Some(cursor) = check_cursor(cursor, &data, resource) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
match Output::from_resource(&output) {
|
match Output::from_resource(&output) {
|
||||||
Some(output) => match state.workspace_state().workspace_handle(&workspace) {
|
Some(output) => match state.workspace_state().workspace_handle(&workspace) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue