input: Move windows between workspaces
This commit is contained in:
parent
5b2ea80c50
commit
f7ac9654d1
6 changed files with 38 additions and 4 deletions
|
|
@ -294,7 +294,14 @@ impl Common {
|
||||||
.add(&handle);
|
.add(&handle);
|
||||||
return FilterResult::Intercept(());
|
return FilterResult::Intercept(());
|
||||||
}
|
}
|
||||||
Action::MoveToWorkspace(num) => { /* TODO */ }
|
Action::MoveToWorkspace(num) => {
|
||||||
|
let current_output = active_output(seat, &self);
|
||||||
|
self.shell.move_current_window(
|
||||||
|
seat,
|
||||||
|
¤t_output,
|
||||||
|
*num,
|
||||||
|
);
|
||||||
|
}
|
||||||
Action::Focus(focus) => match focus {
|
Action::Focus(focus) => match focus {
|
||||||
_ => { /* TODO */ }
|
_ => { /* TODO */ }
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,10 @@ impl Layout for FloatingLayout {
|
||||||
// TODO make sure all windows are still visible on any output or move them
|
// 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) {
|
fn maximize_request(&mut self, space: &mut Space, window: &Window, output: &Output) {
|
||||||
let layers = layer_map_for_output(&output);
|
let layers = layer_map_for_output(&output);
|
||||||
let geometry = layers.non_exclusive_zone();
|
let geometry = layers.non_exclusive_zone();
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ pub trait Layout {
|
||||||
focus_stack: Box<dyn Iterator<Item = &'a Window> + 'a>,
|
focus_stack: Box<dyn Iterator<Item = &'a Window> + 'a>,
|
||||||
); //working around object safety..
|
); //working around object safety..
|
||||||
fn refresh(&mut self, space: &mut Space);
|
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>(
|
fn update_orientation<'a>(
|
||||||
&mut self,
|
&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(
|
fn resize_request(
|
||||||
&mut self,
|
&mut self,
|
||||||
_space: &mut Space,
|
_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")]
|
#[cfg(feature = "debug")]
|
||||||
pub fn mode(&self) -> &Mode {
|
pub fn mode(&self) -> &Mode {
|
||||||
&self.mode
|
&self.mode
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ impl<'a> FocusStackMut<'a> {
|
||||||
type FocusStackData = RefCell<(HashMap<u8, IndexSet<Window>>, IndexSet<Window>)>;
|
type FocusStackData = RefCell<(HashMap<u8, IndexSet<Window>>, IndexSet<Window>)>;
|
||||||
|
|
||||||
pub struct Workspace {
|
pub struct Workspace {
|
||||||
idx: u8,
|
pub(super) idx: u8,
|
||||||
pub space: Space,
|
pub space: Space,
|
||||||
pub(super) layout: Box<dyn Layout>,
|
pub(super) layout: Box<dyn Layout>,
|
||||||
pub(super) pending_windows: Vec<(Window, Seat)>,
|
pub(super) pending_windows: Vec<(Window, Seat)>,
|
||||||
|
|
@ -89,7 +89,7 @@ impl Workspace {
|
||||||
self.pending_windows.push((window, seat.clone()));
|
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()
|
seat.user_data()
|
||||||
.insert_if_missing(|| FocusStackData::new((HashMap::new(), IndexSet::new())));
|
.insert_if_missing(|| FocusStackData::new((HashMap::new(), IndexSet::new())));
|
||||||
let focus_stack = FocusStackMut(RefMut::map(
|
let focus_stack = FocusStackMut(RefMut::map(
|
||||||
|
|
@ -103,6 +103,10 @@ impl Workspace {
|
||||||
.map_window(&mut self.space, window, seat, focus_stack.iter())
|
.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) {
|
pub fn refresh(&mut self) {
|
||||||
self.layout.refresh(&mut self.space);
|
self.layout.refresh(&mut self.space);
|
||||||
self.space.refresh();
|
self.space.refresh();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue