mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2024-12-27 21:58:18 +01:00
Switch to tag if activated window is not on active tag
This commit is contained in:
parent
a8aa7941d2
commit
2c209856d3
2 changed files with 20 additions and 4 deletions
|
@ -772,8 +772,8 @@ impl tag_service_server::TagService for TagService {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
output.with_state_mut(|op_state| {
|
output.with_state(|op_state| {
|
||||||
for op_tag in op_state.tags.iter_mut() {
|
for op_tag in op_state.tags.iter() {
|
||||||
op_tag.set_active(false, state);
|
op_tag.set_active(false, state);
|
||||||
}
|
}
|
||||||
tag.set_active(true, state);
|
tag.set_active(true, state);
|
||||||
|
|
|
@ -686,7 +686,6 @@ impl PointerConstraintsHandler for State {
|
||||||
}
|
}
|
||||||
delegate_pointer_constraints!(State);
|
delegate_pointer_constraints!(State);
|
||||||
|
|
||||||
// FIXME: duplicated code with api calls
|
|
||||||
impl ForeignToplevelHandler for State {
|
impl ForeignToplevelHandler for State {
|
||||||
fn foreign_toplevel_manager_state(&mut self) -> &mut ForeignToplevelManagerState {
|
fn foreign_toplevel_manager_state(&mut self) -> &mut ForeignToplevelManagerState {
|
||||||
&mut self.pinnacle.foreign_toplevel_manager_state
|
&mut self.pinnacle.foreign_toplevel_manager_state
|
||||||
|
@ -700,9 +699,27 @@ impl ForeignToplevelHandler for State {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if !window.is_on_active_tag() {
|
||||||
|
let new_active_tag =
|
||||||
|
window.with_state(|state| state.tags.iter().min_by_key(|tag| tag.id().0).cloned());
|
||||||
|
if let Some(tag) = new_active_tag {
|
||||||
|
output.with_state(|state| {
|
||||||
|
if state.tags.contains(&tag) {
|
||||||
|
for op_tag in state.tags.iter() {
|
||||||
|
op_tag.set_active(false, self);
|
||||||
|
}
|
||||||
|
tag.set_active(true, self);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
output.with_state_mut(|state| state.focus_stack.set_focus(window.clone()));
|
output.with_state_mut(|state| state.focus_stack.set_focus(window.clone()));
|
||||||
self.pinnacle.raise_window(window, true);
|
self.pinnacle.raise_window(window, true);
|
||||||
self.update_keyboard_focus(&output);
|
self.update_keyboard_focus(&output);
|
||||||
|
|
||||||
|
self.pinnacle.request_layout(&output);
|
||||||
|
self.schedule_render(&output);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close(&mut self, wl_surface: WlSurface) {
|
fn close(&mut self, wl_surface: WlSurface) {
|
||||||
|
@ -713,7 +730,6 @@ impl ForeignToplevelHandler for State {
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: fullscreen on specified output? maybe
|
|
||||||
fn set_fullscreen(&mut self, wl_surface: WlSurface, _wl_output: Option<WlOutput>) {
|
fn set_fullscreen(&mut self, wl_surface: WlSurface, _wl_output: Option<WlOutput>) {
|
||||||
let Some(window) = self.pinnacle.window_for_surface(&wl_surface) else {
|
let Some(window) = self.pinnacle.window_for_surface(&wl_surface) else {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue