cargo fmt
This commit is contained in:
parent
f7ff84d2a0
commit
8ccb93d8eb
15 changed files with 460 additions and 239 deletions
|
|
@ -16,9 +16,7 @@ use smithay::{
|
|||
output::Output,
|
||||
seat::{PointerGrabStartData, Seat},
|
||||
shell::{
|
||||
wlr_layer::{
|
||||
wlr_layer_shell_init, LayerShellRequest, LayerSurfaceAttributes,
|
||||
},
|
||||
wlr_layer::{wlr_layer_shell_init, LayerShellRequest, LayerSurfaceAttributes},
|
||||
xdg::{
|
||||
xdg_shell_init, Configure, XdgPopupSurfaceRoleAttributes, XdgRequest,
|
||||
XdgToplevelSurfaceRoleAttributes,
|
||||
|
|
@ -259,7 +257,11 @@ pub fn init_shell(config: &Config, display: &mut Display) -> super::Shell {
|
|||
.as_ref()
|
||||
.and_then(Output::from_resource)
|
||||
.unwrap_or_else(|| active_output(&seat, &*state));
|
||||
state.shell.active_space_mut(&output).pending_layer(LayerSurface::new(surface, namespace), &output, &seat);
|
||||
state.shell.active_space_mut(&output).pending_layer(
|
||||
LayerSurface::new(surface, namespace),
|
||||
&output,
|
||||
&seat,
|
||||
);
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -85,7 +85,10 @@ impl Layout for TilingLayout {
|
|||
focus_stack: Box<dyn Iterator<Item = &'a Window> + 'a>,
|
||||
) -> Option<Window> {
|
||||
let output = super::output_from_seat(Some(seat), space);
|
||||
let idx = space.outputs().position(|o| Some(o) == output.as_ref()).unwrap_or(0);
|
||||
let idx = space
|
||||
.outputs()
|
||||
.position(|o| Some(o) == output.as_ref())
|
||||
.unwrap_or(0);
|
||||
let tree = TilingLayout::active_tree(&mut self.trees, idx);
|
||||
if let Some(last_active) = TilingLayout::last_active_window(tree, focus_stack) {
|
||||
let mut node_id = last_active;
|
||||
|
|
@ -141,7 +144,10 @@ impl Layout for TilingLayout {
|
|||
focus_stack: Box<dyn Iterator<Item = &'a Window> + 'a>,
|
||||
) {
|
||||
let output = super::output_from_seat(Some(seat), space);
|
||||
let idx = space.outputs().position(|o| Some(o) == output.as_ref()).unwrap_or(0);
|
||||
let idx = space
|
||||
.outputs()
|
||||
.position(|o| Some(o) == output.as_ref())
|
||||
.unwrap_or(0);
|
||||
let tree = TilingLayout::active_tree(&mut self.trees, idx);
|
||||
if let Some(last_active) = TilingLayout::last_active_window(tree, focus_stack) {
|
||||
if let Some((fork, _child)) = TilingLayout::find_fork(tree, last_active) {
|
||||
|
|
@ -288,7 +294,10 @@ impl TilingLayout {
|
|||
focus_stack: Option<Box<dyn Iterator<Item = &'a Window> + 'a>>,
|
||||
) {
|
||||
let output = super::output_from_seat(seat, space);
|
||||
let idx = space.outputs().position(|o| Some(o) == output.as_ref()).unwrap_or(0);
|
||||
let idx = space
|
||||
.outputs()
|
||||
.position(|o| Some(o) == output.as_ref())
|
||||
.unwrap_or(0);
|
||||
let tree = TilingLayout::active_tree(&mut self.trees, idx);
|
||||
let new_window = Node::new(Data::Window(window.clone()));
|
||||
|
||||
|
|
@ -529,8 +538,18 @@ impl TilingLayout {
|
|||
if let Some(geo) = geo {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
if let Kind::Xdg(xdg) = &window.toplevel() {
|
||||
if xdg.current_state().map(|state| state.states.contains(XdgState::Fullscreen)).unwrap_or(false) ||
|
||||
xdg.with_pending_state(|pending| pending.states.contains(XdgState::Fullscreen)).unwrap_or(false) {
|
||||
if xdg
|
||||
.current_state()
|
||||
.map(|state| {
|
||||
state.states.contains(XdgState::Fullscreen)
|
||||
})
|
||||
.unwrap_or(false)
|
||||
|| xdg
|
||||
.with_pending_state(|pending| {
|
||||
pending.states.contains(XdgState::Fullscreen)
|
||||
})
|
||||
.unwrap_or(false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
let ret = xdg.with_pending_state(|state| {
|
||||
|
|
@ -549,10 +568,7 @@ impl TilingLayout {
|
|||
}
|
||||
space.map_window(
|
||||
&window,
|
||||
(
|
||||
geo.loc.x + inner,
|
||||
geo.loc.y + inner,
|
||||
),
|
||||
(geo.loc.x + inner, geo.loc.y + inner),
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use super::{layout, Layout};
|
|||
use crate::wayland::workspace as ext_work;
|
||||
use indexmap::IndexSet;
|
||||
use smithay::{
|
||||
desktop::{LayerSurface, Space, Window, Kind},
|
||||
desktop::{Kind, LayerSurface, Space, Window},
|
||||
reexports::wayland_protocols::xdg_shell::server::xdg_toplevel::{self, ResizeEdge},
|
||||
wayland::{
|
||||
output::Output,
|
||||
|
|
@ -61,9 +61,7 @@ pub struct Workspace {
|
|||
}
|
||||
|
||||
impl Workspace {
|
||||
pub fn new(
|
||||
idx: u8,
|
||||
) -> Workspace {
|
||||
pub fn new(idx: u8) -> Workspace {
|
||||
Workspace {
|
||||
idx,
|
||||
space: Space::new(None),
|
||||
|
|
@ -126,11 +124,10 @@ impl Workspace {
|
|||
|
||||
pub fn refresh(&mut self) {
|
||||
let outputs = self.space.outputs().collect::<Vec<_>>();
|
||||
let dead_output_windows = self.fullscreen
|
||||
let dead_output_windows = self
|
||||
.fullscreen
|
||||
.iter()
|
||||
.filter(|(name, _)|
|
||||
!outputs.iter().any(|o| o.name() == **name)
|
||||
)
|
||||
.filter(|(name, _)| !outputs.iter().any(|o| o.name() == **name))
|
||||
.map(|(_, w)| w)
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
|
|
@ -235,7 +232,7 @@ impl Workspace {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn unfullscreen_request(&mut self, window: &Window) {
|
||||
if self.fullscreen.values().any(|w| w == window) {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
|
|
@ -248,7 +245,7 @@ impl Workspace {
|
|||
if ret.is_ok() {
|
||||
self.layout.refresh(&mut self.space);
|
||||
xdg.send_configure();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.fullscreen.retain(|_, w| w != window);
|
||||
|
|
@ -267,6 +264,8 @@ impl Workspace {
|
|||
if !self.space.outputs().any(|o| o == output) {
|
||||
return None;
|
||||
}
|
||||
self.fullscreen.get(&output.name()).filter(|w| w.toplevel().get_surface().is_some())
|
||||
self.fullscreen
|
||||
.get(&output.name())
|
||||
.filter(|w| w.toplevel().get_surface().is_some())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue