Groundwork for tiling layout
This commit is contained in:
parent
5657a77c5b
commit
4796832521
19 changed files with 1685 additions and 837 deletions
82
src/shell/layout/mod.rs
Normal file
82
src/shell/layout/mod.rs
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
use crate::input::ActiveOutput;
|
||||
use smithay::{
|
||||
desktop::{Space, Window},
|
||||
reexports::wayland_protocols::xdg_shell::server::xdg_toplevel::ResizeEdge,
|
||||
wayland::{
|
||||
output::Output,
|
||||
seat::{PointerGrabStartData, Seat},
|
||||
Serial,
|
||||
},
|
||||
};
|
||||
|
||||
pub mod combined;
|
||||
pub mod floating;
|
||||
pub mod tiling;
|
||||
|
||||
pub trait Layout {
|
||||
fn map_window<'a>(
|
||||
&mut self,
|
||||
space: &mut Space,
|
||||
window: &Window,
|
||||
seat: &Seat,
|
||||
focus_stack: Box<dyn Iterator<Item = &'a Window> + 'a>,
|
||||
); //working around object safety..
|
||||
fn refresh(&mut self, space: &mut Space);
|
||||
//fn unmap_window(&mut self, space: &mut Space, window: &Window);
|
||||
|
||||
fn maximize_request(&mut self, space: &mut Space, window: &Window, output: &Output) {
|
||||
let _ = (space, window, output);
|
||||
}
|
||||
fn move_request(
|
||||
&mut self,
|
||||
space: &mut Space,
|
||||
window: &Window,
|
||||
seat: &Seat,
|
||||
serial: Serial,
|
||||
start_data: PointerGrabStartData,
|
||||
) {
|
||||
let _ = (space, window, seat, serial, start_data);
|
||||
}
|
||||
fn resize_request(
|
||||
&mut self,
|
||||
space: &mut Space,
|
||||
window: &Window,
|
||||
seat: &Seat,
|
||||
serial: Serial,
|
||||
start_data: PointerGrabStartData,
|
||||
edges: ResizeEdge,
|
||||
) {
|
||||
let _ = (space, window, seat, serial, start_data, edges);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_default_layout() -> Box<dyn Layout> {
|
||||
Box::new(combined::Combined::new(
|
||||
tiling::TilingLayout::new(),
|
||||
floating::FloatingLayout,
|
||||
|app_id, title| {
|
||||
slog_scope::debug!(
|
||||
"New filter input: ({}:{})",
|
||||
app_id.unwrap_or("<unknown>"),
|
||||
title.unwrap_or("<no title>")
|
||||
);
|
||||
match (app_id.unwrap_or(""), title.unwrap_or("")) {
|
||||
("gcr-prompter", _) => true,
|
||||
_ => false,
|
||||
}
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
fn output_from_seat(seat: &Seat, space: &Space) -> Output {
|
||||
seat.user_data()
|
||||
.get::<ActiveOutput>()
|
||||
.map(|active| active.0.borrow().clone())
|
||||
.or_else(|| {
|
||||
seat.get_pointer()
|
||||
.map(|ptr| space.output_under(ptr.current_location()).next().unwrap())
|
||||
.cloned()
|
||||
})
|
||||
.unwrap_or_else(|| space.outputs().next().cloned().unwrap())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue