mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-17 18:11:30 +01:00
Fix windows not reappearing on tag changes
This commit is contained in:
parent
8fcf86b886
commit
d09d367b22
4 changed files with 41 additions and 3 deletions
|
@ -39,6 +39,16 @@ require("pinnacle").setup(function(pinnacle)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
input.keybind({ mod_key }, keys.l, function()
|
||||||
|
process.spawn("kitty")
|
||||||
|
end)
|
||||||
|
input.keybind({ mod_key }, keys.k, function()
|
||||||
|
process.spawn("foot")
|
||||||
|
end)
|
||||||
|
input.keybind({ mod_key }, keys.j, function()
|
||||||
|
process.spawn("nautilus")
|
||||||
|
end)
|
||||||
|
|
||||||
-- Tags ---------------------------------------------------------------------------
|
-- Tags ---------------------------------------------------------------------------
|
||||||
tag.add("1", "2", "3", "4", "5")
|
tag.add("1", "2", "3", "4", "5")
|
||||||
tag.toggle("1")
|
tag.toggle("1")
|
||||||
|
|
|
@ -96,6 +96,8 @@ impl<B: Backend> CompositorHandler for State<B> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn commit(&mut self, surface: &WlSurface) {
|
fn commit(&mut self, surface: &WlSurface) {
|
||||||
|
tracing::debug!("top of commit");
|
||||||
|
|
||||||
utils::on_commit_buffer_handler::<Self>(surface);
|
utils::on_commit_buffer_handler::<Self>(surface);
|
||||||
|
|
||||||
if !compositor::is_sync_subsurface(surface) {
|
if !compositor::is_sync_subsurface(surface) {
|
||||||
|
@ -116,8 +118,9 @@ impl<B: Backend> CompositorHandler for State<B> {
|
||||||
|
|
||||||
if let Some(window) = self.window_for_surface(surface) {
|
if let Some(window) = self.window_for_surface(surface) {
|
||||||
WindowState::with_state(&window, |state| {
|
WindowState::with_state(&window, |state| {
|
||||||
|
tracing::debug!("in commit with_state");
|
||||||
if let WindowResizeState::WaitingForCommit(new_pos) = state.resize_state {
|
if let WindowResizeState::WaitingForCommit(new_pos) = state.resize_state {
|
||||||
tracing::info!("Committing, new location");
|
tracing::debug!("Committing, new location is {new_pos:?}");
|
||||||
state.resize_state = WindowResizeState::Idle;
|
state.resize_state = WindowResizeState::Idle;
|
||||||
self.space.map_element(window.clone(), new_pos, false);
|
self.space.map_element(window.clone(), new_pos, false);
|
||||||
}
|
}
|
||||||
|
@ -239,7 +242,7 @@ impl<B: Backend> XdgShellHandler for State<B> {
|
||||||
} else {
|
} else {
|
||||||
vec![]
|
vec![]
|
||||||
};
|
};
|
||||||
tracing::info!("new window, tags are {:?}", state.tags);
|
tracing::debug!("new window, tags are {:?}", state.tags);
|
||||||
});
|
});
|
||||||
|
|
||||||
self.windows.push(window.clone());
|
self.windows.push(window.clone());
|
||||||
|
@ -265,6 +268,7 @@ impl<B: Backend> XdgShellHandler for State<B> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toplevel_destroyed(&mut self, surface: ToplevelSurface) {
|
fn toplevel_destroyed(&mut self, surface: ToplevelSurface) {
|
||||||
|
tracing::debug!("toplevel destroyed");
|
||||||
self.windows.retain(|window| window.toplevel() != &surface);
|
self.windows.retain(|window| window.toplevel() != &surface);
|
||||||
let mut windows: Vec<Window> = self.space.elements().cloned().collect();
|
let mut windows: Vec<Window> = self.space.elements().cloned().collect();
|
||||||
windows.retain(|window| window.toplevel() != &surface);
|
windows.retain(|window| window.toplevel() != &surface);
|
||||||
|
@ -366,12 +370,15 @@ impl<B: Backend> XdgShellHandler for State<B> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ack_configure(&mut self, surface: WlSurface, configure: Configure) {
|
fn ack_configure(&mut self, surface: WlSurface, configure: Configure) {
|
||||||
|
tracing::debug!("start of ack_configure");
|
||||||
if let Some(window) = self.window_for_surface(&surface) {
|
if let Some(window) = self.window_for_surface(&surface) {
|
||||||
|
tracing::debug!("found window for surface");
|
||||||
WindowState::with_state(&window, |state| {
|
WindowState::with_state(&window, |state| {
|
||||||
if let WindowResizeState::WaitingForAck(serial, new_loc) = state.resize_state {
|
if let WindowResizeState::WaitingForAck(serial, new_loc) = state.resize_state {
|
||||||
match &configure {
|
match &configure {
|
||||||
Configure::Toplevel(configure) => {
|
Configure::Toplevel(configure) => {
|
||||||
if configure.serial >= serial {
|
if configure.serial >= serial {
|
||||||
|
tracing::debug!("acked configure, new loc is {:?}", new_loc);
|
||||||
state.resize_state = WindowResizeState::WaitingForCommit(new_loc);
|
state.resize_state = WindowResizeState::WaitingForCommit(new_loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -379,6 +386,21 @@ impl<B: Backend> XdgShellHandler for State<B> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// HACK: If a window is currently going through something that generates a bunch of
|
||||||
|
// | commits, like an animation, unmapping it while it's doing that has a chance
|
||||||
|
// | to cause any send_configures to not trigger a commit. I'm not sure if this is because of
|
||||||
|
// | the way I've implemented things or if it's something else. Because of me
|
||||||
|
// | mapping the element in commit, this means that the window won't reappear on a tag
|
||||||
|
// | change. The code below is a workaround.
|
||||||
|
if !self.space.elements().any(|win| win == &window) {
|
||||||
|
WindowState::with_state(&window, |state| {
|
||||||
|
if let WindowResizeState::WaitingForCommit(new_loc) = state.resize_state {
|
||||||
|
self.space.map_element(window.clone(), new_loc, false);
|
||||||
|
state.resize_state = WindowResizeState::Idle;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ impl Layout {
|
||||||
tracing::info!("got output");
|
tracing::info!("got output");
|
||||||
let output_size = state.space.output_geometry(output).unwrap().size;
|
let output_size = state.space.output_geometry(output).unwrap().size;
|
||||||
if window_count == 1 {
|
if window_count == 1 {
|
||||||
|
tracing::debug!("Laying out only window");
|
||||||
let window = windows[0].clone();
|
let window = windows[0].clone();
|
||||||
|
|
||||||
window.toplevel().with_pending_state(|tl_state| {
|
window.toplevel().with_pending_state(|tl_state| {
|
||||||
|
@ -62,8 +63,10 @@ impl Layout {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.initial_configure_sent
|
.initial_configure_sent
|
||||||
});
|
});
|
||||||
|
tracing::debug!("initial configure sent is {initial_configure_sent}");
|
||||||
if initial_configure_sent {
|
if initial_configure_sent {
|
||||||
WindowState::with_state(&window, |state| {
|
WindowState::with_state(&window, |state| {
|
||||||
|
tracing::debug!("sending configure");
|
||||||
state.resize_state = WindowResizeState::WaitingForAck(
|
state.resize_state = WindowResizeState::WaitingForAck(
|
||||||
window.toplevel().send_configure(),
|
window.toplevel().send_configure(),
|
||||||
output.current_location(),
|
output.current_location(),
|
||||||
|
@ -74,7 +77,7 @@ impl Layout {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tracing::warn!("layed out first window");
|
tracing::debug!("layed out first window");
|
||||||
let mut windows = windows.iter();
|
let mut windows = windows.iter();
|
||||||
let first_window = windows.next().unwrap();
|
let first_window = windows.next().unwrap();
|
||||||
|
|
||||||
|
|
|
@ -261,6 +261,7 @@ impl<B: Backend> State<B> {
|
||||||
} else {
|
} else {
|
||||||
state.focused_tags.insert(tag_id.clone(), true);
|
state.focused_tags.insert(tag_id.clone(), true);
|
||||||
}
|
}
|
||||||
|
tracing::debug!("focused tags: {:?}", state.focused_tags);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -641,6 +642,8 @@ impl<B: Backend> State<B> {
|
||||||
}).cloned().collect::<Vec<_>>()
|
}).cloned().collect::<Vec<_>>()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tracing::debug!("Laying out {} windows", windows.len());
|
||||||
|
|
||||||
Layout::master_stack(self, windows, crate::layout::Direction::Left);
|
Layout::master_stack(self, windows, crate::layout::Direction::Left);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue