tiling: Fix swap preview on different workspaces/outputs
This commit is contained in:
parent
e992a4b442
commit
e2ac5c0a23
3 changed files with 1010 additions and 932 deletions
|
|
@ -14,7 +14,7 @@ use crate::{
|
|||
config::WorkspaceLayout,
|
||||
shell::{
|
||||
focus::target::WindowGroup, grabs::SeatMoveGrabState, layout::tiling::ANIMATION_DURATION,
|
||||
CosmicMapped, CosmicMappedRenderElement, WorkspaceRenderElement,
|
||||
CosmicMapped, CosmicMappedRenderElement, OverviewMode, Trigger, WorkspaceRenderElement,
|
||||
},
|
||||
state::{Common, Fps},
|
||||
utils::prelude::{OutputExt, SeatExt},
|
||||
|
|
@ -489,6 +489,26 @@ where
|
|||
let overview = state.shell.overview_mode();
|
||||
let (resize_mode, resize_indicator) = state.shell.resize_mode();
|
||||
let resize_indicator = resize_indicator.map(|indicator| (resize_mode, indicator));
|
||||
let swap_tree = if let OverviewMode::Started(Trigger::KeyboardSwap(_, desc), _) = &overview.0 {
|
||||
if let Some(desc_output) = desc.output.upgrade() {
|
||||
if output != &desc_output || current.0 != desc.handle {
|
||||
state
|
||||
.shell
|
||||
.space_for_handle(&desc.handle)
|
||||
.and_then(|w| w.tiling_layer.tree_for_output(&desc_output))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let overview = (
|
||||
overview.0,
|
||||
overview.1.map(|indicator| (indicator, swap_tree)),
|
||||
);
|
||||
|
||||
let last_active_seat = state.last_active_seat().clone();
|
||||
let move_active = last_active_seat
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -24,6 +24,7 @@ use crate::{
|
|||
xwayland::XWaylandState,
|
||||
};
|
||||
|
||||
use id_tree::Tree;
|
||||
use indexmap::IndexSet;
|
||||
use smithay::{
|
||||
backend::renderer::{
|
||||
|
|
@ -57,7 +58,7 @@ use super::{
|
|||
FocusStack, FocusStackMut,
|
||||
},
|
||||
grabs::{ResizeEdge, ResizeGrab},
|
||||
layout::tiling::NodeDesc,
|
||||
layout::tiling::{Data, NodeDesc},
|
||||
CosmicMappedRenderElement, CosmicSurface, ResizeDirection, ResizeMode,
|
||||
};
|
||||
|
||||
|
|
@ -527,7 +528,7 @@ impl Workspace {
|
|||
override_redirect_windows: &[X11Surface],
|
||||
xwm_state: Option<&'a mut XWaylandState>,
|
||||
draw_focus_indicator: Option<&Seat<State>>,
|
||||
overview: (OverviewMode, Option<SwapIndicator>),
|
||||
overview: (OverviewMode, Option<(SwapIndicator, Option<&Tree<Data>>)>),
|
||||
resize_indicator: Option<(ResizeMode, ResizeIndicator)>,
|
||||
indicator_thickness: u8,
|
||||
) -> Result<
|
||||
|
|
@ -595,10 +596,6 @@ impl Workspace {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
// TODO: Handle modes like
|
||||
// - keyboard window swapping
|
||||
// - resizing in tiling
|
||||
|
||||
// OR windows above all
|
||||
popup_elements.extend(
|
||||
override_redirect_windows
|
||||
|
|
@ -648,14 +645,25 @@ impl Workspace {
|
|||
popup_elements.extend(p_elements.into_iter().map(WorkspaceRenderElement::from));
|
||||
window_elements.extend(w_elements.into_iter().map(WorkspaceRenderElement::from));
|
||||
|
||||
let alpha = match &overview.0 {
|
||||
OverviewMode::Started(_, start) => Some(
|
||||
(Instant::now().duration_since(*start).as_millis() as f64 / 100.0).min(1.0)
|
||||
as f32,
|
||||
),
|
||||
OverviewMode::Ended(_, ended) => Some(
|
||||
1.0 - (Instant::now().duration_since(*ended).as_millis() as f64 / 100.0)
|
||||
.min(1.0) as f32,
|
||||
),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
//tiling surfaces
|
||||
let (w_elements, p_elements) = self.tiling_layer.render_output::<R>(
|
||||
renderer,
|
||||
output,
|
||||
&self.handle,
|
||||
draw_focus_indicator,
|
||||
layer_map.non_exclusive_zone(),
|
||||
overview.clone(),
|
||||
overview,
|
||||
resize_indicator,
|
||||
indicator_thickness,
|
||||
)?;
|
||||
|
|
@ -674,18 +682,6 @@ impl Workspace {
|
|||
}
|
||||
}
|
||||
|
||||
let alpha = match overview.0 {
|
||||
OverviewMode::Started(_, start) => Some(
|
||||
(Instant::now().duration_since(start).as_millis() as f64 / 100.0).min(1.0)
|
||||
as f32,
|
||||
),
|
||||
OverviewMode::Ended(_, ended) => Some(
|
||||
1.0 - (Instant::now().duration_since(ended).as_millis() as f64 / 100.0).min(1.0)
|
||||
as f32,
|
||||
),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
if let Some(alpha) = alpha {
|
||||
window_elements.push(
|
||||
Into::<CosmicMappedRenderElement<R>>::into(BackdropShader::element(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue