Fix focus issue
This commit is contained in:
parent
7ad37946d3
commit
da13c36e9b
3 changed files with 17 additions and 7 deletions
0
rustfmt.toml
Normal file
0
rustfmt.toml
Normal file
|
|
@ -676,10 +676,7 @@ impl State {
|
||||||
0 => 9,
|
0 => 9,
|
||||||
x => x - 1,
|
x => x - 1,
|
||||||
};
|
};
|
||||||
let _ = self
|
Shell::activate_and_focus(self, seat, ¤t_output, workspace as usize)
|
||||||
.common
|
|
||||||
.shell
|
|
||||||
.activate(¤t_output, workspace as usize);
|
|
||||||
}
|
}
|
||||||
Action::NextWorkspace => {
|
Action::NextWorkspace => {
|
||||||
let current_output = seat.active_output();
|
let current_output = seat.active_output();
|
||||||
|
|
@ -690,7 +687,7 @@ impl State {
|
||||||
.active_num(¤t_output)
|
.active_num(¤t_output)
|
||||||
.saturating_add(1);
|
.saturating_add(1);
|
||||||
// TODO: Possibly move to next output, if idx to large
|
// TODO: Possibly move to next output, if idx to large
|
||||||
let _ = self.common.shell.activate(¤t_output, workspace);
|
Shell::activate_and_focus(self, seat, ¤t_output, workspace)
|
||||||
}
|
}
|
||||||
Action::PreviousWorkspace => {
|
Action::PreviousWorkspace => {
|
||||||
let current_output = seat.active_output();
|
let current_output = seat.active_output();
|
||||||
|
|
@ -701,7 +698,7 @@ impl State {
|
||||||
.active_num(¤t_output)
|
.active_num(¤t_output)
|
||||||
.saturating_sub(1);
|
.saturating_sub(1);
|
||||||
// TODO: Possibly move to prev output, if idx < 0
|
// TODO: Possibly move to prev output, if idx < 0
|
||||||
let _ = self.common.shell.activate(¤t_output, workspace);
|
Shell::activate_and_focus(self, seat, ¤t_output, workspace)
|
||||||
}
|
}
|
||||||
Action::LastWorkspace => {
|
Action::LastWorkspace => {
|
||||||
let current_output = seat.active_output();
|
let current_output = seat.active_output();
|
||||||
|
|
@ -711,7 +708,7 @@ impl State {
|
||||||
.workspaces
|
.workspaces
|
||||||
.len(¤t_output)
|
.len(¤t_output)
|
||||||
.saturating_sub(1);
|
.saturating_sub(1);
|
||||||
let _ = self.common.shell.activate(¤t_output, workspace);
|
Shell::activate_and_focus(self, seat, ¤t_output, workspace)
|
||||||
}
|
}
|
||||||
x @ Action::MoveToWorkspace(_) | x @ Action::SendToWorkspace(_) => {
|
x @ Action::MoveToWorkspace(_) | x @ Action::SendToWorkspace(_) => {
|
||||||
let current_output = seat.active_output();
|
let current_output = seat.active_output();
|
||||||
|
|
|
||||||
|
|
@ -1176,6 +1176,19 @@ impl Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn activate_and_focus(state: &mut State, seat: &Seat<State>, output: &Output, idx: usize) {
|
||||||
|
let _ = state.common.shell.activate(output, idx);
|
||||||
|
|
||||||
|
// without this the last window of the target workspace may not receive focus when switching
|
||||||
|
// from a workspace having focused fullscreen window (there may be other cases).
|
||||||
|
let workspace = state.common.shell.active_space(output);
|
||||||
|
if let Some(mapped) = workspace.focus_stack.get(seat).last() {
|
||||||
|
// TODO: There should probably be a `KeyboardFocusTargetRef<'a>` to avoid unnecessary
|
||||||
|
// cloning.
|
||||||
|
Common::set_focus(state, Some(&(mapped.clone().into())), seat, None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn move_current_window(
|
pub fn move_current_window(
|
||||||
state: &mut State,
|
state: &mut State,
|
||||||
seat: &Seat<State>,
|
seat: &Seat<State>,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue