input: Move windows between workspaces
This commit is contained in:
parent
5b2ea80c50
commit
f7ac9654d1
6 changed files with 38 additions and 4 deletions
|
|
@ -54,6 +54,10 @@ impl Layout for FloatingLayout {
|
|||
// TODO make sure all windows are still visible on any output or move them
|
||||
}
|
||||
|
||||
fn unmap_window(&mut self, space: &mut Space, window: &Window) {
|
||||
space.unmap_window(window)
|
||||
}
|
||||
|
||||
fn maximize_request(&mut self, space: &mut Space, window: &Window, output: &Output) {
|
||||
let layers = layer_map_for_output(&output);
|
||||
let geometry = layers.non_exclusive_zone();
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ pub trait Layout {
|
|||
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 unmap_window(&mut self, space: &mut Space, window: &Window);
|
||||
|
||||
fn update_orientation<'a>(
|
||||
&mut self,
|
||||
|
|
|
|||
|
|
@ -200,6 +200,12 @@ impl Layout for TilingLayout {
|
|||
}
|
||||
}
|
||||
|
||||
fn unmap_window(&mut self, space: &mut Space, window: &Window) {
|
||||
self.unmap_window(&window);
|
||||
space.unmap_window(&window);
|
||||
self.refresh(space);
|
||||
}
|
||||
|
||||
fn resize_request(
|
||||
&mut self,
|
||||
_space: &mut Space,
|
||||
|
|
|
|||
|
|
@ -237,6 +237,19 @@ impl Shell {
|
|||
};
|
||||
}
|
||||
|
||||
pub fn move_current_window(&mut self, seat: &Seat, output: &Output, idx: u8) {
|
||||
let workspace = self.active_space_mut(output);
|
||||
if idx == workspace.idx {
|
||||
return;
|
||||
}
|
||||
|
||||
let maybe_window = workspace.focus_stack(seat).last();
|
||||
if let Some(window) = maybe_window {
|
||||
workspace.unmap_window(&window);
|
||||
self.spaces[idx as usize].map_window(&window, seat);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "debug")]
|
||||
pub fn mode(&self) -> &Mode {
|
||||
&self.mode
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ impl<'a> FocusStackMut<'a> {
|
|||
type FocusStackData = RefCell<(HashMap<u8, IndexSet<Window>>, IndexSet<Window>)>;
|
||||
|
||||
pub struct Workspace {
|
||||
idx: u8,
|
||||
pub(super) idx: u8,
|
||||
pub space: Space,
|
||||
pub(super) layout: Box<dyn Layout>,
|
||||
pub(super) pending_windows: Vec<(Window, Seat)>,
|
||||
|
|
@ -89,7 +89,7 @@ impl Workspace {
|
|||
self.pending_windows.push((window, seat.clone()));
|
||||
}
|
||||
|
||||
pub(super) fn map_window<'a>(&mut self, window: &Window, seat: &Seat) {
|
||||
pub(super) fn map_window(&mut self, window: &Window, seat: &Seat) {
|
||||
seat.user_data()
|
||||
.insert_if_missing(|| FocusStackData::new((HashMap::new(), IndexSet::new())));
|
||||
let focus_stack = FocusStackMut(RefMut::map(
|
||||
|
|
@ -103,6 +103,10 @@ impl Workspace {
|
|||
.map_window(&mut self.space, window, seat, focus_stack.iter())
|
||||
}
|
||||
|
||||
pub(super) fn unmap_window(&mut self, window: &Window) {
|
||||
self.layout.unmap_window(&mut self.space, window)
|
||||
}
|
||||
|
||||
pub fn refresh(&mut self) {
|
||||
self.layout.refresh(&mut self.space);
|
||||
self.space.refresh();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue