mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2024-12-26 21:58:10 +01:00
Set window focused only if it's on the focused output
This commit is contained in:
parent
1f909ac81b
commit
e734a716c0
3 changed files with 9 additions and 11 deletions
|
@ -1698,8 +1698,11 @@ impl window_service_server::WindowService for WindowService {
|
|||
});
|
||||
|
||||
let focused = window.as_ref().and_then(|win| {
|
||||
let output = win.output(state)?;
|
||||
state.focused_window(&output).map(|foc_win| win == &foc_win)
|
||||
state
|
||||
.output_focus_stack
|
||||
.current_focus()
|
||||
.and_then(|output| state.focused_window(output))
|
||||
.map(|foc_win| win == &foc_win)
|
||||
});
|
||||
|
||||
let floating = window
|
||||
|
|
|
@ -516,6 +516,7 @@ pub fn run_udev() -> anyhow::Result<()> {
|
|||
Some(Duration::from_micros(((1.0 / 144.0) * 1000000.0) as u64)),
|
||||
&mut state,
|
||||
|state| {
|
||||
state.fixup_focus();
|
||||
state.space.refresh();
|
||||
state.popup_manager.cleanup();
|
||||
state
|
||||
|
@ -1252,13 +1253,6 @@ impl State {
|
|||
texture
|
||||
});
|
||||
|
||||
// let windows = self
|
||||
// .output_focus_stack
|
||||
// .stack
|
||||
// .iter()
|
||||
// .flat_map(|op| op.with_state(|state| state.focus_stack.stack.clone()))
|
||||
// .collect::<Vec<_>>();
|
||||
|
||||
let windows = self.space.elements().cloned().collect::<Vec<_>>();
|
||||
|
||||
let result = render_surface(
|
||||
|
|
|
@ -21,8 +21,9 @@ use crate::{
|
|||
impl State {
|
||||
/// Get the currently focused window on `output`
|
||||
/// that isn't an override redirect window, if any.
|
||||
pub fn focused_window(&mut self, output: &Output) -> Option<WindowElement> {
|
||||
output.with_state(|state| state.focus_stack.stack.retain(|win| win.alive()));
|
||||
pub fn focused_window(&self, output: &Output) -> Option<WindowElement> {
|
||||
// TODO: see if the below is necessary
|
||||
// output.with_state(|state| state.focus_stack.stack.retain(|win| win.alive()));
|
||||
|
||||
let windows = output.with_state(|state| {
|
||||
state
|
||||
|
|
Loading…
Reference in a new issue